]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix another problem with the sqlite3_log() message identifying the table or index...
authordan <Dan Kennedy>
Tue, 4 Jun 2024 15:47:03 +0000 (15:47 +0000)
committerdan <Dan Kennedy>
Tue, 4 Jun 2024 15:47:03 +0000 (15:47 +0000)
FossilOrigin-Name: 885e01ae3547d83443fd656fa0b3aec5e6ced4836a8f9207cb9c1bf89431f11c

manifest
manifest.uuid
src/btree.c
test/concurrent5.test

index e2ff9854d69fa82fdb0c62650fb705525f90ef92..9bd48c5a4f7ed041b47491fb453aab7a36895cac 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sproblem\sin\sSQLITE_DIRECT_OVERFLOW_READ\sbuilds\sthat\scould\sallow\sa\sconcurrent\stransaction\sto\sbe\scommitted\seven\sif\sit\sread\sfrom\san\soverflow\spage\sthat\swas\smodified\sconcurrently,\sin\scases\swhere\sthe\soverflow\spage\swas\swritten\swithout\salso\swriting\sthe\sb-tree\spage\sto\swhich\sit\sis\slinked.
-D 2024-06-04T15:33:45.455
+C Fix\sanother\sproblem\swith\sthe\ssqlite3_log()\smessage\sidentifying\sthe\stable\sor\sindex\sthat\sa\sconflicting\spage\sbelongs\sto.
+D 2024-06-04T15:47:03.558
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -685,7 +685,7 @@ F src/auth.c 19b7ccacae3dfba23fc6f1d0af68134fa216e9040e53b0681b4715445ea030b4
 F src/backup.c 5c97e8023aab1ce14a42387eb3ae00ba5a0644569e3476f38661fa6f824c3523
 F src/bitvec.c 501daeef838fa82a9fb53540d72f29e3d9172c8867f1e19f94f681e2e20b966e
 F src/btmutex.c 79a43670447eacc651519a429f6ece9fd638563cf95b469d6891185ddae2b522
-F src/btree.c 8f47bb2c8f7259604f8007730a74ba1337ea7b782a3138cb6395c84d6eaf686f
+F src/btree.c c3d8e61da147d423c8eae40391693a921b1c99bee8964ff73458bff372178869
 F src/btree.h d906e4d53f483c83d471d99479fa73fcdf20696305d578876f46ee283f3507cb
 F src/btreeInt.h 4e04041380c1ac1f4b2e80d7fb072c6d74c1be605a4271625347ba06b651e37a
 F src/build.c 9bbb6fcdde621fc52ebadc29ed9fa51837c6a9f0576abe2dfe0a93b2bb41694b
@@ -998,7 +998,7 @@ F test/concurrent.test fb624ddac9b008f347685911f90b6b5a022fd0a3f884c0ffef8056bc4
 F test/concurrent2.test 847cd11edc82229a95e1eaf88b55c974430b0f669cefd67a453d274e3480981c
 F test/concurrent3.test 82923fc2ea7321144b4448f98ea38aa316ddceef9020a392c5f6dea536506434
 F test/concurrent4.test e0b12cd467137e50259df3b4f837507e82aaa07c35941c88664dc8ed1d089c44
-F test/concurrent5.test 0c16cbf7446af162a14e6def30445e94016064eb994e5aa4ebb2bebc59554176
+F test/concurrent5.test da0562758d90d8f05d8852092196415436ebe80f12e3904e1f6806a696905608
 F test/concurrent6.test a7860e9ca13bb5fb76bcf41c5524fbfa9c37e6e258ecf84ffb5748a272488c67
 F test/concurrent7.test b96fa5c4cfdf8d5c0bc66b6934214500bad0260884a736f054ccc76e81aae85d
 F test/concurrent8.test b93937e74a8efb8b84f2fea7595b53418c5f29777bbe9cbdb5dc219b3dd72a7d
@@ -2197,9 +2197,9 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P eed5aa7cdf786918ab3aca823c5e1f45e61f7fb53528f7935457e06f677c8d21
-Q +49263c9136c81638833aa71c9d590e318ead2ca60c4d7207ebf8884174df9c8f
-R 2f8e74399e645bdf8ffbc39fd13d5ee8
+P f1d17258f406e3ccfd5a08e7ea0d362da0a198eea9081022ab30bd90ffca8312
+Q +d033d9435007c7753d48f019626cf22c82569f93506a7e0158a09d5c4274baae
+R 5c84942ffa12b3ae47c0cbc493c86325
 U dan
-Z 358fe08ba91b32e742af35cd7485d0c6
+Z 82cd9f660cb00255584d7e25ac37a1f7
 # Remove this line to create a well-formed Fossil manifest.
index 0f16069d94065a542670eb8ca92951cb51f05634..7365943f66d95cac5c62daf17bca6c1889145886 100644 (file)
@@ -1 +1 @@
-f1d17258f406e3ccfd5a08e7ea0d362da0a198eea9081022ab30bd90ffca8312
\ No newline at end of file
+885e01ae3547d83443fd656fa0b3aec5e6ced4836a8f9207cb9c1bf89431f11c
\ No newline at end of file
index 2229060e9efc85d48ff860b51388a15d75c645af..a3a1bcc9d985573a66fd648fb4e5ed2baa571c78 100644 (file)
@@ -6578,6 +6578,7 @@ bypass_moveto_root:
       pCur->pPage = pCur->apPage[--pCur->iPage];
       break;
     }
+    setMempageRoot(pCur->pPage, pCur->pgnoRoot);
     /*
     ***** End of in-lined moveToChild() call */
  }
