Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TDB-20] With checkpoint disabled, closing FT file still rotates header #383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jun-Yuan
Copy link
Contributor

@Jun-Yuan Jun-Yuan commented Sep 4, 2017

Updated: fixed the format again.
new jenkins test: http://jenkins.percona.com/view/TokuDB/job/PerconaFT-param/107/

Updated: fixed the format.
new Jenkins test: http://jenkins.percona.com/view/TokuDB/job/PerconaFT-param/106

Jenkins: http://jenkins.percona.com/view/TokuDB/job/PerconaFT-param/105/

    This is an attempt based on @BohuTang's patch
    https://github.com/percona/PerconaFT/pull/331

    in particular, the ctest is all his credits.

    Summary:
    1) The issue is real.
    2) @Bohu's patch works for mediating the issue but somewhat introduces
    a ft leak that the ft with ref=0 may be left until next open/close or
    checkpoint.
    3) If ft_close should be held off upon a backup, then it simply means
    a backup should hold a ref to the ft and responsible for closing ft up
    if it is the last one to hold it, like any other possible referencer.
    including the checkpoint, the txn and ft handlers.
    4) mtr test contributed by @BohuTang still passes

Copy link
Contributor

@laurynas-biveinis laurynas-biveinis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatting comments only

@@ -602,6 +607,7 @@ struct cachetable {
KIBBUTZ client_kibbutz; // pool of worker threads and jobs to do asynchronously for the client.
KIBBUTZ ct_kibbutz; // pool of worker threads and jobs to do asynchronously for the cachetable
KIBBUTZ checkpointing_kibbutz; // small pool for checkpointing cloned pairs
//bool in_backup; // we are in back up or NOT, default is false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please no commented-out code?

ft/ft.cc Outdated
@@ -313,6 +313,35 @@ static void ft_note_unpin_by_checkpoint (CACHEFILE UU(cachefile), void *header_v
toku_ft_remove_reference(ft, false, ZERO_LSN, unpin_by_checkpoint_callback, NULL);
}


// maps to cf->note_pin_by_backup
//Must be protected by ydb lock.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces after //

ft/ft.cc Outdated
// Requires: the reflock is held.
static void unpin_by_backup_callback(FT ft, void *extra) {
invariant(extra == NULL);
invariant(ft->num_backups>0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces around >

ft/ft.cc Outdated
static void unpin_by_backup_callback(FT ft, void *extra) {
invariant(extra == NULL);
invariant(ft->num_backups>0);
ft->num_backups --;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space before the operator

ft/ft.cc Outdated
}

// maps to cf->note_unpin_by_backup
//Must be protected by ydb lock.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spaces after //

This file is part of PerconaFT.


Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missed s/2015/2017

along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
======= */

#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2017

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg...how did you spot it...hawkeyes


toku_cachetable_create(&ct, 0, ZERO_LSN, nullptr);
// TEST1 : for normal
r = toku_open_ft_handle(fname, 1, &ft, 1<<12, 1<<9, TOKU_DEFAULT_COMPRESSION_METHOD, ct, null_txn, toku_builtin_compare_fun);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and similar lines below are probably too long. A new file can be clang-formatted without much damage I guess

@Jun-Yuan
Copy link
Contributor Author

Thanks. Please review my follow-up

ft/ft.cc Outdated
FT ft = (FT) header_v;
toku_ft_grab_reflock(ft);
assert(toku_ft_needed_unlocked(ft));
ft->num_backups ++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space before the postincrement operator

@@ -358,7 +387,9 @@ static void ft_init(FT ft, FT_OPTIONS options, CACHEFILE cf) {
ft_begin_checkpoint,
ft_end_checkpoint,
ft_note_pin_by_checkpoint,
ft_note_unpin_by_checkpoint);
ft_note_unpin_by_checkpoint,
ft_note_pin_by_backup,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation must be wrong either in the added lines, either in the lines above (in which I'm not sure it should be fixed)

@@ -455,7 +486,9 @@ int toku_read_ft_and_store_in_cachefile (FT_HANDLE ft_handle, CACHEFILE cf, LSN
ft_begin_checkpoint,
ft_end_checkpoint,
ft_note_pin_by_checkpoint,
ft_note_unpin_by_checkpoint);
ft_note_unpin_by_checkpoint,
ft_note_pin_by_backup,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated again. Thanks!

@@ -376,7 +376,9 @@ cachetable_test (void) {
&test_begin_checkpoint,
&dummy_end,
&dummy_note_pin,
&dummy_note_unpin
&dummy_note_unpin,
&dummy_note_pin,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

@@ -508,7 +508,9 @@ cachetable_test (void) {
test_begin_checkpoint, // called in begin_checkpoint
&dummy_end,
&dummy_note_pin,
&dummy_note_unpin
&dummy_note_unpin,
&dummy_note_pin,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

@@ -60,7 +60,9 @@ static void set_cf_userdata(CACHEFILE f1) {
&dummy_begin,
&dummy_end,
&dummy_note_pin,
&dummy_note_unpin
&dummy_note_unpin,
&dummy_note_pin,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

@@ -68,5 +68,7 @@ create_dummy_functions(CACHEFILE cf)
&dummy_begin,
&dummy_end,
&dummy_note_pin,
&dummy_note_unpin,
&dummy_note_pin,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise

…der.

                This is an attempt based on @BohuTANG's patch
                percona#331

                in particular, the ctest is all his credits.

                Summary:
                1) The issue is real.
                2) @bohu's patch works for mediating the issue but somewhat introduces
                a ft leak that the ft with ref=0 may be left until next open/close or
                checkpoint.
                3) If ft_close should be held off upon a backup, then it simply means
                a backup should hold a ref to the ft and responsible for closing ft up
                if it is the last one to hold it, like any other possible referencer.
                including the checkpoint, the txn and ft handlers.
                4) mtr test contributed by @BohuTANG still passes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants