Meituan-Dianping / Meituan-Dianping/SQLAdvisor

mysql_init 返回 NULL

Open
#22 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
5.6k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

问题是:在执行完命令./sqladvisor -f sql.cnf -v 1后,错误日志什么都没有。
以下是输出日志:
2017-03-31 15:50:01 15432 [Note] 第1步: 对SQL解析优化之后得到的SQL:select count(1) AS count(1) from im_server.message where (msgsender = '10006')
2017-03-31 15:50:01 15432 [Note] 第2步:开始解析where中的条件:(msgsender = '10006')
2017-03-31 15:50:01 15432 [Note] show index from message
2017-03-31 15:50:01 15432 [Note] 第3步:SQLAdvisor结束!错误日志:

后来在sqladvisor里面的main.cc添加一些日志,发现在mysql_sql_parse_field_cardinality_new的MYSQL *con = mysql_init(NULL);方法返回的con为NULL,后来单独写了个demo,验证mysql_init是否好使,确定返回非NULL,mysql环境是percona5.5,看官网推荐是5.6,会不会跟这个有问题,求助,先写了

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in main.cc and inspect mysql_sql_parse_field_cardinality_new, focusing on the MYSQL *con = mysql_init(NULL) call and the surrounding error handling. Reproduce the command from the issue with the reported Percona 5.5 environment, then compare the behavior with the standalone mysql_init demo. Done means the cause of the NULL result is identified and the issue has a reproducible resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, mysql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.