From 5f51294a3ce2f40483adb23a5140c90ff95c007f Mon Sep 17 00:00:00 2001 From: "ingo@mysql.com" <> Date: Wed, 26 Oct 2005 14:01:54 +0200 Subject: [PATCH 1/2] 1.2048 05/10/20 10:31:16 ingo@mysql.com +1 -0 Bug#12166 - Unable to index very large tables Moved clearing of errors behind the second repair attempt, but will clear only if no error happened. No test case. The error can be repeated with little free space on tmpdir only. I do not know of a way to create this in a portable way with our test suite. I did however attach a shell script to the bug report which can easily be adapted to the situation on the test machine. --- myisam/mi_check.c | 19 ++++++++++++------- sql/ha_myisam.cc | 11 ++++++++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/myisam/mi_check.c b/myisam/mi_check.c index f5d46210944..4d9cf3e77d4 100644 --- a/myisam/mi_check.c +++ b/myisam/mi_check.c @@ -1294,25 +1294,30 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, param->calc_checksum=1; info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); + + /* + Clear all keys. Note that all key blocks allocated until now remain + "dead" parts of the key file. (Bug #4692) + */ for (i=0 ; i < info->s->base.keys ; i++) share->state.key_root[i]= HA_OFFSET_ERROR; + + /* Drop the delete chain. */ for (i=0 ; i < share->state.header.max_block_size ; i++) share->state.key_del[i]= HA_OFFSET_ERROR; /* - I think mi_repair and mi_repair_by_sort should do the same - (according, e.g. to ha_myisam::repair), but as mi_repair doesn't - touch key_map it cannot be used to T_CREATE_MISSING_KEYS. - That is what the next line is for + If requested, activate (enable) all keys in key_map. In this case, + all indexes will be (re-)built. */ - if (param->testflag & T_CREATE_MISSING_KEYS) - mi_copy_keys_active(share->state.key_map, share->base.keys, - param->keys_in_use); + mi_set_all_keys_active(share->state.key_map, share->base.keys); info->state->key_file_length=share->base.keystart; lock_memory(param); /* Everything is alloced */ + + /* Re-create all keys, which are set in key_map. */ while (!(error=sort_get_next_record(&sort_param))) { if (writekeys(param,info,(byte*)sort_param.record,sort_param.filepos)) diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 70137ff2b16..ced00c94e73 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -985,11 +985,16 @@ int ha_myisam::enable_indexes(uint mode) { sql_print_warning("Warning: Enabling keys got errno %d, retrying", my_errno); - thd->clear_error(); + /* Repairing by sort failed. Now try standard repair method. */ param.testflag&= ~(T_REP_BY_SORT | T_QUICK); error= (repair(thd,param,0) != HA_ADMIN_OK); - if (!error && thd->net.report_error) - error= HA_ERR_CRASHED; + /* + If the standard repair succeeded, clear all error messages which + might have been set by the first repair. They can still be seen + with SHOW WARNINGS then. + */ + if (! error) + thd->clear_error(); } info(HA_STATUS_CONST); thd->proc_info=save_proc_info; From 362677f2af0b0830b4f610dfbef949440b6dfff8 Mon Sep 17 00:00:00 2001 From: "pekka@mysql.com" <> Date: Thu, 27 Oct 2005 09:36:11 +0200 Subject: [PATCH 2/2] ndb - base64 compile fix in ndbapi test --- ndb/test/src/HugoCalculator.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ndb/test/src/HugoCalculator.cpp b/ndb/test/src/HugoCalculator.cpp index 8e01f6442bb..d4d7ca2f95f 100644 --- a/ndb/test/src/HugoCalculator.cpp +++ b/ndb/test/src/HugoCalculator.cpp @@ -17,7 +17,6 @@ #include #include "HugoCalculator.hpp" #include -#include static Uint32