Commit 80a655ba authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4875], move some small functions over

git-svn-id: file:///svn/toku/tokudb@43463 c7de825b-a66e-492c-adef-691d508d4ae1
parent d1ee6434
......@@ -5639,27 +5639,8 @@ toku_brt_suppress_recovery_logs (BRT brt, TOKUTXN txn) {
txn->checkpoint_needed_before_commit = TRUE;
}
BOOL
toku_brt_is_recovery_logging_suppressed (BRT brt) {
return brt->h->txnid_that_suppressed_recovery_logs != TXNID_NONE;
}
LSN toku_brt_checkpoint_lsn(struct brt_header* h) {
return h->checkpoint_lsn;
}
int toku_brt_header_set_panic(struct brt_header *h, int panic, char *panic_string) {
if (h->panic == 0) {
h->panic = panic;
if (h->panic_string)
toku_free(h->panic_string);
h->panic_string = toku_strdup(panic_string);
}
return 0;
}
int toku_brt_set_panic(BRT brt, int panic, char *panic_string) {
return toku_brt_header_set_panic(brt->h, panic, panic_string);
return toku_brtheader_set_panic(brt->h, panic, panic_string);
}
#if 0
......
......@@ -169,8 +169,6 @@ int toku_dump_brt (FILE *,BRT brt) __attribute__ ((warn_unused_result));
void brt_fsync (BRT); /* fsync, but don't clear the caches. */
void brt_flush (BRT); /* fsync and clear the caches. */
LSN toku_brt_checkpoint_lsn(struct brt_header* h) __attribute__ ((warn_unused_result));
// create and initialize a cache table
// cachesize is the upper limit on the size of the size of the values in the table
// pass 0 if you want the default
......@@ -272,7 +270,6 @@ void toku_brt_suppress_recovery_logs (BRT brt, TOKUTXN txn);
// implies: toku_txn_note_brt(brt, txn) has been called
int toku_brt_get_fragmentation(BRT brt, TOKU_DB_FRAGMENTATION report) __attribute__ ((warn_unused_result));
int toku_brt_header_set_panic(struct brt_header *h, int panic, char *panic_string) __attribute__ ((warn_unused_result));
BOOL toku_brt_is_empty_fast (BRT brt);
// Effect: Return TRUE if there are no messages or leaf entries in the tree. If so, it's empty. If there are messages or leaf entries, we say it's not empty
......@@ -282,8 +279,6 @@ BOOL toku_brt_is_empty_fast (BRT brt) __attribute__ ((warn_unused_result));
// Effect: Return TRUE if there are no messages or leaf entries in the tree. If so, it's empty. If there are messages or leaf entries, we say it's not empty
// even though if we were to optimize the tree it might turn out that they are empty.
BOOL toku_brt_is_recovery_logging_suppressed (BRT) __attribute__ ((warn_unused_result));
int toku_brt_strerror_r(int error, char *buf, size_t buflen);
// Effect: LIke the XSI-compliant strerorr_r, extended to db_strerror().
// If error>=0 then the result is to do strerror_r(error, buf, buflen), that is fill buf with a descriptive error message.
......
......@@ -891,3 +891,19 @@ void toku_brtheader_set_new_root_blocknum(
h->root_blocknum = new_root_key;
}
LSN toku_brt_checkpoint_lsn(struct brt_header* h) {
return h->checkpoint_lsn;
}
int toku_brtheader_set_panic(struct brt_header *h, int panic, char *panic_string) {
if (h->panic == 0) {
h->panic = panic;
if (h->panic_string) {
toku_free(h->panic_string);
}
h->panic_string = toku_strdup(panic_string);
}
return 0;
}
......@@ -60,5 +60,8 @@ toku_brtheader_remove_txn_ref(struct brt_header* h, TOKUTXN txn);
void toku_calculate_root_offset_pointer ( struct brt_header* h, CACHEKEY* root_key, u_int32_t *roothash);
void toku_brtheader_set_new_root_blocknum(struct brt_header* h, CACHEKEY new_root_key);
LSN toku_brt_checkpoint_lsn(struct brt_header* h) __attribute__ ((warn_unused_result));
int toku_brtheader_set_panic(struct brt_header *h, int panic, char *panic_string) __attribute__ ((warn_unused_result));
#endif
......@@ -218,7 +218,7 @@ toku_logger_close_rollback(TOKULOGGER logger, BOOL recovery_failed) {
{ //Find "brt"
struct brt_header *h = toku_cachefile_get_userdata(cf);
if (!h->panic && recovery_failed) {
r = toku_brt_header_set_panic(h, EINVAL, "Recovery failed");
r = toku_brtheader_set_panic(h, EINVAL, "Recovery failed");
assert_zero(r);
}
//Verify it is safe to close it.
......
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