MDEV-39412: parse error reading tabs in ranges#4994
Closed
bsrikanth-mariadb wants to merge 50 commits intobb-12.3-MDEV-38805-dev-sprint-work-2from
Closed
MDEV-39412: parse error reading tabs in ranges#4994bsrikanth-mariadb wants to merge 50 commits intobb-12.3-MDEV-38805-dev-sprint-work-2from
bsrikanth-mariadb wants to merge 50 commits intobb-12.3-MDEV-38805-dev-sprint-work-2from
Conversation
…LAIN in the replay. The last command is set "optimizer_replay_context=null"...
This is needed to be able to run replay for many queries in a row. Need to discuss whether we should ship it like this.
and restart it if needed.
If the previous command was EXPLAIN, it would use its context. If the previous command was not an EXPLAIN, nothing would be printed.
…stead of EXPLAIN output.
It seems to get mtr into a state where the replay server is unusable.
A whole class of errors were not printed to the test output.
Usage: --disable_replay next_query <arbitrary reason text> If the next query after this is an EXPLAIN, its processing will be disabled.
Disable replay use for the whole file.
…utput. I don't think we can print warnings, we would get spurious test failures.
…error Disable the testcase with explanation.
Also make it use regexes
…>stats.records' failed The problem was caused by this scenario: - The same table can be used multiple times in the query. - A SELECT may be resolved without ever entering make_join_statistics() and set_statistics_for_table(). This will happen if the SELECT is handled via opt_sum_query, for example. - Then, Context Capture code can take this TABLE object and save its unitialized statistics into the Optimizer Context. - When we then attempt to use unitialized statistics in the other SELECT that is handled in regular way, we get a failure. The fix: - Do not save/restore table->used_stat_records. Do save/restore table->file->stats.records and let the SQL layer to copy it to used_stat_records (or use EITS data).
Handle it by saving the MIN/MAX rows into Optimizer Context. Like we do it for const tables.
Instead of REPLACE INTO, use
SET STATEMENT sql_mode={remove STRICT_...TABLES} REPLACE INTO.
Make Optimizer Context include SET character_set_client=...; SET NAMES ... COLLATE ...;
Read_container_value -> Read_array. Read_list_of_context -> Read_array_into_list
…rgument, not THD.
…_strings and move it to sql_json_lib.
Member
|
Please rebase over |
Note:
while reading from information_schema.optimizer_context one level of unescaping
is already done i.e. (\\t becomes \t or \\\\t becomes \\t)
w.r.t the MDEV, there are 2 problems: -
1.
When reading from the sql script file, json parser is not able to parse
the range value in json_read_value() from json_lib.c
"ranges": [
"(b\t\t\t\t\t\t) <= (b) <= (b???????)"
],
mainly the \t\t stuff, and hence a warning.
It also stops loading the context into memory.
Since, a new table is created with empty data, and without context,
we get Impossible WHERE noticed after reading const tables
2.
There is unescaping call being made in read_string() from sql_json_lib.cc
while parsing of the context. With this \\t was becoming \t.
However, print_range() from opt_range.cc already does escaping of the values.
The value "b\t\t\t" was in fact produced as "\b\\t\\t\\t".
Later, we try to compare range values from the query and the context.
Here a mismatch a found because, in one case there was escaping,
and in the other case escaping got removed.
Solutions
=========
For Problem 1. have escaping for ranges.
This should be done while dumping range values into the context.
For Problem 2. Remove unscaping call in read_string().
503361c to
b100fbf
Compare
Contributor
Author
|
closing this, and instead created a new pr #5049 i.e. against branch bb-12.3-MDEV-39368-test-replay |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note:
while reading from information_schema.optimizer_context one level of unescaping is already done i.e. (\\t becomes \t or \\\\t becomes \\t)
w.r.t the MDEV, there are 2 problems: -
When reading from the sql script file, json parser is not able to parse the range value in json_read_value() from json_lib.c "ranges": [
"(b\t\t\t\t\t\t) <= (b) <= (b???????)"
],
mainly the \t\t stuff, and hence a warning.
It also stops loading the context into memory.
Since, a new table is created with empty data, and without context, we get Impossible WHERE noticed after reading const tables
There is unescaping call being made in read_string() from sql_json_lib.cc while parsing of the context. With this \\t was becoming \t. However, print_range() from opt_range.cc already does escaping of the values. The value "b\t\t\t" was in fact produced as "b\\t\\t\\t". Later, we try to compare range values from the query and the context.
Here a mismatch a found because, in one case there was escaping, and in the other case escaping got removed.
Solutions
For Problem 1. have escaping for ranges.
This should be done while dumping range values into the context.
For Problem 2. Remove unscaping call in read_string().