only corrupt private file checksum in backupable_db_test

Summary:
if it happens (randomly) to corrupt shared file in the test, then the
    checksum will be inconsistent between meta files from different backup.
    BackupEngine will then detect this issue and fail. But in reality, this
    does not happen since the checksum is checked on every backup. So here,
    only corrupt checksum of private file to let BackupEngine to construct
    properly (but fail during restore).

Test Plan: run test with valgrind

Reviewers: igor

Reviewed By: igor

CC: leveldb

Differential Revision: https://reviews.facebook.net/D15531
main
Lei Jin 11 years ago
parent 5d2c62822e
commit 9a126ba3b3
  1. 12
      utilities/backupable/backupable_db_test.cc

@ -250,17 +250,15 @@ class FileManager : public EnvWrapper {
return s;
}
std::vector<int64_t> positions;
auto pos = metadata.find(" crc32 ");
auto pos = metadata.find("private");
if (pos == std::string::npos) {
return Status::Corruption("checksum not found");
return Status::Corruption("private file is expected");
}
do {
positions.push_back(pos);
pos = metadata.find(" crc32 ", pos + 6);
} while (pos != std::string::npos);
if (pos == std::string::npos) {
return Status::Corruption("checksum not found");
}
pos = positions[rnd_.Next() % positions.size()];
if (metadata.size() < pos + 7) {
return Status::Corruption("bad CRC32 checksum value");
}

Loading…
Cancel
Save