1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

First attempt at enhancing the "PRAGMA cache_spill" statement to accept a

cache threashold size.

FossilOrigin-Name: 549d42be0dac87dc04c3eeccfdc60615c3a6ad3f
This commit is contained in:
drh
2015-11-12 14:57:19 +00:00
parent 3d38cec99a
commit 9b0cf34f81
12 changed files with 257 additions and 140 deletions

View File

@ -138,7 +138,7 @@ do_execsql_test pragma2-4.1 {
PRAGMA cache_spill;
PRAGMA main.cache_spill;
PRAGMA temp.cache_spill;
} {1 1 1}
} {2000 2000 2000}
do_execsql_test pragma2-4.2 {
PRAGMA cache_spill=OFF;
PRAGMA cache_spill;
@ -178,21 +178,43 @@ do_test pragma2-4.4 {
PRAGMA lock_status;
}
} {main exclusive temp unknown} ;# EXCLUSIVE lock due to cache spill
do_test pragma2-4.5 {
do_test pragma2-4.5.1 {
db eval {
COMMIT;
ROLLBACK;
PRAGMA cache_spill=OFF;
PRAGMA Cache_Spill;
BEGIN;
UPDATE t1 SET c=c-1;
UPDATE t1 SET c=c+1;
PRAGMA lock_status;
}
} {main reserved temp unknown} ;# No cache spill, so no exclusive lock
} {0 main reserved temp unknown} ;# No cache spill, so no exclusive lock
do_test pragma2-4.5.2 {
db eval {
ROLLBACK;
PRAGMA cache_spill=100000;
PRAGMA cache_spill;
BEGIN;
UPDATE t1 SET c=c+1;
PRAGMA lock_status;
}
} {100000 main reserved temp unknown} ;# Large cache spill threshold
do_test pragma2-4.5.3 {
db eval {
ROLLBACK;
PRAGMA cache_spill=25;
BEGIN;
UPDATE t1 SET c=c+1;
PRAGMA lock_status;
}
} {main exclusive temp unknown} ;# Large cache spill, so no exclusive lock
# Verify that newly attached databases inherit the cache_spill=OFF
# setting.
#
do_execsql_test pragma2-4.6 {
COMMIT;
ROLLBACK;
PRAGMA cache_spill=OFF;
ATTACH 'test2.db' AS aux1;
PRAGMA aux1.cache_size=50;
BEGIN;