Simplify log compaction

Summary: Teon found this nit so we might fix it.

Reviewers: ipaljak

Reviewed By: ipaljak

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1860
This commit is contained in:
Matija Santl 2019-02-13 13:30:41 +01:00
parent cbd6f3bbe2
commit 68c910a083

View File

@ -982,6 +982,10 @@ void RaftServer::SnapshotThread() {
VLOG(40) << "[LogCompaction] Creating snapshot."; VLOG(40) << "[LogCompaction] Creating snapshot.";
bool status = durability::MakeSnapshot(*db_, *dba, durability_dir_, bool status = durability::MakeSnapshot(*db_, *dba, durability_dir_,
snapshot_filename); snapshot_filename);
// Raft lock must be released when destroying dba object.
dba = nullptr;
lock.lock(); lock.lock();
if (status) { if (status) {
@ -1004,10 +1008,6 @@ void RaftServer::SnapshotThread() {
disk_storage_.Delete(LogEntryKey(i)); disk_storage_.Delete(LogEntryKey(i));
} }
} }
lock.unlock();
// Raft lock must be released when destroying dba object.
dba = nullptr;
} }
} }