|
|
@ -424,6 +424,19 @@ class BackupableDBTest { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DeleteLogFiles() { |
|
|
|
|
|
|
|
std::vector<std::string> delete_logs; |
|
|
|
|
|
|
|
env_->GetChildren(dbname_, &delete_logs); |
|
|
|
|
|
|
|
for (auto f : delete_logs) { |
|
|
|
|
|
|
|
uint64_t number; |
|
|
|
|
|
|
|
FileType type; |
|
|
|
|
|
|
|
bool ok = ParseFileName(f, &number, &type); |
|
|
|
|
|
|
|
if (ok && type == kLogFile) { |
|
|
|
|
|
|
|
env_->DeleteFile(dbname_ + "/" + f); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// files
|
|
|
|
// files
|
|
|
|
std::string dbname_; |
|
|
|
std::string dbname_; |
|
|
|
std::string backupdir_; |
|
|
|
std::string backupdir_; |
|
|
@ -720,12 +733,11 @@ TEST(BackupableDBTest, FailOverwritingBackups) { |
|
|
|
// create backups 1, 2, 3, 4, 5
|
|
|
|
// create backups 1, 2, 3, 4, 5
|
|
|
|
OpenBackupableDB(true); |
|
|
|
OpenBackupableDB(true); |
|
|
|
for (int i = 0; i < 5; ++i) { |
|
|
|
for (int i = 0; i < 5; ++i) { |
|
|
|
FillDB(db_.get(), 100 * i, 100 * (i + 1)); |
|
|
|
|
|
|
|
CloseBackupableDB(); |
|
|
|
CloseBackupableDB(); |
|
|
|
|
|
|
|
DeleteLogFiles(); |
|
|
|
OpenBackupableDB(false); |
|
|
|
OpenBackupableDB(false); |
|
|
|
|
|
|
|
FillDB(db_.get(), 100 * i, 100 * (i + 1)); |
|
|
|
ASSERT_OK(db_->CreateNewBackup(true)); |
|
|
|
ASSERT_OK(db_->CreateNewBackup(true)); |
|
|
|
CloseBackupableDB(); |
|
|
|
|
|
|
|
OpenBackupableDB(false); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
CloseBackupableDB(); |
|
|
|
CloseBackupableDB(); |
|
|
|
|
|
|
|
|
|
|
|