-C Fix\sa\sproblem\swith\seponymous\svirtual\stables\sand\sSHARED_SCHEMA\sdatabases.\sAlso,\safter\spreparing\sstatements\sthat\srequire\sall\sdatabase\sschemas\s(REINDEX,\sANALYZE,\sCREATE,\sDROP\sand\ssome\sPRAGMA\sstatements),\sdo\snot\sallow\sthe\sdatabase\sconnection\sto\sreturn\smore\sthan\sone\sschema\sto\seach\sschema-pool.
-D 2019-02-15T19:00:41.452
+C Enhance\sthe\svirtual\stable\sin\stest_schemapool.c\sso\sthat\sit\scan\sbe\sused\sto\scheck\sthat\sSHARED_SCHEMA\sconnections\sare\snot\sallocating\sand\sfreeing\sschemas\swhen\sthey\sshould\snot\sbe.
+D 2019-02-15T19:36:47.869
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 56456706c4da271309914c756c9c8ea537685f1c79f8785afa72f968d6810482
F src/btree.h 63b94fb38ce571c15eb6a3661815561b501d23d5948b2d1e951fbd7a2d04e8d3
F src/btreeInt.h 6111c15868b90669f79081039d19e7ea8674013f907710baa3c814dc3f8bfd3f
F src/build.c 9ee9a6d4dc5e8cddd0657fc9f2208849e83a59b9cd862bd828260ff28dd972a6
-F src/callback.c 434dc7a483d98cf02bda4a1306813a000b4620fe67f6dfea1635b519f1daf26b
+F src/callback.c df42b5473587c3322038d594be585a6d92d532e1a67f5c340b324de887b8a44a
F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e
F src/ctime.c 109e58d00f62e8e71ee1eb5944ac18b90171c928ab2e082e058056e1137cc20b
F src/date.c ebe1dc7c8a347117bb02570f1a931c62dd78f4a2b1b516f4837d45b7d6426957
F src/test_quota.h 2a8ad1952d1d2ca9af0ce0465e56e6c023b5e15d
F src/test_rtree.c 671f3fae50ff116ef2e32a3bf1fe21b5615b4b7b
F src/test_schema.c f575932cb6274d12147a77e13ea4b49d52408513
-F src/test_schemapool.c 5a2f06baeb4071ba547db5b47fb0fb43ffe7bdc96e65e0d5045703a726f32c10
+F src/test_schemapool.c 605de5c8bd8de59a09a2a9d139d004c00a6ba390647c6b3e07b5889dbbcc09af
F src/test_server.c a2615049954cbb9cfb4a62e18e2f0616e4dc38fe
F src/test_sqllog.c 11e6ce7575f489155c604ac4b439f2ac1d3d5aef
F src/test_superlock.c 4839644b9201da822f181c5bc406c0b2385f672e
F test/resetdb.test 8062cf10a09d8c048f8de7711e94571c38b38168db0e5877ba7561789e5eeb2b
F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb
F test/reuse1.test 31c312375ccfcc5c2abc1fca5e4a89d6309c57ea6b1fa3179a5eee68016f9c74
-F test/reuse2.test c33a8973b2de3b4f8b4ffe5c5b455c00a2394b8d71996ee37ed7e861b9f19f1e
-F test/reuse3.test b0f7c7236129fdf7ec51528b75fecaa609408a9fccff2ffed34bfa60d27e5881
+F test/reuse2.test 04d88621f0c51a8b3bf5512b9e61a5d7a61059e33097a1a6b1c6f6cf2d1f2a35
+F test/reuse3.test 624e389467085f6e1c06dcb5815740afce13639033beb108b3ef89796dd0f5f5
F test/rollback.test 06680159bc6746d0f26276e339e3ae2f951c64812468308838e0a3362d911eaa
F test/rollback2.test bc868d57899dc6972e2b4483faae0e03365a0556941474eec487ae21d8d38bb6
F test/rollbackfault.test 0e646aeab8840c399cfbfa43daab46fd609cf04a
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 03c4f00317233a34f29e1218786166d17837d47206532a29d2713093f01adea5
-R fccecdff4cf8aba660dc6d3dc546a5dd
+P ecf6251ec0bb745a4ef9bad9f9ecd3babb687a3806fd96554b265313625270c5
+R af9505b450d481737fb31789b721e9d0
U dan
-Z c88bba0b0856cf8c79509301a9c9f542
+Z e6a41c81ac1abbc49dfae8dadf58f8cc
"CREATE TABLE x(" \
" cksum INTEGER, " \
" nref INTEGER, " \
-" nschema INTEGER " \
+" nschema INTEGER, " \
+" ndelete INTEGER " \
")"
+#define SCHEMAPOOL_NFIELD 4
+
typedef struct schemapool_vtab schemapool_vtab;
typedef struct schemapool_cursor schemapool_cursor;
*/
static int schemaPoolColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){
schemapool_cursor *pCur = (schemapool_cursor*)cur;
- assert( i==0 || i==1 || i==2 );
- sqlite3_result_int64(ctx, pCur->aData[pCur->iRow*3 + i]);
+ assert( i==0 || i==1 || i==2 || i==3 );
+ sqlite3_result_int64(ctx, pCur->aData[pCur->iRow*SCHEMAPOOL_NFIELD + i]);
return SQLITE_OK;
}
struct SchemaPool {
int nRef; /* Number of pointers to this object */
+ int nDelete; /* Schema objects deleted by ReleaseAll() */
u64 cksum; /* Checksum for this Schema contents */
Schema *pSchema; /* Linked list of Schema objects */
Schema sSchema; /* The single dummy schema object */
if( pCur->nRow ){
int iRow = 0;
- pCur->aData = (i64*)sqlite3_malloc(3 * pCur->nRow * sizeof(i64));
+ int nByte = SCHEMAPOOL_NFIELD * pCur->nRow * sizeof(i64);
+ pCur->aData = (i64*)sqlite3_malloc(nByte);
if( pCur->aData==0 ) return SQLITE_NOMEM;
for(pSPool = sqlite3SchemaPoolList(); pSPool; pSPool=pSPool->pNext){
Schema *p;
for(p=pSPool->pSchema; p; p=p->pNext){
nSchema++;
}
- pCur->aData[0 + iRow*3] = pSPool->cksum;
- pCur->aData[1 + iRow*3] = (i64)pSPool->nRef;
- pCur->aData[2 + iRow*3] = nSchema;
+ pCur->aData[0 + iRow*SCHEMAPOOL_NFIELD] = pSPool->cksum;
+ pCur->aData[1 + iRow*SCHEMAPOOL_NFIELD] = (i64)pSPool->nRef;
+ pCur->aData[2 + iRow*SCHEMAPOOL_NFIELD] = nSchema;
+ pCur->aData[3 + iRow*SCHEMAPOOL_NFIELD] = (i64)pSPool->nDelete;
iRow++;
}
}
register_schemapool_module db
do_execsql_test 3.3 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
-} {nref=2 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=2 nschema=1 ndelete=0}
sqlite3 db3 test.db -shared-schema 1
register_schemapool_module db3
do_execsql_test 3.5 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
-} {nref=2 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=2 nschema=1 ndelete=0}
do_execsql_test -db db3 3.6 {
SELECT * FROM t1;
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
-} {nref=3 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=3 nschema=1 ndelete=0}
do_execsql_test 3.7 {
CREATE TABLE t2(x);
}
do_execsql_test 3.8 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool;
-} {nref=3 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=3 nschema=1 ndelete=0}
do_execsql_test -db db1 3.9.1 { SELECT * FROM t1 }
do_execsql_test 3.9.2 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=1 nschema=1 nref=2 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=1 nschema=1 ndelete=0 nref=2 nschema=1 ndelete=0}
do_execsql_test -db db2 3.10.1 { SELECT * FROM t1 }
do_execsql_test 3.10.2 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=1 nschema=1 nref=2 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool ORDER BY 1;
+} {nref=1 nschema=1 ndelete=0 nref=2 nschema=1 ndelete=0}
do_execsql_test -db db3 3.11.1 { SELECT * FROM t1 }
do_execsql_test 3.11.2 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=3 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=3 nschema=1 ndelete=0}
#--------------------------------------------------------------------------
catch {db1 close}
register_schemapool_module db
do_execsql_test 4.0.3 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
} {}
do_test 4.1.1 {
} db2
} {}
do_execsql_test 4.1.2 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
} {}
do_execsql_test -db db2 4.1.3 {
SELECT * FROM db3.x1
}
do_execsql_test 4.1.4 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=1 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=1 nschema=1 ndelete=0}
do_execsql_test -db db2 4.1.5 {
SELECT * FROM db2.x1
}
do_execsql_test 4.1.6 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=2 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=2 nschema=1 ndelete=0}
do_execsql_test -db db2 4.1.7 {
SELECT * FROM x1
}
do_execsql_test 4.1.8 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=6 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=6 nschema=1 ndelete=0}
do_test 4.2.1 {
catchsql { SELECT * FROM abc } db2
} {1 {no such table: abc}}
do_execsql_test 4.2.2 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=6 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=6 nschema=1 ndelete=0}
register_schemapool_module db2
do_execsql_test -db db2 4.3.1 {
INSERT INTO db3.x1 VALUES(10, 11, 12);
INSERT INTO db4.x1 VALUES(13, 14, 15);
INSERT INTO db5.x1 VALUES(16, 17, 18);
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=6 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=6 nschema=1 ndelete=0}
do_execsql_test -db db2 4.3.2 {
SELECT * FROM db5.x1;
SELECT * FROM db2.x1;
SELECT * FROM db1.x1;
SELECT * FROM x1;
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
} {
16 17 18 13 14 15 10 11 12 7 8 9 4 5 6 1 2 3
- nref=6 nschema=1
+ nref=6 nschema=1 ndelete=0
}
do_execsql_test -db db2 4.3.3 {
UPDATE x1 SET a=a+10;
UPDATE db5.x1 SET a=a+10;
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
} {
- nref=6 nschema=1
+ nref=6 nschema=1 ndelete=0
}
do_execsql_test -db db2 4.3.4 {
SELECT * FROM db2.x1;
SELECT * FROM db1.x1;
SELECT * FROM x1;
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
} {
26 17 18 13 14 15 10 11 12 7 8 9 4 5 6 11 2 3
- nref=6 nschema=1
+ nref=6 nschema=1 ndelete=0
}
do_execsql_test -db db2 4.3.5 {
DELETE FROM db3.x1;
DELETE FROM x1;
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
} {
- nref=6 nschema=1
+ nref=6 nschema=1 ndelete=0
}
do_execsql_test -db db2 4.3.6 {
SELECT * FROM db2.x1;
SELECT * FROM db1.x1;
SELECT * FROM x1;
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
} {
26 17 18 13 14 15 7 8 9 4 5 6
- nref=6 nschema=1
+ nref=6 nschema=1 ndelete=0
}
do_execsql_test -db db2 4.3.6 {
SELECT * FROM db5.x1, db4.x1, db1.x1;
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {26 17 18 13 14 15 4 5 6 nref=6 nschema=3}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {26 17 18 13 14 15 4 5 6 nref=6 nschema=3 ndelete=0}
#--------------------------------------------------------------------------
# Test the incremental-blob API with REUSE_SCHEMA connections.
db2 eval "ATTACH 'test.db${i}' AS db${i}"
}
execsql {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
} db2
-} {nref=6 nschema=1}
+} {nref=6 nschema=1 ndelete=0}
do_test 5.1.1 {
set res [list]
} {database_1 database_2 database_3 database_4 database_5}
do_execsql_test -db db2 5.1.2 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=6 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=6 nschema=1 ndelete=0}
do_test 5.2.1 {
sqlite3_table_column_metadata db2 main bbb a
} {{} BINARY 0 0 0}
do_execsql_test -db db2 5.2.3 {
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {nref=6 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {nref=6 nschema=1 ndelete=0}
-breakpoint
do_execsql_test -db db2 5.2.4 {
PRAGMA integrity_check;
- SELECT 'nref=' || nRef, 'nschema=' || nSchema FROM schemapool ORDER BY 1;
-} {ok nref=6 nschema=1}
+ SELECT 'nref=' || nRef, 'nschema=' || nSchema, 'ndelete=' || nDelete
+ FROM schemapool;
+} {ok nref=6 nschema=1 ndelete=5}
finish_test