DeleteLogFiles in FailOverwritingBackups
This commit is contained in:
parent
25c8a1a20f
commit
ee4b9966bc
@ -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) {
|
||||||
|
CloseBackupableDB();
|
||||||
|
DeleteLogFiles();
|
||||||
|
OpenBackupableDB(false);
|
||||||
FillDB(db_.get(), 100 * i, 100 * (i + 1));
|
FillDB(db_.get(), 100 * i, 100 * (i + 1));
|
||||||
CloseBackupableDB();
|
|
||||||
OpenBackupableDB(false);
|
|
||||||
ASSERT_OK(db_->CreateNewBackup(true));
|
ASSERT_OK(db_->CreateNewBackup(true));
|
||||||
CloseBackupableDB();
|
|
||||||
OpenBackupableDB(false);
|
|
||||||
}
|
}
|
||||||
CloseBackupableDB();
|
CloseBackupableDB();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user