Commit 584c66dc authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

add a timestamp to the checkpoint begin and end log entries close[t:1855]

git-svn-id: file:///svn/toku/tokudb@13992 c7de825b-a66e-492c-adef-691d508d4ae1
parent 8e18af9f
...@@ -1533,12 +1533,16 @@ log_open_txn (OMTVALUE txnv, u_int32_t UU(index), void *loggerv) { ...@@ -1533,12 +1533,16 @@ log_open_txn (OMTVALUE txnv, u_int32_t UU(index), void *loggerv) {
return 0; return 0;
} }
static u_int64_t get_timestamp(void) {
struct timeval tv;
int r = gettimeofday(&tv, NULL);
assert(r == 0);
return (tv.tv_sec * 1000000ULL) + tv.tv_usec;
}
// TODO: #1510 locking of cachetable is suspect // TODO: #1510 locking of cachetable is suspect
// verify correct algorithm overall // verify correct algorithm overall
int int
toku_cachetable_begin_checkpoint (CACHETABLE ct, TOKULOGGER logger) { toku_cachetable_begin_checkpoint (CACHETABLE ct, TOKULOGGER logger) {
// Requires: All three checkpoint-relevant locks must be held (see checkpoint.c). // Requires: All three checkpoint-relevant locks must be held (see checkpoint.c).
...@@ -1571,7 +1575,7 @@ toku_cachetable_begin_checkpoint (CACHETABLE ct, TOKULOGGER logger) { ...@@ -1571,7 +1575,7 @@ toku_cachetable_begin_checkpoint (CACHETABLE ct, TOKULOGGER logger) {
// The checkpoint must be performed after the lock is acquired. // The checkpoint must be performed after the lock is acquired.
{ {
LSN begin_lsn; // we'll need to store the lsn of the checkpoint begin in all the trees that are checkpointed. LSN begin_lsn; // we'll need to store the lsn of the checkpoint begin in all the trees that are checkpointed.
int r = toku_log_begin_checkpoint(logger, &begin_lsn, 0); int r = toku_log_begin_checkpoint(logger, &begin_lsn, 0, get_timestamp());
ct->lsn_of_checkpoint_in_progress = begin_lsn; ct->lsn_of_checkpoint_in_progress = begin_lsn;
assert(r==0); assert(r==0);
} }
...@@ -1706,7 +1710,7 @@ toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, char **error_st ...@@ -1706,7 +1710,7 @@ toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, char **error_st
if (logger) { if (logger) {
int r = toku_log_end_checkpoint(logger, NULL, int r = toku_log_end_checkpoint(logger, NULL,
1, // want the end_checkpoint to be fsync'd 1, // want the end_checkpoint to be fsync'd
ct->lsn_of_checkpoint_in_progress.lsn); ct->lsn_of_checkpoint_in_progress.lsn, get_timestamp());
assert(r==0); assert(r==0);
toku_logger_note_checkpoint(logger, ct->lsn_of_checkpoint_in_progress); toku_logger_note_checkpoint(logger, ct->lsn_of_checkpoint_in_progress);
} }
......
...@@ -91,8 +91,8 @@ const struct logtype rollbacks[] = { ...@@ -91,8 +91,8 @@ const struct logtype rollbacks[] = {
const struct logtype logtypes[] = { const struct logtype logtypes[] = {
// Records produced by checkpoints // Records produced by checkpoints
{"begin_checkpoint", 'x', FA{NULLFIELD}}, {"begin_checkpoint", 'x', FA{{"u_int64_t", "timestamp", 0}, NULLFIELD}},
{"end_checkpoint", 'X', FA{{"TXNID", "txnid", 0}, NULLFIELD}}, // TXNID is LSN of begin_checkpoint {"end_checkpoint", 'X', FA{{"TXNID", "txnid", 0}, {"u_int64_t", "timestamp", 0}, NULLFIELD}}, // TXNID is LSN of begin_checkpoint
{"fassociate", 'f', FA{{"FILENUM", "filenum", 0}, {"fassociate", 'f', FA{{"FILENUM", "filenum", 0},
{"BYTESTRING", "fname", 0}, // pathname of file {"BYTESTRING", "fname", 0}, // pathname of file
NULLFIELD}}, NULLFIELD}},
......
...@@ -295,7 +295,7 @@ static int toku_recover_backward_fclose (struct logtype_fclose *UU(l), struct ba ...@@ -295,7 +295,7 @@ static int toku_recover_backward_fclose (struct logtype_fclose *UU(l), struct ba
return 0; return 0;
} }
static int toku_recover_begin_checkpoint (LSN UU(lsn)) { static int toku_recover_begin_checkpoint (LSN UU(lsn), u_int64_t UU(timestamp)) {
return 0; return 0;
} }
...@@ -318,7 +318,7 @@ static int toku_recover_backward_begin_checkpoint (struct logtype_begin_checkpoi ...@@ -318,7 +318,7 @@ static int toku_recover_backward_begin_checkpoint (struct logtype_begin_checkpoi
abort(); abort();
} }
static int toku_recover_end_checkpoint (LSN UU(lsn), TXNID UU(txnid)) { static int toku_recover_end_checkpoint (LSN UU(lsn), TXNID UU(txnid), u_int64_t UU(timestamp)) {
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment