Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Log Tool Show Different Digest Hex From stats_mysql_query_digest #2015

Closed
asdptkt opened this issue Apr 15, 2019 · 2 comments
Closed

Comments

@asdptkt
Copy link

asdptkt commented Apr 15, 2019

Hello, I've been building a library to decode ProxySQL binary log based on https://github.com/sysown/proxysql/blob/v2.0.4/tools/eventslog_reader_sample.cpp

The problem is, the resulting hex digest in above tool shows different value than in stats_mysql_query_digest table in ProxySQL admin.

The tool split the digest hex to two uint32 then hex encode them together, but in the table, it is actually a single uint64 hex.

read_encoded_length((uint64_t *)&query_digest,f);
char digest_hex[20];
uint32_t d32[2];
memcpy(&d32,&query_digest,sizeof(digest_hex));
sprintf(digest_hex,"0x%X%X", d32[0], d32[1]);
From table: 0x38DF1D37B3136F42
From tool: 0xB3136F4238DF1D37

Should I just do it like in the table?

@renecannao
Copy link
Contributor

Hi @asdptkt .
Good catch.
Note that eventslog_reader_sample was meant to be a sample, so not much care was taken to make sure that the digest would match with stats_mysql_query_digest.
In stats_mysql_query_digest, the digest is converted into text here

@renecannao
Copy link
Contributor

Fixed.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants