Skip to content

Commit 5202e9b

Browse files
committed
fix application_id
1 parent 048232c commit 5202e9b

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/zstd_vfs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ class ZstdVFS : public SQLiteNested::VFS {
374374
SQLiteNested::VFS::InitOuterDB(db);
375375
std::vector<const char *> ddl = {
376376
"CREATE TABLE nested_vfs_zstd_dicts (id INTEGER PRIMARY KEY AUTOINCREMENT, dict BLOB "
377-
"NOT NULL, page_count INTEGER NOT NULL); PRAGMA application_id=0x7a737464"};
377+
"NOT NULL, page_count INTEGER NOT NULL)",
378+
"PRAGMA application_id=0x7a737464"};
378379
for (const auto &stmt : ddl) {
379380
SQLite::Statement(db, stmt).executeStep();
380381
}

test/TPC-H.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ def run(cache_MiB, level, threads, inner_page_KiB, outer_page_KiB):
148148
con.close()
149149
assert results == expected_results[query_name]
150150

151+
# verify outer application_id
152+
outer = sqlite3.connect("/tmp/TPC-H.zstd.db")
153+
assert next(outer.execute("PRAGMA application_id"))[0] == 0x7A737464
154+
151155
return timings
152156

153157

test/test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ def test_roundtrip_zstd(tmpdir, chinook_file):
138138
linkcon = sqlite3.connect(f"file:{linkpath}?vfs=zstd", uri=True)
139139
linkcon.execute("select 1")
140140

141+
# verify application_id
142+
outer = sqlite3.connect(dbfn)
143+
assert next(outer.execute("PRAGMA application_id"))[0] == 0x7A737464
144+
141145

142146
@pytest.mark.skipif(os.geteuid() != 0, reason="must run in docker")
143147
def test_db_in_root():
@@ -160,6 +164,10 @@ def test_vacuum(tmpdir, chinook_file):
160164
dbfn = os.path.join(tmpdir, "chinook_zstd_vacuum.sqlite")
161165
con.execute(f"VACUUM INTO 'file:{dbfn}?vfs=zstd'")
162166

167+
# verify application_id
168+
outer = sqlite3.connect(dbfn)
169+
assert next(outer.execute("PRAGMA application_id"))[0] == 0x7A737464
170+
163171
# dump from the zstd version
164172
rslt = subprocess.run(
165173
f"sqlite3 :memory: -bail -cmd '.load {os.path.join(BUILD,'zstd_vfs')}' -cmd '.open file:{dbfn}?mode=ro&vfs=zstd' -cmd .dump -cmd .exit",
@@ -252,9 +260,10 @@ def test_sam(tmpdir):
252260
ratio = float(zstd_sqlite_size) / sam_zst_size
253261
assert ratio <= 1.6
254262

255-
# verify outer page size
263+
# verify outer page size and application_id
256264
con = sqlite3.connect(f"file:{zstd_sqlite}?mode=ro", uri=True)
257265
assert next(con.execute("PRAGMA page_size"))[0] == outer_page_size
266+
assert next(con.execute("PRAGMA application_id"))[0] == 0x7A737464
258267

259268
# verify inner page size
260269
con.enable_load_extension(True)

0 commit comments

Comments
 (0)