Code review comment for lp:~vlad-lesin/percona-server/i_s-innodb-changed-pages

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

> The main trouble is we need common mysql code to implement this. For example
> to traverse
> condition tree we need to know the type of Items, but they are defined in
> sql/item*.h.

I believe it's OK to include sql/*.h in the innodb handler/ source files. But then it needs checking if InnoDB built as a plugin can link to all the symbols it needs.

> So we could place the function which traverses condition tree to recognize our
> pattern
> in common mysql code somewhere near calc_lookup_values_from_cond() and use it
> as
> external function in handler/i_s.cc but I doubt it's a good solution.
>
> At the other hand we could make it common enough to be placed in common code
> like
> calc_lookup_values_from_cond().

If the above works, then I think let's keep it local to i_s.cc at first for now.

> I mean we could parse the following patterns:
> - some_expression & cmp
> - cmp & some_expression
> - cmp & cmp
> - cmp
> where cmp is:
> - some_field (<|<=) uint_value
> - uint_value (>|>=) some_field
> - some_field (<|<=) uint_value
> - uint_value (>|>=) some_field
> to the following structure:
> {
> string field_name1;
> uint field_value1;
> string field_name2;
> string field_value2;
> }
>
> And the purpose of the function would be to get maximum field
> value after which there is not sense to scan table/file/something else.

Looks good. I'd tweak the top-most recognized pattern to be
term & term & ... & term
Where
term can be a "cmp", as defined above, or anything else (ignored)
Then maintain a lower and upper bound for the range and go through each cmp looking if it enables to reduce the range.

« Back to merge proposal