From d32e12b253e02ebc13907f00bf6bb5409bba9c1e Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Feb 2004 16:54:16 +0200 Subject: [PATCH 1/4] row0upd.c: Fix bug: in a FOREIGN KEY, ON UPDATE CASCADE was not triggered if the update changed a string to another value identical in alphabetical ordering, e.g., abc -> aBc innobase/row/row0upd.c: Fix bug: in a FOREIGN KEY, ON UPDATE CASCADE was not triggered if the update changed a string to another value identical in alphabetical ordering, e.g., abc -> aBc --- innobase/row/row0upd.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c index e3725c8b39e..ae373dfc621 100644 --- a/innobase/row/row0upd.c +++ b/innobase/row/row0upd.c @@ -77,8 +77,8 @@ index record. This is only used in foreign key checks and we can assume that index does not contain column prefixes. */ static ibool -row_upd_changes_first_fields( -/*=========================*/ +row_upd_changes_first_fields_binary( +/*================================*/ /* out: TRUE if changes */ dtuple_t* entry, /* in: old value of index entry */ dict_index_t* index, /* in: index of entry */ @@ -196,7 +196,7 @@ row_upd_check_references_constraints( if (foreign->referenced_index == index && (node->is_delete - || row_upd_changes_first_fields(entry, index, + || row_upd_changes_first_fields_binary(entry, index, node->update, foreign->n_fields))) { if (foreign->foreign_table == NULL) { @@ -1048,8 +1048,8 @@ index record. This is only used in foreign key checks and we can assume that index does not contain column prefixes. */ static ibool -row_upd_changes_first_fields( -/*=========================*/ +row_upd_changes_first_fields_binary( +/*================================*/ /* out: TRUE if changes */ dtuple_t* entry, /* in: index entry */ dict_index_t* index, /* in: index of entry */ @@ -1074,15 +1074,16 @@ row_upd_changes_first_fields( col = dict_field_get_col(ind_field); col_pos = dict_col_get_clust_pos(col); + ut_a(ind_field->prefix_len == 0); + for (j = 0; j < n_upd_fields; j++) { upd_field = upd_get_nth_field(update, j); if (col_pos == upd_field->field_no - && (ind_field->prefix_len > 0 - || 0 != cmp_dfield_dfield( + && !dfield_datas_are_binary_equal( dtuple_get_nth_field(entry, i), - &(upd_field->new_val)))) { + &(upd_field->new_val))) { return(TRUE); } } From 588b8b93104a4ca20f07593815b0d4357d3c9acf Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Feb 2004 16:51:01 +0100 Subject: [PATCH 2/4] Changes to fix errors encountered in test builds on Windows. VC++Files/innobase/innobase.dsp: odbc0odbc.c was removed from the tree. VC++Files/libmysql/libmysql.dsp: strxnmov.c is needed in this module. sql/log_event.cc: Cast required to resolve compile error on Windows - byte * is not equivalent to char *. sql/opt_range.cc: Cast to const char * required to resolve compile error on Windows. BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + VC++Files/innobase/innobase.dsp | 4 ---- VC++Files/libmysql/libmysql.dsp | 4 ++++ sql/log_event.cc | 2 +- sql/opt_range.cc | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index c51d344aef5..8db23877ee5 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -2,6 +2,7 @@ Administrador@light. Administrator@co3064164-a. Administrator@co3064164-a.rochd1.qld.optushome.com.au Administrator@fred. +Greg@greg-laptop. Miguel@light.local Sinisa@sinisa.nasamreza.org ahlentz@co3064164-a.rochd1.qld.optusnet.com.au diff --git a/VC++Files/innobase/innobase.dsp b/VC++Files/innobase/innobase.dsp index 83419fc53cc..c50911063ab 100644 --- a/VC++Files/innobase/innobase.dsp +++ b/VC++Files/innobase/innobase.dsp @@ -280,10 +280,6 @@ SOURCE=.\mtr\mtr0mtr.c # End Source File # Begin Source File -SOURCE=.\odbc\odbc0odbc.c -# End Source File -# Begin Source File - SOURCE=.\os\os0file.c # End Source File # Begin Source File diff --git a/VC++Files/libmysql/libmysql.dsp b/VC++Files/libmysql/libmysql.dsp index 923cac29c37..ed8f27ef579 100644 --- a/VC++Files/libmysql/libmysql.dsp +++ b/VC++Files/libmysql/libmysql.dsp @@ -463,6 +463,10 @@ SOURCE=..\strings\strxmov.c # End Source File # Begin Source File +SOURCE=..\strings\strxnmov.c +# End Source File +# Begin Source File + SOURCE=..\mysys\thr_mutex.c # End Source File # Begin Source File diff --git a/sql/log_event.cc b/sql/log_event.cc index 1c10a9a798c..61a1ee24973 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1556,7 +1556,7 @@ Create_file_log_event::Create_file_log_event(const char* buf, int len, We must make copy of 'buf' as this event may have to live over a rotate log entry when used in mysqlbinlog */ - if (!(event_buf= my_memdup(buf, len, MYF(MY_WME))) || + if (!(event_buf= my_memdup((byte*) buf, len, MYF(MY_WME))) || (copy_log_event(event_buf, len, old_format))) DBUG_VOID_RETURN; diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 0ed5c447486..071c83bb6d2 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2414,9 +2414,9 @@ get_quick_keys(PARAM *param,QUICK_SELECT *quick,KEY_PART *key, } /* Get range for retrieving rows in QUICK_SELECT::get_next */ - if (!(range= new QUICK_RANGE(param->min_key, + if (!(range= new QUICK_RANGE((const char *) param->min_key, (uint) (tmp_min_key - param->min_key), - param->max_key, + (const char *) param->max_key, (uint) (tmp_max_key - param->max_key), flag))) return 1; // out of memory From 343680f46e4100c98d82e1190b37dbbc9c5e5341 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 28 Feb 2004 15:11:16 +0100 Subject: [PATCH 3/4] Fix problem with NT named pipes code (per e-mail thread). sql/mysqld.cc: Should be mysql_unix_port (cut and paste error). --- sql/mysqld.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 4484771d4ed..b4c5ce33277 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1176,7 +1176,7 @@ static void server_init(void) pipe_name[sizeof(pipe_name)-1]= 0; /* Safety if too long string */ strxnmov(pipe_name, sizeof(pipe_name)-1, "\\\\.\\pipe\\", - unix_socket, NullS); + mysql_unix_port, NullS); bzero((char*) &saPipeSecurity, sizeof(saPipeSecurity) ); bzero((char*) &sdPipeDescriptor, sizeof(sdPipeDescriptor) ); if (!InitializeSecurityDescriptor(&sdPipeDescriptor, From bf53c870499fac500ef34f0880a4da18c08e417d Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 1 Mar 2004 00:46:31 +0100 Subject: [PATCH 4/4] Fix for BUG#3017 "wrong Relay_Log_Pos if Rotate is in the middle of a transaction in relay log" increment 'pending' instead of 'relay_log_pos'. mysql-test/r/rpl_trunc_binlog.result: result update sql/log_event.cc: - corrected error message - in Rotate_log_event::exec_event(), if we're in a transaction (which can happen if the I/O slave thread reconnected while reading a transaction), don't increment relay_log_pos but pending instead. Otherwise, relay_log_pos becomes garbage (and so if slave stops at that moment, it will never restart). --- mysql-test/r/rpl_trunc_binlog.result | 2 +- sql/log_event.cc | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/rpl_trunc_binlog.result b/mysql-test/r/rpl_trunc_binlog.result index 272fa210807..27b7c3c5677 100644 --- a/mysql-test/r/rpl_trunc_binlog.result +++ b/mysql-test/r/rpl_trunc_binlog.result @@ -10,4 +10,4 @@ reset slave; start slave; show slave status; Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space -127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 161 master-bin.001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. Probably cause is that the master died while writing the transaction to it's binary log. 0 79 # +127.0.0.1 root MASTER_PORT 1 master-bin.002 4 slave-relay-bin.002 120 master-bin.001 Yes No 0 Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. A probable cause is that the master died while writing the transaction to its binary log. 0 79 # diff --git a/sql/log_event.cc b/sql/log_event.cc index 61a1ee24973..038c17ffaba 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2121,7 +2121,7 @@ int Start_log_event::exec_event(struct st_relay_log_info* rli) slave_print_error(rli, 0, "\ Rolling back unfinished transaction (no COMMIT or ROLLBACK) from relay log. \ -Probably cause is that the master died while writing the transaction to it's \ +A probable cause is that the master died while writing the transaction to its \ binary log."); return(1); } @@ -2221,13 +2221,15 @@ int Rotate_log_event::exec_event(struct st_relay_log_info* rli) In that case, we don't want to touch the coordinates which correspond to the beginning of the transaction. */ - if (!rli->inside_transaction) + if (rli->inside_transaction) + rli->inc_pending(get_event_len()); + else { memcpy(rli->master_log_name, new_log_ident, ident_len+1); rli->master_log_pos= pos; + rli->relay_log_pos += get_event_len(); DBUG_PRINT("info", ("master_log_pos: %lu", (ulong) rli->master_log_pos)); } - rli->relay_log_pos += get_event_len(); pthread_mutex_unlock(&rli->data_lock); pthread_cond_broadcast(&rli->data_cond); flush_relay_log_info(rli);