summaryrefslogtreecommitdiff
path: root/storage/maria/trnman.h
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mysql.com>2008-08-06 21:30:05 +0200
committerSergei Golubchik <serg@mysql.com>2008-08-06 21:30:05 +0200
commit3971e262e99366fa4bc9b454e69cf48daac9be85 (patch)
treeb56353bb1faa6894eddf63228e16dcb2b0621f39 /storage/maria/trnman.h
parent7ca3fc4ff0ab53835da9f57af7f630f4c65868b7 (diff)
downloadmariadb-git-3971e262e99366fa4bc9b454e69cf48daac9be85.tar.gz
maria: deadlock detection when waiting on unique key (useless until we can rollback)
include/my_pthread.h: cleanup include/waiting_threads.h: header guard mysys/waiting_threads.c: bug - kill strategy were not applied to deadlocks of length 1. cast timeout to ulonglong. storage/maria/ma_static.c: declare WT_RESOURCE_TYPE ma_rc_dup_unique storage/maria/ma_write.c: deadlock detection when waiting on unique key (useless until we can rollback) storage/maria/maria_def.h: deadlock detection when waiting on unique key (useless until we can rollback) storage/maria/trnman.c: use deadlock detector. protect state transitions of a TRN with a mutex. trnman_trid_to_trn() function. storage/maria/trnman.h: trnman_trid_to_trn() function protect state transitions of a TRN with a mutex use deadlock detector. storage/maria/trnman_public.h: trnman_trid_to_trn()
Diffstat (limited to 'storage/maria/trnman.h')
-rw-r--r--storage/maria/trnman.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/storage/maria/trnman.h b/storage/maria/trnman.h
index c9b26292110..f9f1d91d50e 100644
--- a/storage/maria/trnman.h
+++ b/storage/maria/trnman.h
@@ -21,19 +21,32 @@ C_MODE_START
#include <lf.h>
#include "trnman_public.h"
#include "ma_loghandler_lsn.h"
+#include <waiting_threads.h>
/*
trid - 6 uchar transaction identifier. Assigned when a transaction
is created. Transaction can always be identified by its trid,
even after transaction has ended.
- short_trid - 2-byte transaction identifier, identifies a running
+ short_id - 2-byte transaction identifier, identifies a running
transaction, is reassigned when transaction ends.
+
+ when short_id is 0, TRN is not initialized, for all practical purposes
+ it could be considered unused.
+
+ when commit_trid is ~(TrID)0 the transaction is running, otherwise it's
+ committed.
+
+ state_lock mutex protects the state of a TRN, that is whether a TRN
+ is committed/running/unused. Meaning that modifications of short_id and
+ commit_trid happen under this mutex.
*/
struct st_transaction
{
LF_PINS *pins;
+ WT_THD wt;
+ pthread_mutex_t state_lock;
void *used_tables; /* Tables used by transaction */
TRN *next, *prev;
TrID trid, min_read_from, commit_trid;
@@ -41,7 +54,6 @@ struct st_transaction
LSN_WITH_FLAGS first_undo_lsn;
uint locked_tables;
uint16 short_id;
- /* Note! if short_id is 0, trn is NOT initialized */
};
#define TRANSACTION_LOGGED_LONG_ID ULL(0x8000000000000000)