aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <Dan Kennedy>2022-10-24 15:51:24 +0000
committerdan <Dan Kennedy>2022-10-24 15:51:24 +0000
commit80b30f995eacfafaba95f76d25b5ae2c37f478e9 (patch)
tree5720fd07dc19b302ab02838811faab334d169c89 /src
parent4073706a47c07ed3bee9d7752142f6c8f02316e0 (diff)
downloadsqlite-80b30f995eacfafaba95f76d25b5ae2c37f478e9.tar.gz
sqlite-80b30f995eacfafaba95f76d25b5ae2c37f478e9.zip
Use the same "PRAGMA synchronous" setting for the output of a "VACUUM INTO" as are configured for the database being vacuumed.
FossilOrigin-Name: 86cb21ca12581cae9a29f42ba707bd9d789e667e5ddc0f64b24940d5d5c9a118
Diffstat (limited to 'src')
-rw-r--r--src/vacuum.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vacuum.c b/src/vacuum.c
index 9899b63cf..9908cf142 100644
--- a/src/vacuum.c
+++ b/src/vacuum.c
@@ -161,6 +161,7 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
int nDb; /* Number of attached databases */
const char *zDbMain; /* Schema name of database to vacuum */
const char *zOut; /* Name of output file */
+ u32 pgflags = PAGER_SYNCHRONOUS_OFF; /* sync flags for output db */
if( !db->autoCommit ){
sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
@@ -232,12 +233,17 @@ SQLITE_NOINLINE int sqlite3RunVacuum(
goto end_of_vacuum;
}
db->mDbFlags |= DBFLAG_VacuumInto;
+
+ /* For a VACUUM INTO, the pager-flags are set to the same values as
+ ** they are for the database being vacuumed, except that PAGER_CACHESPILL
+ ** is always set. */
+ pgflags = db->aDb[iDb].safety_level | (db->flags & PAGER_FLAGS_MASK);
}
nRes = sqlite3BtreeGetRequestedReserve(pMain);
sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size);
sqlite3BtreeSetSpillSize(pTemp, sqlite3BtreeSetSpillSize(pMain,0));
- sqlite3BtreeSetPagerFlags(pTemp, PAGER_SYNCHRONOUS_OFF|PAGER_CACHESPILL);
+ sqlite3BtreeSetPagerFlags(pTemp, pgflags|PAGER_CACHESPILL);
/* Begin a transaction and take an exclusive lock on the main database
** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below,