From 617b5a065181a2a7bb221980e49509cbe2f7bce5 Mon Sep 17 00:00:00 2001 From: qiuwenchen Date: Thu, 24 Oct 2024 18:55:56 +0800 Subject: [PATCH] Remove useless code --- src/common/core/InnerDatabase.cpp | 6 ---- src/common/core/operate/OperationQueue.cpp | 5 --- src/common/repair/factory/FactoryBackup.cpp | 31 +++++++------------ .../tests/repair/common/BackupTestCase.mm | 1 - 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/src/common/core/InnerDatabase.cpp b/src/common/core/InnerDatabase.cpp index 7cfd94a8a..17be7513b 100644 --- a/src/common/core/InnerDatabase.cpp +++ b/src/common/core/InnerDatabase.cpp @@ -645,12 +645,6 @@ void InnerDatabase::tryLoadIncremetalMaterial() if (!m_needLoadIncremetalMaterial) { return; } - auto config = CommonCore::shared().getABTestConfig("clicfg_wcdb_incremental_backup"); - if (config.failed() || config.value().length() == 0 - || atoi(config.value().data()) != 1) { - m_needLoadIncremetalMaterial = false; - return; - } const StringView &databasePath = getPath(); StringView materialPath diff --git a/src/common/core/operate/OperationQueue.cpp b/src/common/core/operate/OperationQueue.cpp index 74d3a8fb5..62df69910 100644 --- a/src/common/core/operate/OperationQueue.cpp +++ b/src/common/core/operate/OperationQueue.cpp @@ -524,11 +524,6 @@ void OperationQueue::asyncCheckpoint(const UnsafeStringView& path) Operation operation(Operation::Type::Checkpoint, path); Parameter parameter; double checkPointInterval = OperationQueueTimeIntervalForCheckpoint; - auto config = CommonCore::shared().getABTestConfig("clicfg_wcdb_checkpoint_interval"); - if (config.valueOrDefault().length() > 0) { - checkPointInterval = std::max(checkPointInterval, atof(config->data())); - checkPointInterval = std::min(checkPointInterval, 600.0); - } async(operation, checkPointInterval, parameter, AsyncMode::ForwardOnly); } } diff --git a/src/common/repair/factory/FactoryBackup.cpp b/src/common/repair/factory/FactoryBackup.cpp index 6be3d548a..32b0e463e 100644 --- a/src/common/repair/factory/FactoryBackup.cpp +++ b/src/common/repair/factory/FactoryBackup.cpp @@ -59,21 +59,16 @@ bool FactoryBackup::work(const UnsafeStringView& database, bool interruptible) bool FactoryBackup::doBackUp(const UnsafeStringView& database, bool interruptible) { Optional incrementalMaterialSize = 0; - auto config = CommonCore::shared().getABTestConfig("clicfg_wcdb_incremental_backup"); - bool incrememtalBackupEnable = config.succeed() && config.value().length() > 0 - && atoi(config.value().data()) == 1; SharedIncrementalMaterial incrementalMaterial; - if (incrememtalBackupEnable) { - incrementalMaterial = CommonCore::shared().tryGetIncrementalMaterial(database); - if (interruptible && incrementalMaterial != nullptr) { - incrementalMaterialSize = saveIncrementalMaterial(database, incrementalMaterial); - if (!incrementalMaterialSize.hasValue()) { - return false; - } - if (Time::now().seconds() - incrementalMaterial->info.lastBackupTime < OperationQueueTimeIntervalForBackup - && incrementalMaterial->pages.size() < BackupMaxIncrementalPageCount) { - return true; - } + incrementalMaterial = CommonCore::shared().tryGetIncrementalMaterial(database); + if (interruptible && incrementalMaterial != nullptr) { + incrementalMaterialSize = saveIncrementalMaterial(database, incrementalMaterial); + if (!incrementalMaterialSize.hasValue()) { + return false; + } + if (Time::now().seconds() - incrementalMaterial->info.lastBackupTime < OperationQueueTimeIntervalForBackup + && incrementalMaterial->pages.size() < BackupMaxIncrementalPageCount) { + return true; } } @@ -103,12 +98,10 @@ bool FactoryBackup::doBackUp(const UnsafeStringView& database, bool interruptibl } SharedIncrementalMaterial newIncrementalMaterial = backup.getIncrementalMaterial(); - if (incrememtalBackupEnable) { - if (!saveIncrementalMaterial(database, newIncrementalMaterial).hasValue()) { - return false; - } - CommonCore::shared().tryRegisterIncrementalMaterial(database, newIncrementalMaterial); + if (!saveIncrementalMaterial(database, newIncrementalMaterial).hasValue()) { + return false; } + CommonCore::shared().tryRegisterIncrementalMaterial(database, newIncrementalMaterial); if (interruptible) { notifiyBackupEnd( diff --git a/src/objc/tests/repair/common/BackupTestCase.mm b/src/objc/tests/repair/common/BackupTestCase.mm index 49fa2a620..d97b77fa4 100644 --- a/src/objc/tests/repair/common/BackupTestCase.mm +++ b/src/objc/tests/repair/common/BackupTestCase.mm @@ -47,7 +47,6 @@ - (void)setUp { [super setUp]; self.objectCount = 100; - [WCTDatabase setABTestConfigWithName:@"clicfg_wcdb_incremental_backup" andValue:@"1"]; } - (NSMutableArray*>*)objects