Fdbbackup will now still write a trace file if --log is specified when doing operations that do not require a cluster. Previous behavior was to rely on createCluster()'s trace file initialization.
This commit is contained in:
parent
69425a303b
commit
2d483e7a1c
|
@ -2279,6 +2279,8 @@ int main(int argc, char* argv[]) {
|
|||
bool dryRun = false;
|
||||
std::string traceDir = "";
|
||||
std::string traceLogGroup;
|
||||
uint64_t traceRollSize = TRACE_DEFAULT_ROLL_SIZE;
|
||||
uint64_t traceMaxLogsSize = TRACE_DEFAULT_MAX_LOGS_SIZE;
|
||||
ESOError lastError;
|
||||
bool partial = true;
|
||||
LocalityData localities;
|
||||
|
@ -2706,6 +2708,14 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
}
|
||||
|
||||
// Opens a trace file if trace is set (and if a trace file isn't already open)
|
||||
// For most modes, initCluster() will open a trace file, but some fdbbackup operations do not require
|
||||
// a cluster so they should use this instead.
|
||||
auto initTraceFile = [&]() {
|
||||
if(trace)
|
||||
openTraceFile(NetworkAddress(), traceRollSize, traceMaxLogsSize, traceDir, "trace", traceLogGroup);
|
||||
};
|
||||
|
||||
auto initCluster = [&](bool quiet = false) {
|
||||
auto resolvedClusterFile = ClusterConnectionFile::lookupClusterFileName(clusterFile);
|
||||
try {
|
||||
|
@ -2818,6 +2828,7 @@ int main(int argc, char* argv[]) {
|
|||
break;
|
||||
|
||||
case BACKUP_EXPIRE:
|
||||
initTraceFile();
|
||||
// Must have a usable cluster if either expire DateTime options were used
|
||||
if(!expireDatetime.empty() || !expireRestorableAfterDatetime.empty()) {
|
||||
if(!initCluster())
|
||||
|
@ -2827,10 +2838,12 @@ int main(int argc, char* argv[]) {
|
|||
break;
|
||||
|
||||
case BACKUP_DELETE:
|
||||
initTraceFile();
|
||||
f = stopAfter( deleteBackupContainer(argv[0], destinationContainer) );
|
||||
break;
|
||||
|
||||
case BACKUP_DESCRIBE:
|
||||
initTraceFile();
|
||||
// If timestamp lookups are desired, require a cluster file
|
||||
if(describeTimestamps && !initCluster())
|
||||
return FDB_EXIT_ERROR;
|
||||
|
@ -2839,6 +2852,7 @@ int main(int argc, char* argv[]) {
|
|||
f = stopAfter( describeBackup(argv[0], destinationContainer, describeDeep, describeTimestamps ? Optional<Database>(db) : Optional<Database>()) );
|
||||
break;
|
||||
case BACKUP_LIST:
|
||||
initTraceFile();
|
||||
f = stopAfter( listBackup(baseUrl) );
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue