DeleteLogFiles in FailOverwritingBackups

main
Igor Canadi 11 years ago
parent 25c8a1a20f
commit ee4b9966bc
  1. 18
      utilities/backupable/backupable_db_test.cc

@ -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();

Loading…
Cancel
Save