Skip to content

Commit

Permalink
Merge pull request #2076 from Expensify/main
Browse files Browse the repository at this point in the history
Update expensify_prod branch
  • Loading branch information
deetergp authored Jan 28, 2025
2 parents 9055b94 + 41f910e commit f769ca0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ INCLUDE = -I$(PROJECT) -I$(PROJECT)/mbedtls/include
CXXFLAGS = -g -std=c++20 -fPIC -DSQLITE_ENABLE_NORMALIZE $(BEDROCK_OPTIM_COMPILE_FLAG) -Wall -Werror -Wformat-security -Wno-unqualified-std-cast-call -Wno-error=deprecated-declarations $(INCLUDE)

# Amalgamation flags
AMALGAMATION_FLAGS = -Wno-unused-but-set-variable -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -DSQLITE_ENABLE_NOOP_UPDATE -DSQLITE_MUTEX_ALERT_MILLISECONDS=20 -DHAVE_USLEEP=1 -DSQLITE_MAX_MMAP_SIZE=17592186044416ull -DSQLITE_SHARED_MAPPING -DSQLITE_ENABLE_NORMALIZE -DSQLITE_MAX_PAGE_COUNT=4294967294 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS -DSQLITE_DEFAULT_CACHE_SIZE=-51200 -DSQLITE_MAX_FUNCTION_ARG=32767 -DSQLITE_WAL_BIGHASH
AMALGAMATION_FLAGS = -Wno-unused-but-set-variable -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_STAT4 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT -DSQLITE_ENABLE_NOOP_UPDATE -DSQLITE_MUTEX_ALERT_MILLISECONDS=20 -DHAVE_USLEEP=1 -DSQLITE_MAX_MMAP_SIZE=17592186044416ull -DSQLITE_SHARED_MAPPING -DSQLITE_ENABLE_NORMALIZE -DSQLITE_MAX_PAGE_COUNT=4294967294 -DSQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS -DSQLITE_DEFAULT_CACHE_SIZE=-51200 -DSQLITE_MAX_FUNCTION_ARG=32767 -DSQLITE_DEFAULT_WAL_SYNCHRONOUS=0

# All our intermediate, dependency, object, etc files get hidden in here.
INTERMEDIATEDIR = .build
Expand Down
42 changes: 13 additions & 29 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
** dc3a24a784c95398656e0d7885f7eb0ee626.
** b40cd7395c44b1f2d019d8e809e03de0e083.
*/
#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-12-23 11:31:16 dc3a24a784c95398656e0d7885f7eb0ee626b86c896e759a6ac5c243fd6f0ab7"
#define SQLITE_SOURCE_ID "2024-12-20 19:37:41 b40cd7395c44b1f2d019d8e809e03de0e083c93693322a72ddb250a85640528f"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down Expand Up @@ -66400,13 +66400,8 @@ SQLITE_PRIVATE int sqlite3WalTrace = 0;
** version-2 ("journal_mode=wal2"). Legacy clients may support version-1
** only.
*/
#ifdef SQLITE_WAL_BIGHASH
# define WAL_VERSION1 3007001 /* For "journal_mode=wal" */
# define WAL_VERSION2 3021001 /* For "journal_mode=wal2" */
#else
# define WAL_VERSION1 3007000 /* For "journal_mode=wal" */
# define WAL_VERSION2 3021000 /* For "journal_mode=wal2" */
#endif
#define WAL_VERSION1 3007000 /* For "journal_mode=wal" */
#define WAL_VERSION2 3021000 /* For "journal_mode=wal2" */

#define SQLITE_ENABLE_WAL2NOCKSUM 1

