Skip to content

Commit

Permalink
Merge pull request #1997 from Expensify/main
Browse files Browse the repository at this point in the history
  • Loading branch information
cead22 authored Dec 3, 2024
2 parents e7516de + b6f3e8e commit b635b1a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 42 deletions.
46 changes: 5 additions & 41 deletions libstuff/SLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,57 +41,17 @@ void SLogStackTrace(int level) {
}

// If the param name is not in this whitelist, we will log <REDACTED> in addLogParams.
static const set<string> PARAMS_WHITELIST = {
"accountID",
"authEmail",
"accountIDs",
"attendees",
"bankAccountID",
"cardData",
"cardID",
"clientUpdateID",
static set<string> PARAMS_WHITELIST = {
"command",
"companyName",
"companyWebsite",
"Connection",
"Content-Length",
"count",
"currentTime",
"domainAccountID",
"domainName",
"email",
"errorMessage",
"feed",
"feedCountry",
"feedID",
"feedName",
"field",
"index",
"indexName",
"invoice",
"isUnique",
"key",
"lastIP",
"logParam",
"nvpName",
"policyAccountID",
"policyID",
"reimbursementEntryID",
"reportID",
"requestID",
"requestTimestamp",
"secondaryLogin",
"shouldCompleteOnboarding",
"shouldDismissHybridAppOnboarding",
"status",
"step",
"timeDiff",
"token",
"transactionID",
"type",
"userID",
"secondaryLogin",
"walletBankAccountID"
};

string addLogParams(string&& message, const STable& params) {
Expand All @@ -114,3 +74,7 @@ string addLogParams(string&& message, const STable& params) {

return message;
}

void SWhitelistLogParams(set<string> params) {
PARAMS_WHITELIST.insert(params.begin(), params.end());
}
3 changes: 3 additions & 0 deletions libstuff/libstuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ void SLogLevel(int level);
// Stack trace logging
void SLogStackTrace(int level = LOG_WARNING);

// This method will allow plugins to whitelist log params they need to log.
void SWhitelistLogParams(set<string> params);

// This is a drop-in replacement for syslog that directly logs to `/run/systemd/journal/syslog` bypassing journald.
void SSyslogSocketDirect(int priority, const char* format, ...);

Expand Down
2 changes: 1 addition & 1 deletion sqlitecluster/SQLite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ int SQLite::commit(const string& description, function<void()>* preCheckpointCal
}
_sharedData.checkpointInProgress.clear();
}
SINFO(description << " COMMIT complete in " << time << ". Wrote " << (endPages - startPages)
SINFO(description << " COMMIT " << SToStr(_sharedData.commitCount) << " complete in " << time << ". Wrote " << (endPages - startPages)
<< " pages. WAL file size is " << sz << " bytes. " << _queryCount << " queries attempted, " << _cacheHits
<< " served from cache. Used journal " << _journalName);
_queryCount = 0;
Expand Down
5 changes: 5 additions & 0 deletions test/clustertest/tests/ForkedNodeApprovalTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,10 @@ struct ForkedNodeApprovalTest : tpunit::TestFixture {
// Ok, now we can start the second follower back up and secondary leader should be able to lead.
tester.getTester(2).startServer(false);
ASSERT_TRUE(tester.getTester(1).waitForState("LEADING"));

// We call stopServer on the forked leader because it crashed, but the cluster tester doesn't realize, so shutting down
// normally will time out after a minute. Calling `stopServer` explicitly will clear the server PID, and we won't need
// to wait for this timeout.
tester.getTester(0).stopServer();
}
} __ForkedNodeApprovalTest;

0 comments on commit b635b1a

Please sign in to comment.