From 60fa9cf0b5fe138d5d23ace223e0e5b8408cd72c Mon Sep 17 00:00:00 2001 From: Mike Lin Date: Fri, 25 Sep 2015 21:19:29 -0700 Subject: [PATCH] Override DBImplReadOnly::SyncWAL() to return NotSupported. Previously, calling it caused program abort. --- db/db_impl_readonly.h | 5 +++++ db/db_test.cc | 1 + 2 files changed, 6 insertions(+) diff --git a/db/db_impl_readonly.h b/db/db_impl_readonly.h index 6ad82bbf5..8f3103aac 100644 --- a/db/db_impl_readonly.h +++ b/db/db_impl_readonly.h @@ -100,6 +100,11 @@ class DBImplReadOnly : public DBImpl { return Status::NotSupported("Not supported operation in read only mode."); } + using DBImpl::SyncWAL; + virtual Status SyncWAL() override { + return Status::NotSupported("Not supported operation in read only mode."); + } + private: friend class DB; diff --git a/db/db_test.cc b/db/db_test.cc index 82915e372..92c6076b4 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -244,6 +244,7 @@ TEST_F(DBTest, ReadOnlyDB) { ASSERT_OK(ReadOnlyReopen(options)); ASSERT_EQ("v3", Get("foo")); ASSERT_EQ("v2", Get("bar")); + ASSERT_TRUE(db_->SyncWAL().IsNotSupported()); } TEST_F(DBTest, CompactedDB) {