mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
[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
This commit is contained in:
parent
11e5cb829b
commit
e8a0b831fa
3 changed files with 6 additions and 9 deletions
10
ft/ft.c
10
ft/ft.c
|
@ -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;
|
||||
}
|
||||
|
|
2
ft/ft.h
2
ft/ft.h
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue