Skip to content

非常偶然的情况下,日志不能正常记录explain的输出 #32

@zhaotian2470

Description

@zhaotian2470

非常偶然的情况下,我看到日志只输出explain的3个字段,并且前面有一条错误日志,具体如下:
2018-09-29 09:46:15.397286 I | reflect err sql: Scan error on column index 6: converting driver.Value type []uint8 ("8,98") to a int64: invalid syntax
2018/09/29 09:46:15 [3] - - [SQL] [slow] duration: 34.608907ms, sql: select c.* from core_info as c where c.is_deleted = 0 and c.api_uuid='license' and c.person_check_id='3832568' and c.data_requested_at > '2017-09-29 09:46:15 +0800 CST' order by c.core_info_id desc limit 1[], explain: [{"table":"c","type":"index_merge","key":"idx_person_check_id,idx_api_uuid"}]

正常的日志的explain应该有7个字段,具体如下:
018/09/29 12:44:44 [2] - - 开始获取本地数据
2018/09/29 12:44:44 [3] - - [SQL] [slow] duration: 13.821561ms, sql: select c.* from core_info as c where c.is_deleted = 0 and c.api_uuid='license' and c.person_check_id='4358419' and c.data_requested_at > '2017-09-29 12:44:44 +0800 CST' order by c.core_info_id desc limit 1[], explain: [{"table":"c","type":"ref","key":"idx_person_check_id","key_len":8,"ref":"const","rows":8,"extra":"Using where"}]

我分析这些日志是在解析explain的时候打出来的,但是不能测试环境中复现出现象

我使用的环境:
go版本:go1.10.3
go-orm id:8f43191b5d0221c2d728c7fad0da61227254e6a5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions