You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "helifu (Code Review)" <ge...@cloudera.org> on 2019/01/30 15:05:47 UTC
[kudu-CR] KUDU2665: LBM deletes the valid live block
helifu has uploaded this change for review. ( http://gerrit.cloudera.org:8080/12308
Change subject: KUDU2665: LBM deletes the valid live block
......................................................................
KUDU2665: LBM deletes the valid live block
Due to the nature of WritableBlock finalization/closing, it's
possible for a container with outstanding WritableBlock instances
to briefly appear as dead.
That's because:
1) The container's next block offset (responsible for determining
fullness) is incrmented when the WritableBlock is finalized, but
2) The container's live block count is incremented when the
WritableBlock is closed.
Thus, if the "last" block in a container is deleted after a
WritableBlock was finalized but before it has been closed, the
container will be erroneously marked as dead. When the container's
last referrent disappears, it will be deleted from disk despite
having live blocks in it.
Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
---
M src/kudu/fs/log_block_manager.cc
1 file changed, 21 insertions(+), 5 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/08/12308/1
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 1
Gerrit-Owner: helifu <hz...@corp.netease.com>
[kudu-CR] KUDU2665: LBM deletes the valid live block
Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU2665: LBM deletes the valid live block
......................................................................
Patch Set 1:
(8 comments)
http://gerrit.cloudera.org:8080/#/c/12308/1//COMMIT_MSG
Commit Message:
PS1:
I'd like to see a targeted test for this. I think you can write a single threaded test in log_block_manager-test that does something like this:
1. Create a container.
2. Write a block to it.
3. In a loop, create, write, and finalize enough WritableBlocks in the container so that it becomes full. Maybe adjust log_container_max_size so you don't have to write too much, or adjust log_container_max_blocks instead.
4. When it's full, delete the block written in step #2. Now the container is full and has no live blocks. As per the old code, it should be marked as dead and removed from the LBM.
5. Close the WritableBlocks finalized in step 3. This should drop all referrents and cause the container to be erroneously deleted.
6. You can test whether the container got deleted, and/or you should be able to open and read the blocks created in step 3.
Such a test should fail without this fix and pass with it.
http://gerrit.cloudera.org:8080/#/c/12308/1//COMMIT_MSG@7
PS1, Line 7: KUDU2665: LBM deletes the valid live block
Nit: rewrite as "KUDU-2665: LBM may delete containers with live blocks"
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc
File src/kudu/fs/log_block_manager.cc:
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@531
PS1, Line 531: // Increases the referenced number.
: // Positive means increase, negative means decrease.
: int32_t IncrWritingRef(int32_t value) { return writing_ref_.IncrementBy(value); }
Nit: rename to "blocks_being_written_incr()" and change comment to "// Adjusts the number of blocks being written. Positive means increase, negative means decrease".
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@535
PS1, Line 535: // Returns the referenced number by LogWritableBlock.
: int32_t WritingRefCount() const { return writing_ref_.Load(); }
Nit: move this up to the "simple accessors" section and rename to blocks_being_written(). You can also drop the comment.
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@640
PS1, Line 640: // The number of references by LogWritableBlock.
: AtomicInt<int32_t> writing_ref_;
Nit: rename to blocks_being_written_ and change comment to "The number of LogWritableBlocks currently open for this container."
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@1305
PS1, Line 1305: // Although this code looks like a TOCTOU violation, it is safe because of
: // some additional LBM invariants:
: // 1. When a container becomes full, it stays full for the process' lifetime.
: // 2. A full container will never accrue another live block. Meaning, losing
: // its last live block is a terminal state for a full container.
This needs to be updated to reflect the role of WritingRefCount(). Maybe this?
// Although this code looks like a TOCTOU violation, it is safe because of
// some additional LBM invariants:
// 1. When a container becomes full, it stays full for the process' lifetime.
// 2. A full container will never accrue another live block. Meaning, losing
// its last live block is a terminal state for a full container.
// 3. The only exception to #2 is if the container currently has a finalized but
not-yet-closed WritableBlock. In this case the container became full
when the WritableBlock was finalized, but the live block counter only
reflects the new block when it is closed.
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@1421
PS1, Line 1421: // However, due to KUDU-2665, it's not safe to visit container's next block
: // offset and live block count at the same time. Thus, we need another flag
: // to identify whether the container is being written instead of a lock.
Nit: this is more or less a retread of the "invariant" comment of TrySetDead. If you refactor this condition into a container method, you can move that comment into the method and drop this one.
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@1424
PS1, Line 1424: if (container->full() && container->live_blocks() == 0 && container->WritingRefCount() == 0) {
This is getting unwieldy to have two copies of; please decompose into a single container method.
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 1
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Comment-Date: Wed, 30 Jan 2019 20:22:40 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2665: LBM may delete containers with live blocks
Posted by "Hao Hao (Code Review)" <ge...@cloudera.org>.
Hao Hao has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU-2665: LBM may delete containers with live blocks
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 4
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Sat, 02 Feb 2019 00:36:25 +0000
Gerrit-HasComments: No
[kudu-CR] KUDU-2665: LBM may delete containers with live blocks
Posted by "helifu (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins, Adar Dembo, Hao Hao,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/12308
to look at the new patch set (#4).
Change subject: KUDU-2665: LBM may delete containers with live blocks
......................................................................
KUDU-2665: LBM may delete containers with live blocks
Due to the nature of WritableBlock finalization/closing, it's
possible for a container with outstanding WritableBlock instances
to briefly appear as dead.
That's because:
1) The container's next block offset (responsible for determining
fullness) is incrmented when the WritableBlock is finalized, but
2) The container's live block count is incremented when the
WritableBlock is closed.
Thus, if the "last" block in a container is deleted after a
WritableBlock was finalized but before it has been closed, the
container will be erroneously marked as dead. When the container's
last referrent disappears, it will be deleted from disk despite
having live blocks in it.
Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
---
M src/kudu/fs/log_block_manager-test.cc
M src/kudu/fs/log_block_manager.cc
2 files changed, 103 insertions(+), 19 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/08/12308/4
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 4
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
[kudu-CR] KUDU2665: LBM deletes the valid live block
Posted by "helifu (Code Review)" <ge...@cloudera.org>.
helifu has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU2665: LBM deletes the valid live block
......................................................................
Patch Set 1:
(6 comments)
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc
File src/kudu/fs/log_block_manager.cc:
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@531
PS1, Line 531: // Increases the referenced number.
: // Positive means increase, negative means decrease.
: int32_t IncrWritingRef(int32_t value) { return writing_ref_.IncrementBy(value); }
> Nit: rename to "blocks_being_written_incr()" and change comment to "// Adju
Done
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@535
PS1, Line 535: // Returns the referenced number by LogWritableBlock.
: int32_t WritingRefCount() const { return writing_ref_.Load(); }
> Nit: move this up to the "simple accessors" section and rename to blocks_be
Done
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@640
PS1, Line 640: // The number of references by LogWritableBlock.
: AtomicInt<int32_t> writing_ref_;
> Nit: rename to blocks_being_written_ and change comment to "The number of L
Done
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@1305
PS1, Line 1305: // Although this code looks like a TOCTOU violation, it is safe because of
: // some additional LBM invariants:
: // 1. When a container becomes full, it stays full for the process' lifetime.
: // 2. A full container will never accrue another live block. Meaning, losing
: // its last live block is a terminal state for a full container.
> This needs to be updated to reflect the role of WritingRefCount(). Maybe th
Done
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@1421
PS1, Line 1421: // However, due to KUDU-2665, it's not safe to visit container's next block
: // offset and live block count at the same time. Thus, we need another flag
: // to identify whether the container is being written instead of a lock.
> Nit: this is more or less a retread of the "invariant" comment of TrySetDea
Done
http://gerrit.cloudera.org:8080/#/c/12308/1/src/kudu/fs/log_block_manager.cc@1424
PS1, Line 1424: if (container->full() && container->live_blocks() == 0 && container->WritingRefCount() == 0) {
> This is getting unwieldy to have two copies of; please decompose into a sin
Done
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 1
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Thu, 31 Jan 2019 06:37:40 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2665: LBM may delete containers with live blocks
Posted by "helifu (Code Review)" <ge...@cloudera.org>.
helifu has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU-2665: LBM may delete containers with live blocks
......................................................................
Patch Set 3:
(4 comments)
http://gerrit.cloudera.org:8080/#/c/12308/3/src/kudu/fs/log_block_manager-test.cc
File src/kudu/fs/log_block_manager-test.cc:
http://gerrit.cloudera.org:8080/#/c/12308/3/src/kudu/fs/log_block_manager-test.cc@1878
PS3, Line 1878: // The size of the container will be 10*4KB after alignment.
> This may not necessarily be true; the filesystem block size may vary from f
Done
http://gerrit.cloudera.org:8080/#/c/12308/3/src/kudu/fs/log_block_manager-test.cc@1916
PS3, Line 1916: if (close_block) {
> The idea here is to test Abort(), right? If so, could you note that in the
Done
http://gerrit.cloudera.org:8080/#/c/12308/3/src/kudu/fs/log_block_manager-test.cc@1928
PS3, Line 1928: ASSERT_EQ(Status::NotFound("").CodeAsString(), s.CodeAsString());
> Simpler to do:
Done
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc
File src/kudu/fs/log_block_manager.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc@1549
PS2, Line 1549: container_->blocks_being_written_incr(-1);
> Sounds good, would you mind adding a comment here to explain it?
Done
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 3
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Sat, 02 Feb 2019 00:04:49 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2665: LBM may delete containers with live blocks
Posted by "Hao Hao (Code Review)" <ge...@cloudera.org>.
Hao Hao has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU-2665: LBM may delete containers with live blocks
......................................................................
Patch Set 3: Code-Review+1
(2 comments)
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG@12
PS2, Line 12: That's because
> sorry, i have no idea. what does 'dist-test' mean?
Our jenkins job are using dist-test to have efficient test runs (tests are submitted to a distributed testing service running on shared infrastructure, https://github.com/apache/kudu/blob/master/build-support/dist_test.py) It has a feature to allow you to loop a certain test multiple times.
Though interestingly, I just tried to loop the test (without your fix) and have no luck of reproduce the error.
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc
File src/kudu/fs/log_block_manager.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc@1549
PS2, Line 1549: container_->blocks_being_written_incr(-1);
> yep, that's a very good point.
Sounds good, would you mind adding a comment here to explain it?
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 3
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Fri, 01 Feb 2019 19:32:53 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU2665: LBM may delete containers with live blocks
Posted by "helifu (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins, Adar Dembo,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/12308
to look at the new patch set (#2).
Change subject: KUDU2665: LBM may delete containers with live blocks
......................................................................
KUDU2665: LBM may delete containers with live blocks
Due to the nature of WritableBlock finalization/closing, it's
possible for a container with outstanding WritableBlock instances
to briefly appear as dead.
That's because:
1) The container's next block offset (responsible for determining
fullness) is incrmented when the WritableBlock is finalized, but
2) The container's live block count is incremented when the
WritableBlock is closed.
Thus, if the "last" block in a container is deleted after a
WritableBlock was finalized but before it has been closed, the
container will be erroneously marked as dead. When the container's
last referrent disappears, it will be deleted from disk despite
having live blocks in it.
Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
---
M src/kudu/fs/log_block_manager-test.cc
M src/kudu/fs/log_block_manager.cc
2 files changed, 89 insertions(+), 19 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/08/12308/2
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 2
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
[kudu-CR] KUDU2665: LBM may delete containers with live blocks
Posted by "helifu (Code Review)" <ge...@cloudera.org>.
helifu has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU2665: LBM may delete containers with live blocks
......................................................................
Patch Set 2:
(4 comments)
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG@7
PS2, Line 7: KUDU2665: LBM may delete containers with live blocks
> Nit: add a dash between 'KUDU' and '2665'.
Done
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG@12
PS2, Line 12: That's because
> Is it possible to detect the flakiness of block_manager-stress-test by loop
sorry, i have no idea. what does 'dist-test' mean?
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc
File src/kudu/fs/log_block_manager-test.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1914
PS2, Line 1914: ASSERT_OK(writer->Close());
> Maybe add a test when a block is never closed, and have a block deletion tr
Done
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc
File src/kudu/fs/log_block_manager.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc@1549
PS2, Line 1549: container_->blocks_being_written_incr(-1);
> We should probably decrement 'blocks_being_written' after checking if the b
yep, that's a very good point.
but i think the order here can help to avoid unnecessary hole punch, and the container should not be deleted because we have the reference to the container which is 'container_'.
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 2
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Fri, 01 Feb 2019 03:44:07 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2665: LBM may delete containers with live blocks
Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU-2665: LBM may delete containers with live blocks
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 4
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Sat, 02 Feb 2019 18:49:03 +0000
Gerrit-HasComments: No
[kudu-CR] KUDU2665: LBM may delete containers with live blocks
Posted by "Hao Hao (Code Review)" <ge...@cloudera.org>.
Hao Hao has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU2665: LBM may delete containers with live blocks
......................................................................
Patch Set 2:
(4 comments)
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG@12
PS2, Line 12: That's because
Is it possible to detect the flakiness of block_manager-stress-test by looping the test by dist-test? If so, could you verify the test is no longer flaky after your fix and add this information in the commit message?
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc
File src/kudu/fs/log_block_manager-test.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1877
PS2, Line 1877: // Create a bunch of blocks.
> Nit: new code should use BlockCreationTransactions to create blocks.
+1.
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1914
PS2, Line 1914: ASSERT_OK(writer->Close());
Maybe add a test when a block is never closed, and have a block deletion transaction happening concurrently?
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc
File src/kudu/fs/log_block_manager.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc@1549
PS2, Line 1549: container_->blocks_being_written_incr(-1);
We should probably decrement 'blocks_being_written' after checking if the block is not closed? Since if the block is not closed, the live block count is not incremented yet. There could be a chance that the container is deleted before DoCloseBlocks() being called in Abort().
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 2
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Fri, 01 Feb 2019 01:43:47 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2665: LBM may delete containers with live blocks
Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU-2665: LBM may delete containers with live blocks
......................................................................
KUDU-2665: LBM may delete containers with live blocks
Due to the nature of WritableBlock finalization/closing, it's
possible for a container with outstanding WritableBlock instances
to briefly appear as dead.
That's because:
1) The container's next block offset (responsible for determining
fullness) is incrmented when the WritableBlock is finalized, but
2) The container's live block count is incremented when the
WritableBlock is closed.
Thus, if the "last" block in a container is deleted after a
WritableBlock was finalized but before it has been closed, the
container will be erroneously marked as dead. When the container's
last referrent disappears, it will be deleted from disk despite
having live blocks in it.
Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Reviewed-on: http://gerrit.cloudera.org:8080/12308
Reviewed-by: Hao Hao <ha...@cloudera.com>
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
M src/kudu/fs/log_block_manager-test.cc
M src/kudu/fs/log_block_manager.cc
2 files changed, 103 insertions(+), 19 deletions(-)
Approvals:
Hao Hao: Looks good to me, approved
Kudu Jenkins: Verified
Adar Dembo: Looks good to me, approved
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 5
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
[kudu-CR] KUDU2665: LBM may delete containers with live blocks
Posted by "helifu (Code Review)" <ge...@cloudera.org>.
helifu has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU2665: LBM may delete containers with live blocks
......................................................................
Patch Set 2:
(5 comments)
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc
File src/kudu/fs/log_block_manager-test.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1873
PS2, Line 1873: MetricRegistry registry;
: scoped_refptr<MetricEntity> entity = METRIC_ENTITY_server.Instantiate(®istry, "test");
: ASSERT_OK(ReopenBlockManager(entity));
> If you're not testing metrics, I don't think you need to do this.
Done
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1877
PS2, Line 1877: // Create a bunch of blocks.
> Nit: new code should use BlockCreationTransactions to create blocks.
Done
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1895
PS2, Line 1895:
: // Lower the max container size, now the container is full.
: FLAGS_log_container_max_size = 1;
> Doing this here feels a little weird. It's not something you could do in pr
Done
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1920
PS2, Line 1920: CHECK_OK(bm_->OpenBlock(block_id, &block));
> ASSERT_OK.
Done
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc
File src/kudu/fs/log_block_manager.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc@554
PS2, Line 554: // Tries to mark the container as 'dead'. It can only be set successfully
: // once, and it is deleted when the container goes out of scope.
> Nit: "Tries to mark the container as 'dead', which means it will be deleted
Done
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 2
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Fri, 01 Feb 2019 01:36:11 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU2665: LBM may delete containers with live blocks
Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU2665: LBM may delete containers with live blocks
......................................................................
Patch Set 2:
(6 comments)
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG@7
PS2, Line 7: KUDU2665: LBM may delete containers with live blocks
Nit: add a dash between 'KUDU' and '2665'.
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc
File src/kudu/fs/log_block_manager-test.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1873
PS2, Line 1873: MetricRegistry registry;
: scoped_refptr<MetricEntity> entity = METRIC_ENTITY_server.Instantiate(®istry, "test");
: ASSERT_OK(ReopenBlockManager(entity));
If you're not testing metrics, I don't think you need to do this.
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1877
PS2, Line 1877: // Create a bunch of blocks.
Nit: new code should use BlockCreationTransactions to create blocks.
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1895
PS2, Line 1895:
: // Lower the max container size, now the container is full.
: FLAGS_log_container_max_size = 1;
Doing this here feels a little weird. It's not something you could do in production (in that the flag can't be reconfigured at runtime), and by doing it after Finalize() the container lands on the "available container" list.
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager-test.cc@1920
PS2, Line 1920: CHECK_OK(bm_->OpenBlock(block_id, &block));
ASSERT_OK.
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc
File src/kudu/fs/log_block_manager.cc:
http://gerrit.cloudera.org:8080/#/c/12308/2/src/kudu/fs/log_block_manager.cc@554
PS2, Line 554: // Tries to mark the container as 'dead'. It can only be set successfully
: // once, and it is deleted when the container goes out of scope.
Nit: "Tries to mark the container as 'dead', which means it will be deleted when it goes out of scope. Can only be set dead once."
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 2
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Thu, 31 Jan 2019 19:36:11 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU-2665: LBM may delete containers with live blocks
Posted by "helifu (Code Review)" <ge...@cloudera.org>.
Hello Kudu Jenkins, Adar Dembo, Hao Hao,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/12308
to look at the new patch set (#3).
Change subject: KUDU-2665: LBM may delete containers with live blocks
......................................................................
KUDU-2665: LBM may delete containers with live blocks
Due to the nature of WritableBlock finalization/closing, it's
possible for a container with outstanding WritableBlock instances
to briefly appear as dead.
That's because:
1) The container's next block offset (responsible for determining
fullness) is incrmented when the WritableBlock is finalized, but
2) The container's live block count is incremented when the
WritableBlock is closed.
Thus, if the "last" block in a container is deleted after a
WritableBlock was finalized but before it has been closed, the
container will be erroneously marked as dead. When the container's
last referrent disappears, it will be deleted from disk despite
having live blocks in it.
Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
---
M src/kudu/fs/log_block_manager-test.cc
M src/kudu/fs/log_block_manager.cc
2 files changed, 102 insertions(+), 19 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/08/12308/3
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 3
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
[kudu-CR] KUDU-2665: LBM may delete containers with live blocks
Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU-2665: LBM may delete containers with live blocks
......................................................................
Patch Set 3:
(4 comments)
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/12308/2//COMMIT_MSG@12
PS2, Line 12: That's because
> Our jenkins job are using dist-test to have efficient test runs (tests are
FWIW, I also wasn't able to repro this bug using dist-test's loop feature. I was only able to repro from time to time on an el6.6 box in RELEASE mode.
I'm not sure how easy it is to submit jobs to dist-test outside of Cloudera's infrastructure.
http://gerrit.cloudera.org:8080/#/c/12308/3/src/kudu/fs/log_block_manager-test.cc
File src/kudu/fs/log_block_manager-test.cc:
http://gerrit.cloudera.org:8080/#/c/12308/3/src/kudu/fs/log_block_manager-test.cc@1878
PS3, Line 1878: // The size of the container will be 10*4KB after alignment.
This may not necessarily be true; the filesystem block size may vary from filesystem to filesystem. For example, on my el6.6 testing box, the block size is 2K.
That said, it doesn't seem like it matters. It seems like it's enough to write one block, then write a block sized to FLAGS_log_container_max_size (i.e. the "special" block), then delete the first block.
http://gerrit.cloudera.org:8080/#/c/12308/3/src/kudu/fs/log_block_manager-test.cc@1916
PS3, Line 1916: if (close_block) {
The idea here is to test Abort(), right? If so, could you note that in the "// Close and reset the writer" comment?
http://gerrit.cloudera.org:8080/#/c/12308/3/src/kudu/fs/log_block_manager-test.cc@1928
PS3, Line 1928: ASSERT_EQ(Status::NotFound("").CodeAsString(), s.CodeAsString());
Simpler to do:
ASSERT_TRUE(s.IsNotFound());
Or even combine with L1927:
ASSERT_TRUE(bm_->OpenBlock(block_id, &block).IsNotFound());
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 3
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Hao Hao <ha...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Fri, 01 Feb 2019 20:54:53 +0000
Gerrit-HasComments: Yes
[kudu-CR] KUDU2665: LBM may delete containers with live blocks
Posted by "helifu (Code Review)" <ge...@cloudera.org>.
helifu has posted comments on this change. ( http://gerrit.cloudera.org:8080/12308 )
Change subject: KUDU2665: LBM may delete containers with live blocks
......................................................................
Patch Set 2:
if we comment 'blocks_being_written() == 0' in the log_block_manager.cc, then the error result will come.
--
To view, visit http://gerrit.cloudera.org:8080/12308
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I894f32b1c164ae7770c92171850edd167dfaf8ad
Gerrit-Change-Number: 12308
Gerrit-PatchSet: 2
Gerrit-Owner: helifu <hz...@corp.netease.com>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: helifu <hz...@corp.netease.com>
Gerrit-Comment-Date: Thu, 31 Jan 2019 07:05:57 +0000
Gerrit-HasComments: No