diff --git a/documentation/sphinx/source/backups.rst b/documentation/sphinx/source/backups.rst index fdfcbc4ffb..5600522f9f 100644 --- a/documentation/sphinx/source/backups.rst +++ b/documentation/sphinx/source/backups.rst @@ -406,10 +406,8 @@ The following options apply to all commands: ``--blob_credentials `` Use FILE as a :ref:`Blob Credential File`. Can be used multiple times. -The following options apply to all commands except ``start``: - -``-C `` - Path to the cluster file that should be used to connect to the FoundationDB cluster you want to use. If not specified, a :ref:`default cluster file ` will be used. +``--dest_cluster_file `` + Required. Path to the cluster file that should be used to connect to the FoundationDB cluster you are restoring to. .. _restore-start: @@ -424,10 +422,6 @@ The ``start`` command will start a new restore on the specified (or default) tag ``-r `` Required. Specifies the Backup URL for the source backup data to restore to the database. The source data must be accessible by the ``backup_agent`` processes for the cluster. -``--dest_cluster_file `` - Required. The backup data will be restored into this cluster. - - ``-w`` Wait for the restore to reach a final state (such as complete) before exiting. Prints a progress update every few seconds. Behavior is identical to that of the wait command. diff --git a/fdbbackup/backup.actor.cpp b/fdbbackup/backup.actor.cpp index 91a316341b..5f9c8a307b 100644 --- a/fdbbackup/backup.actor.cpp +++ b/fdbbackup/backup.actor.cpp @@ -903,7 +903,7 @@ static void printBackupUsage(bool devhelp) { printf(" -e ERRORLIMIT The maximum number of errors printed by status (default is 10).\n"); printf(" -k KEYS List of key ranges to backup.\n" " If not specified, the entire database will be backed up.\n"); - printf(" -n, --dryrun For start or restore operations, performs a trial run with no actual changes made.\n"); + printf(" -n, --dryrun For backup start or restore start, performs a trial run with no actual changes made.\n"); #ifndef TLS_DISABLED printf(TLS_HELP); #endif @@ -3387,27 +3387,31 @@ int main(int argc, char* argv[]) { break; case EXE_RESTORE: if(dryRun) { + if(restoreType != RESTORE_START) { + fprintf(stderr, "Restore dry run only works for 'start' command\n"); + return FDB_EXIT_ERROR; + } + + // Must explicitly call trace file options handling if not calling Database::createDatabase() initTraceFile(); } - else if(restoreType != RESTORE_START && !initCluster()) { - return FDB_EXIT_ERROR; - } + else { + if(restoreClusterFileDest.empty()) { + fprintf(stderr, "Restore destination cluster file must be specified explicitly.\n"); + return FDB_EXIT_ERROR; + } - if(restoreClusterFileDest.empty()) { - fprintf(stderr, "Restore destination cluster file must be specified explicitly.\n"); - return FDB_EXIT_ERROR; - } + if(!fileExists(restoreClusterFileDest)) { + fprintf(stderr, "Restore destination cluster file '%s' does not exist.\n", restoreClusterFileDest.c_str()); + return FDB_EXIT_ERROR; + } - if(!fileExists(restoreClusterFileDest)) { - fprintf(stderr, "Restore destination cluster file '%s' does not exist.\n", restoreClusterFileDest.c_str()); - return FDB_EXIT_ERROR; - } - - try { - db = Database::createDatabase(restoreClusterFileDest, Database::API_VERSION_LATEST); - } catch(Error &e) { - fprintf(stderr, "Restore destination cluster file '%s' invalid: %s\n", restoreClusterFileDest.c_str(), e.what()); - return FDB_EXIT_ERROR; + try { + db = Database::createDatabase(restoreClusterFileDest, Database::API_VERSION_LATEST); + } catch(Error &e) { + fprintf(stderr, "Restore destination cluster file '%s' invalid: %s\n", restoreClusterFileDest.c_str(), e.what()); + return FDB_EXIT_ERROR; + } } switch(restoreType) {