WL#5755: Make CHANGE MASTER support new options without changing the parser

Affects: Server-Prototype Only   —   Status: Un-Assigned

Change the parser of CHANGE MASTER to be able to extend this command with new
options without changing the parser. 
This is required for WL#5675.

The idea is to change the parser of CHANGE MASTER to accept a list of
OPTION=VALUE, OPTION is an identifier, and VALUE is a literal value of all types
MySQL support, or a list of values. After this work, it would be possible to
extend CHANGE MASTER to support new options without changing the parser
(sql_yacc.yy).
The parser (sql_yacc.yy) for CHANGE MASTER will be changed to accept a list of
OPTION=VALUE, OPTION is an identifier, and VALUE is a literal value or a list of
literal values in the form of (val[,val]) of any types MySQL supports. 

Rpl_lex is the handler for parsing CHANGE MASTER, for each OPTION=VALUE,
the parser will call functions of Rpl_lex to validate the option name or
value(s) and record the information in LEX_MASTER_INFO if all are valid. And
report error if there are syntax or other kinds of errors.

Rpl_lex::init
---------------------
This is called at the beginning of parsing CHANGE MASTER to reset all values to
unspecified state. START SLAVE also calls this to reset the log information for
UNTIL clause.

Rpl_lex::start_option
-----------------------------
This is called when found an OPTION, the function will check if this option is
supported or not, and also do some initialization for the option if needed.

Rpl_lex::set_option_value
---------------------------------
This is used by options that accepts a literal value. It is called after the
value is parsed.

Rpl_lex::add_option_value
---------------------------------
This is used by OPTION that accepts a list of values. It will be called for each
value in the values list.

Rpl_lex::end_option
---------------------------
This is called after one OPTION=VALUE has been parsed. 

Other functions
---------------
All the following functions are required for START SLAVE UNTIL, SHOW
BINLOG/RELAYLOG EVENTS and SHOW NEW MASTER. 

They are not used for CHANGE MASTER.

Rpl_lex::set_server_id
Rpl_lex::set_log_file
Rpl_lex::set_log_pos
Rpl_lex::set_relay_log_file
Rpl_lex::set_relay_log_pos
Rpl_lex::check_slave_until_opts

Rpl_lex
=======

class Rpl_lex {
  /**
     Set all fields to their "unspecified" value.
  */
  void init(enum_sql_command command);

  /*
    This is called when start parsing an option
  */
  int start_option(THD* thd, char* name, const char* tok, uint lineno);
  /*
    This is called to set the value for an option.
  */
  int set_option_value(THD* thd, Item* value, const char* tok, uint lineno);
  /*
    This is for options that accept a list of values
    (e.g. IGNORE_SERVER_IDS), this will be called for each value in
    the list.
   */
  int add_option_value(THD* thd, Item* value, const char* tok, uint lineno);
  /*
    This is called after parsed value(s) of the option
  */
  int end_option(THD* thd, char* name);

   /*
     The following interfaces are required by START SLAVE UNTIL,
     SHOW BINLOG/RELAYLOG EVENTS and SHOW NEW MASTER.
    */
   int set_server_id(THD*, ulong);
   int set_log_file(THD*, char*);
   int set_log_pos(THD*, ulonglong);
   int set_relay_log_file(THD*, char*);
   int set_relay_log_pos(THD*, ulonglong);
   int check_slave_until_opts(THD*);
} Rpl_lex;