Commit 3e6373c5 authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

refs #5500 logger close rollback does not fail


git-svn-id: file:///svn/toku/tokudb@48238 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1b8c8ac4
...@@ -200,9 +200,7 @@ toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, bool create) ...@@ -200,9 +200,7 @@ toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, bool create)
// so it will always be clean (!h->dirty) when about to be closed. // so it will always be clean (!h->dirty) when about to be closed.
// Rollback log can only be closed when there are no open transactions, // Rollback log can only be closed when there are no open transactions,
// so it will always be empty (no data blocks) when about to be closed. // so it will always be empty (no data blocks) when about to be closed.
// TODO: can't fail void toku_logger_close_rollback(TOKULOGGER logger) {
int
toku_logger_close_rollback(TOKULOGGER logger) {
CACHEFILE cf = logger->rollback_cachefile; // stored in logger at rollback cachefile open CACHEFILE cf = logger->rollback_cachefile; // stored in logger at rollback cachefile open
if (cf) { if (cf) {
FT_HANDLE ft_to_close; FT_HANDLE ft_to_close;
...@@ -226,7 +224,6 @@ toku_logger_close_rollback(TOKULOGGER logger) { ...@@ -226,7 +224,6 @@ toku_logger_close_rollback(TOKULOGGER logger) {
//Set as dealt with already. //Set as dealt with already.
logger->rollback_cachefile = NULL; logger->rollback_cachefile = NULL;
} }
return 0;
} }
// No locks held on entry // No locks held on entry
......
...@@ -26,7 +26,7 @@ int toku_logger_open_with_last_xid(const char *directory, TOKULOGGER logger, TXN ...@@ -26,7 +26,7 @@ int toku_logger_open_with_last_xid(const char *directory, TOKULOGGER logger, TXN
void toku_logger_shutdown(TOKULOGGER logger); void toku_logger_shutdown(TOKULOGGER logger);
int toku_logger_close(TOKULOGGER *loggerp); int toku_logger_close(TOKULOGGER *loggerp);
int toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, bool create); int toku_logger_open_rollback(TOKULOGGER logger, CACHETABLE cachetable, bool create);
int toku_logger_close_rollback(TOKULOGGER logger); void toku_logger_close_rollback(TOKULOGGER logger);
bool toku_logger_rollback_is_open (TOKULOGGER); // return true iff the rollback is open. bool toku_logger_rollback_is_open (TOKULOGGER); // return true iff the rollback is open.
void toku_logger_fsync (TOKULOGGER logger); void toku_logger_fsync (TOKULOGGER logger);
......
...@@ -232,8 +232,7 @@ static void recover_env_cleanup (RECOVER_ENV renv) { ...@@ -232,8 +232,7 @@ static void recover_env_cleanup (RECOVER_ENV renv) {
file_map_destroy(&renv->fmap); file_map_destroy(&renv->fmap);
if (renv->destroy_logger_at_end) { if (renv->destroy_logger_at_end) {
r = toku_logger_close_rollback(renv->logger); toku_logger_close_rollback(renv->logger);
assert(r==0);
r = toku_logger_close(&renv->logger); r = toku_logger_close(&renv->logger);
assert(r == 0); assert(r == 0);
} else { } else {
......
...@@ -109,7 +109,7 @@ static void test_it (int N) { ...@@ -109,7 +109,7 @@ static void test_it (int N) {
r = toku_close_ft_handle_nolsn(brt, NULL); CKERR(r); r = toku_close_ft_handle_nolsn(brt, NULL); CKERR(r);
r = toku_checkpoint(cp, logger, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); CKERR(r); r = toku_checkpoint(cp, logger, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); CKERR(r);
toku_logger_close_rollback(logger); CKERR(r); toku_logger_close_rollback(logger);
r = toku_checkpoint(cp, logger, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); CKERR(r); r = toku_checkpoint(cp, logger, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); CKERR(r);
toku_cachetable_close(&ct); toku_cachetable_close(&ct);
r = toku_logger_close(&logger); assert(r==0); r = toku_logger_close(&logger); assert(r==0);
......
...@@ -89,7 +89,6 @@ create_populate_tree(const char *logdir, const char *fname, int n) { ...@@ -89,7 +89,6 @@ create_populate_tree(const char *logdir, const char *fname, int n) {
assert(error == 0); assert(error == 0);
toku_logger_close_rollback(logger); toku_logger_close_rollback(logger);
assert(error == 0);
error = toku_checkpoint(cp, logger, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT); error = toku_checkpoint(cp, logger, NULL, NULL, NULL, NULL, CLIENT_CHECKPOINT);
assert(error == 0); assert(error == 0);
...@@ -193,7 +192,6 @@ test_provdel(const char *logdir, const char *fname, int n) { ...@@ -193,7 +192,6 @@ test_provdel(const char *logdir, const char *fname, int n) {
assert(error == 0); assert(error == 0);
toku_logger_close_rollback(logger); toku_logger_close_rollback(logger);
assert(error == 0);
error = toku_logger_close(&logger); error = toku_logger_close(&logger);
assert(error == 0); assert(error == 0);
......
...@@ -80,8 +80,7 @@ static inline void clean_shutdown(TOKULOGGER *loggerp, CACHETABLE *ctp) { ...@@ -80,8 +80,7 @@ static inline void clean_shutdown(TOKULOGGER *loggerp, CACHETABLE *ctp) {
r = toku_checkpoint(cp, *loggerp, NULL, NULL, NULL, NULL, SHUTDOWN_CHECKPOINT); r = toku_checkpoint(cp, *loggerp, NULL, NULL, NULL, NULL, SHUTDOWN_CHECKPOINT);
CKERR(r); CKERR(r);
r = toku_logger_close_rollback(*loggerp); toku_logger_close_rollback(*loggerp);
CKERR(r);
r = toku_checkpoint(cp, *loggerp, NULL, NULL, NULL, NULL, SHUTDOWN_CHECKPOINT); r = toku_checkpoint(cp, *loggerp, NULL, NULL, NULL, NULL, SHUTDOWN_CHECKPOINT);
CKERR(r); CKERR(r);
...@@ -95,11 +94,9 @@ static inline void clean_shutdown(TOKULOGGER *loggerp, CACHETABLE *ctp) { ...@@ -95,11 +94,9 @@ static inline void clean_shutdown(TOKULOGGER *loggerp, CACHETABLE *ctp) {
} }
static inline void shutdown_after_recovery(TOKULOGGER *loggerp, CACHETABLE *ctp) { static inline void shutdown_after_recovery(TOKULOGGER *loggerp, CACHETABLE *ctp) {
int r; toku_logger_close_rollback(*loggerp);
r = toku_logger_close_rollback(*loggerp);
CKERR(r);
toku_cachetable_close(ctp); toku_cachetable_close(ctp);
r = toku_logger_close(loggerp); int r = toku_logger_close(loggerp);
CKERR(r); CKERR(r);
} }
......
...@@ -1041,12 +1041,7 @@ env_close(DB_ENV * env, uint32_t flags) { ...@@ -1041,12 +1041,7 @@ env_close(DB_ENV * env, uint32_t flags) {
toku_ydb_do_error(env, r, "%s", err_msg); toku_ydb_do_error(env, r, "%s", err_msg);
goto panic_and_quit_early; goto panic_and_quit_early;
} }
r = toku_logger_close_rollback(env->i->logger); toku_logger_close_rollback(env->i->logger);
if (r) {
err_msg = "Cannot close environment (error during closing rollback cachefile)\n";
toku_ydb_do_error(env, r, "%s", err_msg);
goto panic_and_quit_early;
}
//Do a second checkpoint now that the rollback cachefile is closed. //Do a second checkpoint now that the rollback cachefile is closed.
r = toku_checkpoint(cp, env->i->logger, NULL, NULL, NULL, NULL, SHUTDOWN_CHECKPOINT); r = toku_checkpoint(cp, env->i->logger, NULL, NULL, NULL, NULL, SHUTDOWN_CHECKPOINT);
if (r) { if (r) {
......
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