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

Fix spaces removal on digests with control chars #4554

Merged
merged 4 commits into from
May 24, 2024

Conversation

JavierJF
Copy link
Collaborator

Right now queries with control characters can result in digests containing multiple spaces:

query:

mysql_query(proxy, "SELECT\t\t\t\t\t\t\t\t1");

digest:

mysql> select digest_text,count_star from stats_mysql_query_digest_reset;
+-----------------+------------+
| digest_text     | count_star |
+-----------------+------------+
| SELECT        ? | 1          |
+-----------------+------------+
1 row in set (0.01 sec)

This is undesired behavior, whenever multiple characters that are classified as an space character (see is_space_char function in c_tokenizer.cpp) are found in sequence, they should be compressed into one single space.

Compression of multiple spaces into one should apply to every character
that is considered a space by `is_space_char`.
Check that several spaces created by control chars are compressed into
one when mixed with literals, digits and arithmetic operators.
@renecannao
Copy link
Contributor

A suggestion for different approach: both *(shared_st->res_cur_pos-1) and shared_st->prev_char should already be ' ' if they were space chars .
Maybe the different approach will make absolutely no difference in term of performance

@renecannao renecannao merged commit f7c0382 into v2.x May 24, 2024
23 of 44 checks passed
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

Successfully merging this pull request may close these issues.

2 participants