Skip to content

Commit

Permalink
Fix a bug in cleanupUnneededSnapshots()
Browse files Browse the repository at this point in the history
Summary: Before this diff cleanupUnneededSnapshots() didn't actually remove cleaned-up snapshots from _snapshotMap. That means we leaked all snapshots and only removed them at the end, in function dropAllSnapshots(). This bug caused couple of test failures in the CI tool.

Test Plan:
I used the test from the Mongo CI tool that was failing:

    python buildscripts/resmoke.py --suites=core_small_oplog_rs --storageEngine=rocksdb --jobs=1 --continueOnFailure --log=buildlogger --reportFile=report.json

The failure reproed locally consistently. After this diff, the test is successful.

Reviewers: IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D48393
  • Loading branch information
igorcanadi committed Oct 9, 2015
1 parent 576b34b commit 827d822
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/rocks_snapshot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ namespace mongo {
}

auto it = _snapshots.begin();
for (; it != _snapshots.end() && *it != _committedSnapshot; it++);
for (; it != _snapshots.end() && *it != _committedSnapshot; it++) {
auto snapshotHolder = _snapshotMap.find(*it);
// _snapshots and _snapshotMap have to have the same snapshots
invariant(snapshotHolder != _snapshotMap.end());
_snapshotMap.erase(snapshotHolder);
}
invariant(it != _snapshots.end());
_snapshots.erase(_snapshots.begin(), it);
}
Expand Down

0 comments on commit 827d822

Please sign in to comment.