From: dan Date: Wed, 11 Dec 2024 20:42:29 +0000 (+0000) Subject: When a writer initializes a new *-shm file hash table, zero only the hash-table slots... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c2d7c02c657b1ad5e284503612e29ef8aa2aaa8;p=thirdparty%2Fsqlite.git When a writer initializes a new *-shm file hash table, zero only the hash-table slots, not the array of page numbers. FossilOrigin-Name: ac5401c62b3ff03e43e01d066f4664491ce9b640ec64150a58b38839b4834afb --- diff --git a/manifest b/manifest index 4124321135..0ad34da1fd 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\swith\sthe\sformatting\sof\s"slow\sschema"\slog\smessages.\sAlso\schange\slogging\sversion\sto\sv=17. -D 2024-12-10T14:56:20.988 +C When\sa\swriter\sinitializes\sa\snew\s*-shm\sfile\shash\stable,\szero\sonly\sthe\shash-table\sslots,\snot\sthe\sarray\sof\spage\snumbers. +D 2024-12-11T20:42:29.249 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -779,7 +779,7 @@ F src/shell.c.in 40de636c1d90fb8a9ca7f49dc8f50d930f1b60736e73aca5eb37c4c7d0e47f9 F src/sqlite.h.in b7ff496637807ae88b2557039fc940518db328bf5d5621e2f7c048dfba32a52b F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 3f046c04ea3595d6bfda99b781926b17e672fd6d27da2ba6d8d8fc39981dcb54 -F src/sqliteInt.h a2b6836f09882cd32cca238b16ed61820b905e188a73df87438805693609030b +F src/sqliteInt.h 3fb893edbabad31aa7a32cecf3a5282cbd14391b5e1d143e23594d04fe568b36 F src/sqliteLimit.h 6878ab64bdeb8c24a1d762d45635e34b96da21132179023338c93f820eee6728 F src/status.c cb11f8589a6912af2da3bb1ec509a94dd8ef27df4d4c1a97e0bcf2309ece972b F src/table.c 0f141b58a16de7e2fbe81c308379e7279f4c6b50eb08efeec5892794a0ba30d1 @@ -857,7 +857,7 @@ F src/vdbetrace.c fe0bc29ebd4e02c8bc5c1945f1d2e6be5927ec12c06d89b03ef2a4def34bf8 F src/vdbevtab.c fc46b9cbd759dc013f0b3724549cc0d71379183c667df3a5988f7e2f1bd485f3 F src/vtab.c 5fb499d20494b7eecaadb7584634af9afcb374cb0524912b475fcb1712458a1b F src/vxworks.h d2988f4e5a61a4dfe82c6524dd3d6e4f2ce3cdb9 -F src/wal.c 5d071c855cac887f5bbf190ab3fee31ad7ee06237229dda00b11bc93f3352656 +F src/wal.c 9dc2b38da29d4aa24f0ce5610f36b6b911f152bc1af7ae09495d8bd57517d046 F src/wal.h 8c59ee7a835574396d7cbd04626d11fd849613e361a46e7e9519091ab03bdb29 F src/walker.c d5006d6b005e4ea7302ad390957a8d41ed83faa177e412f89bc5600a7462a014 F src/where.c c046dd58c3410f7b7528e1e6317cb876398557bad346d568ed8562321a7d002d @@ -2250,8 +2250,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 1a59cae3c31aea25cef3705cce2477e26515a0463cf9094bd29951899b758767 -R 0e3a507f138acab242e219ec9f3fad2f +P df4183ace93b788b798b258274bf6b651906c9f1cf2af4983e447cdf52904523 +R 94edb7bb8062fb14ef6badf564e5e7de U dan -Z df17b7a974fce400562bc6481f89f235 +Z 6fb05f3841c97a9cc6100a75f02a6296 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 41451e3485..cf395e0066 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -df4183ace93b788b798b258274bf6b651906c9f1cf2af4983e447cdf52904523 +ac5401c62b3ff03e43e01d066f4664491ce9b640ec64150a58b38839b4834afb diff --git a/src/sqliteInt.h b/src/sqliteInt.h index c0520c1995..4676ab1413 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1878,7 +1878,7 @@ struct sqlite3 { #define SCHEMA_TIME_FINISH 19 #define SCHEMA_TIME_N 20 -#define SCHEMA_TIME_TIMEOUT (0 * 1000 * 1000) +#define SCHEMA_TIME_TIMEOUT (1 * 1000 * 1000) diff --git a/src/wal.c b/src/wal.c index e136407c4d..904ffcdfaa 100644 --- a/src/wal.c +++ b/src/wal.c @@ -1693,9 +1693,9 @@ static int walIndexAppend(Wal *pWal, int iWal, u32 iFrame, u32 iPage){ */ if( pWal->aCommitTime ) t = sqlite3STimeNow(); if( idx==1 && sLoc.aPgno[0]!=0 ){ - int nByte = (int)((u8*)&sLoc.aHash[HASHTABLE_NSLOT] - (u8*)sLoc.aPgno); - assert( nByte>=0 && (nByte & 0x07)==0 ); - zero64((void*)sLoc.aPgno, nByte); + /* Special for BEDROCK branch: Zero only the aHash[] part. Not the + ** aPgno[] part of the page. */ + zero64((void*)sLoc.aHash, HASHTABLE_NSLOT * sizeof(sLoc.aHash[0])); } if( pWal->aCommitTime ){ pWal->aCommitTime[COMMIT_TIME_WALINDEX_MEMSETUS]+=sqlite3STimeNow()-t; @@ -1706,11 +1706,23 @@ static int walIndexAppend(Wal *pWal, int iWal, u32 iFrame, u32 iPage){ ** writing one or more dirty pages to the WAL to free up memory). ** Remove the remnants of that writers uncommitted transaction from ** the hash-table before writing any new entries. - */ - if( sLoc.aPgno[idx-1] ){ + ** + ** Special for BEDROCK branch: On this branch we do not assume that + ** the aPgno[] part of each hash-table has been zeroed. Therefore, we + ** only need to clear out the remnants of an old writer's transaction if + ** the hash table matches the aPgno[] entry (as it would if a write + ** transaction was interrupted). And, because this makes the test more + ** expensive, we only do the check for the first frame written by each + ** transaction. */ + if( sLoc.aPgno[idx-1] && iFrame-1==walidxGetMxFrame(&pWal->hdr, iWal) ){ if( pWal->aCommitTime ) t = sqlite3STimeNow(); - walCleanupHash(pWal); - assert( !sLoc.aPgno[idx-1] ); + nCollide = idx; + for(iKey=walHash(iPage); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){ + if( sLoc.aHash[iKey]==idx ){ + walCleanupHash(pWal); + } + if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT; + } if( pWal->aCommitTime ){ pWal->aCommitTime[COMMIT_TIME_WALINDEX_CLEANUPUS]+=sqlite3STimeNow()-t; }