Skip to content

Commit

Permalink
m/u: SQLite journaling defaults if not explicit
Browse files Browse the repository at this point in the history
We do leverage the SQLite defaults if we don't override it explicitely in
munin config. This ensure that the safest default for the current
platform is used as the SQLite package should be trusted on it.
  • Loading branch information
steveschnepp committed May 18, 2024
1 parent ce790c3 commit 7ff6a86
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/Munin/Master/Update.pm
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,13 @@ sub get_dbh {
INFO 'get_dbh: $dbh->{Driver}->{Name} = ' . $dbh->{Driver}->{Name} . ($is_read_only ? "(ro)" : "(rw)");

# Sets some session vars
my $db_journal_mode = $ENV{MUNIN_DB_JOURNAL_MODE} || $config->{db_journal_mode} || "TRUNCATE";
$dbh->do("PRAGMA journal_mode=$db_journal_mode;") if $db_driver eq "SQLite";
DEBUG "get_dbh: PRAGMA journal_mode=$db_journal_mode;" if $db_driver eq "SQLite";

# db_journal_mode is only set explicitely. Otherwise use the platform SQLite default
my $db_journal_mode = $ENV{MUNIN_DB_JOURNAL_MODE} || $config->{db_journal_mode};
if ($db_journal_mode) {
$dbh->do("PRAGMA journal_mode=$db_journal_mode;") if $db_driver eq "SQLite";
DEBUG "get_dbh: PRAGMA journal_mode=$db_journal_mode;" if $db_driver eq "SQLite";
}

my $db_synchronous_mode = $ENV{MUNIN_DB_SYNCHRONOUS_MODE} || $config->{db_synchronous_mode} || "OFF";
$dbh->do("PRAGMA main.synchronous=$db_synchronous_mode;") if $db_driver eq "SQLite";
Expand Down

0 comments on commit 7ff6a86

Please sign in to comment.