Loading Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \ @readline_topdir@ sql-common \ @thread_dirs@ pstack \ @sql_union_dirs@ scripts man tests \ @sql_union_dirs@ scripts @man_dirs@ tests \ netware @libmysqld_dirs@ \ @bench_dirs@ support-files @tools_dirs@ Loading client/mysqldump.c +24 −13 Original line number Diff line number Diff line Loading @@ -539,6 +539,12 @@ static void write_footer(FILE *sql_file) } } /* write_footer */ static void free_table_ent(char *key) { my_free((gptr) key, MYF(0)); } byte* get_table_key(const char *entry, uint *length, my_bool not_used __attribute__((unused))) Loading @@ -551,7 +557,8 @@ byte* get_table_key(const char *entry, uint *length, void init_table_rule_hash(HASH* h) { if (hash_init(h, charset_info, 16, 0, 0, (hash_get_key) get_table_key, 0, 0)) (hash_get_key) get_table_key, (hash_free_key) free_table_ent, 0)) exit(EX_EOM); } Loading Loading @@ -806,7 +813,8 @@ static void DB_error(MYSQL *mysql, const char *when) SYNOPSIS mysql_query_with_error_report() mysql_con connection to use res if non zero, result will be put there with mysql_store_result res if non zero, result will be put there with mysql_store_result() query query to send to server RETURN VALUES Loading Loading @@ -958,13 +966,14 @@ static char *quote_name(const char *name, char *buff, my_bool force) return buff; } /* quote_name */ /* Quote a table name so it can be used in "SHOW TABLES LIKE <tabname>" SYNOPSIS quote_for_like name - name of the table buff - quoted name of the table quote_for_like() name name of the table buff quoted name of the table DESCRIPTION Quote \, _, ' and % characters Loading @@ -980,7 +989,6 @@ static char *quote_name(const char *name, char *buff, my_bool force) Example: "t\1" => "t\\\\1" */ static char *quote_for_like(const char *name, char *buff) { char *to= buff; Loading Loading @@ -2446,7 +2454,6 @@ static int dump_selected_tables(char *db, char **table_names, int tables) DYNAMIC_STRING lock_tables_query; HASH dump_tables; char *table_name; DBUG_ENTER("dump_selected_tables"); if (init_dumping(db)) Loading @@ -2454,7 +2461,8 @@ static int dump_selected_tables(char *db, char **table_names, int tables) /* Init hash table for storing the actual name of tables to dump */ if (hash_init(&dump_tables, charset_info, 16, 0, 0, (hash_get_key) get_table_key, 0, 0)) (hash_get_key) get_table_key, (hash_free_key) free_table_ent, 0)) exit(EX_EOM); init_dynamic_string(&lock_tables_query, "LOCK TABLES ", 256, 1024); Loading Loading @@ -2926,6 +2934,7 @@ int main(int argc, char **argv) { compatible_mode_normal_str[0]= 0; default_charset= (char *)mysql_universal_client_charset; bzero((char*) &ignore_table, sizeof(ignore_table)); MY_INIT("mysqldump"); if (get_options(&argc, &argv)) Loading Loading @@ -2984,6 +2993,8 @@ int main(int argc, char **argv) if (md_result_file != stdout) my_fclose(md_result_file, MYF(0)); my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); if (hash_inited(&ignore_table)) hash_free(&ignore_table); if (extended_insert) dynstr_free(&extended_row); if (insert_pat_inited) Loading client/mysqltest.c +18 −17 Original line number Diff line number Diff line Loading @@ -994,18 +994,20 @@ static void do_exec(struct st_query* q) error= pclose(res_file); if (error != 0) { uint status= WEXITSTATUS(error); uint status= WEXITSTATUS(error), i; my_bool ok= 0; if (q->abort_on_error) die("At line %u: command \"%s\" failed", start_lineno, cmd); else { bool ok= 0; uint i; DBUG_PRINT("info", ("error: %d, status: %d", error, status)); for (i=0 ; (uint) i < q->expected_errors ; i++) { DBUG_PRINT("info", ("expected error: %d", q->expected_errno[i].code.errnum)); DBUG_PRINT("info", ("error: %d, status: %d", error, status)); DBUG_PRINT("info", ("expected error: %d", q->expected_errno[i].code.errnum)); if ((q->expected_errno[i].type == ERR_ERRNO) && (q->expected_errno[i].code.errnum == status)) ok= 1; Loading @@ -1016,7 +1018,6 @@ static void do_exec(struct st_query* q) die("At line: %u: command \"%s\" failed with wrong error: %d", start_lineno, cmd, status); } } else if (q->expected_errno[0].type == ERR_ERRNO && q->expected_errno[0].code.errnum != 0) { Loading innobase/include/row0mysql.h +14 −4 Original line number Diff line number Diff line Loading @@ -243,17 +243,27 @@ row_update_for_mysql( the MySQL format */ row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL handle */ /************************************************************************* Does an unlock of a row for MySQL. */ This can only be used when srv_locks_unsafe_for_binlog is TRUE. Before calling this function we must use trx_reset_new_rec_lock_info() and trx_register_new_rec_lock() to store the information which new record locks really were set. This function removes a newly set lock under prebuilt->pcur, and also under prebuilt->clust_pcur. Currently, this is only used and tested in the case of an UPDATE or a DELETE statement, where the row lock is of the LOCK_X type. Thus, this implements a 'mini-rollback' that releases the latest record locks we set. */ int row_unlock_for_mysql( /*=================*/ /* out: error code or DB_SUCCESS */ row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL handle */ ibool has_latches_on_recs);/* TRUE if called so that we have the latches on the records under pcur and clust_pcur, and we do not need to reposition the cursors. */ /************************************************************************* Creates an query graph node of 'update' type to be used in the MySQL interface. */ Loading innobase/include/trx0trx.h +41 −2 Original line number Diff line number Diff line Loading @@ -16,10 +16,39 @@ Created 3/26/1996 Heikki Tuuri #include "que0types.h" #include "mem0mem.h" #include "read0types.h" #include "dict0types.h" #include "trx0xa.h" extern ulint trx_n_mysql_transactions; /***************************************************************** Resets the new record lock info in a transaction struct. */ UNIV_INLINE void trx_reset_new_rec_lock_info( /*========================*/ trx_t* trx); /* in: transaction struct */ /***************************************************************** Registers that we have set a new record lock on an index. We only have space to store 2 indexes! If this is called to store more than 2 indexes after trx_reset_new_rec_lock_info(), then this function does nothing. */ UNIV_INLINE void trx_register_new_rec_lock( /*======================*/ trx_t* trx, /* in: transaction struct */ dict_index_t* index); /* in: trx sets a new record lock on this index */ /***************************************************************** Checks if trx has set a new record lock on an index. */ UNIV_INLINE ibool trx_new_rec_locks_contain( /*======================*/ /* out: TRUE if trx has set a new record lock on index */ trx_t* trx, /* in: transaction struct */ dict_index_t* index); /* in: index */ /************************************************************************ Releases the search latch if trx has reserved it. */ Loading Loading @@ -495,8 +524,18 @@ struct trx_struct{ lock_t* auto_inc_lock; /* possible auto-inc lock reserved by the transaction; note that it is also in the lock list trx_locks */ ibool trx_create_lock;/* this is TRUE if we have created a new lock for a record accessed */ dict_index_t* new_rec_locks[2];/* these are normally NULL; if srv_locks_unsafe_for_binlog is TRUE, in a cursor search, if we set a new record lock on an index, this is set to point to the index; this is used in releasing the locks under the cursors if we are performing an UPDATE and we determine after retrieving the row that it does not need to be locked; thus, these can be used to implement a 'mini-rollback' that releases the latest record locks */ UT_LIST_NODE_T(trx_t) trx_list; /* list of transactions */ UT_LIST_NODE_T(trx_t) Loading Loading
Makefile.am +1 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ EXTRA_DIST = INSTALL-SOURCE README COPYING EXCEPTIONS-CLIENT SUBDIRS = . include @docs_dirs@ @zlib_dir@ @yassl_dir@ \ @readline_topdir@ sql-common \ @thread_dirs@ pstack \ @sql_union_dirs@ scripts man tests \ @sql_union_dirs@ scripts @man_dirs@ tests \ netware @libmysqld_dirs@ \ @bench_dirs@ support-files @tools_dirs@ Loading
client/mysqldump.c +24 −13 Original line number Diff line number Diff line Loading @@ -539,6 +539,12 @@ static void write_footer(FILE *sql_file) } } /* write_footer */ static void free_table_ent(char *key) { my_free((gptr) key, MYF(0)); } byte* get_table_key(const char *entry, uint *length, my_bool not_used __attribute__((unused))) Loading @@ -551,7 +557,8 @@ byte* get_table_key(const char *entry, uint *length, void init_table_rule_hash(HASH* h) { if (hash_init(h, charset_info, 16, 0, 0, (hash_get_key) get_table_key, 0, 0)) (hash_get_key) get_table_key, (hash_free_key) free_table_ent, 0)) exit(EX_EOM); } Loading Loading @@ -806,7 +813,8 @@ static void DB_error(MYSQL *mysql, const char *when) SYNOPSIS mysql_query_with_error_report() mysql_con connection to use res if non zero, result will be put there with mysql_store_result res if non zero, result will be put there with mysql_store_result() query query to send to server RETURN VALUES Loading Loading @@ -958,13 +966,14 @@ static char *quote_name(const char *name, char *buff, my_bool force) return buff; } /* quote_name */ /* Quote a table name so it can be used in "SHOW TABLES LIKE <tabname>" SYNOPSIS quote_for_like name - name of the table buff - quoted name of the table quote_for_like() name name of the table buff quoted name of the table DESCRIPTION Quote \, _, ' and % characters Loading @@ -980,7 +989,6 @@ static char *quote_name(const char *name, char *buff, my_bool force) Example: "t\1" => "t\\\\1" */ static char *quote_for_like(const char *name, char *buff) { char *to= buff; Loading Loading @@ -2446,7 +2454,6 @@ static int dump_selected_tables(char *db, char **table_names, int tables) DYNAMIC_STRING lock_tables_query; HASH dump_tables; char *table_name; DBUG_ENTER("dump_selected_tables"); if (init_dumping(db)) Loading @@ -2454,7 +2461,8 @@ static int dump_selected_tables(char *db, char **table_names, int tables) /* Init hash table for storing the actual name of tables to dump */ if (hash_init(&dump_tables, charset_info, 16, 0, 0, (hash_get_key) get_table_key, 0, 0)) (hash_get_key) get_table_key, (hash_free_key) free_table_ent, 0)) exit(EX_EOM); init_dynamic_string(&lock_tables_query, "LOCK TABLES ", 256, 1024); Loading Loading @@ -2926,6 +2934,7 @@ int main(int argc, char **argv) { compatible_mode_normal_str[0]= 0; default_charset= (char *)mysql_universal_client_charset; bzero((char*) &ignore_table, sizeof(ignore_table)); MY_INIT("mysqldump"); if (get_options(&argc, &argv)) Loading Loading @@ -2984,6 +2993,8 @@ int main(int argc, char **argv) if (md_result_file != stdout) my_fclose(md_result_file, MYF(0)); my_free(opt_password, MYF(MY_ALLOW_ZERO_PTR)); if (hash_inited(&ignore_table)) hash_free(&ignore_table); if (extended_insert) dynstr_free(&extended_row); if (insert_pat_inited) Loading
client/mysqltest.c +18 −17 Original line number Diff line number Diff line Loading @@ -994,18 +994,20 @@ static void do_exec(struct st_query* q) error= pclose(res_file); if (error != 0) { uint status= WEXITSTATUS(error); uint status= WEXITSTATUS(error), i; my_bool ok= 0; if (q->abort_on_error) die("At line %u: command \"%s\" failed", start_lineno, cmd); else { bool ok= 0; uint i; DBUG_PRINT("info", ("error: %d, status: %d", error, status)); for (i=0 ; (uint) i < q->expected_errors ; i++) { DBUG_PRINT("info", ("expected error: %d", q->expected_errno[i].code.errnum)); DBUG_PRINT("info", ("error: %d, status: %d", error, status)); DBUG_PRINT("info", ("expected error: %d", q->expected_errno[i].code.errnum)); if ((q->expected_errno[i].type == ERR_ERRNO) && (q->expected_errno[i].code.errnum == status)) ok= 1; Loading @@ -1016,7 +1018,6 @@ static void do_exec(struct st_query* q) die("At line: %u: command \"%s\" failed with wrong error: %d", start_lineno, cmd, status); } } else if (q->expected_errno[0].type == ERR_ERRNO && q->expected_errno[0].code.errnum != 0) { Loading
innobase/include/row0mysql.h +14 −4 Original line number Diff line number Diff line Loading @@ -243,17 +243,27 @@ row_update_for_mysql( the MySQL format */ row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL handle */ /************************************************************************* Does an unlock of a row for MySQL. */ This can only be used when srv_locks_unsafe_for_binlog is TRUE. Before calling this function we must use trx_reset_new_rec_lock_info() and trx_register_new_rec_lock() to store the information which new record locks really were set. This function removes a newly set lock under prebuilt->pcur, and also under prebuilt->clust_pcur. Currently, this is only used and tested in the case of an UPDATE or a DELETE statement, where the row lock is of the LOCK_X type. Thus, this implements a 'mini-rollback' that releases the latest record locks we set. */ int row_unlock_for_mysql( /*=================*/ /* out: error code or DB_SUCCESS */ row_prebuilt_t* prebuilt); /* in: prebuilt struct in MySQL row_prebuilt_t* prebuilt, /* in: prebuilt struct in MySQL handle */ ibool has_latches_on_recs);/* TRUE if called so that we have the latches on the records under pcur and clust_pcur, and we do not need to reposition the cursors. */ /************************************************************************* Creates an query graph node of 'update' type to be used in the MySQL interface. */ Loading
innobase/include/trx0trx.h +41 −2 Original line number Diff line number Diff line Loading @@ -16,10 +16,39 @@ Created 3/26/1996 Heikki Tuuri #include "que0types.h" #include "mem0mem.h" #include "read0types.h" #include "dict0types.h" #include "trx0xa.h" extern ulint trx_n_mysql_transactions; /***************************************************************** Resets the new record lock info in a transaction struct. */ UNIV_INLINE void trx_reset_new_rec_lock_info( /*========================*/ trx_t* trx); /* in: transaction struct */ /***************************************************************** Registers that we have set a new record lock on an index. We only have space to store 2 indexes! If this is called to store more than 2 indexes after trx_reset_new_rec_lock_info(), then this function does nothing. */ UNIV_INLINE void trx_register_new_rec_lock( /*======================*/ trx_t* trx, /* in: transaction struct */ dict_index_t* index); /* in: trx sets a new record lock on this index */ /***************************************************************** Checks if trx has set a new record lock on an index. */ UNIV_INLINE ibool trx_new_rec_locks_contain( /*======================*/ /* out: TRUE if trx has set a new record lock on index */ trx_t* trx, /* in: transaction struct */ dict_index_t* index); /* in: index */ /************************************************************************ Releases the search latch if trx has reserved it. */ Loading Loading @@ -495,8 +524,18 @@ struct trx_struct{ lock_t* auto_inc_lock; /* possible auto-inc lock reserved by the transaction; note that it is also in the lock list trx_locks */ ibool trx_create_lock;/* this is TRUE if we have created a new lock for a record accessed */ dict_index_t* new_rec_locks[2];/* these are normally NULL; if srv_locks_unsafe_for_binlog is TRUE, in a cursor search, if we set a new record lock on an index, this is set to point to the index; this is used in releasing the locks under the cursors if we are performing an UPDATE and we determine after retrieving the row that it does not need to be locked; thus, these can be used to implement a 'mini-rollback' that releases the latest record locks */ UT_LIST_NODE_T(trx_t) trx_list; /* list of transactions */ UT_LIST_NODE_T(trx_t) Loading