Skip to content

Commit

Permalink
Merge pull request #1928 from Expensify/main
Browse files Browse the repository at this point in the history
Update expensify_prod branch
  • Loading branch information
jasperhuangg authored Oct 30, 2024
2 parents 0f4fbf0 + a30c7e1 commit 6064bd4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 18 deletions.
9 changes: 7 additions & 2 deletions libstuff/SLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ static const set<string> PARAMS_WHITELIST = {
"command",
"companyName",
"companyWebsite",
"domainAccountID",
"domainName",
"errorMessage",
"feedCountry",
"indexName",
"invoice",
"isUnique",
Expand All @@ -56,7 +59,9 @@ static const set<string> PARAMS_WHITELIST = {
"reportID",
"token",
"transactionID",
"type"
"type",
"bankAccountID",
"step"
};

string addLogParams(string&& message, const map<string, string>& params) {
Expand All @@ -70,7 +75,7 @@ string addLogParams(string&& message, const map<string, string>& params) {
string valueToLog = value;
if (!SContains(PARAMS_WHITELIST, key)) {
if (!GLOBAL_IS_LIVE) {
STHROW("500 Log param not in the whitelist, either do not log that or add it to PARAMS_WHITELIST if it's not sensitive");
STHROW("500 Log param " + key + " not in the whitelist, either do not log that or add it to PARAMS_WHITELIST if it's not sensitive");
}
valueToLog = "<REDACTED>";
}
Expand Down
43 changes: 28 additions & 15 deletions libstuff/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
** separate file. This file contains only code for the core SQLite library.
**
** The content in this amalgamation comes from Fossil check-in
** af4e778bd3bdf30cac3d9a6266f105a8cd71.
** 7dbb43bd307b5e297e6b2deac4e1d73d8cd6.
*/
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1
Expand Down Expand Up @@ -465,7 +465,7 @@ extern "C" {
*/
#define SQLITE_VERSION "3.47.0"
#define SQLITE_VERSION_NUMBER 3047000
#define SQLITE_SOURCE_ID "2024-10-25 18:37:00 af4e778bd3bdf30cac3d9a6266f105a8cd71f947b8d71249ef74b8fdc0505dd7"
#define SQLITE_SOURCE_ID "2024-10-30 18:24:33 7dbb43bd307b5e297e6b2deac4e1d73d8cd68e37d880a5ecf5a3918a53e99d9d"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down Expand Up @@ -17450,19 +17450,21 @@ SQLITE_PRIVATE int sqlite3CursorRangeHintExprCheck(Walker *pWalker, Expr *pExpr)
#define COMMIT_TIME_RELOCATE2COUNT 9

#define COMMIT_TIME_AFTER_FIXUNLOCKED 10
#define COMMIT_TIME_AFTER_WALFRAMES 11

#define COMMIT_TIME_BEFORE_PHASETWO 12
#define COMMIT_TIME_AFTER_PHASETWO 13
#define COMMIT_TIME_OSWRITE 11
#define COMMIT_TIME_AFTER_WALFRAMES 12

#define COMMIT_TIME_AFTER_VDBECOMMIT 14
#define COMMIT_TIME_AFTER_HALT 15
#define COMMIT_TIME_FINISH 16
#define COMMIT_TIME_BEFORE_PHASETWO 13
#define COMMIT_TIME_AFTER_PHASETWO 14

#define COMMIT_TIME_N 17
#define COMMIT_TIME_AFTER_VDBECOMMIT 15
#define COMMIT_TIME_AFTER_HALT 16
#define COMMIT_TIME_FINISH 17

#define COMMIT_TIME_N 18

/* #define COMMIT_TIME_TIMEOUT (2*1000*1000) */
#define COMMIT_TIME_TIMEOUT (10*1000) /* 10ms threshold */
#define COMMIT_TIME_TIMEOUT (0*1000) /* 10ms threshold */

SQLITE_PRIVATE void sqlite3CommitTimeLog(u64*);
SQLITE_PRIVATE u64 sqlite3STimeNow();
Expand Down Expand Up @@ -70931,6 +70933,7 @@ static int walWriteToLog(
sqlite3_int64 iOffset /* Start writing at this offset */
){
int rc;
u64 t;
if( iOffset<p->iSyncPoint && iOffset+iAmt>=p->iSyncPoint ){
int iFirstAmt = (int)(p->iSyncPoint - iOffset);
rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset);
Expand All @@ -70942,7 +70945,13 @@ static int walWriteToLog(
rc = sqlite3OsSync(p->pFd, WAL_SYNC_FLAGS(p->syncFlags));
if( iAmt==0 || rc ) return rc;
}
if( p->pWal->aCommitTime ){
t = sqlite3STimeNow();
}
rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);
if( p->pWal->aCommitTime ){
p->pWal->aCommitTime[COMMIT_TIME_OSWRITE] += (sqlite3STimeNow() - t);
}
return rc;
}

Expand Down Expand Up @@ -93221,18 +93230,22 @@ SQLITE_PRIVATE void sqlite3CommitTimeLog(u64 *aCommit){
for(ii=1; ii<COMMIT_TIME_N; ii++){
int iVal;
const char *zHash = "";
const char *zU = "";
if( ii==COMMIT_TIME_RELOCATE1COUNT
|| ii==COMMIT_TIME_RELOCATE2COUNT
|| ii==COMMIT_TIME_OTHERWRITERS
){
iVal = (int)aCommit[ii];
zHash = "#";
}else if( ii==COMMIT_TIME_OSWRITE ){
iVal = (int)aCommit[ii];
zU = "us";
}else{
iVal = (aCommit[ii]==0 ? 0 : (int)(aCommit[ii] - i1));
}
zStr = sqlite3_mprintf("%z%s%s%d", zStr, (zStr?", ":""), zHash, iVal);
zStr = sqlite3_mprintf("%z%s%s%d%s", zStr, (zStr?", ":""),zHash,iVal,zU);
}
sqlite3_log(SQLITE_WARNING, "slow commit (v=6): (%s)", zStr);
sqlite3_log(SQLITE_WARNING, "slow commit (v=7): (%s)", zStr);
sqlite3_free(zStr);
}
}
Expand Down Expand Up @@ -93260,7 +93273,7 @@ SQLITE_PRIVATE void sqlite3PrepareTimeLog(const char *zSql, int nSql, u64 *aPrep
}
if( nByte<0 ){ nByte = sqlite3Strlen30(zSql); }
sqlite3_log(SQLITE_WARNING,
"slow prepare (v=6): (%s) [%.*s]", zStr, nByte, zSql
"slow prepare (v=7): (%s) [%.*s]", zStr, nByte, zSql
);
sqlite3_free(zStr);
}
Expand All @@ -93276,7 +93289,7 @@ SQLITE_PRIVATE void sqlite3SchemaTimeLog(u64 *aSchema){
(aSchema[ii]==0 ? 0 : (int)(aSchema[ii] - i1))
);
}
sqlite3_log(SQLITE_WARNING, "slow schema (v=6): (%s)", zStr);
sqlite3_log(SQLITE_WARNING, "slow schema (v=7): (%s)", zStr);
sqlite3_free(zStr);
}
}
Expand Down Expand Up @@ -257654,7 +257667,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2024-10-25 18:37:00 af4e778bd3bdf30cac3d9a6266f105a8cd71f947b8d71249ef74b8fdc0505dd7", -1, SQLITE_TRANSIENT);
sqlite3_result_text(pCtx, "fts5: 2024-10-30 18:24:33 7dbb43bd307b5e297e6b2deac4e1d73d8cd68e37d880a5ecf5a3918a53e99d9d", -1, SQLITE_TRANSIENT);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion libstuff/sqlite3.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ extern "C" {
*/
#define SQLITE_VERSION "3.47.0"
#define SQLITE_VERSION_NUMBER 3047000
#define SQLITE_SOURCE_ID "2024-10-25 18:37:00 af4e778bd3bdf30cac3d9a6266f105a8cd71f947b8d71249ef74b8fdc0505dd7"
#define SQLITE_SOURCE_ID "2024-10-30 18:24:33 7dbb43bd307b5e297e6b2deac4e1d73d8cd68e37d880a5ecf5a3918a53e99d9d"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down

0 comments on commit 6064bd4

Please sign in to comment.