Fossil SCM
Update the built-in SQLite to the version that includes the WAL restart race fix.
Commit
305ee2d1e2e2f464cf8c4d39cb4f882fc74dc11ca14dd96fa112154692bf9cfe
Parent
ba8756ac35322a1…
2 files changed
+81
-66
+2
-2
+81
-66
| --- extsrc/sqlite3.c | ||
| +++ extsrc/sqlite3.c | ||
| @@ -16,11 +16,11 @@ | ||
| 16 | 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | 19 | ** |
| 20 | 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | -** 88dce64242552e7443d9fb496f6f3ad71dc5 with changes in files: | |
| 21 | +** 7168988acbec2d8d51106a263e553f8942b8 with changes in files: | |
| 22 | 22 | ** |
| 23 | 23 | ** |
| 24 | 24 | */ |
| 25 | 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | 26 | #define SQLITE_CORE 1 |
| @@ -467,14 +467,14 @@ | ||
| 467 | 467 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 468 | 468 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 469 | 469 | */ |
| 470 | 470 | #define SQLITE_VERSION "3.52.0" |
| 471 | 471 | #define SQLITE_VERSION_NUMBER 3052000 |
| 472 | -#define SQLITE_SOURCE_ID "2026-03-02 17:11:44 88dce64242552e7443d9fb496f6f3ad71dc5b4a882ce21b7ef1d5ea4e26f1e61" | |
| 472 | +#define SQLITE_SOURCE_ID "2026-03-03 19:43:19 7168988acbec2d8d51106a263e553f8942b8b23d983dbbe5028e0f9be68cbb83" | |
| 473 | 473 | #define SQLITE_SCM_BRANCH "trunk" |
| 474 | 474 | #define SQLITE_SCM_TAGS "" |
| 475 | -#define SQLITE_SCM_DATETIME "2026-03-02T17:11:44.720Z" | |
| 475 | +#define SQLITE_SCM_DATETIME "2026-03-03T19:43:19.771Z" | |
| 476 | 476 | |
| 477 | 477 | /* |
| 478 | 478 | ** CAPI3REF: Run-Time Library Version Numbers |
| 479 | 479 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 480 | 480 | ** |
| @@ -69150,72 +69150,86 @@ | ||
| 69150 | 69150 | |
| 69151 | 69151 | if( pIter |
| 69152 | 69152 | && (rc = walBusyLock(pWal,xBusy,pBusyArg,WAL_READ_LOCK(0),1))==SQLITE_OK |
| 69153 | 69153 | ){ |
| 69154 | 69154 | u32 nBackfill = pInfo->nBackfill; |
| 69155 | - pInfo->nBackfillAttempted = mxSafeFrame; SEH_INJECT_FAULT; | |
| 69156 | - | |
| 69157 | - /* Sync the WAL to disk */ | |
| 69158 | - rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); | |
| 69159 | - | |
| 69160 | - /* If the database may grow as a result of this checkpoint, hint | |
| 69161 | - ** about the eventual size of the db file to the VFS layer. | |
| 69162 | - */ | |
| 69163 | - if( rc==SQLITE_OK ){ | |
| 69164 | - i64 nReq = ((i64)mxPage * szPage); | |
| 69165 | - i64 nSize; /* Current size of database file */ | |
| 69166 | - sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_START, 0); | |
| 69167 | - rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); | |
| 69168 | - if( rc==SQLITE_OK && nSize<nReq ){ | |
| 69169 | - if( (nSize+65536+(i64)pWal->hdr.mxFrame*szPage)<nReq ){ | |
| 69170 | - /* If the size of the final database is larger than the current | |
| 69171 | - ** database plus the amount of data in the wal file, plus the | |
| 69172 | - ** maximum size of the pending-byte page (65536 bytes), then | |
| 69173 | - ** must be corruption somewhere. */ | |
| 69174 | - rc = SQLITE_CORRUPT_BKPT; | |
| 69175 | - }else{ | |
| 69176 | - sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT,&nReq); | |
| 69177 | - } | |
| 69178 | - } | |
| 69179 | - | |
| 69180 | - } | |
| 69181 | - | |
| 69182 | - /* Iterate through the contents of the WAL, copying data to the db file */ | |
| 69183 | - while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ | |
| 69184 | - i64 iOffset; | |
| 69185 | - assert( walFramePgno(pWal, iFrame)==iDbpage ); | |
| 69186 | - SEH_INJECT_FAULT; | |
| 69187 | - if( AtomicLoad(&db->u1.isInterrupted) ){ | |
| 69188 | - rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT; | |
| 69189 | - break; | |
| 69190 | - } | |
| 69191 | - if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){ | |
| 69192 | - continue; | |
| 69193 | - } | |
| 69194 | - iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; | |
| 69195 | - /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ | |
| 69196 | - rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); | |
| 69197 | - if( rc!=SQLITE_OK ) break; | |
| 69198 | - iOffset = (iDbpage-1)*(i64)szPage; | |
| 69199 | - testcase( IS_BIG_INT(iOffset) ); | |
| 69200 | - rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); | |
| 69201 | - if( rc!=SQLITE_OK ) break; | |
| 69202 | - } | |
| 69203 | - sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0); | |
| 69204 | - | |
| 69205 | - /* If work was actually accomplished... */ | |
| 69206 | - if( rc==SQLITE_OK ){ | |
| 69207 | - if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ | |
| 69208 | - i64 szDb = pWal->hdr.nPage*(i64)szPage; | |
| 69209 | - testcase( IS_BIG_INT(szDb) ); | |
| 69210 | - rc = sqlite3OsTruncate(pWal->pDbFd, szDb); | |
| 69211 | - if( rc==SQLITE_OK ){ | |
| 69212 | - rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); | |
| 69213 | - } | |
| 69214 | - } | |
| 69215 | - if( rc==SQLITE_OK ){ | |
| 69216 | - AtomicStore(&pInfo->nBackfill, mxSafeFrame); SEH_INJECT_FAULT; | |
| 69155 | + WalIndexHdr *pLive = (WalIndexHdr*)walIndexHdr(pWal); | |
| 69156 | + | |
| 69157 | + /* Now that read-lock slot 0 is locked, check that the wal has not been | |
| 69158 | + ** wrapped since the header was read for this checkpoint. If it was, then | |
| 69159 | + ** there was no work to do anyway. In this case the | |
| 69160 | + ** (pInfo->nBackfill<pWal->hdr.mxFrame) test above only passed because | |
| 69161 | + ** pInfo->nBackfill had already been set to 0 by the writer that wrapped | |
| 69162 | + ** the wal file. It would also be dangerous to proceed, as there may be | |
| 69163 | + ** fewer than pWal->hdr.mxFrame valid frames in the wal file. */ | |
| 69164 | + int bChg = memcmp(pLive->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)); | |
| 69165 | + if( 0==bChg ){ | |
| 69166 | + pInfo->nBackfillAttempted = mxSafeFrame; SEH_INJECT_FAULT; | |
| 69167 | + | |
| 69168 | + /* Sync the WAL to disk */ | |
| 69169 | + rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); | |
| 69170 | + | |
| 69171 | + /* If the database may grow as a result of this checkpoint, hint | |
| 69172 | + ** about the eventual size of the db file to the VFS layer. | |
| 69173 | + */ | |
| 69174 | + if( rc==SQLITE_OK ){ | |
| 69175 | + i64 nReq = ((i64)mxPage * szPage); | |
| 69176 | + i64 nSize; /* Current size of database file */ | |
| 69177 | + sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_START, 0); | |
| 69178 | + rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); | |
| 69179 | + if( rc==SQLITE_OK && nSize<nReq ){ | |
| 69180 | + if( (nSize+65536+(i64)pWal->hdr.mxFrame*szPage)<nReq ){ | |
| 69181 | + /* If the size of the final database is larger than the current | |
| 69182 | + ** database plus the amount of data in the wal file, plus the | |
| 69183 | + ** maximum size of the pending-byte page (65536 bytes), then | |
| 69184 | + ** must be corruption somewhere. */ | |
| 69185 | + rc = SQLITE_CORRUPT_BKPT; | |
| 69186 | + }else{ | |
| 69187 | + sqlite3OsFileControlHint( | |
| 69188 | + pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq); | |
| 69189 | + } | |
| 69190 | + } | |
| 69191 | + | |
| 69192 | + } | |
| 69193 | + | |
| 69194 | + /* Iterate through the contents of the WAL, copying data to the | |
| 69195 | + ** db file */ | |
| 69196 | + while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ | |
| 69197 | + i64 iOffset; | |
| 69198 | + assert( walFramePgno(pWal, iFrame)==iDbpage ); | |
| 69199 | + SEH_INJECT_FAULT; | |
| 69200 | + if( AtomicLoad(&db->u1.isInterrupted) ){ | |
| 69201 | + rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT; | |
| 69202 | + break; | |
| 69203 | + } | |
| 69204 | + if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){ | |
| 69205 | + continue; | |
| 69206 | + } | |
| 69207 | + iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; | |
| 69208 | + /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ | |
| 69209 | + rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); | |
| 69210 | + if( rc!=SQLITE_OK ) break; | |
| 69211 | + iOffset = (iDbpage-1)*(i64)szPage; | |
| 69212 | + testcase( IS_BIG_INT(iOffset) ); | |
| 69213 | + rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); | |
| 69214 | + if( rc!=SQLITE_OK ) break; | |
| 69215 | + } | |
| 69216 | + sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0); | |
| 69217 | + | |
| 69218 | + /* If work was actually accomplished... */ | |
| 69219 | + if( rc==SQLITE_OK ){ | |
| 69220 | + if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ | |
| 69221 | + i64 szDb = pWal->hdr.nPage*(i64)szPage; | |
| 69222 | + testcase( IS_BIG_INT(szDb) ); | |
| 69223 | + rc = sqlite3OsTruncate(pWal->pDbFd, szDb); | |
| 69224 | + if( rc==SQLITE_OK ){ | |
| 69225 | + rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); | |
| 69226 | + } | |
| 69227 | + } | |
| 69228 | + if( rc==SQLITE_OK ){ | |
| 69229 | + AtomicStore(&pInfo->nBackfill, mxSafeFrame); SEH_INJECT_FAULT; | |
| 69230 | + } | |
| 69217 | 69231 | } |
| 69218 | 69232 | } |
| 69219 | 69233 | |
| 69220 | 69234 | /* Release the reader lock held while backfilling */ |
| 69221 | 69235 | walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1); |
| @@ -71261,10 +71275,11 @@ | ||
| 71261 | 71275 | } |
| 71262 | 71276 | } |
| 71263 | 71277 | |
| 71264 | 71278 | /* Copy data from the log to the database file. */ |
| 71265 | 71279 | if( rc==SQLITE_OK ){ |
| 71280 | + sqlite3FaultSim(660); | |
| 71266 | 71281 | if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){ |
| 71267 | 71282 | rc = SQLITE_CORRUPT_BKPT; |
| 71268 | 71283 | }else if( eMode2!=SQLITE_CHECKPOINT_NOOP ){ |
| 71269 | 71284 | rc = walCheckpoint(pWal, db, eMode2, xBusy2, pBusyArg, sync_flags,zBuf); |
| 71270 | 71285 | } |
| @@ -261856,11 +261871,11 @@ | ||
| 261856 | 261871 | int nArg, /* Number of args */ |
| 261857 | 261872 | sqlite3_value **apUnused /* Function arguments */ |
| 261858 | 261873 | ){ |
| 261859 | 261874 | assert( nArg==0 ); |
| 261860 | 261875 | UNUSED_PARAM2(nArg, apUnused); |
| 261861 | - sqlite3_result_text(pCtx, "fts5: 2026-03-02 17:11:44 88dce64242552e7443d9fb496f6f3ad71dc5b4a882ce21b7ef1d5ea4e26f1e61", -1, SQLITE_TRANSIENT); | |
| 261876 | + sqlite3_result_text(pCtx, "fts5: 2026-03-03 19:43:19 7168988acbec2d8d51106a263e553f8942b8b23d983dbbe5028e0f9be68cbb83", -1, SQLITE_TRANSIENT); | |
| 261862 | 261877 | } |
| 261863 | 261878 | |
| 261864 | 261879 | /* |
| 261865 | 261880 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 261866 | 261881 | ** |
| 261867 | 261882 |
| --- extsrc/sqlite3.c | |
| +++ extsrc/sqlite3.c | |
| @@ -16,11 +16,11 @@ | |
| 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | ** |
| 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | ** 88dce64242552e7443d9fb496f6f3ad71dc5 with changes in files: |
| 22 | ** |
| 23 | ** |
| 24 | */ |
| 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | #define SQLITE_CORE 1 |
| @@ -467,14 +467,14 @@ | |
| 467 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 468 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 469 | */ |
| 470 | #define SQLITE_VERSION "3.52.0" |
| 471 | #define SQLITE_VERSION_NUMBER 3052000 |
| 472 | #define SQLITE_SOURCE_ID "2026-03-02 17:11:44 88dce64242552e7443d9fb496f6f3ad71dc5b4a882ce21b7ef1d5ea4e26f1e61" |
| 473 | #define SQLITE_SCM_BRANCH "trunk" |
| 474 | #define SQLITE_SCM_TAGS "" |
| 475 | #define SQLITE_SCM_DATETIME "2026-03-02T17:11:44.720Z" |
| 476 | |
| 477 | /* |
| 478 | ** CAPI3REF: Run-Time Library Version Numbers |
| 479 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 480 | ** |
| @@ -69150,72 +69150,86 @@ | |
| 69150 | |
| 69151 | if( pIter |
| 69152 | && (rc = walBusyLock(pWal,xBusy,pBusyArg,WAL_READ_LOCK(0),1))==SQLITE_OK |
| 69153 | ){ |
| 69154 | u32 nBackfill = pInfo->nBackfill; |
| 69155 | pInfo->nBackfillAttempted = mxSafeFrame; SEH_INJECT_FAULT; |
| 69156 | |
| 69157 | /* Sync the WAL to disk */ |
| 69158 | rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); |
| 69159 | |
| 69160 | /* If the database may grow as a result of this checkpoint, hint |
| 69161 | ** about the eventual size of the db file to the VFS layer. |
| 69162 | */ |
| 69163 | if( rc==SQLITE_OK ){ |
| 69164 | i64 nReq = ((i64)mxPage * szPage); |
| 69165 | i64 nSize; /* Current size of database file */ |
| 69166 | sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_START, 0); |
| 69167 | rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); |
| 69168 | if( rc==SQLITE_OK && nSize<nReq ){ |
| 69169 | if( (nSize+65536+(i64)pWal->hdr.mxFrame*szPage)<nReq ){ |
| 69170 | /* If the size of the final database is larger than the current |
| 69171 | ** database plus the amount of data in the wal file, plus the |
| 69172 | ** maximum size of the pending-byte page (65536 bytes), then |
| 69173 | ** must be corruption somewhere. */ |
| 69174 | rc = SQLITE_CORRUPT_BKPT; |
| 69175 | }else{ |
| 69176 | sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT,&nReq); |
| 69177 | } |
| 69178 | } |
| 69179 | |
| 69180 | } |
| 69181 | |
| 69182 | /* Iterate through the contents of the WAL, copying data to the db file */ |
| 69183 | while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ |
| 69184 | i64 iOffset; |
| 69185 | assert( walFramePgno(pWal, iFrame)==iDbpage ); |
| 69186 | SEH_INJECT_FAULT; |
| 69187 | if( AtomicLoad(&db->u1.isInterrupted) ){ |
| 69188 | rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT; |
| 69189 | break; |
| 69190 | } |
| 69191 | if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){ |
| 69192 | continue; |
| 69193 | } |
| 69194 | iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; |
| 69195 | /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ |
| 69196 | rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); |
| 69197 | if( rc!=SQLITE_OK ) break; |
| 69198 | iOffset = (iDbpage-1)*(i64)szPage; |
| 69199 | testcase( IS_BIG_INT(iOffset) ); |
| 69200 | rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); |
| 69201 | if( rc!=SQLITE_OK ) break; |
| 69202 | } |
| 69203 | sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0); |
| 69204 | |
| 69205 | /* If work was actually accomplished... */ |
| 69206 | if( rc==SQLITE_OK ){ |
| 69207 | if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ |
| 69208 | i64 szDb = pWal->hdr.nPage*(i64)szPage; |
| 69209 | testcase( IS_BIG_INT(szDb) ); |
| 69210 | rc = sqlite3OsTruncate(pWal->pDbFd, szDb); |
| 69211 | if( rc==SQLITE_OK ){ |
| 69212 | rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); |
| 69213 | } |
| 69214 | } |
| 69215 | if( rc==SQLITE_OK ){ |
| 69216 | AtomicStore(&pInfo->nBackfill, mxSafeFrame); SEH_INJECT_FAULT; |
| 69217 | } |
| 69218 | } |
| 69219 | |
| 69220 | /* Release the reader lock held while backfilling */ |
| 69221 | walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1); |
| @@ -71261,10 +71275,11 @@ | |
| 71261 | } |
| 71262 | } |
| 71263 | |
| 71264 | /* Copy data from the log to the database file. */ |
| 71265 | if( rc==SQLITE_OK ){ |
| 71266 | if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){ |
| 71267 | rc = SQLITE_CORRUPT_BKPT; |
| 71268 | }else if( eMode2!=SQLITE_CHECKPOINT_NOOP ){ |
| 71269 | rc = walCheckpoint(pWal, db, eMode2, xBusy2, pBusyArg, sync_flags,zBuf); |
| 71270 | } |
| @@ -261856,11 +261871,11 @@ | |
| 261856 | int nArg, /* Number of args */ |
| 261857 | sqlite3_value **apUnused /* Function arguments */ |
| 261858 | ){ |
| 261859 | assert( nArg==0 ); |
| 261860 | UNUSED_PARAM2(nArg, apUnused); |
| 261861 | sqlite3_result_text(pCtx, "fts5: 2026-03-02 17:11:44 88dce64242552e7443d9fb496f6f3ad71dc5b4a882ce21b7ef1d5ea4e26f1e61", -1, SQLITE_TRANSIENT); |
| 261862 | } |
| 261863 | |
| 261864 | /* |
| 261865 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 261866 | ** |
| 261867 |
| --- extsrc/sqlite3.c | |
| +++ extsrc/sqlite3.c | |
| @@ -16,11 +16,11 @@ | |
| 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | ** |
| 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | ** 7168988acbec2d8d51106a263e553f8942b8 with changes in files: |
| 22 | ** |
| 23 | ** |
| 24 | */ |
| 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | #define SQLITE_CORE 1 |
| @@ -467,14 +467,14 @@ | |
| 467 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 468 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 469 | */ |
| 470 | #define SQLITE_VERSION "3.52.0" |
| 471 | #define SQLITE_VERSION_NUMBER 3052000 |
| 472 | #define SQLITE_SOURCE_ID "2026-03-03 19:43:19 7168988acbec2d8d51106a263e553f8942b8b23d983dbbe5028e0f9be68cbb83" |
| 473 | #define SQLITE_SCM_BRANCH "trunk" |
| 474 | #define SQLITE_SCM_TAGS "" |
| 475 | #define SQLITE_SCM_DATETIME "2026-03-03T19:43:19.771Z" |
| 476 | |
| 477 | /* |
| 478 | ** CAPI3REF: Run-Time Library Version Numbers |
| 479 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 480 | ** |
| @@ -69150,72 +69150,86 @@ | |
| 69150 | |
| 69151 | if( pIter |
| 69152 | && (rc = walBusyLock(pWal,xBusy,pBusyArg,WAL_READ_LOCK(0),1))==SQLITE_OK |
| 69153 | ){ |
| 69154 | u32 nBackfill = pInfo->nBackfill; |
| 69155 | WalIndexHdr *pLive = (WalIndexHdr*)walIndexHdr(pWal); |
| 69156 | |
| 69157 | /* Now that read-lock slot 0 is locked, check that the wal has not been |
| 69158 | ** wrapped since the header was read for this checkpoint. If it was, then |
| 69159 | ** there was no work to do anyway. In this case the |
| 69160 | ** (pInfo->nBackfill<pWal->hdr.mxFrame) test above only passed because |
| 69161 | ** pInfo->nBackfill had already been set to 0 by the writer that wrapped |
| 69162 | ** the wal file. It would also be dangerous to proceed, as there may be |
| 69163 | ** fewer than pWal->hdr.mxFrame valid frames in the wal file. */ |
| 69164 | int bChg = memcmp(pLive->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)); |
| 69165 | if( 0==bChg ){ |
| 69166 | pInfo->nBackfillAttempted = mxSafeFrame; SEH_INJECT_FAULT; |
| 69167 | |
| 69168 | /* Sync the WAL to disk */ |
| 69169 | rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); |
| 69170 | |
| 69171 | /* If the database may grow as a result of this checkpoint, hint |
| 69172 | ** about the eventual size of the db file to the VFS layer. |
| 69173 | */ |
| 69174 | if( rc==SQLITE_OK ){ |
| 69175 | i64 nReq = ((i64)mxPage * szPage); |
| 69176 | i64 nSize; /* Current size of database file */ |
| 69177 | sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_START, 0); |
| 69178 | rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); |
| 69179 | if( rc==SQLITE_OK && nSize<nReq ){ |
| 69180 | if( (nSize+65536+(i64)pWal->hdr.mxFrame*szPage)<nReq ){ |
| 69181 | /* If the size of the final database is larger than the current |
| 69182 | ** database plus the amount of data in the wal file, plus the |
| 69183 | ** maximum size of the pending-byte page (65536 bytes), then |
| 69184 | ** must be corruption somewhere. */ |
| 69185 | rc = SQLITE_CORRUPT_BKPT; |
| 69186 | }else{ |
| 69187 | sqlite3OsFileControlHint( |
| 69188 | pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq); |
| 69189 | } |
| 69190 | } |
| 69191 | |
| 69192 | } |
| 69193 | |
| 69194 | /* Iterate through the contents of the WAL, copying data to the |
| 69195 | ** db file */ |
| 69196 | while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ |
| 69197 | i64 iOffset; |
| 69198 | assert( walFramePgno(pWal, iFrame)==iDbpage ); |
| 69199 | SEH_INJECT_FAULT; |
| 69200 | if( AtomicLoad(&db->u1.isInterrupted) ){ |
| 69201 | rc = db->mallocFailed ? SQLITE_NOMEM_BKPT : SQLITE_INTERRUPT; |
| 69202 | break; |
| 69203 | } |
| 69204 | if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ){ |
| 69205 | continue; |
| 69206 | } |
| 69207 | iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; |
| 69208 | /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ |
| 69209 | rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); |
| 69210 | if( rc!=SQLITE_OK ) break; |
| 69211 | iOffset = (iDbpage-1)*(i64)szPage; |
| 69212 | testcase( IS_BIG_INT(iOffset) ); |
| 69213 | rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); |
| 69214 | if( rc!=SQLITE_OK ) break; |
| 69215 | } |
| 69216 | sqlite3OsFileControl(pWal->pDbFd, SQLITE_FCNTL_CKPT_DONE, 0); |
| 69217 | |
| 69218 | /* If work was actually accomplished... */ |
| 69219 | if( rc==SQLITE_OK ){ |
| 69220 | if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ |
| 69221 | i64 szDb = pWal->hdr.nPage*(i64)szPage; |
| 69222 | testcase( IS_BIG_INT(szDb) ); |
| 69223 | rc = sqlite3OsTruncate(pWal->pDbFd, szDb); |
| 69224 | if( rc==SQLITE_OK ){ |
| 69225 | rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags)); |
| 69226 | } |
| 69227 | } |
| 69228 | if( rc==SQLITE_OK ){ |
| 69229 | AtomicStore(&pInfo->nBackfill, mxSafeFrame); SEH_INJECT_FAULT; |
| 69230 | } |
| 69231 | } |
| 69232 | } |
| 69233 | |
| 69234 | /* Release the reader lock held while backfilling */ |
| 69235 | walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1); |
| @@ -71261,10 +71275,11 @@ | |
| 71275 | } |
| 71276 | } |
| 71277 | |
| 71278 | /* Copy data from the log to the database file. */ |
| 71279 | if( rc==SQLITE_OK ){ |
| 71280 | sqlite3FaultSim(660); |
| 71281 | if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){ |
| 71282 | rc = SQLITE_CORRUPT_BKPT; |
| 71283 | }else if( eMode2!=SQLITE_CHECKPOINT_NOOP ){ |
| 71284 | rc = walCheckpoint(pWal, db, eMode2, xBusy2, pBusyArg, sync_flags,zBuf); |
| 71285 | } |
| @@ -261856,11 +261871,11 @@ | |
| 261871 | int nArg, /* Number of args */ |
| 261872 | sqlite3_value **apUnused /* Function arguments */ |
| 261873 | ){ |
| 261874 | assert( nArg==0 ); |
| 261875 | UNUSED_PARAM2(nArg, apUnused); |
| 261876 | sqlite3_result_text(pCtx, "fts5: 2026-03-03 19:43:19 7168988acbec2d8d51106a263e553f8942b8b23d983dbbe5028e0f9be68cbb83", -1, SQLITE_TRANSIENT); |
| 261877 | } |
| 261878 | |
| 261879 | /* |
| 261880 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 261881 | ** |
| 261882 |
+2
-2
| --- extsrc/sqlite3.h | ||
| +++ extsrc/sqlite3.h | ||
| @@ -146,14 +146,14 @@ | ||
| 146 | 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | 148 | */ |
| 149 | 149 | #define SQLITE_VERSION "3.52.0" |
| 150 | 150 | #define SQLITE_VERSION_NUMBER 3052000 |
| 151 | -#define SQLITE_SOURCE_ID "2026-03-02 17:11:44 88dce64242552e7443d9fb496f6f3ad71dc5b4a882ce21b7ef1d5ea4e26f1e61" | |
| 151 | +#define SQLITE_SOURCE_ID "2026-03-03 19:43:19 7168988acbec2d8d51106a263e553f8942b8b23d983dbbe5028e0f9be68cbb83" | |
| 152 | 152 | #define SQLITE_SCM_BRANCH "trunk" |
| 153 | 153 | #define SQLITE_SCM_TAGS "" |
| 154 | -#define SQLITE_SCM_DATETIME "2026-03-02T17:11:44.720Z" | |
| 154 | +#define SQLITE_SCM_DATETIME "2026-03-03T19:43:19.771Z" | |
| 155 | 155 | |
| 156 | 156 | /* |
| 157 | 157 | ** CAPI3REF: Run-Time Library Version Numbers |
| 158 | 158 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 159 | 159 | ** |
| 160 | 160 |
| --- extsrc/sqlite3.h | |
| +++ extsrc/sqlite3.h | |
| @@ -146,14 +146,14 @@ | |
| 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | */ |
| 149 | #define SQLITE_VERSION "3.52.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3052000 |
| 151 | #define SQLITE_SOURCE_ID "2026-03-02 17:11:44 88dce64242552e7443d9fb496f6f3ad71dc5b4a882ce21b7ef1d5ea4e26f1e61" |
| 152 | #define SQLITE_SCM_BRANCH "trunk" |
| 153 | #define SQLITE_SCM_TAGS "" |
| 154 | #define SQLITE_SCM_DATETIME "2026-03-02T17:11:44.720Z" |
| 155 | |
| 156 | /* |
| 157 | ** CAPI3REF: Run-Time Library Version Numbers |
| 158 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 159 | ** |
| 160 |
| --- extsrc/sqlite3.h | |
| +++ extsrc/sqlite3.h | |
| @@ -146,14 +146,14 @@ | |
| 146 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 147 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 148 | */ |
| 149 | #define SQLITE_VERSION "3.52.0" |
| 150 | #define SQLITE_VERSION_NUMBER 3052000 |
| 151 | #define SQLITE_SOURCE_ID "2026-03-03 19:43:19 7168988acbec2d8d51106a263e553f8942b8b23d983dbbe5028e0f9be68cbb83" |
| 152 | #define SQLITE_SCM_BRANCH "trunk" |
| 153 | #define SQLITE_SCM_TAGS "" |
| 154 | #define SQLITE_SCM_DATETIME "2026-03-03T19:43:19.771Z" |
| 155 | |
| 156 | /* |
| 157 | ** CAPI3REF: Run-Time Library Version Numbers |
| 158 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 159 | ** |
| 160 |