diff --git a/fdbclient/BackupContainerLocalDirectory.actor.cpp b/fdbclient/BackupContainerLocalDirectory.actor.cpp index 4e4d82edbb..8d2b50928b 100644 --- a/fdbclient/BackupContainerLocalDirectory.actor.cpp +++ b/fdbclient/BackupContainerLocalDirectory.actor.cpp @@ -158,15 +158,19 @@ BackupContainerLocalDirectory::BackupContainerLocalDirectory(const std::string& std::string absolutePath = abspath(path); if (!g_network->isSimulated() && path != absolutePath) { - TraceEvent(SevWarn, "BackupContainerLocalDirectory") - .detail("Description", "Backup path must be absolute (e.g. file:///some/path)") - .detail("URL", url) - .detail("Path", path) - .detail("AbsolutePath", absolutePath); - // throw io_error(); - IBackupContainer::lastOpenError = - format("Backup path '%s' must be the absolute path '%s'", path.c_str(), absolutePath.c_str()); - throw backup_invalid_url(); + if (CLIENT_KNOBS->BACKUP_CONTAINER_LOCAL_ALLOW_RELATIVE_PATH) { + path = absolutePath; + } else { + TraceEvent(SevWarn, "BackupContainerLocalDirectory") + .detail("Description", "Backup path must be absolute (e.g. file:///some/path)") + .detail("URL", url) + .detail("Path", path) + .detail("AbsolutePath", absolutePath); + // throw io_error(); + IBackupContainer::lastOpenError = + format("Backup path '%s' must be the absolute path '%s'", path.c_str(), absolutePath.c_str()); + throw backup_invalid_url(); + } } // Finalized path written to will be will be /backup- @@ -185,12 +189,19 @@ Future> BackupContainerLocalDirectory::listURLs(const s // Remove trailing slashes on path path.erase(path.find_last_not_of("\\/") + 1); - if (!g_network->isSimulated() && path != abspath(path)) { - TraceEvent(SevWarn, "BackupContainerLocalDirectory") - .detail("Description", "Backup path must be absolute (e.g. file:///some/path)") - .detail("URL", url) - .detail("Path", path); - throw io_error(); + std::string absolutePath = abspath(path); + + if (!g_network->isSimulated() && path != absolutePath) { + if (CLIENT_KNOBS->BACKUP_CONTAINER_LOCAL_ALLOW_RELATIVE_PATH) { + path = absolutePath; + } else { + TraceEvent(SevWarn, "BackupContainerLocalDirectory") + .detail("Description", "Backup path must be absolute (e.g. file:///some/path)") + .detail("URL", url) + .detail("Path", path) + .detail("AbsolutePath", absolutePath); + throw io_error(); + } } std::vector dirs = platform::listDirectories(path); std::vector results; diff --git a/fdbclient/ClientKnobs.cpp b/fdbclient/ClientKnobs.cpp index 2bdf24e353..faa2209fa9 100644 --- a/fdbclient/ClientKnobs.cpp +++ b/fdbclient/ClientKnobs.cpp @@ -192,7 +192,8 @@ void ClientKnobs::initialize(Randomize randomize) { init( MIN_CLEANUP_SECONDS, 3600.0 ); init( FASTRESTORE_ATOMICOP_WEIGHT, 1 ); if( randomize && BUGGIFY ) { FASTRESTORE_ATOMICOP_WEIGHT = deterministicRandom()->random01() * 200 + 1; } init( RESTORE_RANGES_READ_BATCH, 10000 ); - init( BLOB_GRANULE_RESTORE_CHECK_INTERVAL, 10 ); + init( BLOB_GRANULE_RESTORE_CHECK_INTERVAL, 10 ); + init( BACKUP_CONTAINER_LOCAL_ALLOW_RELATIVE_PATH, false ); // Configuration init( DEFAULT_AUTO_COMMIT_PROXIES, 3 ); diff --git a/fdbclient/include/fdbclient/ClientKnobs.h b/fdbclient/include/fdbclient/ClientKnobs.h index f4bd86d27c..679d9374d7 100644 --- a/fdbclient/include/fdbclient/ClientKnobs.h +++ b/fdbclient/include/fdbclient/ClientKnobs.h @@ -193,6 +193,7 @@ public: int64_t FASTRESTORE_ATOMICOP_WEIGHT; // workload amplication factor for atomic op int RESTORE_RANGES_READ_BATCH; int BLOB_GRANULE_RESTORE_CHECK_INTERVAL; + bool BACKUP_CONTAINER_LOCAL_ALLOW_RELATIVE_PATH; // Configuration int32_t DEFAULT_AUTO_COMMIT_PROXIES;