Skip to content

Commit 34f0799

Browse files
Modify the protected cache settings (#1149)
The parameter max_file_size needs to be increased to cover the use case when the cache is too big and leveldb manifest file exceeds the max_file_size, as the result leveldb consider the cache is broken and starts the cache repair operation. Relates-To: OLPEDGE-2448 Signed-off-by: Mykhailo Kuchma <[email protected]>
1 parent d61ac46 commit 34f0799

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,16 @@ DefaultCache::StorageOpenResult DefaultCacheImpl::SetupStorage() {
789789

790790
DefaultCache::StorageOpenResult DefaultCacheImpl::SetupProtectedCache() {
791791
protected_cache_ = std::make_unique<DiskCache>();
792+
793+
// Storage settings for protected cache are different. We want to specify the
794+
// max_file_size greater than the manifest file size. Or else leveldb will try
795+
// to repair the cache.
796+
StorageSettings protected_storage_settings;
797+
protected_storage_settings.max_file_size = 32 * 1024 * 1024;
798+
792799
auto status = protected_cache_->Open(
793800
settings_.disk_path_protected.get(), settings_.disk_path_protected.get(),
794-
StorageSettings{}, OpenOptions::ReadOnly);
801+
protected_storage_settings, OpenOptions::ReadOnly);
795802
if (status == OpenResult::Fail) {
796803
OLP_SDK_LOG_ERROR_F(kLogTag, "Failed to reopen protected cache %s",
797804
settings_.disk_path_protected.get().c_str());

0 commit comments

Comments
 (0)