Skip to content

Commit 1687505

Browse files
Do not mark as corrupted cache with L0 files (#1217)
Temporarily revert L0 files detection for protected cache. We don't need it for now Relates-To: OAM-1116 Signed-off-by: Andrey Kashcheev <[email protected]>
1 parent 3d7d673 commit 1687505

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

olp-cpp-sdk-core/src/cache/DiskCache.cpp

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -244,18 +244,12 @@ OpenResult DiskCache::Open(const std::string& data_path,
244244
status = leveldb::DB::Open(open_options, versioned_data_path, &db);
245245
}
246246

247-
if (status.IsCorruption() || status.IsIOError()) {
248-
if (is_read_only) {
249-
OLP_SDK_LOG_ERROR_F(
250-
kLogTag, "Open: cache corrupted, cache_path='%s', error='%s'",
251-
versioned_data_path.c_str(), status.ToString().c_str());
252-
return OpenResult::Corrupted;
253-
} else if (RepairCache(versioned_data_path)) {
254-
status = leveldb::DB::Open(open_options, versioned_data_path, &db);
255-
if (status.ok()) {
256-
database_.reset(db);
257-
return OpenResult::Repaired;
258-
}
247+
if ((status.IsCorruption() || status.IsIOError()) &&
248+
RepairCache(versioned_data_path)) {
249+
status = leveldb::DB::Open(open_options, versioned_data_path, &db);
250+
if (status.ok()) {
251+
database_.reset(db);
252+
return OpenResult::Repaired;
259253
}
260254
}
261255

@@ -268,14 +262,7 @@ OpenResult DiskCache::Open(const std::string& data_path,
268262
error_ = NoError{};
269263
}
270264

271-
std::unique_ptr<leveldb::DB> tmp_db{db};
272-
273-
if (is_read_only && !CheckCompactionFinished(*tmp_db)) {
274-
OLP_SDK_LOG_ERROR(kLogTag, "Open: interrupted compaction detected");
275-
return OpenResult::Corrupted;
276-
}
277-
278-
database_.swap(tmp_db);
265+
database_.reset(db);
279266

280267
return OpenResult::Success;
281268
}

0 commit comments

Comments
 (0)