Loading client/mysql.cc +21 −18 Original line number Diff line number Diff line Loading @@ -1593,6 +1593,22 @@ static int reconnect(void) return 0; } static void get_current_db() { MYSQL_RES *res; my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); current_db= NULL; /* In case of error below current_db will be NULL */ if (!mysql_query(&mysql, "SELECT DATABASE()") && (res= mysql_use_result(&mysql))) { MYSQL_ROW row= mysql_fetch_row(res); if (row[0]) current_db= my_strdup(row[0], MYF(MY_WME)); mysql_free_result(res); } } /*************************************************************************** The different commands Loading Loading @@ -1917,6 +1933,10 @@ com_go(String *buffer,char *line __attribute__((unused))) if (err >= 1) error= put_error(&mysql); if (!error && !status.batch && (mysql.server_status & SERVER_STATUS_DB_DROPPED)) get_current_db(); return error; /* New command follows */ } Loading Loading @@ -2631,24 +2651,7 @@ com_use(String *buffer __attribute__((unused)), char *line) under our feet, for example if DROP DATABASE or RENAME DATABASE (latter one not yet available by the time the comment was written) */ /* Let's reset current_db, assume it's gone */ my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); current_db= 0; /* We don't care about in case of an error below because current_db was just set to 0. */ if (!mysql_query(&mysql, "SELECT DATABASE()") && (res= mysql_use_result(&mysql))) { row= mysql_fetch_row(res); if (row[0]) { current_db= my_strdup(row[0], MYF(MY_WME)); } (void) mysql_fetch_row(res); // Read eof mysql_free_result(res); } get_current_db(); if (!current_db || cmp_database(charset_info, current_db,tmp)) { Loading client/mysqldump.c +5 −0 Original line number Diff line number Diff line Loading @@ -865,6 +865,11 @@ static int dbConnect(char *host, char *user,char *passwd) DBerror(&mysql_connection, "when trying to connect"); return 1; } /* Don't dump SET NAMES with a pre-4.1 server (bug#7997). */ if (mysql_get_server_version(&mysql_connection) < 40100) opt_set_charset= 0; /* As we're going to set SQL_MODE, it would be lost on reconnect, so we cannot reconnect. Loading include/my_sys.h +4 −4 Original line number Diff line number Diff line Loading @@ -776,9 +776,9 @@ extern void get_defaults_files(int argc, char **argv, char **defaults, char **extra_defaults); extern int load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv); extern int process_default_option_files(const char *conf_file, Process_option_func func, void *func_ctx); extern int my_search_option_files(const char *conf_file, int *argc, char ***argv, uint *args_used, Process_option_func func, void *func_ctx); extern void free_defaults(char **argv); extern void print_defaults(const char *conf_file, const char **groups); extern my_bool my_compress(byte *, ulong *, ulong *); Loading include/mysql_com.h +1 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ enum enum_server_command COM_FETCH command. */ #define SERVER_STATUS_LAST_ROW_SENT 128 #define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ #define MYSQL_ERRMSG_SIZE 512 #define NET_READ_TIMEOUT 30 /* Timeout on read */ Loading innobase/btr/btr0cur.c +19 −17 Original line number Diff line number Diff line Loading @@ -1642,7 +1642,7 @@ btr_cur_optimistic_update( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(page_cursor, index, mtr); page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); Loading Loading @@ -1885,7 +1885,7 @@ btr_cur_pessimistic_update( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(page_cursor, index, mtr); page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); Loading Loading @@ -2401,6 +2401,7 @@ btr_cur_optimistic_delete( mem_heap_t* heap = NULL; ulint offsets_[100] = { 100, }; ulint* offsets = offsets_; ibool no_compress_needed; ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_page(cursor)), MTR_MEMO_PAGE_X_FIX)); Loading @@ -2414,9 +2415,11 @@ btr_cur_optimistic_delete( offsets = rec_get_offsets(rec, cursor->index, offsets, ULINT_UNDEFINED, &heap); if (!rec_offs_any_extern(offsets) no_compress_needed = !rec_offs_any_extern(offsets) && btr_cur_can_delete_without_compress( cursor, rec_offs_size(offsets), mtr)) { cursor, rec_offs_size(offsets), mtr); if (no_compress_needed) { lock_update_delete(rec); Loading @@ -2425,20 +2428,17 @@ btr_cur_optimistic_delete( max_ins_size = page_get_max_insert_size_after_reorganize(page, 1); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); cursor->index, offsets, mtr); ibuf_update_free_bits_low(cursor->index, page, max_ins_size, mtr); if (heap) { mem_heap_free(heap); } return(TRUE); } if (heap) { mem_heap_free(heap); } return(FALSE); return(no_compress_needed); } /***************************************************************** Loading Loading @@ -2478,6 +2478,7 @@ btr_cur_pessimistic_delete( ibool success; ibool ret = FALSE; mem_heap_t* heap; ulint* offsets; page = btr_cur_get_page(cursor); tree = btr_cur_get_tree(cursor); Loading @@ -2503,20 +2504,20 @@ btr_cur_pessimistic_delete( } } heap = mem_heap_create(256); heap = mem_heap_create(1024); rec = btr_cur_get_rec(cursor); offsets = rec_get_offsets(rec, cursor->index, NULL, ULINT_UNDEFINED, &heap); /* Free externally stored fields if the record is neither a node pointer nor in two-byte format. This avoids unnecessary calls to rec_get_offsets(). */ This avoids an unnecessary loop. */ if (cursor->index->table->comp ? !rec_get_node_ptr_flag(rec) : !rec_get_1byte_offs_flag(rec)) { btr_rec_free_externally_stored_fields(cursor->index, rec, rec_get_offsets(rec, cursor->index, NULL, ULINT_UNDEFINED, &heap), in_rollback, mtr); mem_heap_empty(heap); rec, offsets, in_rollback, mtr); } if ((page_get_n_recs(page) < 2) Loading Loading @@ -2568,7 +2569,8 @@ btr_cur_pessimistic_delete( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, offsets, mtr); ut_ad(btr_check_node_ptr(tree, page, mtr)); Loading Loading
client/mysql.cc +21 −18 Original line number Diff line number Diff line Loading @@ -1593,6 +1593,22 @@ static int reconnect(void) return 0; } static void get_current_db() { MYSQL_RES *res; my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); current_db= NULL; /* In case of error below current_db will be NULL */ if (!mysql_query(&mysql, "SELECT DATABASE()") && (res= mysql_use_result(&mysql))) { MYSQL_ROW row= mysql_fetch_row(res); if (row[0]) current_db= my_strdup(row[0], MYF(MY_WME)); mysql_free_result(res); } } /*************************************************************************** The different commands Loading Loading @@ -1917,6 +1933,10 @@ com_go(String *buffer,char *line __attribute__((unused))) if (err >= 1) error= put_error(&mysql); if (!error && !status.batch && (mysql.server_status & SERVER_STATUS_DB_DROPPED)) get_current_db(); return error; /* New command follows */ } Loading Loading @@ -2631,24 +2651,7 @@ com_use(String *buffer __attribute__((unused)), char *line) under our feet, for example if DROP DATABASE or RENAME DATABASE (latter one not yet available by the time the comment was written) */ /* Let's reset current_db, assume it's gone */ my_free(current_db, MYF(MY_ALLOW_ZERO_PTR)); current_db= 0; /* We don't care about in case of an error below because current_db was just set to 0. */ if (!mysql_query(&mysql, "SELECT DATABASE()") && (res= mysql_use_result(&mysql))) { row= mysql_fetch_row(res); if (row[0]) { current_db= my_strdup(row[0], MYF(MY_WME)); } (void) mysql_fetch_row(res); // Read eof mysql_free_result(res); } get_current_db(); if (!current_db || cmp_database(charset_info, current_db,tmp)) { Loading
client/mysqldump.c +5 −0 Original line number Diff line number Diff line Loading @@ -865,6 +865,11 @@ static int dbConnect(char *host, char *user,char *passwd) DBerror(&mysql_connection, "when trying to connect"); return 1; } /* Don't dump SET NAMES with a pre-4.1 server (bug#7997). */ if (mysql_get_server_version(&mysql_connection) < 40100) opt_set_charset= 0; /* As we're going to set SQL_MODE, it would be lost on reconnect, so we cannot reconnect. Loading
include/my_sys.h +4 −4 Original line number Diff line number Diff line Loading @@ -776,9 +776,9 @@ extern void get_defaults_files(int argc, char **argv, char **defaults, char **extra_defaults); extern int load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv); extern int process_default_option_files(const char *conf_file, Process_option_func func, void *func_ctx); extern int my_search_option_files(const char *conf_file, int *argc, char ***argv, uint *args_used, Process_option_func func, void *func_ctx); extern void free_defaults(char **argv); extern void print_defaults(const char *conf_file, const char **groups); extern my_bool my_compress(byte *, ulong *, ulong *); Loading
include/mysql_com.h +1 −0 Original line number Diff line number Diff line Loading @@ -147,6 +147,7 @@ enum enum_server_command COM_FETCH command. */ #define SERVER_STATUS_LAST_ROW_SENT 128 #define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ #define MYSQL_ERRMSG_SIZE 512 #define NET_READ_TIMEOUT 30 /* Timeout on read */ Loading
innobase/btr/btr0cur.c +19 −17 Original line number Diff line number Diff line Loading @@ -1642,7 +1642,7 @@ btr_cur_optimistic_update( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(page_cursor, index, mtr); page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); Loading Loading @@ -1885,7 +1885,7 @@ btr_cur_pessimistic_update( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(page_cursor, index, mtr); page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); Loading Loading @@ -2401,6 +2401,7 @@ btr_cur_optimistic_delete( mem_heap_t* heap = NULL; ulint offsets_[100] = { 100, }; ulint* offsets = offsets_; ibool no_compress_needed; ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_page(cursor)), MTR_MEMO_PAGE_X_FIX)); Loading @@ -2414,9 +2415,11 @@ btr_cur_optimistic_delete( offsets = rec_get_offsets(rec, cursor->index, offsets, ULINT_UNDEFINED, &heap); if (!rec_offs_any_extern(offsets) no_compress_needed = !rec_offs_any_extern(offsets) && btr_cur_can_delete_without_compress( cursor, rec_offs_size(offsets), mtr)) { cursor, rec_offs_size(offsets), mtr); if (no_compress_needed) { lock_update_delete(rec); Loading @@ -2425,20 +2428,17 @@ btr_cur_optimistic_delete( max_ins_size = page_get_max_insert_size_after_reorganize(page, 1); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); cursor->index, offsets, mtr); ibuf_update_free_bits_low(cursor->index, page, max_ins_size, mtr); if (heap) { mem_heap_free(heap); } return(TRUE); } if (heap) { mem_heap_free(heap); } return(FALSE); return(no_compress_needed); } /***************************************************************** Loading Loading @@ -2478,6 +2478,7 @@ btr_cur_pessimistic_delete( ibool success; ibool ret = FALSE; mem_heap_t* heap; ulint* offsets; page = btr_cur_get_page(cursor); tree = btr_cur_get_tree(cursor); Loading @@ -2503,20 +2504,20 @@ btr_cur_pessimistic_delete( } } heap = mem_heap_create(256); heap = mem_heap_create(1024); rec = btr_cur_get_rec(cursor); offsets = rec_get_offsets(rec, cursor->index, NULL, ULINT_UNDEFINED, &heap); /* Free externally stored fields if the record is neither a node pointer nor in two-byte format. This avoids unnecessary calls to rec_get_offsets(). */ This avoids an unnecessary loop. */ if (cursor->index->table->comp ? !rec_get_node_ptr_flag(rec) : !rec_get_1byte_offs_flag(rec)) { btr_rec_free_externally_stored_fields(cursor->index, rec, rec_get_offsets(rec, cursor->index, NULL, ULINT_UNDEFINED, &heap), in_rollback, mtr); mem_heap_empty(heap); rec, offsets, in_rollback, mtr); } if ((page_get_n_recs(page) < 2) Loading Loading @@ -2568,7 +2569,8 @@ btr_cur_pessimistic_delete( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, offsets, mtr); ut_ad(btr_check_node_ptr(tree, page, mtr)); Loading