Adar Dembo has submitted this change and it was merged. Change subject: KUDU-1978: avoid corruption when deleting misaligned blocks ......................................................................
KUDU-1978: avoid corruption when deleting misaligned blocks The gist of the problem: when punching out blocks, we don't actually know where they end. The existing code assumes that proper alignment is always maintained, but when faced with a repeated sequence of blocks misaligned on both start and end offsets, this may not be true. It is conceivable (though not certain) that KUDU-1793 can cause such sequences. To fix, we could maintain per-block end offsets, but that'd be expensive for such a rare case (remember: we have millions of blocks). Instead, we'll look for blocks misaligned on their start offsets and skip the align up step when punching them out. This means we won't reclaim all of their space, but it's better than corrupting data belonging to the next block. A black box reproduction of KUDU-1793 is virtually impossible, so here's a white box implementation instead, via augmentation of the LBMCorruptor's misaligned block generator. Without the fix (though with the removal of the DCHECK_EQ), the new test fails 100% of the time. With the fix, it hasn't failed in 1000 runs. Change-Id: I6ed6e349ab10d8d04722cd7ef99e7a06554f51f1 Reviewed-on: http://gerrit.cloudera.org:8080/6715 Tested-by: Kudu Jenkins Reviewed-by: David Ribeiro Alves <davidral...@gmail.com> --- M src/kudu/fs/log_block_manager-test-util.cc M src/kudu/fs/log_block_manager-test-util.h M src/kudu/fs/log_block_manager-test.cc M src/kudu/fs/log_block_manager.cc 4 files changed, 180 insertions(+), 42 deletions(-) Approvals: David Ribeiro Alves: Looks good to me, approved Kudu Jenkins: Verified -- To view, visit http://gerrit.cloudera.org:8080/6715 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: merged Gerrit-Change-Id: I6ed6e349ab10d8d04722cd7ef99e7a06554f51f1 Gerrit-PatchSet: 6 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Adar Dembo <a...@cloudera.com> Gerrit-Reviewer: Adar Dembo <a...@cloudera.com> Gerrit-Reviewer: David Ribeiro Alves <davidral...@gmail.com> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Todd Lipcon <t...@apache.org>