Skip to content

Commit

Permalink
Remove useless code
Browse files Browse the repository at this point in the history
  • Loading branch information
Qiuwen-chen committed Oct 24, 2024
1 parent 88095f6 commit 617b5a0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 31 deletions.
6 changes: 0 additions & 6 deletions src/common/core/InnerDatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 0 additions & 5 deletions src/common/core/operate/OperationQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
31 changes: 12 additions & 19 deletions src/common/repair/factory/FactoryBackup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,16 @@ bool FactoryBackup::work(const UnsafeStringView& database, bool interruptible)
bool FactoryBackup::doBackUp(const UnsafeStringView& database, bool interruptible)
{
Optional<size_t> 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;
}
}

Expand Down Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion src/objc/tests/repair/common/BackupTestCase.mm
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ - (void)setUp
{
[super setUp];
self.objectCount = 100;
[WCTDatabase setABTestConfigWithName:@"clicfg_wcdb_incremental_backup" andValue:@"1"];
}

- (NSMutableArray<NSObject<RepairTestObject>*>*)objects
Expand Down

0 comments on commit 617b5a0

Please sign in to comment.