@@ -10106,6 +10107,9 @@ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){
           pPageIn = 0;
           rc = sqlite3PagerGet(pSrcPager, ovflIn, &pPageIn, PAGER_GET_READONLY);
           if( rc==SQLITE_OK ){
+            setMempageRoot(
+                (MemPage*)sqlite3PagerGetExtra(pPageIn), pSrc->pgnoRoot
+            );
             aIn = (const u8*)sqlite3PagerGetData(pPageIn);
             ovflIn = get4byte(aIn);
             aIn += 4;
index bc00232442a03cd65e1958eef642049c45fa8a02..573d0ef23e81eb61d4d0d6aa09f39b3fb9b75c57 100644 (file)
@@ -124,6 +124,151 @@ do_test_conflict_msg 1.3.2 {
   conflict at page 211 (read/write page; part of db index t3.i3; content=0A0310006300D800...)
 }
 
+db2 close
+reset_db
+do_execsql_test 1.5.0 {
+  PRAGMA auto_vacuum = 0;
+  PRAGMA journal_mode = wal;
+  CREATE TABLE t1(a, b);
+  CREATE INDEX i1 ON t1(a, b);
+  WITH s(i) AS (
+    SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<1000
+  ) 
+  INSERT INTO t1 SELECT i, randomblob(200) FROM s;
+} {wal}
+do_test 1.5.1 {
+  set ::log [list]
+
+breakpoint
+  execsql {
+    BEGIN CONCURRENT;
+      INSERT INTO t1 VALUES(100000, '');
+  } db
+
+  sqlite3 db2 test.db
+  execsql { INSERT INTO t1(rowid, a, b) VALUES(-1, 100001, '') } db2
+  catchsql COMMIT db
+} {1 {database is locked}}
+
+do_test_conflict_msg 1.5.2 {
+  conflict at page 507 (read/write page; part of db index t1.i1; content=0A00000003025000...)
+}
+
+
+#-------------------------------------------------------------------------
+reset_db
+sqlite3 db2 test.db
+
+set big1 [string repeat ab 10000]
+set big2 "[string repeat ab  9999]xy"
+
+do_execsql_test 1.6.0 {
+  CREATE TABLE x1(x, y);
+  INSERT INTO x1 VALUES(1, $big1);
+  PRAGMA journal_mode = wal;
+} {wal}
+
+do_execsql_test -db db2 1.6.1.1 {
+  BEGIN; 
+    UPDATE x1 SET y=$big2;
+} {}
+do_execsql_test 1.6.1.2 {
+  BEGIN CONCURRENT;
+    UPDATE x1 SET y=$big2;
+}
+do_execsql_test -db db2 1.6.1.3 COMMIT
+do_catchsql_test 1.6.1.4 {
+  COMMIT;
+} {1 {database is locked}}
+do_test_conflict_msg 1.6.1.5 {
+  conflict at page 21 (read/write page; part of db table x1; content=0000000061626162...)
+}
+catchsql ROLLBACK
+
+do_test 1.6.2.1 {
+  execsql { BEGIN } db2
+  set fd [db2 incrblob main x1 y 1]
+  seek $fd 19998
+  puts -nonewline $fd 00
+  close $fd
+} {}
+do_test 1.6.2.2 {
+  execsql { BEGIN CONCURRENT } db
+  set fd [db incrblob main x1 y 1]
+  seek $fd 19998
+  puts -nonewline $fd 12
+  close $fd
+} {}
+do_execsql_test -db db2 1.6.2.3 COMMIT
+do_catchsql_test 1.6.2.4 {
+  COMMIT;
+} {1 {database is locked}}
+do_test_conflict_msg 1.6.1.5 {
+  conflict at page 21 (read/write page; part of db table x1; content=0000000061626162...)
+}
+catchsql ROLLBACK
+
+#--------------------------------------------------------------------------
+reset_db
+sqlite3 db2 test.db
+
+set big1 [string repeat ab 10000]
+set big2 "[string repeat ab  9999]xy"
+
+do_execsql_test 1.7.0 {
+  CREATE TABLE ww(a);
+  CREATE TABLE y1(x, y);
+  INSERT INTO y1 VALUES(1, $big1);
+  PRAGMA journal_mode = wal;
+} {wal}
+
+do_execsql_test -db db2 1.7.1 {
+  BEGIN;
+    UPDATE y1 SET y=$big2;
+    SELECT * FROM ww;
+}
+
+do_execsql_test 1.7.2 {
+  BEGIN CONCURRENT;
+    INSERT INTO ww SELECT y FROM y1;
+}
+
+do_execsql_test -db db2 1.7.3 COMMIT
+
+do_catchsql_test 1.7.4 {
+  COMMIT;
+} {1 {database is locked}}
+
+#-------------------------------------------------------------------------
+reset_db
+sqlite3 db2 test.db
+
+set big1 "[string repeat ab 10000]"
+set big2 "[string repeat ab  9999]xy"
+do_execsql_test 2.0 {
+  PRAGMA journal_mode = wal;
+  CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT);
+  CREATE TABLE t2(a INTEGER PRIMARY KEY, b TEXT);
+  INSERT INTO t1 VALUES(100, $big1);
+} {wal}
+
+do_execsql_test -db db2 2.1 {
+  BEGIN CONCURRENT;
+    INSERT INTO t2 SELECT * FROM t1;
+}
+
+do_execsql_test 2.2 {
+   UPDATE t1 SET b=$big2
+}
+
+do_test 2.3 {
+  list [catch { db2 eval COMMIT } msg] $msg
+} {1 {database is locked}}
+
+do_test_conflict_msg 2.4 {
+  conflict at page 22 (read-only page; part of db table t1; content=0000000061626162...)
+}
+
 db close
 db2 close
 sqlite3_shutdown
@@ -131,3 +276,4 @@ test_sqlite3_log
 sqlite3_initialize
 finish_test
 
+