stonedb icon indicating copy to clipboard operation
stonedb copied to clipboard

feature: Tianmu engine supports master-slave replication of binlog in row format

Open lylth opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

Implement master-slave replication of binlog in row format of innodb master tianmu slave

lylth avatar Aug 09 '22 02:08 lylth

When the configuration parameter 'binlog_format=row', the table data inserted into the tianmu engine will report the following error

mysql> create table person(id int, name varchar(20)) engine=tianmu;
Query OK, 0 rows affected (0.05 sec)
mysql> insert into person values(1,'abcd');
ERROR 1662 (HY000): Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = ROW and at least one table uses a storage engine limited to statement-based logging.

lylth avatar Aug 09 '22 16:08 lylth

When creating the tianmu engine table, only the flag of the statement format is set: HA_BINLOG_STMT_CAPABLE, and the row format is not set: HA_BINLOG_ROW_CAPABLE. The code points are as follows

  ulonglong table_flags() const override {
    return HA_NON_KEY_AUTO_INC | HA_REC_NOT_IN_SEQ | HA_PARTIAL_COLUMN_READ | HA_BINLOG_STMT_CAPABLE |
           HA_BLOCK_CONST_TABLE | HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_NULL_IN_KEY | HA_DUPLICATE_POS |
           HA_PRIMARY_KEY_IN_READ_INDEX;
  }

The stack is as follows:

stonedb::dbhandler::StonedbHandler::table_flags(const stonedb::dbhandler::StonedbHandler * const this) (\opt\lth\stonedb\storage\stonedb\handler\stonedb_handler.h:53)
handler::init(handler * const this) (\opt\lth\stonedb\sql\handler.h:2414)
get_new_handler(TABLE_SHARE * share, MEM_ROOT * alloc, handlerton * db_type) (\opt\lth\stonedb\sql\handler.cc:663)
create_table_impl(THD * thd, const char * db, const char * table_name, const char * error_table_name, const char * path, HA_CREATE_INFO * create_info, Alter_info * alter_info, bool internal_tmp_table, uint select_field_count, bool no_ha_table, bool * is_trans, KEY ** key_info, uint * key_count) (\opt\lth\stonedb\sql\sql_table.cc:4931)
mysql_create_table_no_lock(THD * thd, const char * db, const char * table_name, HA_CREATE_INFO * create_info, Alter_info * alter_info, uint select_field_count, bool * is_trans) (\opt\lth\stonedb\sql\sql_table.cc:5483)
mysql_create_table(THD * thd, TABLE_LIST * create_table, HA_CREATE_INFO * create_info, Alter_info * alter_info) (\opt\lth\stonedb\sql\sql_table.cc:5527)
mysql_execute_command(THD * thd, bool first_level) (\opt\lth\stonedb\sql\sql_parse.cc:3299)
mysql_parse(THD * thd, Parser_state * parser_state) (\opt\lth\stonedb\sql\sql_parse.cc:5621)
dispatch_command(THD * thd, const COM_DATA * com_data, enum_server_command command) (\opt\lth\stonedb\sql\sql_parse.cc:1495)
do_command(THD * thd) (\opt\lth\stonedb\sql\sql_parse.cc:1034)
handle_connection(void * arg) (\opt\lth\stonedb\sql\conn_handler\connection_handler_per_thread.cc:313)
pfs_spawn_thread(void * arg) (\opt\lth\stonedb\storage\perfschema\pfs.cc:2197)
  }

lylth avatar Aug 09 '22 17:08 lylth