mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
MDEV-33281 Optimizer hints code cleanup:
- remove get_args_printer() from hints printing - add append_hint_arguments(THD *thd, opt_hints_enum hint, String *str) - add more comments - rename st_opt_hint_info::hint_name to hint_type - add pptimizer trace support for hints - add dbug_print_hints() - make print_warn() not be a template - introduce Printable_parser_rule interface, make grammar rules that emit warnings implement it and print_warn invokes its function) - remove Parser::Hint::append_args() as it is not used anywhere (it used to be necessary call print_warn(... (Parser::Hint*)NULL);
This commit is contained in:
committed by
Oleg Smirnov
parent
0e088b5d7e
commit
c4fe794d22
@@ -117,6 +117,14 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class Printable_parser_rule
|
||||
{
|
||||
public:
|
||||
virtual void append_args(THD *thd, String *str) const = 0;
|
||||
virtual ~Printable_parser_rule() {}
|
||||
};
|
||||
|
||||
|
||||
class Optimizer_hint_parser: public Optimizer_hint_tokenizer,
|
||||
public Parser_templates
|
||||
{
|
||||
@@ -605,13 +613,14 @@ public:
|
||||
Keyword_MAX_EXECUTION_TIME,
|
||||
LParen,
|
||||
Unsigned_Number,
|
||||
RParen>
|
||||
RParen>,
|
||||
public Printable_parser_rule
|
||||
{
|
||||
public:
|
||||
using AND4::AND4;
|
||||
|
||||
bool resolve(Parse_context *pc) const;
|
||||
void append_args(THD *thd, String *str) const;
|
||||
void append_args(THD *thd, String *str) const override;
|
||||
ulonglong get_milliseconds() const;
|
||||
};
|
||||
|
||||
@@ -717,13 +726,14 @@ public:
|
||||
Semijoin_hint_type,
|
||||
LParen,
|
||||
Semijoin_hint_body,
|
||||
RParen>
|
||||
RParen>,
|
||||
public Printable_parser_rule
|
||||
{
|
||||
public:
|
||||
using AND4::AND4;
|
||||
|
||||
bool resolve(Parse_context *pc) const;
|
||||
void append_args(THD *thd, String *str) const;
|
||||
void append_args(THD *thd, String *str) const override;
|
||||
|
||||
private:
|
||||
Opt_hints_qb* resolve_for_qb_name(Parse_context *pc, bool hint_state,
|
||||
@@ -792,13 +802,14 @@ public:
|
||||
Keyword_SUBQUERY,
|
||||
LParen,
|
||||
Subquery_hint_body,
|
||||
RParen>
|
||||
RParen>,
|
||||
public Printable_parser_rule
|
||||
{
|
||||
public:
|
||||
using AND4::AND4;
|
||||
|
||||
bool resolve(Parse_context *pc) const;
|
||||
void append_args(THD *thd, String *str) const;
|
||||
void append_args(THD *thd, String *str) const override;
|
||||
|
||||
private:
|
||||
void set_subquery_strategy(TokenID token_id, Opt_hints_qb *qb) const;
|
||||
@@ -825,16 +836,6 @@ public:
|
||||
{
|
||||
public:
|
||||
using OR6::OR6;
|
||||
|
||||
/**
|
||||
Append additional hint arguments to the printed string.
|
||||
Implement this method in Hint specifications if needed:
|
||||
Table_level_hint, Semijoin_hint, etc
|
||||
|
||||
@param thd Pointer to THD object
|
||||
@param str Pointer to String object
|
||||
*/
|
||||
void append_args(THD *thd, String *str) const {}
|
||||
};
|
||||
|
||||
private:
|
||||
|
Reference in New Issue
Block a user