Closed maksverver closed 2 months ago
Thank you for reporting this!
Is this a real failure, or just a flake?
Likely not flaky, but because of how the test checks VACUUM has run (possibly some wrong assumptions there).
If it's not a real failure, is there a way to make it pass more reliably?
Two ideas, for now, will try when I get some time:
Meanwhile, can you please paste the output of the following script? (not critical; trying to see what may have caused the difference)
import sqlite3
db = sqlite3.connect('')
def pq(sql):
print('#', sql)
print()
for row in db.execute(sql):
print(*row)
print()
pq('select sqlite_version()')
pq('PRAGMA page_size')
pq('PRAGMA compile_options')
# select sqlite_version()
3.46.1
# PRAGMA page_size
4096
# PRAGMA compile_options
ATOMIC_INTRINSICS=1
COMPILER=gcc-14.2.1 20240805
DEFAULT_AUTOVACUUM
DEFAULT_CACHE_SIZE=-2000
DEFAULT_FILE_FORMAT=4
DEFAULT_JOURNAL_SIZE_LIMIT=-1
DEFAULT_MMAP_SIZE=0
DEFAULT_PAGE_SIZE=4096
DEFAULT_PCACHE_INITSZ=20
DEFAULT_RECURSIVE_TRIGGERS
DEFAULT_SECTOR_SIZE=4096
DEFAULT_SYNCHRONOUS=2
DEFAULT_WAL_AUTOCHECKPOINT=1000
DEFAULT_WAL_SYNCHRONOUS=2
DEFAULT_WORKER_THREADS=0
DIRECT_OVERFLOW_READ
ENABLE_COLUMN_METADATA
ENABLE_DBSTAT_VTAB
ENABLE_FTS3
ENABLE_FTS3_PARENTHESIS
ENABLE_FTS3_TOKENIZER
ENABLE_FTS4
ENABLE_FTS5
ENABLE_MATH_FUNCTIONS
ENABLE_RTREE
ENABLE_STAT4
ENABLE_STMTVTAB
ENABLE_UNLOCK_NOTIFY
HAVE_ISNAN
MALLOC_SOFT_LIMIT=1024
MAX_ATTACHED=10
MAX_COLUMN=2000
MAX_COMPOUND_SELECT=500
MAX_DEFAULT_PAGE_SIZE=8192
MAX_EXPR_DEPTH=10000
MAX_FUNCTION_ARG=127
MAX_LENGTH=1000000000
MAX_LIKE_PATTERN_LENGTH=50000
MAX_MMAP_SIZE=0x7fff0000
MAX_PAGE_COUNT=0xfffffffe
MAX_PAGE_SIZE=65536
MAX_SQL_LENGTH=1000000000
MAX_TRIGGER_DEPTH=1000
MAX_VARIABLE_NUMBER=250000
MAX_VDBE_OP=250000000
MAX_WORKER_THREADS=8
MUTEX_PTHREADS
SECURE_DELETE
SYSTEM_MALLOC
TEMP_STORE=1
THREADSAFE=1
Looks like the reason for the size increase are the internal table sqlite_stat1
and sqlite_stat4
that are created when running ANALYZE
:
sqlite3 <<EOF
CREATE TABLE t(id);
PRAGMA page_count; -- 2
DROP TABLE t;
VACUUM;
PRAGMA page_count; -- 1
EOF
sqlite3 <<EOF
CREATE TABLE t(id);
ANALYZE;
PRAGMA page_count; -- 4
DROP TABLE t;
VACUUM;
PRAGMA page_count; -- 3
SELECT name FROM sqlite_master; -- sqlite_stat1, sqlite_stat4
DROP TABLE sqlite_stat1;
DROP TABLE sqlite_stat4;
VACUUM;
PRAGMA page_count; -- 1
EOF
(ANALYZE might be triggered indirectly by PRAGMA OPTIMIZE.)
So a solution might be dropping all tables from sqlite_stat1, sqlite_stat2, sqlite_stat3, and sqlite_stat4 if they exist (which are generated depends on how sqlite3 was compiled.)
So a solution might be dropping all tables from sqlite_stat1, ...
Indeed: https://sqlite.org/forum/forumpost/5414ca8f89389f8a
Thank you for looking into this!
Thank you for the PR and the research!
The comment does mention the test is brittle. Is this a real failure, or just a flake? If it's not a real failure, is there a way to make it pass more reliably?
Test output is below: