Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix node debug dump #1619

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contrib/munin-node-debug
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
15 changes: 11 additions & 4 deletions lib/Munin/Master/Update.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down