mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
Closes #2003 closes [t:2003] add 'table lock on empty' log entry, and recovery logic for it.
git-svn-id: file:///svn/toku/tokudb@14489 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
c44cab7a53
commit
2fefaf6428
3 changed files with 34 additions and 3 deletions
13
newbrt/brt.c
13
newbrt/brt.c
|
@ -4905,15 +4905,22 @@ brt_is_empty (BRT brt) {
|
||||||
int
|
int
|
||||||
toku_brt_note_table_lock (BRT brt, TOKUTXN txn)
|
toku_brt_note_table_lock (BRT brt, TOKUTXN txn)
|
||||||
{
|
{
|
||||||
|
int r = 0;
|
||||||
if (brt->h->txnid_that_created_or_locked_when_empty != toku_txn_get_txnid(txn) &&
|
if (brt->h->txnid_that_created_or_locked_when_empty != toku_txn_get_txnid(txn) &&
|
||||||
brt_is_empty(brt) &&
|
brt_is_empty(brt) &&
|
||||||
brt->h->txnid_that_created_or_locked_when_empty == 0) {
|
brt->h->txnid_that_created_or_locked_when_empty == 0) {
|
||||||
brt->h->txnid_that_created_or_locked_when_empty = toku_txn_get_txnid(txn);
|
brt->h->txnid_that_created_or_locked_when_empty = toku_txn_get_txnid(txn);
|
||||||
int r = toku_txn_note_brt(txn, brt);
|
r = toku_txn_note_brt(txn, brt);
|
||||||
assert(r==0);
|
assert(r==0);
|
||||||
return toku_logger_save_rollback_tablelock_on_empty_table(txn, toku_cachefile_filenum(brt->cf));
|
r = toku_logger_save_rollback_tablelock_on_empty_table(txn, toku_cachefile_filenum(brt->cf));
|
||||||
|
if (r==0) {
|
||||||
|
TOKULOGGER logger = toku_txn_logger(txn);
|
||||||
|
TXNID xid = toku_txn_get_txnid(txn);
|
||||||
|
r = toku_log_tablelock_on_empty_table(logger, (LSN*)NULL,
|
||||||
|
0, toku_cachefile_filenum(brt->cf), xid);
|
||||||
}
|
}
|
||||||
return 0;
|
}
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
LSN toku_brt_checkpoint_lsn(BRT brt) {
|
LSN toku_brt_checkpoint_lsn(BRT brt) {
|
||||||
|
|
|
@ -116,6 +116,9 @@ const struct logtype logtypes[] = {
|
||||||
{"fclose", 'e', FA{{"BYTESTRING", "fname", 0},
|
{"fclose", 'e', FA{{"BYTESTRING", "fname", 0},
|
||||||
{"FILENUM", "filenum", 0},
|
{"FILENUM", "filenum", 0},
|
||||||
NULLFIELD}},
|
NULLFIELD}},
|
||||||
|
{"tablelock_on_empty_table", 'L', FA{{"FILENUM", "filenum", 0},
|
||||||
|
{"TXNID", "xid", 0},
|
||||||
|
NULLFIELD}},
|
||||||
{"enq_insert", 'I', FA{{"FILENUM", "filenum", 0},
|
{"enq_insert", 'I', FA{{"FILENUM", "filenum", 0},
|
||||||
{"TXNID", "xid", 0},
|
{"TXNID", "xid", 0},
|
||||||
{"BYTESTRING", "key", 0},
|
{"BYTESTRING", "key", 0},
|
||||||
|
|
|
@ -193,6 +193,11 @@ static int toku_recover_backward_xabort (struct logtype_xabort *UU(l), RECOVER_E
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int toku_recover_backward_tablelock_on_empty_table(struct logtype_tablelock_on_empty_table *UU(l), RECOVER_ENV UU(renv)) {
|
||||||
|
// nothing
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void create_dir_from_file (const char *fname) {
|
static void create_dir_from_file (const char *fname) {
|
||||||
char *tmp=toku_strdup(fname);
|
char *tmp=toku_strdup(fname);
|
||||||
char ch;
|
char ch;
|
||||||
|
@ -313,6 +318,22 @@ static void toku_recover_enq_insert (LSN lsn, FILENUM filenum, TXNID xid, BYTEST
|
||||||
assert(r == 0);
|
assert(r == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int toku_recover_tablelock_on_empty_table(LSN UU(lsn), FILENUM filenum, TXNID xid, RECOVER_ENV renv) {
|
||||||
|
struct cf_pair *pair = NULL;
|
||||||
|
int r = find_cachefile(&renv->fmap, filenum, &pair);
|
||||||
|
if (r!=0) {
|
||||||
|
// if we didn't find a cachefile, then we don't have to do anything.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
TOKUTXN txn;
|
||||||
|
r = toku_txnid2txn(renv->logger, xid, &txn);
|
||||||
|
assert(r == 0);
|
||||||
|
r = toku_brt_note_table_lock(pair->brt, txn);
|
||||||
|
assert(r == 0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int toku_recover_backward_enq_insert (struct logtype_enq_insert *UU(l), RECOVER_ENV UU(renv)) {
|
static int toku_recover_backward_enq_insert (struct logtype_enq_insert *UU(l), RECOVER_ENV UU(renv)) {
|
||||||
// nothing
|
// nothing
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue