Revert "KUDU-2356. Idle WALs should not consume significant memory"
This reverts commit e03375eb04945f172692ca6c4677e3442ed0b295. Reason for revert: this made several TSAN tests flaky Change-Id: I8e3ff0073e33877afc1905958bf5be354ff1af2a Reviewed-on: http://gerrit.cloudera.org:8080/9812 Tested-by: Kudu Jenkins Reviewed-by: Adar Dembo <a...@cloudera.com> Project: http://git-wip-us.apache.org/repos/asf/kudu/repo Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/12ae13b0 Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/12ae13b0 Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/12ae13b0 Branch: refs/heads/master Commit: 12ae13b03596e4dc3dee21cd86ae59c905c5fff2 Parents: 43bc1ab Author: Todd Lipcon <t...@apache.org> Authored: Mon Mar 26 23:52:28 2018 +0000 Committer: Adar Dembo <a...@cloudera.com> Committed: Tue Mar 27 19:17:55 2018 +0000 ---------------------------------------------------------------------- src/kudu/consensus/log-test.cc | 10 ---------- src/kudu/consensus/log.cc | 1 - src/kudu/consensus/log.h | 1 - src/kudu/consensus/log_util.cc | 4 ---- src/kudu/consensus/log_util.h | 7 ------- 5 files changed, 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/kudu/blob/12ae13b0/src/kudu/consensus/log-test.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/log-test.cc b/src/kudu/consensus/log-test.cc index c1f4c92..3d56b96 100644 --- a/src/kudu/consensus/log-test.cc +++ b/src/kudu/consensus/log-test.cc @@ -52,9 +52,7 @@ #include "kudu/gutil/strings/substitute.h" #include "kudu/util/async_util.h" #include "kudu/util/compression/compression.pb.h" -#include "kudu/util/debug/sanitizer_scopes.h" #include "kudu/util/env.h" -#include "kudu/util/faststring.h" #include "kudu/util/metrics.h" #include "kudu/util/random.h" #include "kudu/util/status.h" @@ -1141,19 +1139,11 @@ TEST_F(LogTest, TestAutoStopIdleAppendThread) { ASSERT_EVENTUALLY([&]() { AppendNoOpsToLogSync(clock_, log_.get(), &opid, 2); ASSERT_TRUE(log_->append_thread_active_for_tests()); - debug::ScopedTSANIgnoreReadsAndWrites ignore_tsan; - ASSERT_GT(log_->active_segment_->compress_buf_.capacity(), faststring::kInitialCapacity); }); // After some time, the append thread should shut itself down. ASSERT_EVENTUALLY([&]() { ASSERT_FALSE(log_->append_thread_active_for_tests()); }); - - // The log should free its buffer once it is idle. - { - debug::ScopedTSANIgnoreReadsAndWrites ignore_tsan; - ASSERT_EQ(faststring::kInitialCapacity, log_->active_segment_->compress_buf_.capacity()); - } } // Test that Log::TotalSize() captures creation, addition, and deletion of log segments. http://git-wip-us.apache.org/repos/asf/kudu/blob/12ae13b0/src/kudu/consensus/log.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/log.cc b/src/kudu/consensus/log.cc index c27e425..5d82ebc 100644 --- a/src/kudu/consensus/log.cc +++ b/src/kudu/consensus/log.cc @@ -341,7 +341,6 @@ void Log::AppendThread::DoWork() { } HandleGroup(std::move(entry_batches)); } - log_->active_segment_->GoIdle(); VLOG_WITH_PREFIX(2) << "WAL Appender going idle"; } http://git-wip-us.apache.org/repos/asf/kudu/blob/12ae13b0/src/kudu/consensus/log.h ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/log.h b/src/kudu/consensus/log.h index 71fd6d0..aaeb769 100644 --- a/src/kudu/consensus/log.h +++ b/src/kudu/consensus/log.h @@ -242,7 +242,6 @@ class Log : public RefCountedThreadSafe<Log> { FRIEND_TEST(LogTestOptionalCompression, TestMultipleEntriesInABatch); FRIEND_TEST(LogTestOptionalCompression, TestReadLogWithReplacedReplicates); FRIEND_TEST(LogTest, TestWriteAndReadToAndFromInProgressSegment); - FRIEND_TEST(LogTest, TestAutoStopIdleAppendThread); class AppendThread; http://git-wip-us.apache.org/repos/asf/kudu/blob/12ae13b0/src/kudu/consensus/log_util.cc ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/log_util.cc b/src/kudu/consensus/log_util.cc index 33c8188..07fba47 100644 --- a/src/kudu/consensus/log_util.cc +++ b/src/kudu/consensus/log_util.cc @@ -866,10 +866,6 @@ Status WritableLogSegment::WriteEntryBatch(const Slice& data, return Status::OK(); } -void WritableLogSegment::GoIdle() { - compress_buf_.clear(); - compress_buf_.shrink_to_fit(); -} unique_ptr<LogEntryBatchPB> CreateBatchFromAllocatedOperations( const vector<consensus::ReplicateRefPtr>& msgs) { http://git-wip-us.apache.org/repos/asf/kudu/blob/12ae13b0/src/kudu/consensus/log_util.h ---------------------------------------------------------------------- diff --git a/src/kudu/consensus/log_util.h b/src/kudu/consensus/log_util.h index 7f21fd3..af81c82 100644 --- a/src/kudu/consensus/log_util.h +++ b/src/kudu/consensus/log_util.h @@ -402,8 +402,6 @@ class ReadableLogSegment : public RefCountedThreadSafe<ReadableLogSegment> { }; // A writable log segment where state data is stored. -// -// This class is not thread-safe. class WritableLogSegment { public: WritableLogSegment(std::string path, @@ -435,10 +433,6 @@ class WritableLogSegment { return writable_file_->Sync(); } - // Indicate that the segment has not been written for some period of time. - // In this case, temporary buffers should be freed up. - void GoIdle(); - // Returns true if the segment header has already been written to disk. bool IsHeaderWritten() const { return is_header_written_; @@ -472,7 +466,6 @@ class WritableLogSegment { } private: - FRIEND_TEST(LogTest, TestAutoStopIdleAppendThread); const std::shared_ptr<WritableFile>& writable_file() const { return writable_file_;