Reduce a duplicate consistency check when applying a new version (#10169)

Summary:
One consistency check in SaveTo() is dupilcated with the one within Apply(). Remove one of then in release mode to reduce time spent in DB mutex.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10169

Test Plan: Run existing tests and see nothing breaks.

Reviewed By: ltamasi

Differential Revision: D37157821

fbshipit-source-id: 73b89443a20b43362ff66d10b9212022034a8234
main
sdong 3 years ago committed by Facebook GitHub Bot
parent 8f59c41cc7
commit 4207872fc3
  1. 7
      db/version_builder.cc

@ -1144,10 +1144,15 @@ class VersionBuilder::Rep {
// Save the current state in *vstorage.
Status SaveTo(VersionStorageInfo* vstorage) const {
Status s = CheckConsistency(base_vstorage_);
Status s;
#ifndef NDEBUG
// The same check is done within Apply() so we skip it in release mode.
s = CheckConsistency(base_vstorage_);
if (!s.ok()) {
return s;
}
#endif // NDEBUG
s = CheckConsistency(vstorage);
if (!s.ok()) {

Loading…
Cancel
Save