Expand Down Expand Up @@ -66791,11 +66786,7 @@ struct Wal {
** Each page of the wal-index mapping contains a hash-table made up of
** an array of HASHTABLE_NSLOT elements of the following type.
*/
#ifdef SQLITE_WAL_BIGHASH
typedef u32 ht_slot;
#else
typedef u16 ht_slot;
#endif
typedef u16 ht_slot;

/*
** This structure is used to implement an iterator that loops through
Expand Down Expand Up @@ -66832,14 +66823,9 @@ struct WalIterator {
** Changing any of these constants will alter the wal-index format and
** create incompatibilities.
*/
#ifdef SQLITE_WAL_BIGHASH
# define HASHTABLE_BITS 17 /* 128K frames per hash */
#else
# define HASHTABLE_BITS 12 /* 4K frames per hash */
#endif
# define HASHTABLE_NPAGE (1<<HASHTABLE_BITS) /* Must be power of 2 */
# define HASHTABLE_HASH_1 383 /* Should be prime */
# define HASHTABLE_NSLOT (HASHTABLE_NPAGE*2) /* Must be a power of 2 */
#define HASHTABLE_NPAGE 4096 /* Must be power of 2 */
#define HASHTABLE_HASH_1 383 /* Should be prime */
#define HASHTABLE_NSLOT (HASHTABLE_NPAGE*2) /* Must be a power of 2 */

/*
** The block of page numbers associated with the first hash-table in a
Expand Down Expand Up @@ -68180,13 +68166,11 @@ SQLITE_PRIVATE int sqlite3WalOpen(
assert( 40 == sizeof(WalCkptInfo) );
assert( 120 == WALINDEX_LOCK_OFFSET );
assert( 136 == WALINDEX_HDR_SIZE );
#ifndef SQLITE_WAL_BIGHASH
assert( 4096 == HASHTABLE_NPAGE );
assert( 4062 == HASHTABLE_NPAGE_ONE );
assert( 8192 == HASHTABLE_NSLOT );
assert( 383 == HASHTABLE_HASH_1 );
assert( 32768 == WALINDEX_PGSZ );
#endif
assert( 8 == SQLITE_SHM_NLOCK );
assert( 5 == WAL_NREADER );
assert( 24 == WAL_FRAME_HDRSIZE );
Expand Down Expand Up @@ -68401,7 +68385,7 @@ static void walMergesort(
ht_slot *aMerge = 0; /* List to be merged */
int iList; /* Index into input list */
u32 iSub = 0; /* Index into aSub array */
struct Sublist aSub[HASHTABLE_BITS+1]; /* Array of sub-lists */
struct Sublist aSub[13]; /* Array of sub-lists */

memset(aSub, 0, sizeof(aSub));
assert( nList<=HASHTABLE_NPAGE && nList>0 );
Expand Down Expand Up @@ -93513,7 +93497,7 @@ SQLITE_PRIVATE void sqlite3CommitTimeLog(u64 *aCommit){
}
zStr = sqlite3_mprintf("%z%s%s%d%s", zStr, (zStr?", ":""),zHash,iVal,zU);
}
sqlite3_log(SQLITE_WARNING, "slow commit (v=21): (%s)", zStr);
sqlite3_log(SQLITE_WARNING, "slow commit (v=20): (%s)", zStr);
sqlite3_free(zStr);
}
}
Expand Down Expand Up @@ -93541,7 +93525,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=21): (%s) [%.*s]", zStr, nByte, zSql
"slow prepare (v=20): (%s) [%.*s]", zStr, nByte, zSql
);
sqlite3_free(zStr);
}
Expand All @@ -93562,7 +93546,7 @@ SQLITE_PRIVATE void sqlite3SchemaTimeLog(u64 *aSchema, const char *zFile){
}
zStr = sqlite3_mprintf("%z%s%d", zStr, (zStr?", ":""), val);
}
sqlite3_log(SQLITE_WARNING, "slow schema (%s) (v=21): (%s)", zFile, zStr);
sqlite3_log(SQLITE_WARNING, "slow schema (%s) (v=20): (%s)", zFile, zStr);
sqlite3_free(zStr);
}
}
Expand Down Expand Up @@ -258042,7 +258026,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2024-12-23 11:31:16 dc3a24a784c95398656e0d7885f7eb0ee626b86c896e759a6ac5c243fd6f0ab7", -1, SQLITE_TRANSIENT);
sqlite3_result_text(pCtx, "fts5: 2024-12-20 19:37:41 b40cd7395c44b1f2d019d8e809e03de0e083c93693322a72ddb250a85640528f", -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-12-23 11:31:16 dc3a24a784c95398656e0d7885f7eb0ee626b86c896e759a6ac5c243fd6f0ab7"
#define SQLITE_SOURCE_ID "2024-12-20 19:37:41 b40cd7395c44b1f2d019d8e809e03de0e083c93693322a72ddb250a85640528f"

/*
** CAPI3REF: Run-Time Library Version Numbers
Expand Down
3 changes: 0 additions & 3 deletions sqlitecluster/SQLite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,6 @@ void SQLite::commonConstructorInitialization(bool hctree) {
// Setting a wal hook prevents auto-checkpointing.
sqlite3_wal_hook(_db, _walHookCallback, this);

// Always set synchronous commits to off for best commit performance in WAL mode.
SASSERT(!SQuery(_db, "setting synchronous commits to off", "PRAGMA synchronous = OFF;"));

// For non-passive checkpoints, we must set a busy timeout in order to wait on any readers.
// We set it to 2 minutes as the majority of transactions should take less than that.
if (_checkpointMode != SQLITE_CHECKPOINT_PASSIVE) {
Expand Down
2 changes: 1 addition & 1 deletion sqlitecluster/SQLiteNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ bool SQLiteNode::update() {
SASSERTWARN(_db.getUncommittedHash().empty());

if (_isShuttingDown) {
SWARN("Shutting down in WAITING, how did we here here?");
SWARN("Shutting down in WAITING, how did we get here?");

// Return false to allow the poll loop to run again. This is here for legacy reasons form before the above warning was added.
// Probably this whole block can be removed if that warning never fires.
Expand Down

0 comments on commit f769ca0

Please sign in to comment.