You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by aw...@apache.org on 2019/02/05 19:38:37 UTC

[kudu] branch master updated: Add a feature flag for deleting dead containers

This is an automated email from the ASF dual-hosted git repository.

awong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 8dc7904  Add a feature flag for deleting dead containers
8dc7904 is described below

commit 8dc7904951a9950dc7729f992441c693d4413bfb
Author: Hao Hao <ha...@cloudera.com>
AuthorDate: Mon Feb 4 22:00:41 2019 -0800

    Add a feature flag for deleting dead containers
    
    Previous commit series (0c501979b, daf04ea1d, 2107f2306) added the
    support for deleting the full and dead containers at runtime. However,
    recent dist-test shows block_manager-stress-test is still flaky after
    these commit series. Unfortunately, at this point, there isn't any
    successful repro of the error. Thus, in this patch we add an experiment
    feature flag for deleting dead containers and disable it by default.
    
    Change-Id: If04a8fa4e7e1adf774876e3d881d88f82da98349
    Reviewed-on: http://gerrit.cloudera.org:8080/12367
    Tested-by: Kudu Jenkins
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
---
 src/kudu/fs/log_block_manager-test.cc | 10 ++++++++++
 src/kudu/fs/log_block_manager.cc      | 10 +++++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/kudu/fs/log_block_manager-test.cc b/src/kudu/fs/log_block_manager-test.cc
index c82b7ff..3472311 100644
--- a/src/kudu/fs/log_block_manager-test.cc
+++ b/src/kudu/fs/log_block_manager-test.cc
@@ -77,6 +77,7 @@ using strings::Substitute;
 
 DECLARE_bool(cache_force_single_shard);
 DECLARE_bool(crash_on_eio);
+DECLARE_bool(log_block_manager_delete_dead_container);
 DECLARE_double(env_inject_eio);
 DECLARE_double(log_container_excess_space_before_cleanup_fraction);
 DECLARE_double(log_container_live_metadata_before_compact_ratio);
@@ -1751,6 +1752,9 @@ TEST_F(LogBlockManagerTest, TestAbortBlock) {
 }
 
 TEST_F(LogBlockManagerTest, TestDeleteDeadContainersByDeletionTransaction) {
+  // Enable deleting full and dead containers at runtime.
+  FLAGS_log_block_manager_delete_dead_container = true;
+
   const auto TestProcess = [&] (int block_num) {
     ASSERT_GT(block_num, 0);
     MetricRegistry registry;
@@ -1870,6 +1874,9 @@ TEST_F(LogBlockManagerTest, TestDeleteDeadContainersByDeletionTransaction) {
 // Test for KUDU-2665 to ensure that once the container is full and has no live
 // blocks but with a reference by WritableBlock, it will not be deleted.
 TEST_F(LogBlockManagerTest, TestDoNotDeleteFakeDeadContainer) {
+  // Enable deleting full and dead containers at runtime.
+  FLAGS_log_block_manager_delete_dead_container = true;
+
   // Lower the max container size.
   FLAGS_log_container_max_size = 64 * 1024;
 
@@ -1933,6 +1940,9 @@ TEST_F(LogBlockManagerTest, TestDoNotDeleteFakeDeadContainer) {
 }
 
 TEST_F(LogBlockManagerTest, TestHalfPresentContainer) {
+  // Enable deleting full and dead containers at runtime.
+  FLAGS_log_block_manager_delete_dead_container = true;
+
   BlockId block_id;
   string data_file_name;
   string metadata_file_name;
diff --git a/src/kudu/fs/log_block_manager.cc b/src/kudu/fs/log_block_manager.cc
index a389b59..52effeb 100644
--- a/src/kudu/fs/log_block_manager.cc
+++ b/src/kudu/fs/log_block_manager.cc
@@ -111,6 +111,13 @@ DEFINE_bool(log_block_manager_test_hole_punching, true,
 TAG_FLAG(log_block_manager_test_hole_punching, advanced);
 TAG_FLAG(log_block_manager_test_hole_punching, unsafe);
 
+DEFINE_bool(log_block_manager_delete_dead_container, false,
+            "When enabled, full and dead log block containers will be deleted "
+            "at runtime, which can potentially help improving log block manager "
+            "startup time");
+TAG_FLAG(log_block_manager_delete_dead_container, advanced);
+TAG_FLAG(log_block_manager_delete_dead_container, experimental);
+
 METRIC_DEFINE_gauge_uint64(server, log_block_manager_bytes_under_management,
                            "Bytes Under Management",
                            kudu::MetricUnit::kBytes,
@@ -548,7 +555,8 @@ class LogBlockContainer: public RefCountedThreadSafe<LogBlockContainer> {
   //    when the WritableBlock was finalized, but the live block counter only
   //    reflects the new block when it is closed.
   bool check_death_condition() const {
-    return (full() && live_blocks() == 0 && blocks_being_written() == 0);
+    return (full() && live_blocks() == 0 && blocks_being_written() == 0 &&
+            FLAGS_log_block_manager_delete_dead_container);
   }
 
   // Tries to mark the container as 'dead', which means it will be deleted