From c3a881a6722228c1567a51aec5ae770580280fdc Mon Sep 17 00:00:00 2001 From: "heikki@donna.mysql.fi" <> Date: Thu, 20 Dec 2001 20:00:39 +0200 Subject: [PATCH 1/3] log0recv.c: Add warnings to recovery in some cases where log file might be corrupt and consequently recovery can be trusted less than normally --- innobase/log/log0recv.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 1734cfadfff..f83a49d01a6 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -564,8 +564,15 @@ recv_parse_or_apply_log_rec_body( } else if (type <= MLOG_WRITE_STRING) { new_ptr = mlog_parse_string(ptr, end_ptr, page); } else { - new_ptr = NULL; /* Eliminate compiler warning */ - ut_error; + new_ptr = NULL; + + fprintf(stderr, + "InnoDB: WARNING: the log file may have been corrupt and it\n" + "InnoDB: is possible that the log scan did not proceed\n" + "InnoDB: far enough in recovery. Please run CHECK TABLE\n" + "InnoDB: on your InnoDB tables to check that they are ok!\n" + "InnoDB: Corrupt log record type %lu\n", + (ulint)type); } ut_ad(!page || new_ptr); @@ -1316,9 +1323,29 @@ recv_parse_log_rec( new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space, page_no); + + /* If the operating system writes to the log complete 512-byte + blocks, we should not get the warnings below in recovery. + A warning means that the header and the trailer appeared ok + in a 512-byte block, but in the middle there was something wrong. + TODO: (1) add similar warnings in the case there is an incompletely + written log record which does not extend to the boundary of a + 512-byte block. (2) Add a checksum to a log block. */ + + if (!new_ptr) { + return(0); + } + /* Check that space id and page_no are sensible */ - if (!new_ptr || *space != 0 || *page_no > 0x8FFFFFFF) { + if (*space != 0 || *page_no > 0x8FFFFFFF) { + fprintf(stderr, + "InnoDB: WARNING: the log file may have been corrupt and it\n" + "InnoDB: is possible that the log scan did not proceed\n" + "InnoDB: far enough in recovery. Please run CHECK TABLE\n" + "InnoDB: on your InnoDB tables to check that they are ok!\n" + "InnoDB: Corrupt log record type %lu, space id %lu, page no %lu\n", + (ulint)(*type), *space, *page_no); return(0); } From 2dfa455503b9be5d09dd47b6bdd74a50571eb5eb Mon Sep 17 00:00:00 2001 From: "heikki@donna.mysql.fi" <> Date: Thu, 20 Dec 2001 22:45:07 +0200 Subject: [PATCH 2/3] row0ins.c: Allow equal key values in a unique secondary index if the key value contains an SQL NULL --- innobase/row/row0ins.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c index 2c6d3b0ed00..3321c288e39 100644 --- a/innobase/row/row0ins.c +++ b/innobase/row/row0ins.c @@ -319,6 +319,7 @@ row_ins_dupl_error_with_rec( ulint matched_fields; ulint matched_bytes; ulint n_unique; + ulint i; n_unique = dict_index_get_n_unique(index); @@ -329,12 +330,26 @@ row_ins_dupl_error_with_rec( if (matched_fields < n_unique) { - return(FALSE); + return(FALSE); + } + + /* In a unique secondary index we allow equal key values if they + contain SQL NULLs */ + + if (!(index->type & DICT_CLUSTERED)) { + + for (i = 0; i < n_unique; i++) { + if (UNIV_SQL_NULL == dfield_get_len( + dtuple_get_nth_field(entry, i))) { + + return(FALSE); + } + } } if (!rec_get_deleted_flag(rec)) { - return(TRUE); + return(TRUE); } return(FALSE); From 05a3c0e8f695530af36daa619bdae8fcccb87912 Mon Sep 17 00:00:00 2001 From: "monty@hundin.mysql.fi" <> Date: Fri, 21 Dec 2001 06:54:58 +0200 Subject: [PATCH 3/3] Fixed shutdown problem on HPUX --- Docs/manual.texi | 6 ++++++ mysql-test/r/innodb.result | 14 +++++++------- sql/mysqld.cc | 9 ++++++++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index f51b779414f..f3f3cdec961 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -46888,6 +46888,12 @@ not yet 100% confident in this code. @appendixsubsec Changes in release 3.23.47 @itemize @bullet @item +InnoDB now supports @code{NULL} in keys. +@item +Fixed shutdown problem on HPUX. (Introduced in 3.23.46) +@item +Added 'DO expression' command. +@item Fixed core-dump bug in replication when using SELECT RELEASE_LOCK(); @item Added new statement DO expression,[expression]. diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index a422f55767d..63674d050c1 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -111,11 +111,11 @@ id parent_id level 1010 102 2 1015 102 2 table type possible_keys key key_len ref rows Extra -t1 index level level 1 NULL 39 where used; Using index +t1 ref level level 1 const 12 where used; Using index table type possible_keys key key_len ref rows Extra -t1 index level level 1 NULL 39 where used; Using index +t1 ref level level 1 const 12 where used; Using index table type possible_keys key key_len ref rows Extra -t1 ref level level 1 const 12 +t1 ref level level 1 const 12 where used level id 1 1002 1 1003 @@ -133,9 +133,9 @@ level id parent_id Table Op Msg_type Msg_text test.t1 optimize error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 0 PRIMARY 1 id A 2 NULL NULL -t1 1 parent_id 1 parent_id A 2 NULL NULL -t1 1 level 1 level A 2 NULL NULL +t1 0 PRIMARY 1 id A 87 NULL NULL +t1 1 parent_id 1 parent_id A 21 NULL NULL +t1 1 level 1 level A 4 NULL NULL gesuchnr benutzer_id 1 1 2 1 @@ -438,7 +438,7 @@ hello 1 Table Op Msg_type Msg_text test.t1 optimize error The handler for the table doesn't support check/repair Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Comment -t1 0 PRIMARY 1 a A 2 NULL NULL +t1 0 PRIMARY 1 a A 1 NULL NULL i j 1 2 i j diff --git a/sql/mysqld.cc b/sql/mysqld.cc index c014f75fb84..c34f18da1ec 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -610,13 +610,20 @@ void kill_mysql(void) { DBUG_PRINT("error",("Got error %d from pthread_kill",errno)); /* purecov: inspected */ } -#else +#elif !defined(SIGNALS_DONT_BREAK_READ) kill(current_pid,MYSQL_KILL_SIGNAL); #endif DBUG_PRINT("quit",("After pthread_kill")); shutdown_in_progress=1; // Safety if kill didn't work #ifdef SIGNALS_DONT_BREAK_READ + if (!abort_loop) + { + pthread_t tmp; abort_loop=1; + if (pthread_create(&tmp,&connection_attrib, kill_server_thread, + (void*) 0)) + sql_print_error("Error: Can't create thread to kill server"); + } #endif DBUG_VOID_RETURN; }