summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <guilhem@gbichot3.local>2007-07-04 16:01:00 +0200
committerunknown <guilhem@gbichot3.local>2007-07-04 16:01:00 +0200
commit3a1c7c914ca08b43094f3eba257798750c77e714 (patch)
treee64f30791704149fa70628003719d314be580e23
parenta898a7b63e65b46da82225ab8823897963dcbb3a (diff)
downloadmariadb-git-3a1c7c914ca08b43094f3eba257798750c77e714.tar.gz
Maria: correcting assertions (should be enforced only in multi-threaded
mode) so ma_test_all works again; more error detection in ma_test_all; maria_control renamed to maria_log_control (Monty's suggestion, so that a "rm maria_log*" removes all log-related files). Disabling failing wrong assertion. storage/maria/ma_blockrec.c: disabling assertion which fails because cur_block is a local variable not initialized storage/maria/ma_check.c: comment storage/maria/ma_control_file.h: control file renamed storage/maria/ma_loghandler.c: assertions needed only in multi-threaded mode (ma_test1 and ma_test2 are single-threaded, it's ok for them to use dummy_transaction_object with transactional tables: trn->rec_lsn can be set without interfering with other threads). storage/maria/ma_test_all.sh: got caught by failures in some ma_test1 runs, which I didn't see because ma_test_all returned 0 and I didn't scroll up in the window; now using "set -e" to avoid that. Also testing that we get the errors and warnings we expect. storage/maria/unittest/Makefile.am: maria_control renamed
-rw-r--r--storage/maria/ma_blockrec.c2
-rw-r--r--storage/maria/ma_check.c6
-rw-r--r--storage/maria/ma_control_file.h2
-rw-r--r--storage/maria/ma_loghandler.c4
-rwxr-xr-xstorage/maria/ma_test_all.sh12
-rw-r--r--storage/maria/unittest/Makefile.am2
6 files changed, 20 insertions, 8 deletions
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c
index 06c1df16663..3ce4c9efe42 100644
--- a/storage/maria/ma_blockrec.c
+++ b/storage/maria/ma_blockrec.c
@@ -1811,10 +1811,12 @@ static my_bool write_block_record(MARIA_HA *info,
ulong length;
ulong data_length= (tmp_data - info->rec_buff);
+#ifdef MONTY_WILL_KNOW
#ifdef SANITY_CHECKS
if (cur_block->sub_blocks == 1)
goto crashed; /* no reserved full or tails */
#endif
+#endif
/*
Find out where to write tail for non-blob fields.
diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c
index ae23e64575b..88198892985 100644
--- a/storage/maria/ma_check.c
+++ b/storage/maria/ma_check.c
@@ -1925,7 +1925,11 @@ int maria_chk_data_link(HA_CHECK *param, MARIA_HA *info,int extend)
Recover old table by reading each record and writing all keys
NOTES
- Save new datafile-name in temp_filename
+ Save new datafile-name in temp_filename.
+ We overwrite the index file as we go (writekeys() for example), so if we
+ crash during this the table is unusable and user (or Recovery in the
+ future) must repeat the REPAIR/OPTIMIZE operation. We could use a
+ temporary index file in the future (drawback: more disk space).
IMPLEMENTATION (for hard repair with block format)
- Create new, unrelated MARIA_HA of the table
diff --git a/storage/maria/ma_control_file.h b/storage/maria/ma_control_file.h
index fa4ec442e41..d6c121b21be 100644
--- a/storage/maria/ma_control_file.h
+++ b/storage/maria/ma_control_file.h
@@ -18,7 +18,7 @@
First version written by Guilhem Bichot on 2006-04-27.
*/
-#define CONTROL_FILE_BASE_NAME "maria_control"
+#define CONTROL_FILE_BASE_NAME "maria_log_control"
/* Here is the interface of this module */
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 6195e552185..cb5e02a1cc0 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -5623,7 +5623,7 @@ static my_bool write_hook_for_redo(enum translog_record_type type
non-transactional log records (REPAIR, CREATE, RENAME, DROP) should not
call this hook; we trust them but verify ;)
*/
- DBUG_ASSERT(trn->trid != 0);
+ DBUG_ASSERT(!(maria_multi_threaded && (trn->trid == 0)));
/*
If the hook stays so simple, it would be faster to pass
!trn->rec_lsn ? trn->rec_lsn : some_dummy_lsn
@@ -5650,7 +5650,7 @@ static my_bool write_hook_for_undo(enum translog_record_type type
struct st_translog_parts *parts
__attribute__ ((unused)))
{
- DBUG_ASSERT(trn->trid != 0); /* see write_hook_for_redo() */
+ DBUG_ASSERT(!(maria_multi_threaded && (trn->trid == 0)));
trn->undo_lsn= *lsn;
if (unlikely(LSN_WITH_FLAGS_TO_LSN(trn->first_undo_lsn) == 0))
trn->first_undo_lsn=
diff --git a/storage/maria/ma_test_all.sh b/storage/maria/ma_test_all.sh
index 5ea76a7037d..a6786315afe 100755
--- a/storage/maria/ma_test_all.sh
+++ b/storage/maria/ma_test_all.sh
@@ -9,6 +9,8 @@
# Remove # from following line if you need some more information
#set -x -v -e
+set -e # abort at first failure
+
valgrind="valgrind --alignment=8 --leak-check=yes"
silent="-s"
suffix=""
@@ -196,15 +198,19 @@ run_repair_tests "-M -T"
run_pack_tests "-M -T"
#
-# Tests that gives warnings
+# Tests that gives warnings or errors
#
$maria_path/ma_test2$suffix $silent -L -K -W -P -S -R1 -m500
$maria_path/maria_chk$suffix -sm test2
echo "ma_test2$suffix $silent -L -K -R1 -m2000 ; Should give error 135"
-$maria_path/ma_test2$suffix $silent -L -K -R1 -m2000
+$maria_path/ma_test2$suffix $silent -L -K -R1 -m2000 >ma_test2_message.txt 2>&1 && false # success is failure
+cat ma_test2_message.txt
+grep "Error: 135" ma_test2_message.txt > /dev/null
echo "$maria_path/maria_chk$suffix -sm test2 will warn that 'Datafile is almost full'"
-$maria_path/maria_chk$suffix -sm test2
+$maria_path/maria_chk$suffix -sm test2 >ma_test2_message.txt 2>&1
+cat ma_test2_message.txt
+grep "warning: Datafile is almost full" ma_test2_message.txt >/dev/null
$maria_path/maria_chk$suffix -ssm test2
#
diff --git a/storage/maria/unittest/Makefile.am b/storage/maria/unittest/Makefile.am
index 28264d5d903..b63cb60c059 100644
--- a/storage/maria/unittest/Makefile.am
+++ b/storage/maria/unittest/Makefile.am
@@ -84,6 +84,6 @@ ma_pagecache_consist_64kWR_t_big_CPPFLAGS = $(ma_pagecache_common_cppflags) -DPA
# the generic lock manager may not be used in the end and lockman1-t crashes,
# so we don't build lockman-t and lockman1-t
-CLEANFILES = maria_control page_cache_test_file_1 \
+CLEANFILES = maria_log_control page_cache_test_file_1 \
maria_log.????????