Skip to content

Commit cd01a5e

Browse files
committed
Enable paranoid corruption checks in LevelDB >= 1.16
1 parent 029f490 commit cd01a5e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/leveldbwrapper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ static leveldb::Options GetOptions(size_t nCacheSize) {
3232
options.filter_policy = leveldb::NewBloomFilterPolicy(10);
3333
options.compression = leveldb::kNoCompression;
3434
options.max_open_files = 64;
35+
if (leveldb::kMajorVersion > 1 || (leveldb::kMajorVersion == 1 && leveldb::kMinorVersion >= 16)) {
36+
// LevelDB versions before 1.16 consider short writes to be corruption. Only trigger error
37+
// on corruption in later versions.
38+
options.paranoid_checks = true;
39+
}
3540
return options;
3641
}
3742

0 commit comments

Comments
 (0)