From: dan Date: Thu, 10 Dec 2020 19:20:15 +0000 (+0000) Subject: Fix minor issues with new code on this branch. X-Git-Tag: version-3.35.0~190^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fvacuum-lomem;p=thirdparty%2Fsqlite.git Fix minor issues with new code on this branch. FossilOrigin-Name: f7fa76d0963e7b34026dc20c920bfbf7961033fe2b99503f6857157595f86823 --- diff --git a/manifest b/manifest index 95ecdca302..44b269d0ac 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Merge\strunk\schanges\sinto\sthis\sbranch. -D 2020-12-10T18:07:01.742 +C Fix\sminor\sissues\swith\snew\scode\son\sthis\sbranch. +D 2020-12-10T19:20:15.980 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -481,7 +481,7 @@ F src/auth.c a3d5bfdba83d25abed1013a8c7a5f204e2e29b0c25242a56bc02bb0c07bf1e06 F src/backup.c 3014889fa06e20e6adfa0d07b60097eec1f6e5b06671625f476a714d2356513d F src/bitvec.c 17ea48eff8ba979f1f5b04cc484c7bb2be632f33 F src/btmutex.c 8acc2f464ee76324bf13310df5692a262b801808984c1b79defb2503bbafadb6 -F src/btree.c b14822d4dd984340d8b1c46bf5d49b12ab3adf6b639c5f3b395fa541153b1ba3 +F src/btree.c de8d2a4d8dedf9187cc9019b8f882bc788ab8fe815b7f69042e880fbc11304dc F src/btree.h 285f8377aa1353185a32bf455faafa9ff9a0d40d074d60509534d14990c7829e F src/btreeInt.h 7614cae30f95b6aed0c7cac7718276a55cfe2c77058cbfd8bef5b75329757331 F src/build.c f6449d4e85e998e14d3f537e8ea898dca2fcb83c277db3e60945af9b9177db81 @@ -612,7 +612,7 @@ F src/upsert.c 2920de71b20f04fe25eb00b655d086f0ba60ea133c59d7fa3325c49838818e78 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 F src/util.c c0c7977de7ef9b8cb10f6c85f2d0557889a658f817b0455909a49179ba4c8002 F src/vacuum.c 492422c1463c076473bae1858799c7a0a5fe87a133d1223239447c422cd26286 -F src/vdbe.c b8ac132f98ab4edb126c7784cfd6f479aa45e476c9e873c13ecd7bd6ffdd8668 +F src/vdbe.c 808c1503dd183578d7ebcf0e517e636c6005f783daadc9a27305b10597c1142e F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1 F src/vdbeInt.h 3ca5e9fd6e095a8b6cf6bc3587a46fc93499503b2fe48951e1034ba9e2ce2f6e F src/vdbeapi.c c5e7cb2ab89a24d7f723e87b508f21bfb1359a04db5277d8a99fd1e015c12eb9 @@ -1654,7 +1654,7 @@ F test/vacuum2.test 9fd45ce6ce29f5614c249e03938d3567c06a9e772d4f155949f8eafe2d8a F test/vacuum3.test 77ecdd54592b45a0bcb133339f99f1ae0ae94d0d F test/vacuum4.test 7ea76b769fffeb41f925303b04cbcf5a5bbeabe55e4c60ae754ff24eeeb7c010 F test/vacuum5.test 263b144d537e92ad8e9ca8a73cc6e1583f41cfd0dda9432b87f7806174a2f48c -F test/vacuum6.test 7d3aea27ef3c671dafccbad5adc7848205c38ab14ee7a1dabe592e0794e132d7 +F test/vacuum6.test e67488fa1341cc8034ba261807d429a8c06f4593ec1bb1651d8497d2d5df92c9 F test/vacuummem.test 7b42abb3208bd82dd23a7536588396f295a314f2 F test/varint.test bbce22cda8fc4d135bcc2b589574be8410614e62 F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661 @@ -1889,7 +1889,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 101cef14910d6e865a94bc870aed599321b893188062a9a61d70a9434992cf23 01841fb4bf3d6c5fd5bcbc7d1338998c50f69f84ca475fba7cf764d636714678 -R a5d793c28e830d9302f879f5ab38dd56 +P 7337eed629b4537b8fc2dc87c3c71d0a664128a91fd00f3c5f18843505beee90 +R 4dec8f74318b8721d36ac1bd02f7a778 U dan -Z 2458c10db91ae6ca73e242d0fd66a7be +Z 1308f2122d2b4d2b55d5a48e115dbda3 diff --git a/manifest.uuid b/manifest.uuid index e8cdfeec6b..7aba6f714d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7337eed629b4537b8fc2dc87c3c71d0a664128a91fd00f3c5f18843505beee90 \ No newline at end of file +f7fa76d0963e7b34026dc20c920bfbf7961033fe2b99503f6857157595f86823 \ No newline at end of file diff --git a/src/btree.c b/src/btree.c index 224d533b7c..7522f01c36 100644 --- a/src/btree.c +++ b/src/btree.c @@ -8945,6 +8945,21 @@ end_insert: return rc; } +/* +** This function is used as part of copying the current row from cursor +** pSrc into cursor pDest. If the cursors are open on intkey tables, then +** parameter iKey is used as the rowid value when the record is copied +** into pDest. Otherwise, the record is copied verbatim. +** +** This function does not actually write the new value to cursor pDest. +** Instead, it creates and populates any required overflow pages and +** writes the data for the new cell into the BtShared.pTmpSpace buffer +** for the destination database. The size of the cell, in bytes, is left +** in BtShared.nPreformatSize. The caller completes the insertion by +** calling sqlite3BtreeInsert() with the BTREE_PREFORMAT flag specified. +** +** SQLITE_OK is returned if successful, or an SQLite error code otherwise. +*/ int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 iKey){ int rc = SQLITE_OK; BtShared *pBt = pDest->pBt; diff --git a/src/vdbe.c b/src/vdbe.c index e640dedbcd..904b5e2bc0 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -3572,6 +3572,13 @@ case OP_Transaction: { && (iMeta!=pOp->p3 || db->aDb[pOp->p1].pSchema->iGeneration!=pOp->p4.i) ){ + /* + ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema + ** version is checked to ensure that the schema has not changed since the + ** SQL statement was prepared. + */ + sqlite3DbFree(db, p->zErrMsg); + p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed"); /* If the schema-cookie from the database file matches the cookie ** stored with the in-memory representation of the schema, do ** not reload the schema from the database file. @@ -3588,13 +3595,6 @@ case OP_Transaction: { if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){ sqlite3ResetOneSchema(db, pOp->p1); } - /* - ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema - ** version is checked to ensure that the schema has not changed since the - ** SQL statement was prepared. - */ - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed"); p->expired = 1; rc = SQLITE_SCHEMA; } @@ -5145,12 +5145,22 @@ case OP_Insert: { } /* Opcode: RowCell P1 P2 P3 * * +** +** P1 and P2 are both open cursors. Both must be opened on the same type +** of table - intkey or index. This opcode is used as part of copying +** the current row from P2 into P1. If the cursors are opened on intkey +** tables, register P3 contains the rowid to use with the new record in +** P1. If they are opened on index tables, P3 is not used. +** +** This opcode must be followed by either an Insert or InsertIdx opcode +** with the OPFLAG_PREFORMAT flag set to complete the insert operation. */ case OP_RowCell: { VdbeCursor *pDest; /* Cursor to write to */ VdbeCursor *pSrc; /* Cursor to read from */ i64 iKey; /* Rowid value to insert with */ assert( pOp[1].opcode==OP_Insert || pOp[1].opcode==OP_IdxInsert ); + assert( pOp[1].p5 & OPFLAG_PREFORMAT ); pDest = p->apCsr[pOp->p1]; pSrc = p->apCsr[pOp->p2]; iKey = pOp->p3 ? aMem[pOp->p3].u.i : 0; diff --git a/test/vacuum6.test b/test/vacuum6.test index 203b3329e2..51070fd0c7 100644 --- a/test/vacuum6.test +++ b/test/vacuum6.test @@ -34,6 +34,7 @@ do_execsql_test 1.1 { } #------------------------------------------------------------------------- +# reset_db foreach {tn sz} {1 400 2 4000 3 9999} { reset_db @@ -69,23 +70,29 @@ do_execsql_test 3.2 { } {ok} #------------------------------------------------------------------------- +# reset_db do_execsql_test 4.0 { CREATE TABLE tx(a, b); CREATE INDEX i1 ON tx(b); WITH s(i) AS ( - SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<10000 + SELECT 8000 UNION ALL SELECT i+1 FROM s WHERE i<10000 ) INSERT INTO tx SELECT i, randomblob(i) FROM s; -} -foreach {tn pgsz} { - 1 2048 - 2 1024 - 3 65536 - 4 8192 + + SELECT sum(length(b)) FROM tx; +} {18009000} +foreach {tn pgsz av} { + 1 2048 0 + 2 1024 1 + 3 65536 0 + 4 8192 1 + 5 512 0 + 6 4096 1 } { do_execsql_test 4.1.$tn.1 " - PRAGMA page_size = $pgsz + PRAGMA page_size = $pgsz; + PRAGMA auto_vacuum = $av; " do_execsql_test 4.1.$tn.2 VACUUM integrity_check 4.1.$tn.3