summaryrefslogtreecommitdiff
path: root/storage/maria/ma_loghandler.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@mysql.com>2009-01-16 00:25:53 +0200
committerMichael Widenius <monty@mysql.com>2009-01-16 00:25:53 +0200
commit3fca23902cdf36bdc52f2d5826bfd24c2024feb8 (patch)
treeb22b92e6f525233e951763dd718aa9415c513219 /storage/maria/ma_loghandler.c
parenta955efc40c965dd8b19a18b2eef439d9166bb132 (diff)
downloadmariadb-git-3fca23902cdf36bdc52f2d5826bfd24c2024feb8.tar.gz
Log queries to maria_log if compiled with EXTRA_DEBUG
Added DBUG_ASSERT() to unlikely error senario Don't use errno == 0 in maria_create() / myisam_create() sql/sql_insert.cc: Added DBUG_ASSERT() for case that should never happen in real life Added my_error() to avoid assert if mysql_lock() or postlock() doesn't call my_error() storage/maria/ha_maria.cc: Log queries to maria_log if compiled with EXTRA_DEBUG storage/maria/ma_create.c: Don't use errno == 0 storage/maria/ma_loghandler.c: Added logging of debug info to maria_log storage/maria/ma_loghandler.h: Added logging of debug info to maria_log storage/maria/ma_recovery.c: Added printing of debug info from maria_log storage/maria/trnman.c: Added functions to read/store state in TRN storage/maria/trnman.h: Added functions to read/store state in TRN storage/maria/trnman_public.h: Added state in TRN to remmeber if we have already logged the query storage/myisam/mi_create.c: Don't use errno == 0
Diffstat (limited to 'storage/maria/ma_loghandler.c')
-rw-r--r--storage/maria/ma_loghandler.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index a0c8d0e63a3..27d7460f7fb 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -685,6 +685,10 @@ static LOG_DESC INIT_LOGREC_IMPORTED_TABLE=
{LOGRECTYPE_VARIABLE_LENGTH, 0, 0, NULL, NULL, NULL, 0,
"imported_table", LOGREC_IS_GROUP_ITSELF, NULL, NULL};
+static LOG_DESC INIT_LOGREC_DEBUG_INFO=
+{LOGRECTYPE_VARIABLE_LENGTH, 0, 0, NULL, NULL, NULL, 0,
+ "info", LOGREC_IS_GROUP_ITSELF, NULL, NULL};
+
const myf log_write_flags= MY_WME | MY_NABP | MY_WAIT_IF_FULL;
void translog_table_init()
@@ -774,6 +778,9 @@ void translog_table_init()
INIT_LOGREC_REDO_BITMAP_NEW_PAGE;
log_record_type_descriptor[LOGREC_IMPORTED_TABLE]=
INIT_LOGREC_IMPORTED_TABLE;
+ log_record_type_descriptor[LOGREC_DEBUG_INFO]=
+ INIT_LOGREC_DEBUG_INFO;
+
for (i= LOGREC_FIRST_FREE; i < LOGREC_NUMBER_OF_TYPES; i++)
log_record_type_descriptor[i].rclass= LOGRECTYPE_NOT_ALLOWED;
#ifndef DBUG_OFF
@@ -8299,6 +8306,43 @@ void translog_set_file_size(uint32 size)
DBUG_VOID_RETURN;
}
+
+/**
+ Write debug information to log if we EXTRA_DEBUG is enabled
+*/
+
+my_bool translog_log_debug_info(TRN *trn, enum translog_debug_info_type type,
+ uchar *info, size_t length)
+{
+#ifdef EXTRA_DEBUG
+ LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 2];
+ uchar debug_type;
+ LSN lsn;
+
+ if (!trn)
+ {
+ /*
+ We can't log the current transaction because we don't have
+ an active transaction. Use a temporary transaction object instead
+ */
+ trn= &dummy_transaction_object;
+ }
+ debug_type= (uchar) type;
+ log_array[TRANSLOG_INTERNAL_PARTS + 0].str= &debug_type;
+ log_array[TRANSLOG_INTERNAL_PARTS + 0].length= 1;
+ log_array[TRANSLOG_INTERNAL_PARTS + 1].str= info;
+ log_array[TRANSLOG_INTERNAL_PARTS + 1].length= length;
+ return translog_write_record(&lsn, LOGREC_DEBUG_INFO,
+ trn, NULL,
+ (translog_size_t) (1+ length),
+ sizeof(log_array)/sizeof(log_array[0]),
+ log_array, NULL, NULL);
+#else
+ return 0;
+#endif
+}
+
+
#ifdef MARIA_DUMP_LOG
#include <my_getopt.h>
extern void translog_example_table_init();