mirror of
https://github.com/apple/foundationdb.git
synced 2025-05-14 01:42:37 +08:00
adding knob to allow relative paths for local backup containers
This commit is contained in:
parent
d038154d69
commit
8f241632af
@ -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 <path>/backup-<uid>
|
||||
@ -185,12 +189,19 @@ Future<std::vector<std::string>> 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<std::string> dirs = platform::listDirectories(path);
|
||||
std::vector<std::string> results;
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user