Commit 61bcc5b1 authored by Yoni Fogel's avatar Yoni Fogel

[t:4904] Closes #4904 Simplify ft_get_some_existing_handle

Now verifies there is exactly one handle and returns it.
Removing this code entirely would make refcounting more complicated.

git-svn-id: file:///svn/toku/tokudb@44225 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3821c947
......@@ -576,14 +576,12 @@ int toku_remove_ft (FT h, char **error_string, BOOL oplsn_valid, LSN oplsn) {
return r;
}
// gets the first existing BRT handle, if it exists. If no BRT handle exists
// for this header, returns NULL
FT_HANDLE toku_ft_get_some_existing_ft_handle(FT h) {
// Verifies there exists exactly one ft handle and returns it.
FT_HANDLE toku_ft_get_only_existing_ft_handle(FT h) {
FT_HANDLE ft_handle_ret = NULL;
toku_ft_grab_reflock(h);
if (!toku_list_empty(&h->live_ft_handles)) {
ft_handle_ret = toku_list_struct(toku_list_head(&h->live_ft_handles), struct ft_handle, live_ft_handle_link);
}
assert(toku_list_num_elements_est(&h->live_ft_handles) == 1);
ft_handle_ret = toku_list_struct(toku_list_head(&h->live_ft_handles), struct ft_handle, live_ft_handle_link);
toku_ft_release_reflock(h);
return ft_handle_ret;
}
......
......@@ -46,7 +46,7 @@ int toku_ft_needed_unlocked(FT h);
BOOL toku_ft_has_one_reference_unlocked(FT ft);
int toku_remove_ft (FT h, char **error_string, BOOL oplsn_valid, LSN oplsn) __attribute__ ((warn_unused_result));
FT_HANDLE toku_ft_get_some_existing_ft_handle(FT h);
FT_HANDLE toku_ft_get_only_existing_ft_handle(FT h);
void toku_ft_note_hot_begin(FT_HANDLE brt);
void toku_ft_note_hot_complete(FT_HANDLE brt, BOOL success, MSN msn_at_start_of_hot);
......
......@@ -216,8 +216,7 @@ toku_logger_close_rollback(TOKULOGGER logger, BOOL recovery_failed) {
toku_block_verify_no_data_blocks_except_root_unlocked(ft->blocktable, ft->h->root_blocknum);
}
assert(!ft->h->dirty);
ft_to_close = toku_ft_get_some_existing_ft_handle(ft);
assert(ft_to_close);
ft_to_close = toku_ft_get_only_existing_ft_handle(ft);
{
BOOL is_empty;
is_empty = toku_ft_is_empty_fast(ft_to_close);
......
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