mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Fix a problem with mixing temp-files and mmap-mode.
FossilOrigin-Name: c80c5c62b2e2c5e47e0839f8e2d5b6341ca4a249
This commit is contained in:
@ -316,5 +316,34 @@ foreach {tn mode} {
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
# When using mmap mode with a temp file, SQLite must search the cache
|
||||
# before using a mapped page even when there is no write transaction
|
||||
# open. For a temp file, the on-disk version may not be up to date.
|
||||
#
|
||||
sqlite3 db ""
|
||||
do_execsql_test 10.0 {
|
||||
PRAGMA cache_size = 50;
|
||||
PRAGMA page_size = 1024;
|
||||
CREATE TABLE t1(a, b, PRIMARY KEY(a)) WITHOUT ROWID;
|
||||
CREATE INDEX i1 ON t1(a);
|
||||
CREATE TABLE t2(x, y);
|
||||
INSERT INTO t2 VALUES(1, 2);
|
||||
}
|
||||
|
||||
do_execsql_test 10.1 {
|
||||
BEGIN;
|
||||
WITH x(i) AS ( SELECT 1 UNION ALL SELECT i+1 FROM x WHERE i<500 )
|
||||
INSERT INTO t1 SELECT randomblob(100), randomblob(100) FROM x;
|
||||
COMMIT;
|
||||
INSERT INTO t2 VALUES(3, 4);
|
||||
}
|
||||
|
||||
do_execsql_test 10.2 {
|
||||
PRAGMA mmap_size = 512000;
|
||||
SELECT * FROM t2;
|
||||
PRAGMA integrity_check;
|
||||
} {512000 1 2 3 4 ok}
|
||||
|
||||
finish_test
|
||||
|
||||
|
Reference in New Issue
Block a user