diff --git a/contrib/munin-node-debug b/contrib/munin-node-debug index eecb78344..7f139bb3c 100755 --- a/contrib/munin-node-debug +++ b/contrib/munin-node-debug @@ -97,8 +97,8 @@ if ($dump_config) { for (my $i = 0; $i < $nb_servers; $i++) { my $port = $starting_port + $i; for (my $p = 0; $p < $nb_servers_per_port; $p++) { - my $hostname = get_hostname($i, $p); - my $group = get_group($i, $p); + my $hostname = get_hostname($port, $p); + my $group = get_group($port, $p); print "[$group;$hostname]\n"; print " address 127.0.0.1\n"; print " port $port\n"; diff --git a/lib/Munin/Master/Update.pm b/lib/Munin/Master/Update.pm index 8f3c62f1c..ed249cced 100644 --- a/lib/Munin/Master/Update.pm +++ b/lib/Munin/Master/Update.pm @@ -84,18 +84,25 @@ sub get_dbh { my $dbh = DBI->connect("dbi:$db_driver:dbname=$datafilename", $db_user, $db_passwd, \%db_args) or die $DBI::errstr; - DEBUG 'get_dbh: $dbh->{Driver}->{Name} = ' . $dbh->{Driver}->{Name} . ($is_read_only ? "(ro)" : "(rw)"); + 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"; + + # 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"; + DEBUG "get_dbh: PRAGMA main.synchronous=$db_synchronous_mode;" if $db_driver eq "SQLite"; # AutoCommit when readonly is a no-op anyway - $dbh->{AutoCommit} = 0; + $dbh->{AutoCommit} = $ENV{MUNIN_DB_AUTOCOMMIT} || $config->{db_autocommit} || 0; $dbh->{AutoCommit} = 1 if $is_read_only; + DEBUG "get_dbh: {AutoCommit} = " . $dbh->{AutoCommit}; # Plainly returns it, but do *not* put it in $self, as it will let Perl # do its GC properly and closing it when out of scope.