Fix a problem with RBU function sqlite3rbu_bp_progress() when used during an RBU vacuum.
FossilOrigin-Name: 8c44b02f1479cec61554800702a3c1d806e4ee64b41ba2af17320f62794a02fe
This commit is contained in:
parent
554a19dbee
commit
b8a8d523cb
@ -414,5 +414,37 @@ foreach {bReopen} { 0 1 } {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
# Test that sqlite3_bp_progress() works with an RBU vacuum if there
|
||||||
|
# is an rbu_count table in the db being vacuumed.
|
||||||
|
#
|
||||||
|
reset_db
|
||||||
|
do_execsql_test 6.0 {
|
||||||
|
CREATE TABLE t1(a, b, c);
|
||||||
|
CREATE INDEX i1 ON t1(a);
|
||||||
|
CREATE INDEX i2 ON t1(b);
|
||||||
|
WITH s(i) AS (
|
||||||
|
SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<100
|
||||||
|
)
|
||||||
|
INSERT INTO t1 SELECT i, i, i FROM s;
|
||||||
|
CREATE TABLE rbu_count(tbl TEXT PRIMARY KEY, cnt INTEGER) WITHOUT ROWID;
|
||||||
|
INSERT INTO rbu_count VALUES('t1', (SELECT count(*) FROM t1));
|
||||||
|
INSERT INTO rbu_count VALUES('rbu_count', 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
forcedelete state.db
|
||||||
|
do_test 6.1 {
|
||||||
|
set maxA 0
|
||||||
|
set maxB 0
|
||||||
|
sqlite3rbu_vacuum rbu test.db state.db
|
||||||
|
while {[rbu step]=="SQLITE_OK"} {
|
||||||
|
foreach {a b} [rbu bp_progress] {
|
||||||
|
if {$a > $maxA} { set maxA $a }
|
||||||
|
if {$b > $maxB} { set maxB $b }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list [rbu close] $maxA $maxB
|
||||||
|
} {SQLITE_DONE 10000 10000}
|
||||||
|
|
||||||
|
|
||||||
finish_test
|
finish_test
|
||||||
|
@ -944,8 +944,8 @@ static void rbuTargetNameFunc(
|
|||||||
zIn = (const char*)sqlite3_value_text(argv[0]);
|
zIn = (const char*)sqlite3_value_text(argv[0]);
|
||||||
if( zIn ){
|
if( zIn ){
|
||||||
if( rbuIsVacuum(p) ){
|
if( rbuIsVacuum(p) ){
|
||||||
assert( argc==2 );
|
assert( argc==2 || argc==1 );
|
||||||
if( 0==sqlite3_value_int(argv[1]) ){
|
if( argc==1 || 0==sqlite3_value_int(argv[1]) ){
|
||||||
sqlite3_result_text(pCtx, zIn, -1, SQLITE_STATIC);
|
sqlite3_result_text(pCtx, zIn, -1, SQLITE_STATIC);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -3860,10 +3860,11 @@ static void rbuIndexCntFunc(
|
|||||||
sqlite3_stmt *pStmt = 0;
|
sqlite3_stmt *pStmt = 0;
|
||||||
char *zErrmsg = 0;
|
char *zErrmsg = 0;
|
||||||
int rc;
|
int rc;
|
||||||
|
sqlite3 *db = (rbuIsVacuum(p) ? p->dbRbu : p->dbMain);
|
||||||
|
|
||||||
assert( nVal==1 );
|
assert( nVal==1 );
|
||||||
|
|
||||||
rc = prepareFreeAndCollectError(p->dbMain, &pStmt, &zErrmsg,
|
rc = prepareFreeAndCollectError(db, &pStmt, &zErrmsg,
|
||||||
sqlite3_mprintf("SELECT count(*) FROM sqlite_master "
|
sqlite3_mprintf("SELECT count(*) FROM sqlite_master "
|
||||||
"WHERE type='index' AND tbl_name = %Q", sqlite3_value_text(apVal[0]))
|
"WHERE type='index' AND tbl_name = %Q", sqlite3_value_text(apVal[0]))
|
||||||
);
|
);
|
||||||
@ -3878,7 +3879,7 @@ static void rbuIndexCntFunc(
|
|||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
sqlite3_result_int(pCtx, nIndex);
|
sqlite3_result_int(pCtx, nIndex);
|
||||||
}else{
|
}else{
|
||||||
sqlite3_result_error(pCtx, sqlite3_errmsg(p->dbMain), -1);
|
sqlite3_result_error(pCtx, sqlite3_errmsg(db), -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
|||||||
C Make\ssure\sthe\sbtree\scursor\soverflow\scache\sis\scleared\swhen\soverwriting\na\scell\sin\ssqlite3BtreeInsert().\s\sTicket\s[3cf9bb227e9a5d32]
|
C Fix\sa\sproblem\swith\sRBU\sfunction\ssqlite3rbu_bp_progress()\swhen\sused\sduring\san\sRBU\svacuum.
|
||||||
D 2019-08-12T18:26:46.324
|
D 2019-08-13T15:11:25.734
|
||||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||||
@ -354,7 +354,7 @@ F ext/rbu/rbufts.test 0ae8d1da191c75bd776b86e24456db0fb6e97b7c944259fae5407ea55d
|
|||||||
F ext/rbu/rbumisc.test 329986cf5dd51890c4eb906c2f960ebb773a79a64bed90f506b7c417825b37eb
|
F ext/rbu/rbumisc.test 329986cf5dd51890c4eb906c2f960ebb773a79a64bed90f506b7c417825b37eb
|
||||||
F ext/rbu/rbumulti.test 5fb139058f37ddc5a113c5b93238de915b769b7792de41b44c983bc7c18cf5b9
|
F ext/rbu/rbumulti.test 5fb139058f37ddc5a113c5b93238de915b769b7792de41b44c983bc7c18cf5b9
|
||||||
F ext/rbu/rbupartial.test f25df014b8dbe3c5345851fba6e66f79ab237f57dc201b2d5f0dbae658ae5a4c
|
F ext/rbu/rbupartial.test f25df014b8dbe3c5345851fba6e66f79ab237f57dc201b2d5f0dbae658ae5a4c
|
||||||
F ext/rbu/rbuprogress.test 04614ff8820bab9c1ec1b7dbec1edc4b45474421d4fe7abbd2a879a9c02884f9
|
F ext/rbu/rbuprogress.test 857cf1f8166c83ef977edb9ef4fc42d80f71fbd798652b46ae2f3a7031870f8d
|
||||||
F ext/rbu/rburesume.test dbdc4ca504e9c76375a69e5f0d91205db967dcc509a5166ca80231f8fda49eb1
|
F ext/rbu/rburesume.test dbdc4ca504e9c76375a69e5f0d91205db967dcc509a5166ca80231f8fda49eb1
|
||||||
F ext/rbu/rbusave.test f4190a1a86fccf84f723af5c93813365ae33feda35845ba107b59683d1cdd926
|
F ext/rbu/rbusave.test f4190a1a86fccf84f723af5c93813365ae33feda35845ba107b59683d1cdd926
|
||||||
F ext/rbu/rbusplit.test b37e7b40b38760881dc9c854bd40b4744c6b6cd74990754eca3bda0f407051e8
|
F ext/rbu/rbusplit.test b37e7b40b38760881dc9c854bd40b4744c6b6cd74990754eca3bda0f407051e8
|
||||||
@ -363,7 +363,7 @@ F ext/rbu/rbuvacuum.test 55e101e90168c2b31df6c9638fe73dc7f7cc666b6142266d1563697
|
|||||||
F ext/rbu/rbuvacuum2.test b8e5b51dc8b2c0153373d024c0936be3f66f9234acbd6d0baab0869d56b14e6b
|
F ext/rbu/rbuvacuum2.test b8e5b51dc8b2c0153373d024c0936be3f66f9234acbd6d0baab0869d56b14e6b
|
||||||
F ext/rbu/rbuvacuum3.test 8addd82e4b83b4c93fa47428eae4fd0dbf410f8512c186f38e348feb49ba03dc
|
F ext/rbu/rbuvacuum3.test 8addd82e4b83b4c93fa47428eae4fd0dbf410f8512c186f38e348feb49ba03dc
|
||||||
F ext/rbu/rbuvacuum4.test a78898e438a44803eb2bc897ba3323373c9f277418e2d6d76e90f2f1dbccfd10
|
F ext/rbu/rbuvacuum4.test a78898e438a44803eb2bc897ba3323373c9f277418e2d6d76e90f2f1dbccfd10
|
||||||
F ext/rbu/sqlite3rbu.c 4261ba8d5dc1c4aa1c9cf4c8c60f8ba4df3780d1516720771d2bbc292892e11b
|
F ext/rbu/sqlite3rbu.c f3a3e09f575157052813be667d6ab3b54f47fb02e6e1c9f767ad7bb8f1fb90b3
|
||||||
F ext/rbu/sqlite3rbu.h 1dc88ab7bd32d0f15890ea08d23476c4198d3da3056985403991f8c9cd389812
|
F ext/rbu/sqlite3rbu.h 1dc88ab7bd32d0f15890ea08d23476c4198d3da3056985403991f8c9cd389812
|
||||||
F ext/rbu/test_rbu.c 03f6f177096a5f822d68d8e4069ad8907fe572c62ff2d19b141f59742821828a
|
F ext/rbu/test_rbu.c 03f6f177096a5f822d68d8e4069ad8907fe572c62ff2d19b141f59742821828a
|
||||||
F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15
|
F ext/repair/README.md 92f5e8aae749a4dae14f02eea8e1bb42d4db2b6ce5e83dbcdd6b1446997e0c15
|
||||||
@ -1836,7 +1836,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 636ca4472c9f41eb3989f28854d4968867837399a2092f389d1b814d98cccbae
|
P 7dae7b969ed314605a3a2da2cfdce4d81152740f5d3bfbc2a6e311b13ee325a7
|
||||||
R 35de1073023e10ac023f683a008bdac4
|
R 860238736fdd0447f200637ad8b8114e
|
||||||
U drh
|
U dan
|
||||||
Z 4e3a468c24aea8e9967dfc838bb1156b
|
Z 5966eddfdd5804ca0c3aea69442d9a4f
|
||||||
|
@ -1 +1 @@
|
|||||||
7dae7b969ed314605a3a2da2cfdce4d81152740f5d3bfbc2a6e311b13ee325a7
|
8c44b02f1479cec61554800702a3c1d806e4ee64b41ba2af17320f62794a02fe
|
Loading…
Reference in New Issue
Block a user