diff options
author | Michael Widenius <monty@askmonty.org> | 2011-05-16 12:16:08 +0300 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-05-16 12:16:08 +0300 |
commit | 8c5e18c9cfde61197a9f653efa08450ae9a6ce0a (patch) | |
tree | b7d7466f3ffa6e5c197046625f323d8029964e6f | |
parent | 3a6da123e2778045081822c6dc0bbd5b473ab4c8 (diff) | |
download | mariadb-git-8c5e18c9cfde61197a9f653efa08450ae9a6ce0a.tar.gz |
Added more asserts to find out how maria.maria-big could have failed in buildbot.
storage/maria/ma_loghandler.c:
Added assert if we give wrong type to translog_write_record().
(This should be impossible, but the failure record in buildbot also looks impossible so we need more information...)
storage/maria/ma_loghandler.h:
Added prototype for check_translog_description_table()
storage/maria/unittest/ma_loghandler_examples.c:
Call check_translog_description_table() to register number of log_record_type_descriptor[] events.
-rw-r--r-- | storage/maria/ma_loghandler.c | 15 | ||||
-rw-r--r-- | storage/maria/ma_loghandler.h | 1 | ||||
-rw-r--r-- | storage/maria/unittest/ma_loghandler_examples.c | 1 |
3 files changed, 13 insertions, 4 deletions
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index fc8edbe36e4..b796ea897c1 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -458,7 +458,9 @@ void translog_lock_handler_assert_owner() @param num how many records should be filled */ -static void check_translog_description_table(int num) +static max_allowed_translog_type= 0; + +void check_translog_description_table(int num) { int i; DBUG_ENTER("check_translog_description_table"); @@ -467,6 +469,7 @@ static void check_translog_description_table(int num) /* last is reserved for extending the table */ DBUG_ASSERT(num < LOGREC_NUMBER_OF_TYPES - 1); DBUG_ASSERT(log_record_type_descriptor[0].rclass == LOGRECTYPE_NOT_ALLOWED); + max_allowed_translog_type= num; for (i= 0; i <= num; i++) { @@ -3583,6 +3586,7 @@ my_bool translog_init_with_table(const char *directory, log_descriptor.flush_no= 0; log_descriptor.next_pass_max_lsn= LSN_IMPOSSIBLE; + /* Normally in Aria this this calls translog_table_init() */ (*init_table_func)(); compile_time_assert(sizeof(log_descriptor.dirty_buffer_mask) * 8 >= TRANSLOG_BUFFERS_NO); @@ -6224,6 +6228,8 @@ my_bool translog_write_record(LSN *lsn, (uint) short_trid, (ulong) rec_len)); DBUG_ASSERT(translog_status == TRANSLOG_OK || translog_status == TRANSLOG_READONLY); + DBUG_ASSERT(type != 0); + DBUG_ASSERT(type <= max_allowed_translog_type); if (unlikely(translog_status != TRANSLOG_OK)) { DBUG_PRINT("error", ("Transaction log is write protected")); @@ -6322,9 +6328,9 @@ my_bool translog_write_record(LSN *lsn, /* process this parts */ if (!(rc= (log_record_type_descriptor[type].prewrite_hook && - (*log_record_type_descriptor[type].prewrite_hook) (type, trn, - tbl_info, - hook_arg)))) + (*log_record_type_descriptor[type].prewrite_hook)(type, trn, + tbl_info, + hook_arg)))) { switch (log_record_type_descriptor[type].rclass) { case LOGRECTYPE_VARIABLE_LENGTH: @@ -6337,6 +6343,7 @@ my_bool translog_write_record(LSN *lsn, short_trid, &parts, trn, hook_arg); break; case LOGRECTYPE_NOT_ALLOWED: + DBUG_ASSERT(0); default: DBUG_ASSERT(0); rc= 1; diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h index f33e92e9771..0c3c5c22d6b 100644 --- a/storage/maria/ma_loghandler.h +++ b/storage/maria/ma_loghandler.h @@ -312,6 +312,7 @@ extern my_bool translog_init_with_table(const char *directory, my_bool readonly, void (*init_table_func)(), my_bool no_error); +void check_translog_description_table(int num); extern my_bool translog_write_record(LSN *lsn, enum translog_record_type type, TRN *trn, diff --git a/storage/maria/unittest/ma_loghandler_examples.c b/storage/maria/unittest/ma_loghandler_examples.c index 0c11a3b9a8e..be2ac7ec459 100644 --- a/storage/maria/unittest/ma_loghandler_examples.c +++ b/storage/maria/unittest/ma_loghandler_examples.c @@ -59,6 +59,7 @@ void translog_example_table_init() i < LOGREC_NUMBER_OF_TYPES; i++) log_record_type_descriptor[i].rclass= LOGRECTYPE_NOT_ALLOWED; + check_translog_description_table(LOGREC_VARIABLE_RECORD_2LSN_EXAMPLE); } |