@@ -731,50 +731,19 @@ static cbm_store_t *store_open_internal(const char *path, bool in_memory, bool c
731731 * commit, which is the point: bounded beats unbounded.
732732 *
733733 * Must run before SQLite initialises, so it is done once on the first open. */
734- enum {
735- STORE_PAGECACHE_SLOT_BYTES = 4096 + 256 , /* page + pcache1 header slack */
736- STORE_PAGECACHE_SLOTS = 2048 , /* ~8.7 MiB, shared by all connections */
737- };
738-
739- /* Must run before ANY sqlite3 call: SQLITE_CONFIG_PAGECACHE is refused once
740- * sqlite3_initialize has run, and being refused is what left every request's
741- * page cache coming from the general allocator (#581). Idempotent, so the
742- * open paths can keep calling it as a backstop. */
743- void cbm_store_configure_pagecache (void ) {
744- static atomic_int configured = ATOMIC_VAR_INIT (0 );
745- int expected = 0 ;
746- if (!atomic_compare_exchange_strong (& configured , & expected , 1 )) {
747- return ;
748- }
749- static char slab [STORE_PAGECACHE_SLOT_BYTES * STORE_PAGECACHE_SLOTS ];
750- int rc = sqlite3_config (SQLITE_CONFIG_PAGECACHE , slab , STORE_PAGECACHE_SLOT_BYTES ,
751- STORE_PAGECACHE_SLOTS );
752- if (rc != SQLITE_OK ) {
753- /* Fail loud rather than silently reverting to per-connection cache
754- * allocation, which is the behaviour that produced #581. Not fatal:
755- * the store still works, it just fragments — so say so clearly. */
756- cbm_log_warn ("store.pagecache.config_failed" , "rc" ,
757- rc == SQLITE_MISUSE ? "misuse" : "error" , "detail" ,
758- "shared SQLite page-cache slab was refused (SQLite already initialised?); "
759- "page cache will be served from the general allocator and may fragment" );
760- }
761- }
762734
763735cbm_store_t * cbm_store_open_memory (void ) {
764- cbm_store_configure_pagecache ();
765736 return store_open_internal (":memory:" , true, true);
766737}
767738
768739cbm_store_t * cbm_store_open_path (const char * db_path ) {
769- cbm_store_configure_pagecache ();
770740 if (!db_path ) {
771741 return NULL ;
772742 }
773743 return store_open_internal (db_path , false, true);
774744}
775745
776746cbm_store_t * cbm_store_open_path_existing (const char * db_path ) {
777- cbm_store_configure_pagecache ();
778747 if (!db_path ) {
779748 return NULL ;
780749 }
@@ -845,7 +814,6 @@ static bool build_immutable_uri(const char *path, char *out, size_t out_sz) {
845814}
846815
847816cbm_store_t * cbm_store_open_path_query (const char * db_path ) {
848- cbm_store_configure_pagecache ();
849817 if (!db_path ) {
850818 return NULL ;
851819 }
0 commit comments