Override DBImplReadOnly::SyncWAL() to return NotSupported. Previously, calling it caused program abort.

This commit is contained in:
Mike Lin 2015-09-25 21:19:29 -07:00
parent 7df348b405
commit 60fa9cf0b5
2 changed files with 6 additions and 0 deletions

View File

@ -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;

View File

@ -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) {