Log size has 1GiB default in simulation (#12532)

This commit is contained in:
Syed Paymaan Raza
2025-10-31 12:08:24 -07:00
committed by GitHub
parent b23faeac5b
commit 8aaea0f952
2 changed files with 24 additions and 3 deletions

View File

@@ -667,7 +667,7 @@ static void printUsage(const char* name, bool devhelp) {
printOptionUsage("-L PATH, --logdir PATH", " Store log files in the given folder (default is `.').");
printOptionUsage("--logsize SIZE",
"Roll over to a new log file after the current log file"
" exceeds SIZE bytes. The default value is 10MiB.");
" exceeds SIZE bytes. The default value is 10MiB (1GiB in simulation).");
printOptionUsage("--maxlogs SIZE, --maxlogssize SIZE",
" Delete the oldest log file when the total size of all log"
" files exceeds SIZE bytes. If set to 0, old log files will not"
@@ -1119,6 +1119,7 @@ struct CLIOptions {
logFolder = ".", metricsConnFile, metricsPrefix, newClusterKey, authzPublicKeyFile;
std::string logGroup = "default";
uint64_t rollsize = TRACE_DEFAULT_ROLL_SIZE;
bool rollsizeSet = false;
uint64_t maxLogsSize = TRACE_DEFAULT_MAX_LOGS_SIZE;
bool maxLogsSizeSet = false;
int maxLogs = 0;
@@ -1518,6 +1519,7 @@ private:
flushAndExit(FDB_EXIT_ERROR);
}
rollsize = ti.get();
rollsizeSet = true;
break;
}
case OPT_MAXLOGSSIZE: {
@@ -1872,6 +1874,16 @@ private:
}
}
}
if (role == ServerRole::Simulation) {
if (!rollsizeSet) {
rollsize = TRACE_DEFAULT_ROLL_SIZE_SIM;
}
if (!maxLogsSizeSet) {
maxLogsSize = TRACE_DEFAULT_MAX_LOGS_SIZE_SIM;
}
}
// Sets up blob credentials, including one from the environment FDB_BLOB_CREDENTIALS.
// Below is top-half of BackupTLSConfig::setupBlobCredentials().
const char* blobCredsFromENV = getenv("FDB_BLOB_CREDENTIALS");

View File

@@ -37,8 +37,17 @@
#include "flow/ITrace.h"
#include "flow/Traceable.h"
#define TRACE_DEFAULT_ROLL_SIZE (10 << 20)
#define TRACE_DEFAULT_MAX_LOGS_SIZE (10 * TRACE_DEFAULT_ROLL_SIZE)
// Note: this default only applies to non-simulation fdbserver process invocations
// i.e. when -r is not set to simulation
#define TRACE_DEFAULT_ROLL_SIZE (10ULL << 20)
// Same as above, but default for when -r is set to simulation
// Having a higher default (1GiB) is useful because you don't have to
// grep multiple trace files when debugging.
#define TRACE_DEFAULT_ROLL_SIZE_SIM (1ULL << 30)
#define TRACE_DEFAULT_MAX_LOGS_SIZE (10ULL * TRACE_DEFAULT_ROLL_SIZE)
#define TRACE_DEFAULT_MAX_LOGS_SIZE_SIM (10ULL * TRACE_DEFAULT_ROLL_SIZE_SIM)
FDB_BOOLEAN_PARAM(InitializeTraceMetrics);