From f653fdcf5a0ec7565e8eb3c0fe817ef794c7fb30 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Fri, 24 Jan 2014 15:51:01 -0800 Subject: [PATCH] Fixing iterator cleanup for Tailing iterator Immutable tailing iterator doesn't set CleanupState::mem, so we don't have to unref it. --- db/db_impl.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index aff55c75d..0bed3bc28 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -2668,9 +2668,11 @@ static void CleanupIteratorState(void* arg1, void* arg2) { DBImpl::DeletionState deletion_state(state->db->GetOptions(). max_write_buffer_number); state->mu->Lock(); - MemTable* m = state->mem->Unref(); - if (m != nullptr) { - deletion_state.memtables_to_free.push_back(m); + if (state->mem) { // not set for immutable iterator + MemTable* m = state->mem->Unref(); + if (m != nullptr) { + deletion_state.memtables_to_free.push_back(m); + } } if (state->version) { // not set for memtable-only iterator state->version->Unref();