Skip to content

Commit f9d5a2c

Browse files
committed
Honor existing autovacuum mode on open
1 parent e3b8cf7 commit f9d5a2c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

core/lib.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -590,16 +590,16 @@ impl Database {
590590
AutoVacuumMode::None
591591
};
592592

593-
// Force autovacuum to None if the experimental flag is not enabled
594-
let final_mode = if !self.opts.enable_autovacuum {
595-
if mode != AutoVacuumMode::None {
596-
tracing::warn!(
597-
"Database has autovacuum enabled but --experimental-autovacuum flag is not set. Forcing autovacuum to None."
598-
);
599-
}
600-
AutoVacuumMode::None
601-
} else {
593+
// TODO: remove behind experimental toggle once feature is fully supported.
594+
// Do not disable autovacuum if the database header already has it enabled; otherwise we would
595+
// corrupt pointer-map expectations for existing databases. The flag only controls enabling it
596+
// when creating/rewriting databases, not honoring an already-enabled file.
597+
let final_mode = if mode != AutoVacuumMode::None {
602598
mode
599+
} else if self.opts.enable_autovacuum {
600+
mode
601+
} else {
602+
AutoVacuumMode::None
603603
};
604604

605605
pager.set_auto_vacuum_mode(final_mode);

0 commit comments

Comments
 (0)