From 2932b0ac4587b0a060a320f62902a697f0e342da Mon Sep 17 00:00:00 2001 From: Mikhail Bautin Date: Fri, 2 Feb 2018 00:02:32 -0800 Subject: [PATCH] This commit provides additional functionality that is logically related to the earlier commit https://github.com/YugaByte/yugabyte-db/commit/864e72ba501b7c424e05683ce754b01b93f82a74 Original commit message: ENG-2793 Do not fail when deciding if we can flush an empty immutable memtable Summary: There was a crash during one of our performance integration tests that was caused by Frontiers() not being set on a memtable. That could only possibly happen if the memtable is empty, and it is still not clear how an empty memtable could get into the list of immutable memtables. Regardless of that, instead of crashing, we should just flush that memtable and log an error message. ``` #0 operator() (memtable=..., __closure=0x7f2e454b67b0) at ../../../../../src/yb/tablet/tablet_peer.cc:178 #1 std::_Function_handler&, const std::shared_future >&, const scoped_refptr&, const std::shared_ptr&, const scoped_refptr&, const scoped_refptr&, yb::ThreadPool*):::: >::_M_invoke(const std::_Any_data &, const rocksdb::MemTable &) (__functor=..., __args#0=...) at /n/jenkins/linuxbrew/linuxbrew_2018-01-09T08_28_02/Cellar/gcc/5.5.0/include/c++/5.5.0/functional:1857 #2 0x00007f2f7346a70e in operator() (__args#0=..., this=0x7f2e454b67b0) at /n/jenkins/linuxbrew/linuxbrew_2018-01-09T08_28_02/Cellar/gcc/5.5.0/include/c++/5.5.0/functional:2267 #3 rocksdb::MemTableList::PickMemtablesToFlush(rocksdb::autovector*, std::function const&) (this=0x7d02978, ret=ret@entry=0x7f2e454b6370, filter=...) at ../../../../../src/yb/rocksdb/db/memtable_list.cc:259 #4 0x00007f2f7345517f in rocksdb::FlushJob::Run (this=this@entry=0x7f2e454b6750, file_meta=file_meta@entry=0x7f2e454b68d0) at ../../../../../src/yb/rocksdb/db/flush_job.cc:143 #5 0x00007f2f7341b7c3 in rocksdb::DBImpl::FlushMemTableToOutputFile (this=this@entry=0x89d2400, cfd=cfd@entry=0x7d02300, mutable_cf_options=..., made_progress=made_progress@entry=0x7f2e454b709e, job_context=job_context@entry=0x7f2e454b70b0, log_buffer=0x7f2e454b7280) at ../../../../../src/yb/rocksdb/db/db_impl.cc:1586 #6 0x00007f2f7341c19f in rocksdb::DBImpl::BackgroundFlush (this=this@entry=0x89d2400, made_progress=made_progress@entry=0x7f2e454b709e, job_context=job_context@entry=0x7f2e454b70b0, log_buffer=log_buffer@entry=0x7f2e454b7280) at ../../../../../src/yb/rocksdb/db/db_impl.cc:2816 #7 0x00007f2f7342539b in rocksdb::DBImpl::BackgroundCallFlush (this=0x89d2400) at ../../../../../src/yb/rocksdb/db/db_impl.cc:2838 #8 0x00007f2f735154c3 in rocksdb::ThreadPool::BGThread (this=0x3b0bb20, thread_id=0) at ../../../../../src/yb/rocksdb/util/thread_posix.cc:133 #9 0x00007f2f73515558 in rocksdb::BGThreadWrapper (arg=0xd970a20) at ../../../../../src/yb/rocksdb/util/thread_posix.cc:157 #10 0x00007f2f6c964694 in start_thread (arg=0x7f2e454b8700) at pthread_create.c:333 ``` Test Plan: Jenkins Reviewers: hector, sergei Reviewed By: hector, sergei Subscribers: sergei, bogdan, bharat, ybase Differential Revision: https://phabricator.dev.yugabyte.com/D4044 --- ent/src/yb/integration-tests/CMakeLists-include.txt | 2 +- ent/src/yb/integration-tests/snapshot-test.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ent/src/yb/integration-tests/CMakeLists-include.txt b/ent/src/yb/integration-tests/CMakeLists-include.txt index fbaeb933731f..951a66f3b05b 100644 --- a/ent/src/yb/integration-tests/CMakeLists-include.txt +++ b/ent/src/yb/integration-tests/CMakeLists-include.txt @@ -1,3 +1,3 @@ # Copyright (c) YugaByte, Inc. -ADD_YB_TEST(snapshot-test RESOURCE_LOCK "master-rpc-ports") +ADD_YB_TEST(snapshot-test) diff --git a/ent/src/yb/integration-tests/snapshot-test.cc b/ent/src/yb/integration-tests/snapshot-test.cc index aa782777561d..84798b4c460d 100644 --- a/ent/src/yb/integration-tests/snapshot-test.cc +++ b/ent/src/yb/integration-tests/snapshot-test.cc @@ -406,8 +406,8 @@ TEST_F(SnapshotTest, SnapshotRemoteBootstrap) { workload.StopAndJoin(); - cluster_->FlushTablets(); - cluster_->CleanTabletLogs(); + ASSERT_OK(cluster_->FlushTablets()); + ASSERT_OK(cluster_->CleanTabletLogs()); ASSERT_OK(ts0->Start()); ASSERT_NO_FATALS(VerifySnapshotFiles(snapshot_id));