Commit 256b8963 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

replace the timestamp and shutdown log entry with a comment log entry closes[t:2192]

git-svn-id: file:///svn/toku/tokudb@15946 c7de825b-a66e-492c-adef-691d508d4ae1
parent a4c76fe9
...@@ -150,8 +150,7 @@ const struct logtype logtypes[] = { ...@@ -150,8 +150,7 @@ const struct logtype logtypes[] = {
{"TXNID", "xid", 0}, {"TXNID", "xid", 0},
{"BYTESTRING", "key", 0}, {"BYTESTRING", "key", 0},
NULLFIELD}}, NULLFIELD}},
{"shutdown", 'S', FA{{"u_int64_t", "timestamp", 0}, NULLFIELD}}, {"comment", 'T', FA{{"u_int64_t", "timestamp", 0},
{"timestamp", 'T', FA{{"u_int64_t", "timestamp", 0},
{"BYTESTRING", "comment", 0}, {"BYTESTRING", "comment", 0},
NULLFIELD}}, NULLFIELD}},
{0,0,FA{NULLFIELD}} {0,0,FA{NULLFIELD}}
......
...@@ -138,8 +138,10 @@ int toku_logger_close(TOKULOGGER *loggerp) { ...@@ -138,8 +138,10 @@ int toku_logger_close(TOKULOGGER *loggerp) {
int toku_logger_shutdown(TOKULOGGER logger) { int toku_logger_shutdown(TOKULOGGER logger) {
int r = 0; int r = 0;
if (logger->is_open) { if (logger->is_open) {
if (toku_omt_size(logger->live_txns) == 0) if (toku_omt_size(logger->live_txns) == 0) {
r = toku_log_shutdown(logger, NULL, TRUE, 0); BYTESTRING comment = { strlen("shutdown"), "shutdown" };
r = toku_log_comment(logger, NULL, TRUE, 0, comment);
}
} }
return r; return r;
} }
......
...@@ -705,22 +705,12 @@ static int toku_recover_backward_xbegin (struct logtype_xbegin *l, RECOVER_ENV r ...@@ -705,22 +705,12 @@ static int toku_recover_backward_xbegin (struct logtype_xbegin *l, RECOVER_ENV r
abort(); abort();
} }
static int toku_recover_timestamp (struct logtype_timestamp *UU(l), RECOVER_ENV UU(renv)) { static int toku_recover_comment (struct logtype_comment *UU(l), RECOVER_ENV UU(renv)) {
// nothing // nothing
return 0; return 0;
} }
static int toku_recover_backward_timestamp (struct logtype_timestamp *UU(l), RECOVER_ENV UU(renv)) { static int toku_recover_backward_comment (struct logtype_comment *UU(l), RECOVER_ENV UU(renv)) {
// nothing
return 0;
}
static int toku_recover_shutdown (struct logtype_shutdown *UU(l), RECOVER_ENV UU(renv)) {
// nothing
return 0;
}
static int toku_recover_backward_shutdown (struct logtype_shutdown *UU(l), RECOVER_ENV UU(renv)) {
// nothing // nothing
return 0; return 0;
} }
...@@ -775,7 +765,7 @@ int tokudb_needs_recovery(const char *log_dir, BOOL ignore_log_empty) { ...@@ -775,7 +765,7 @@ int tokudb_needs_recovery(const char *log_dir, BOOL ignore_log_empty) {
if (r != 0) { if (r != 0) {
needs_recovery = TRUE; goto exit; needs_recovery = TRUE; goto exit;
} }
if (le->cmd == LT_shutdown || le->cmd == LT_timestamp) { if (le->cmd == LT_comment) {
r = toku_logcursor_prev(logcursor, &le); r = toku_logcursor_prev(logcursor, &le);
if (r != 0) { if (r != 0) {
needs_recovery = TRUE; goto exit; needs_recovery = TRUE; goto exit;
...@@ -986,7 +976,7 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di ...@@ -986,7 +976,7 @@ static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_di
// write a recovery log entry // write a recovery log entry
BYTESTRING recover_comment = { strlen("recover"), "recover" }; BYTESTRING recover_comment = { strlen("recover"), "recover" };
r = toku_log_timestamp(renv->logger, NULL, TRUE, 0, recover_comment); r = toku_log_comment(renv->logger, NULL, TRUE, 0, recover_comment);
assert(r == 0); assert(r == 0);
// checkpoint // checkpoint
......
...@@ -45,7 +45,7 @@ test_main (int argc, const char *argv[]) { ...@@ -45,7 +45,7 @@ test_main (int argc, const char *argv[]) {
char str[32]; char str[32];
sprintf(str, "hello%d", helloseq++); sprintf(str, "hello%d", helloseq++);
BYTESTRING bs0 = { .data = str, .len = strlen(str) }; BYTESTRING bs0 = { .data = str, .len = strlen(str) };
r = toku_log_timestamp(logger, &lsn, 0, 0, bs0); r = toku_log_comment(logger, &lsn, 0, 0, bs0);
assert(r == 0); assert(r == 0);
r = toku_logger_close(&logger); r = toku_logger_close(&logger);
...@@ -75,10 +75,10 @@ test_main (int argc, const char *argv[]) { ...@@ -75,10 +75,10 @@ test_main (int argc, const char *argv[]) {
for (int i=0; i<N; i++) { for (int i=0; i<N; i++) {
r = toku_logcursor_next(lc, &le); r = toku_logcursor_next(lc, &le);
assert(r == 0 && le->cmd == LT_timestamp); assert(r == 0 && le->cmd == LT_comment);
char expect[32]; char expect[32];
sprintf(expect, "hello%d", helloseq++); sprintf(expect, "hello%d", helloseq++);
assert(le->u.timestamp.comment.len == strlen(expect) && memcmp(le->u.timestamp.comment.data, expect, le->u.timestamp.comment.len) == 0); assert(le->u.comment.comment.len == strlen(expect) && memcmp(le->u.comment.comment.data, expect, le->u.comment.comment.len) == 0);
} }
r = toku_logcursor_next(lc, &le); r = toku_logcursor_next(lc, &le);
...@@ -95,10 +95,10 @@ test_main (int argc, const char *argv[]) { ...@@ -95,10 +95,10 @@ test_main (int argc, const char *argv[]) {
for (int i=0; i<N; i++) { for (int i=0; i<N; i++) {
r = toku_logcursor_prev(lc, &le); r = toku_logcursor_prev(lc, &le);
assert(r == 0 && le->cmd == LT_timestamp); assert(r == 0 && le->cmd == LT_comment);
char expect[32]; char expect[32];
sprintf(expect, "hello%d", --helloseq); sprintf(expect, "hello%d", --helloseq);
assert(le->u.timestamp.comment.len == strlen(expect) && memcmp(le->u.timestamp.comment.data, expect, le->u.timestamp.comment.len) == 0); assert(le->u.comment.comment.len == strlen(expect) && memcmp(le->u.comment.comment.data, expect, le->u.comment.comment.len) == 0);
} }
r = toku_logcursor_prev(lc, &le); r = toku_logcursor_prev(lc, &le);
......
...@@ -33,7 +33,7 @@ test_main (int argc, const char *argv[]) { ...@@ -33,7 +33,7 @@ test_main (int argc, const char *argv[]) {
char str[32]; char str[32];
sprintf(str, "hello%d", helloseq++); sprintf(str, "hello%d", helloseq++);
BYTESTRING bs0 = { .data = str, .len = strlen(str) }; BYTESTRING bs0 = { .data = str, .len = strlen(str) };
r = toku_log_timestamp(logger, &lsn, 0, 0, bs0); r = toku_log_comment(logger, &lsn, 0, 0, bs0);
assert(r == 0); assert(r == 0);
r = toku_logger_close(&logger); r = toku_logger_close(&logger);
...@@ -63,7 +63,7 @@ test_main (int argc, const char *argv[]) { ...@@ -63,7 +63,7 @@ test_main (int argc, const char *argv[]) {
char str[32]; char str[32];
sprintf(str, "hello%d", helloseq++); sprintf(str, "hello%d", helloseq++);
BYTESTRING bs0 = { .data = str, .len = strlen(str) }; BYTESTRING bs0 = { .data = str, .len = strlen(str) };
r = toku_log_timestamp(logger, &lsn, 0, 0, bs0); r = toku_log_comment(logger, &lsn, 0, 0, bs0);
assert(r == 0); assert(r == 0);
r = toku_logger_close(&logger); r = toku_logger_close(&logger);
...@@ -81,10 +81,10 @@ test_main (int argc, const char *argv[]) { ...@@ -81,10 +81,10 @@ test_main (int argc, const char *argv[]) {
for (int i=0; i<2*N; i++) { for (int i=0; i<2*N; i++) {
r = toku_logcursor_next(lc, &le); r = toku_logcursor_next(lc, &le);
assert(r == 0 && le->cmd == LT_timestamp); assert(r == 0 && le->cmd == LT_comment);
char expect[32]; char expect[32];
sprintf(expect, "hello%d", helloseq++); sprintf(expect, "hello%d", helloseq++);
assert(le->u.timestamp.comment.len == strlen(expect) && memcmp(le->u.timestamp.comment.data, expect, le->u.timestamp.comment.len) == 0); assert(le->u.comment.comment.len == strlen(expect) && memcmp(le->u.comment.comment.data, expect, le->u.comment.comment.len) == 0);
} }
r = toku_logcursor_next(lc, &le); r = toku_logcursor_next(lc, &le);
...@@ -101,10 +101,10 @@ test_main (int argc, const char *argv[]) { ...@@ -101,10 +101,10 @@ test_main (int argc, const char *argv[]) {
for (int i=0; i<2*N; i++) { for (int i=0; i<2*N; i++) {
r = toku_logcursor_prev(lc, &le); r = toku_logcursor_prev(lc, &le);
assert(r == 0 && le->cmd == LT_timestamp); assert(r == 0 && le->cmd == LT_comment);
char expect[32]; char expect[32];
sprintf(expect, "hello%d", --helloseq); sprintf(expect, "hello%d", --helloseq);
assert(le->u.timestamp.comment.len == strlen(expect) && memcmp(le->u.timestamp.comment.data, expect, le->u.timestamp.comment.len) == 0); assert(le->u.comment.comment.len == strlen(expect) && memcmp(le->u.comment.comment.data, expect, le->u.comment.comment.len) == 0);
} }
r = toku_logcursor_prev(lc, &le); r = toku_logcursor_prev(lc, &le);
......
...@@ -37,13 +37,13 @@ test_main (int argc, const char *argv[]) { ...@@ -37,13 +37,13 @@ test_main (int argc, const char *argv[]) {
assert(r == 0); assert(r == 0);
BYTESTRING bs0 = { .data = "hello", .len = 5 }; BYTESTRING bs0 = { .data = "hello", .len = 5 };
r = toku_log_timestamp(logger, &lsn, 0, now(), bs0); r = toku_log_comment(logger, &lsn, 0, now(), bs0);
assert(r == 0); assert(r == 0);
sleep(10); sleep(10);
BYTESTRING bs1 = { .data = "world", .len = 5 }; BYTESTRING bs1 = { .data = "world", .len = 5 };
r = toku_log_timestamp(logger, &lsn, 0, now(), bs1); r = toku_log_comment(logger, &lsn, 0, now(), bs1);
assert(r == 0); assert(r == 0);
r = toku_logger_close(&logger); r = toku_logger_close(&logger);
...@@ -57,16 +57,16 @@ test_main (int argc, const char *argv[]) { ...@@ -57,16 +57,16 @@ test_main (int argc, const char *argv[]) {
assert(r == 0 && lc != NULL); assert(r == 0 && lc != NULL);
r = toku_logcursor_next(lc, &le); r = toku_logcursor_next(lc, &le);
assert(r == 0 && le->cmd == LT_timestamp); assert(r == 0 && le->cmd == LT_comment);
assert(le->u.timestamp.comment.len == 5 && memcmp(le->u.timestamp.comment.data, "hello", 5) == 0); assert(le->u.comment.comment.len == 5 && memcmp(le->u.comment.comment.data, "hello", 5) == 0);
u_int64_t t = le->u.timestamp.timestamp; u_int64_t t = le->u.comment.timestamp;
r = toku_logcursor_next(lc, &le); r = toku_logcursor_next(lc, &le);
assert(r == 0 && le->cmd == LT_timestamp); assert(r == 0 && le->cmd == LT_comment);
assert(le->u.timestamp.comment.len == 5 && memcmp(le->u.timestamp.comment.data, "world", 5) == 0); assert(le->u.comment.comment.len == 5 && memcmp(le->u.comment.comment.data, "world", 5) == 0);
if (verbose) if (verbose)
printf("%"PRIu64"\n", le->u.timestamp.timestamp - t); printf("%"PRIu64"\n", le->u.comment.timestamp - t);
assert(le->u.timestamp.timestamp - t >= 10*1000000); assert(le->u.comment.timestamp - t >= 10*1000000);
r = toku_logcursor_next(lc, &le); r = toku_logcursor_next(lc, &le);
assert(r != 0); assert(r != 0);
...@@ -79,16 +79,16 @@ test_main (int argc, const char *argv[]) { ...@@ -79,16 +79,16 @@ test_main (int argc, const char *argv[]) {
assert(r == 0 && lc != NULL); assert(r == 0 && lc != NULL);
r = toku_logcursor_prev(lc, &le); r = toku_logcursor_prev(lc, &le);
assert(r == 0 && le->cmd == LT_timestamp); assert(r == 0 && le->cmd == LT_comment);
assert(le->u.timestamp.comment.len == 5 && memcmp(le->u.timestamp.comment.data, "world", 5) == 0); assert(le->u.comment.comment.len == 5 && memcmp(le->u.comment.comment.data, "world", 5) == 0);
t = le->u.timestamp.timestamp; t = le->u.comment.timestamp;
r = toku_logcursor_prev(lc, &le); r = toku_logcursor_prev(lc, &le);
assert(r == 0 && le->cmd == LT_timestamp); assert(r == 0 && le->cmd == LT_comment);
assert(le->u.timestamp.comment.len == 5 && memcmp(le->u.timestamp.comment.data, "hello", 5) == 0); assert(le->u.comment.comment.len == 5 && memcmp(le->u.comment.comment.data, "hello", 5) == 0);
if (verbose) if (verbose)
printf("%"PRIu64"\n", t - le->u.timestamp.timestamp); printf("%"PRIu64"\n", t - le->u.comment.timestamp);
assert(t - le->u.timestamp.timestamp >= 10*1000000); assert(t - le->u.comment.timestamp >= 10*1000000);
r = toku_logcursor_prev(lc, &le); r = toku_logcursor_prev(lc, &le);
assert(r != 0); assert(r != 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