Corrected function name to timeKeeperVersionFromDatetime(). 'Fdbbackup expire' now allows an expire_before version of 0 if explicitly passed by version or by timestamp.

This commit is contained in:
Stephen Atherton 2018-01-23 00:19:51 -08:00
parent 51a1bd9327
commit 7f0b7311b9
3 changed files with 6 additions and 6 deletions

View File

@ -1825,16 +1825,16 @@ Reference<IBackupContainer> openBackupContainer(const char *name, std::string de
ACTOR Future<Void> expireBackupData(const char *name, std::string destinationContainer, Version endVersion, std::string endDatetime, Database db, bool force, Version restorableAfterVersion, std::string restorableAfterDatetime) {
if (!endDatetime.empty()) {
Version v = wait( timeKeeperVersionFromEpochs(endDatetime, db) );
Version v = wait( timeKeeperVersionFromDatetime(endDatetime, db) );
endVersion = v;
}
if (!restorableAfterDatetime.empty()) {
Version v = wait( timeKeeperVersionFromEpochs(restorableAfterDatetime, db) );
Version v = wait( timeKeeperVersionFromDatetime(restorableAfterDatetime, db) );
restorableAfterVersion = v;
}
if (!endVersion) {
if (endVersion == invalidVersion) {
fprintf(stderr, "ERROR: No version or date/time is specified.\n");
printHelpTeaser(name);
throw backup_error();;
@ -2259,7 +2259,7 @@ int main(int argc, char* argv[]) {
std::string sourceClusterFile;
std::string baseUrl;
std::string expireDatetime;
Version expireVersion = 0;
Version expireVersion = invalidVersion;
std::string expireRestorableAfterDatetime;
Version expireRestorableAfterVersion = std::numeric_limits<Version>::max();
std::vector<std::pair<std::string, std::string>> knobs;

View File

@ -1178,7 +1178,7 @@ Future<std::vector<std::string>> IBackupContainer::listContainers(std::string ba
return listContainers_impl(baseURL);
}
ACTOR Future<Version> timeKeeperVersionFromEpochs(std::string datetime, Database db) {
ACTOR Future<Version> timeKeeperVersionFromDatetime(std::string datetime, Database db) {
state KeyBackedMap<int64_t, Version> versionMap(timeKeeperPrefixRange.begin);
state Reference<ReadYourWritesTransaction> tr = Reference<ReadYourWritesTransaction>(new ReadYourWritesTransaction(db));

View File

@ -28,7 +28,7 @@
#include <vector>
Future<Optional<int64_t>> timeKeeperEpochsFromVersion(Version const &v, Reference<ReadYourWritesTransaction> const &tr);
Future<Version> timeKeeperVersionFromEpochs(std::string const &datetime, Database const &db);
Future<Version> timeKeeperVersionFromDatetime(std::string const &datetime, Database const &db);
// Append-only file interface for writing backup data
// Once finish() is called the file cannot be further written to.