SQLite User Forum

Using -DSQLITE_OMIT_SHARED_CACHE causes pager2-3.1 Tcl test to fail
Login

Using -DSQLITE_OMIT_SHARED_CACHE causes pager2-3.1 Tcl test to fail

(1) By 0xjnml on 2023-05-05 12:51:52 [source]

Hi,

I'm trying to evaluate the performance impact of -DSQLITE_OMIT_SHARED_CACHE, because of https://www.sqlite.org/sharedcache.html saying:

Applications that build their own copy of SQLite from source code are encouraged to use the -DSQLITE_OMIT_SHARED_CACHE compile-time option, as the resulting binary will be both smaller and faster.

When I use the option and run the Tcl tests, a single test failure is reported:

pager2-3.1...
Error: no such table: t1
Time: pager2.test 2161 ms

SQLite 2023-03-22 11:56:21 0d1fc92f94cb6b76bffe3ec34d69cffde2924203304e8ffc4155597af0c191da

Looking at the test source

#-------------------------------------------------------------------------
# Test that shared in-memory databases seem to work.
#
db close
do_test pager2-3.1 {
  forcedelete test.db
  sqlite3_shutdown
  sqlite3_config_uri 1

  sqlite3 db1 {file:test.db?mode=memory&cache=shared}
  sqlite3 db2 {file:test.db?mode=memory&cache=shared}
  sqlite3 db3 test.db

  db1 eval { CREATE TABLE t1(a, b) }
  db2 eval { INSERT INTO t1 VALUES(1, 2) }
  list [catch { db3 eval { INSERT INTO t1 VALUES(3, 4) } } msg] $msg
} {1 {no such table: t1}}

it seems to me it is expected to fail with -DSQLITE_OMIT_SHARED_CACHE. I think that there might be missing a test for the capability enabled in the pager2-3.1 test.

Can someone please confirm or should I look for a bug on my side?

FTR: The project I'm testing is the Go transpilation of SQLite, but AFAICT the problem would arise for the C version in the same way.

Thanks in advance for any insights!

(2) By Richard Hipp (drh) on 2023-05-05 14:14:53 in reply to 1 [link] [source]

(3) By 0xjnml on 2023-05-06 13:43:09 in reply to 2 [link] [source]

Thank you very much!