Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix a problem with RBU function sqlite3rbu_bp_progress() when used during an RBU vacuum. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8c44b02f1479cec61554800702a3c1d8 |
User & Date: | dan 2019-08-13 15:11:25.734 |
Context
2019-08-13
| ||
17:27 | Update some corruption test cases to take [724f4df9c] into account. (check-in: 927cd7b4c5 user: dan tags: trunk) | |
15:22 | Merge latest trunk changes with this branch. (check-in: 5b4689d89c user: dan tags: reuse-schema) | |
15:11 | Fix a problem with RBU function sqlite3rbu_bp_progress() when used during an RBU vacuum. (check-in: 8c44b02f14 user: dan tags: trunk) | |
2019-08-12
| ||
18:26 | Make sure the btree cursor overflow cache is cleared when overwriting a cell in sqlite3BtreeInsert(). Ticket [3cf9bb227e9a5d32] (check-in: 7dae7b969e user: drh tags: trunk) | |
Changes
Changes to ext/rbu/rbuprogress.test.
︙ | ︙ | |||
409 410 411 412 413 414 415 416 417 418 | set R(nopk) $r1 set R(vtab) $r2 do_sp_test 5.$tn.$bReopen.$tn2.1 $bReopen test.db rbu.db $R($tn) } } } finish_test | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | set R(nopk) $r1 set R(vtab) $r2 do_sp_test 5.$tn.$bReopen.$tn2.1 $bReopen test.db rbu.db $R($tn) } } } #------------------------------------------------------------------------- # 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 |
Changes to ext/rbu/sqlite3rbu.c.
︙ | ︙ | |||
940 941 942 943 944 945 946 | sqlite3rbu *p = sqlite3_user_data(pCtx); const char *zIn; assert( argc==1 || argc==2 ); zIn = (const char*)sqlite3_value_text(argv[0]); if( zIn ){ if( rbuIsVacuum(p) ){ | | | | 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | sqlite3rbu *p = sqlite3_user_data(pCtx); const char *zIn; assert( argc==1 || argc==2 ); zIn = (const char*)sqlite3_value_text(argv[0]); if( zIn ){ if( rbuIsVacuum(p) ){ assert( argc==2 || argc==1 ); if( argc==1 || 0==sqlite3_value_int(argv[1]) ){ sqlite3_result_text(pCtx, zIn, -1, SQLITE_STATIC); } }else{ if( strlen(zIn)>4 && memcmp("data", zIn, 4)==0 ){ int i; for(i=4; zIn[i]>='0' && zIn[i]<='9'; i++); if( zIn[i]=='_' && zIn[i+1] ){ |
︙ | ︙ | |||
3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 | int nVal, sqlite3_value **apVal ){ sqlite3rbu *p = (sqlite3rbu*)sqlite3_user_data(pCtx); sqlite3_stmt *pStmt = 0; char *zErrmsg = 0; int rc; assert( nVal==1 ); | > | | | 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 | int nVal, sqlite3_value **apVal ){ sqlite3rbu *p = (sqlite3rbu*)sqlite3_user_data(pCtx); sqlite3_stmt *pStmt = 0; char *zErrmsg = 0; int rc; sqlite3 *db = (rbuIsVacuum(p) ? p->dbRbu : p->dbMain); assert( nVal==1 ); rc = prepareFreeAndCollectError(db, &pStmt, &zErrmsg, sqlite3_mprintf("SELECT count(*) FROM sqlite_master " "WHERE type='index' AND tbl_name = %Q", sqlite3_value_text(apVal[0])) ); if( rc!=SQLITE_OK ){ sqlite3_result_error(pCtx, zErrmsg, -1); }else{ int nIndex = 0; if( SQLITE_ROW==sqlite3_step(pStmt) ){ nIndex = sqlite3_column_int(pStmt, 0); } rc = sqlite3_finalize(pStmt); if( rc==SQLITE_OK ){ sqlite3_result_int(pCtx, nIndex); }else{ sqlite3_result_error(pCtx, sqlite3_errmsg(db), -1); } } sqlite3_free(zErrmsg); } /* |
︙ | ︙ |