From: dan Date: Fri, 20 Feb 2026 18:27:02 +0000 (+0000) Subject: Fix OMIT_CONCURRENT builds on this branch. X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=ea504caad194ca3f9de9caa846ab572193809bc7;p=thirdparty%2Fsqlite.git Fix OMIT_CONCURRENT builds on this branch. FossilOrigin-Name: 461907251e63055b6ecb56ae8b687c6cead6bf0870a78d50855c54568e2f2391 --- diff --git a/manifest b/manifest index c9e205f292..862aaca7c4 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\stests\sfor\sthe\snew\scode\sin\sbtree.c\son\sthis\sbranch. -D 2026-02-20T16:58:45.446 +C Fix\sOMIT_CONCURRENT\sbuilds\son\sthis\sbranch. +D 2026-02-20T18:27:02.921 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -688,7 +688,7 @@ F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523 F src/bitvec.c 1a048c91b2fbccbbc32dcefa757f93216c0f518ed2bc0b4db39947264479ad06 F src/btmutex.c 30dada73a819a1ef5b7583786370dce1842e12e1ad941e4d05ac29695528daea F src/btrecord.c 11e78cc540398deeb6f7860ae1732dcf72fa90c0067c931ebe19cb46b2a6ac92 -F src/btree.c 29db13c69d228fc414d776e67d69ce0545df442e7e4dd56864e4565db99bb663 +F src/btree.c ae7eb53c073728fbf65c16bcbe92c0228f8a426f2e9a3f82897dcd0a12cc3467 F src/btree.h c7b48ffbe4f18885bb83eab53c33599d52628b844b3c2d93199484695728c36d F src/btreeInt.h f896cac9794a34bd1f817b1be291b9d074301158d91e5e39b971f5d2f61aeab6 F src/build.c 899c33f67843888e9f5c996e66c5a4eeca0016eebafcf5e261b32b5df0f1a50c @@ -712,7 +712,7 @@ F src/insert.c dfd311b0ac2d4f6359e62013db67799757f4d2cc56cca5c10f4888acfbbfa3fd F src/json.c 8b6341a419150b28530cc21e3951b2238c35cdc312f11b2ca29017fe4b1dedc0 F src/legacy.c d7874bc885906868cd51e6c2156698f2754f02d9eee1bae2d687323c3ca8e5aa F src/loadext.c 56a542244fbefc739a2ef57fac007c16b2aefdb4377f584e9547db2ce3e071f9 -F src/main.c 966d6f52df89001542b42396785cfe7d62cc66b06dd123c8fb24788bfe6047f1 +F src/main.c 6a81e57f9749b16fe333edf36760afe4dd1e0de75dc147b369660dd10f8547fa F src/malloc.c 422f7e0498e1c9ef967f06283b6f2c0b16db6b905d8e06f6dbc8baaa3e4e6c5a F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c 3bb59158c38e05f6270e761a9f435bf19827a264c13d1631c58b84bdc96d73b2 @@ -1009,7 +1009,7 @@ F test/concurrent8.test b93937e74a8efb8b84f2fea7595b53418c5f29777bbe9cbdb5dc219b F test/concurrent9.test 4b59e327c524d09c992f94b5cc7202cfed124ecbb85823c30308b5e1c7e16dca F test/concurrentA.test 2272fecbf128ac5a8d7b0c9cfe732c4935a5a1b915e237c93ef8dce39f7df670 F test/concurrentB.test b85e8adc4c1acf9b1cc0e8c2012348dc116d4ce032bb699d039f10de9b4cca71 -F test/concurrentC.test d5d4b9ce51a2d1b6fa5f652b24b077dc615085c0cdba302317f727923846ad10 +F test/concurrentC.test fd85071ee3792a1fe9c7faf5cdf70a338cdb1aeaa127ba6d1394db84b8fe0dbe F test/concurrentD.test ded9c6e975af21652717afb87c8632395610372bc276d1efa701af05233f0c69 F test/conflict.test 3307ffdf988e04b01c4e942d8aa369a977f085bf629f43a627c9a77f39d65926 F test/conflict2.test 5557909ce683b1073982f5d1b61dfb1d41e369533bfdaf003180c5bc87282dd1 @@ -2238,8 +2238,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 5fe1e2bb8e2049c33e29fa852bebfc151adf2ea4a05971b58ca7f6963c74bcea -R 9e48e63cc9ae39b6143f273626e4fe0e +P 9202cd04f74ae69bb82c6574c2259d270ae35c9476cccc2e20f3c1f9c8a6c995 +R 5a7bc9e12a953155b053b6e3af37cb59 U dan -Z 50ea9f4a1b2820f61ff1e25001651907 +Z 1f713f7a76b880e3040163159533c150 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index c4005bafb4..c3b9828d6b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9202cd04f74ae69bb82c6574c2259d270ae35c9476cccc2e20f3c1f9c8a6c995 +461907251e63055b6ecb56ae8b687c6cead6bf0870a78d50855c54568e2f2391 diff --git a/src/btree.c b/src/btree.c index 5e015ec042..ac28552890 100644 --- a/src/btree.c +++ b/src/btree.c @@ -636,19 +636,21 @@ static void btreeBcFreeWriteArray(BtWrite *aWrite, int nWrite){ /* !defined(SQLITE_OMIT_CONCURRENT) ** -** If this is a BEGIN CONCURRENT transactin, update the BtShared.conc +** If this is a BEGIN CONCURRENT transaction, update the BtShared.conc ** object to reflect the fact that nSvpt savepoints are now open. */ static void btreeBcSavepointBegin(BtShared *pBt, int nSvpt){ - if( nSvpt>=BTCONC_MAX_SAVEPOINT ){ - /* More than 8 nested savepoints. No logical OCC this transaction. */ - pBt->conc.eState = BTCONC_STATE_RETIRED; - }else if( nSvpt>pBt->conc.nSvpt ){ - int ii; - for(ii=pBt->conc.nSvpt; iiconc.aSvpt[ii] = pBt->conc.nWrite; + if( pBt->conc.eState==BTCONC_STATE_INUSE ){ + if( nSvpt>=BTCONC_MAX_SAVEPOINT ){ + /* More than 8 nested savepoints. No logical OCC this transaction. */ + pBt->conc.eState = BTCONC_STATE_RETIRED; + }else if( nSvpt>pBt->conc.nSvpt ){ + int ii; + for(ii=pBt->conc.nSvpt; iiconc.aSvpt[ii] = pBt->conc.nWrite; + } + pBt->conc.nSvpt = nSvpt; } - pBt->conc.nSvpt = nSvpt; } } @@ -954,6 +956,8 @@ static void btreeBcRemoveOldest(BtSharedLog *pBtLog){ #ifdef SQLITE_DEBUG { + /* Check that BtSharedLog.nByte is the sum of the nByte member of + ** all log entries. */ i64 nTotal = 0; BtSharedLogEntry *pEntry = pBtLog->pFirst; for( ; pEntry; pEntry=pEntry->pLogNext) nTotal += pEntry->nByte; @@ -1175,15 +1179,22 @@ int btreeBcReadIndexSort(BtConcurrent *pBtConc){ ); if( res<=0 ){ - /* This range overlaps with the previous one. This call is to - ** figure out if it is entirely encapsulated within the previous - ** range (if res<=0) or if it only partially overlaps and the - ** max of the previous range needs to be extended (res>0). */ - res = btreeBcRecordCompare( - pBtConc->pUnpacked, pIn->pKeyInfo, - pIn->aRecMax, pIn->nRecMax, pIn->drc_max, - pOut->aRecMax, pOut->nRecMax, pOut->drc_max - ); + + if( pIn->aRecMax!=pIn->aRecMin || pOut->aRecMax!=pOut->aRecMin ){ + /* This range overlaps with the previous one. This call is to + ** figure out if it is entirely encapsulated within the previous + ** range (if res<=0) or if it only partially overlaps and the + ** max of the previous range needs to be extended (res>0). + ** + ** This test is not required if both pOut and pIn are an exact + ** key searchs, not true ranges (if aRecMax==aRecMin). In that + ** case, pIn is always wholly encapsulated by pOut. */ + res = btreeBcRecordCompare( + pBtConc->pUnpacked, pIn->pKeyInfo, + pIn->aRecMax, pIn->nRecMax, pIn->drc_max, + pOut->aRecMax, pOut->nRecMax, pOut->drc_max + ); + } sqlite3KeyInfoUnref(pIn->pKeyInfo); if( pIn->aRecMin!=pIn->aRecMax ) sqlite3_free(pIn->aRecMin); @@ -1288,11 +1299,14 @@ int btreeBcWriteIndexSort( ** Figure out which table or index this is using the schema managed by ** pBt. Return the name of the table. If pzIdx is not NULL and the root ** page belongs to an index, set (*pzIdx) to the name of the index. +** +** This is used to identify the specific table and index on which a +** conflict occurred in an sqlite3_log() message. */ static const char *btreeBcRootToObject( - BtShared *pBt, - Pgno iRoot, - const char **pzIdx + BtShared *pBt, /* Shared b-tree object */ + Pgno iRoot, /* Root page of table or index */ + const char **pzIdx /* OUT: Index name (or NULL) */ ){ Schema *pSchema = pBt->pSchema; const char *zRet = 0; @@ -1401,7 +1415,7 @@ int btreeBcDetectIndexConflict( }else{ /* Most index scans are not really scans, but exact lookups. In ** this case pRead->aRecMin==pRead->aRecMax. */ - assert( (pRead->aRecMin!=pRead->aRecMax) || pRead->drc_min>0 ); + assert( (pRead->aRecMin!=pRead->aRecMax) || pRead->drc_min>=0 ); int cmp = btreeBcRecordCompare( pBtConc->pUnpacked, @@ -1655,11 +1669,9 @@ static void btreeBcDisconnect(BtShared *pBt){ sqlite3_mutex_leave( sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MAIN) ); if( pFree ){ - /* TODO: Free existing log entries */ while( pFree->pFirst ){ btreeBcRemoveOldest(pFree); } - sqlite3_mutex_free(pFree->mutex); sqlite3_free(pFree); } @@ -2255,6 +2267,9 @@ static int btreeBcTryLogicalCommit(Btree *p, int *pbLog){ # define btreePtrmapCheck(y,z) # define btreeBcEndTransaction(db, pBt) +# define btreeBcDisconnect(pBt) +# define btreeBcScanFinish(pCsr) SQLITE_OK +# define btreeBcScanStart(pCsr,eRead,pKey,iKey) SQLITE_OK #endif /* SQLITE_OMIT_CONCURRENT */ static void releasePage(MemPage *pPage); /* Forward reference */ @@ -6360,7 +6375,6 @@ static void btreeEndTransaction(Btree *p){ ** the record of all pages read within the transaction. */ btreePtrmapDelete(pBt); btreeBcEndTransaction(db, pBt); - pBt->conc.eState = BTCONC_STATE_NONE; sqlite3PagerEndConcurrent(pBt->pPager); btreeIntegrity(p); } @@ -6830,6 +6844,7 @@ int sqlite3BtreeCloseCursor(BtCursor *pCur){ sqlite3BtreeEnter(pBtree); assert( pBt->pCursor!=0 ); +#ifndef SQLITE_OMIT_CONCURRENT if( SQLITE_OK!=btreeBcScanFinish(pCur) ){ /* Allocation failed in btreeBcScanFinish(), but we have no way ** to return the error to the user. So just disable the BtConcurrent @@ -6837,6 +6852,7 @@ int sqlite3BtreeCloseCursor(BtCursor *pCur){ assert( pBt->conc.eState==BTCONC_STATE_INUSE ); pBt->conc.eState = BTCONC_STATE_RETIRED; } +#endif if( pBt->pCursor==pCur ){ pBt->pCursor = pCur->pNext; @@ -13693,15 +13709,16 @@ int sqlite3BtreeExclusiveLock(Btree *p){ Pgno pgno = 0; BtShared *pBt = p->pBt; assert( p->inTrans==TRANS_WRITE && pBt->pPage1 ); - memset(db->aCommit, 0, sizeof(db->aCommit)); sqlite3BtreeEnter(p); + +#ifdef SQLITE_OMIT_CONCURRENT + rc = sqlite3PagerExclusiveLock(pBt->pPager, 0, 0); +#else + memset(db->aCommit, 0, sizeof(db->aCommit)); rc = sqlite3PagerExclusiveLock(pBt->pPager, (db->eConcurrent==CONCURRENT_SCHEMA) ? 0 : pBt->pPage1->pDbPage, db->aCommit ); -#ifdef SQLITE_OMIT_CONCURRENT - assert( db->aCommit[SQLITE_COMMIT_CONFLICT_PGNO]==0 ); -#else if( rc==SQLITE_BUSY_SNAPSHOT && db->aCommit[SQLITE_COMMIT_CONFLICT_PGNO]>1 diff --git a/src/main.c b/src/main.c index 19e6ea83fb..6ff9a76fd6 100644 --- a/src/main.c +++ b/src/main.c @@ -753,12 +753,14 @@ int sqlite3_config(int op, ...){ } case SQLITE_CONFIG_SHAREDLOG_MAXSIZE: { +#ifndef SQLITE_OMIT_CONCURRENT i64 iVal = va_arg(ap, sqlite3_int64); if( iVal<0 ){ sqlite3GlobalConfig.nSharedLogMaxSize =SQLITE_DEFAULT_SHAREDLOG_MAXSIZE; }else{ sqlite3GlobalConfig.nSharedLogMaxSize = iVal; } +#endif break; } diff --git a/test/concurrentC.test b/test/concurrentC.test index 839a7b1a33..9706ea3d51 100644 --- a/test/concurrentC.test +++ b/test/concurrentC.test @@ -534,12 +534,11 @@ do_test 11.3 { BEGIN CONCURRENT; INSERT INTO t1 VALUES(11, 11); COMMIT; BEGIN CONCURRENT; INSERT INTO t2 VALUES(4, 4); COMMIT; } db2 +} {8192} -} {} - -do_test 11.1 { +do_test 11.4 { list [file size test.db-wal] [file size test.db-wal2] -} {8416 2128} +} {8416 8416} do_execsql_test 11.5 COMMIT