summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_locking.c
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-11-25 16:25:01 +0400
committerSergey Vojtovich <svoj@sun.com>2009-11-25 16:25:01 +0400
commit40ec012c905be0262ba5c36bbccfa0db0105e31f (patch)
tree0ee4d96f089106d4e6d64f0f23d003b719e53367 /storage/myisam/mi_locking.c
parent23159440504311372b2c081c1b5f2cb2f7d98ef3 (diff)
downloadmariadb-git-40ec012c905be0262ba5c36bbccfa0db0105e31f.tar.gz
Backport from 6.0-codebase.
WL#3951 - MyISAM: Additional Error Logs for Data Corruption When table corruption is detected, in addition to current error message provide following information: - list of threads (and queries) accessing a table; - thread_id of a thread that detected corruption; - source file name and line number where this corruption was detected; - optional extra information (string). mysql-test/r/myisam_crash_before_flush_keys.result: Adjusted a test case according to WL#3951. mysql-test/t/myisam_crash_before_flush_keys.test: Adjusted a test case according to WL#3951. storage/myisam/CMakeLists.txt: Added mi_extrafunc.h to myisam sources list. storage/myisam/Makefile.am: Added mi_extrafunc.h to myisam headers list. storage/myisam/ha_myisam.cc: Added _mi_report_crashed() function (reports additional information whenever table corruption is detected). storage/myisam/mi_extrafunc.h: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/mi_locking.c: For every call to mi_lock_database(F_[RD|WR|EXTRA_]LCK) - add current thread to the list of threads accessing this table. For every call to mi_lock_database(F_UNLCK) - remove current thread from the list of threads accessing this table. storage/myisam/mi_test1.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/mi_test2.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/mi_test3.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/myisam_ftdump.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/myisamchk.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/myisamdef.h: Extra elements are added to MI_INFO and MYISAM_SHARE structures. MI_INFO is extended with LIST element, that holds a pointer to THD object accessing a table. MYISAM_SHARE is extended with LIST (list of threads accessing a table). Whenever table is marked as crashed, call mi_report_crashed() macro to provide useful information. storage/myisam/myisamlog.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/myisampack.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/rt_test.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisam/sp_test.c: All standalone programs must define their version of _mi_report_crashed() by including mi_extrafunc.h. storage/myisammrg/ha_myisammrg.cc: For each unedrlying table initialize `in_use' variable.
Diffstat (limited to 'storage/myisam/mi_locking.c')
-rw-r--r--storage/myisam/mi_locking.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/storage/myisam/mi_locking.c b/storage/myisam/mi_locking.c
index 8a5866ae763..fd2094caa54 100644
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@ -45,6 +45,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
++share->w_locks;
++share->tot_locks;
info->lock_type= lock_type;
+ info->s->in_use= list_add(info->s->in_use, &info->in_use);
DBUG_RETURN(0);
}
@@ -136,6 +137,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
}
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
info->lock_type= F_UNLCK;
+ info->s->in_use= list_delete(info->s->in_use, &info->in_use);
break;
case F_RDLCK:
if (info->lock_type == F_WRLCK)
@@ -182,6 +184,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
share->r_locks++;
share->tot_locks++;
info->lock_type=lock_type;
+ info->s->in_use= list_add(info->s->in_use, &info->in_use);
break;
case F_WRLCK:
if (info->lock_type == F_RDLCK)
@@ -231,6 +234,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
info->invalidator=info->s->invalidator;
share->w_locks++;
share->tot_locks++;
+ info->s->in_use= list_add(info->s->in_use, &info->in_use);
break;
default:
break; /* Impossible */