Skip to content

Commit

Permalink
Merge pull request #1431 from Expensify/main
Browse files Browse the repository at this point in the history
Update expensify_prod branch
  • Loading branch information
pecanoro authored Jan 19, 2023
2 parents 04ae576 + f7472c0 commit a6bf5d5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
29 changes: 26 additions & 3 deletions libstuff/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ extern "C" {
*/
#define SQLITE_VERSION "3.40.0"
#define SQLITE_VERSION_NUMBER 3040000
#define SQLITE_SOURCE_ID "2023-01-16 20:33:43 906caf8911ed2afd7bf828550d2e709b23860597e1288334fc9ba57480542142"
#define SQLITE_SOURCE_ID "2023-01-19 21:05:02 a057f9cb2c647e0ee95c5956eb8707f2a4892bbf207544b47d76db56fd4f8990"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down Expand Up @@ -53078,6 +53078,11 @@ static void pcache1TruncateUnsafe(
){
TESTONLY( int nPage = 0; ) /* To assert pCache->nPage is correct */
unsigned int h, iStop;

#define TRUNCATE_UNSAFE_TIMEOUT 1500000
u64 tmTruncate = 0;
unsigned int nTmPage = 0;

assert( sqlite3_mutex_held(pCache->pGroup->mutex) );
assert( pCache->iMaxKey >= iLimit );
assert( pCache->nHash > 0 );
Expand All @@ -53095,11 +53100,18 @@ static void pcache1TruncateUnsafe(
h = pCache->nHash/2;
iStop = h - 1;
}

if( iLimit<=1 ){
tmTruncate = sqlite3STimeNow();
nTmPage = pCache->nPage;
}

for(;;){
PgHdr1 **pp;
PgHdr1 *pPage;
assert( h<pCache->nHash );
pp = &pCache->apHash[h];

while( (pPage = *pp)!=0 ){
if( pPage->iKey>=iLimit ){
pCache->nPage--;
Expand All @@ -53114,6 +53126,17 @@ static void pcache1TruncateUnsafe(
if( h==iStop ) break;
h = (h+1) % pCache->nHash;
}

if( iLimit<=1 ){
tmTruncate = sqlite3STimeNow() - tmTruncate;
if( tmTruncate>TRUNCATE_UNSAFE_TIMEOUT ){
sqlite3_log(SQLITE_WARNING,
"slow pcache.xTruncate(1) (v=6): (%d) nPage: %d -> %d",
(int)tmTruncate, (int)nTmPage, (int)pCache->nPage
);
}
}

assert( nPage<0 || pCache->nPage==(unsigned)nPage );
}

Expand Down Expand Up @@ -88372,7 +88395,7 @@ SQLITE_PRIVATE void sqlite3OpenTransLog(u64 *aOpenTransTm){
u64 i1 = aOpenTransTm[OPEN_TRANS_START];
if( aOpenTransTm[OPEN_TRANS_DONE]>(i1+OPEN_TRANS_TIMEOUT) ){
sqlite3_log(SQLITE_WARNING,
"slow open transaction (v=5): (%d, %d, %d, %d)",
"slow open transaction (v=6): (%d, %d, %d, %d)",
(aOpenTransTm[OPEN_TRANS_BEFORERESET]==0) ? 0 :
(int)(aOpenTransTm[OPEN_TRANS_BEFORERESET] - i1),

Expand Down Expand Up @@ -239523,7 +239546,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2023-01-16 20:33:43 906caf8911ed2afd7bf828550d2e709b23860597e1288334fc9ba57480542142", -1, SQLITE_TRANSIENT);
sqlite3_result_text(pCtx, "fts5: 2023-01-19 21:05:02 a057f9cb2c647e0ee95c5956eb8707f2a4892bbf207544b47d76db56fd4f8990", -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.40.0"
#define SQLITE_VERSION_NUMBER 3040000
#define SQLITE_SOURCE_ID "2023-01-16 20:33:43 906caf8911ed2afd7bf828550d2e709b23860597e1288334fc9ba57480542142"
#define SQLITE_SOURCE_ID "2023-01-19 21:05:02 a057f9cb2c647e0ee95c5956eb8707f2a4892bbf207544b47d76db56fd4f8990"

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

0 comments on commit a6bf5d5

Please sign in to comment.