SQLite Forum

Request: Allow VACUUM INTO with a new page size even in WAL mode
Login

Request: Allow VACUUM INTO with a new page size even in WAL mode

(1) By anonymous on 2021-10-28 23:22:24 [link] [source]

The page size being fixed while in WAL mode is a perfectly reasonable limitation. However, I don't see how those reasons apply to VACUUM INTO, which creates a new database without changing the original one.

The patch below seems to do what I want without breaking anything else.


Index: src/vacuum.c
==================================================================
--- src/vacuum.c
+++ src/vacuum.c
@@ -247,12 +247,14 @@
   if( rc!=SQLITE_OK ) goto end_of_vacuum;
   rc = sqlite3BtreeBeginTrans(pMain, pOut==0 ? 2 : 0, 0);
   if( rc!=SQLITE_OK ) goto end_of_vacuum;
 
   /* Do not attempt to change the page size for a WAL database */
-  if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))
-                                               ==PAGER_JOURNALMODE_WAL ){
+  if( !pOut
+      && sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain))
+                                               ==PAGER_JOURNALMODE_WAL
+  ){
     db->nextPagesize = 0;
   }
 
   if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0)
    || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0))


(2) By Larry Brasfield (larrybr) on 2021-10-29 14:02:10 in reply to 1 [link] [source]

Richard has implemented your suggested behavior, in a similar manner.

(3) By anonymous on 2021-10-31 02:55:11 in reply to 2 [source]

Thanks!