* It looks like adding and removing Striker peers (and all the sync'ing stuff behind it) is finally sorted out. Obviously, time will tell for sure, but currently things look good.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 6 years ago
parent 43035ba038
commit 510321d634
  1. 6
      Anvil/Tools/Database.pm
  2. 31
      tools/anvil-daemon

@ -942,6 +942,7 @@ sub connect
$anvil->data->{sys}{database}{connections}++; $anvil->data->{sys}{database}{connections}++;
push @{$successful_connections}, $uuid; push @{$successful_connections}, $uuid;
$anvil->data->{cache}{database_handle}{$uuid} = $dbh; $anvil->data->{cache}{database_handle}{$uuid} = $dbh;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { "cache::database_handle::${uuid}" => $anvil->data->{cache}{database_handle}{$uuid} }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0071", variables => { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0071", variables => {
host => $host, host => $host,
@ -5058,6 +5059,8 @@ sub resync_databases
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::database::resync_needed' => $anvil->data->{sys}{database}{resync_needed} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::database::resync_needed' => $anvil->data->{sys}{database}{resync_needed} }});
if (not $anvil->data->{sys}{database}{resync_needed}) if (not $anvil->data->{sys}{database}{resync_needed})
{ {
# We don't need table data, clear it.
delete $anvil->data->{sys}{database}{table};
return(0); return(0);
} }
@ -5429,6 +5432,9 @@ sub resync_databases
} }
} # foreach my $table } # foreach my $table
# We're done with the table data, clear it.
delete $anvil->data->{sys}{database}{table};
# Clear the variable that indicates we need a resync. # Clear the variable that indicates we need a resync.
$anvil->data->{sys}{database}{resync_needed} = 0; $anvil->data->{sys}{database}{resync_needed} = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::database::resync_needed' => $anvil->data->{sys}{database}{resync_needed} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::database::resync_needed' => $anvil->data->{sys}{database}{resync_needed} }});

@ -112,23 +112,11 @@ my $check_if_database_is_configured = 0;
# These are the things we always want running. # These are the things we always want running.
while(1) while(1)
{ {
# Connect to the database(s) # Reload defaults, re-read the config and then connect to the database(s)
$anvil->Storage->read_config({force_read => 1, file => $anvil->data->{path}{configs}{'anvil.conf'}}); $anvil->Storage->read_config({force_read => 1, file => $anvil->data->{path}{configs}{'anvil.conf'}});
$anvil->Database->connect({check_if_configured => $check_if_database_is_configured}); $anvil->Database->connect({check_if_configured => $check_if_database_is_configured});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 3, secure => 0, key => "log_0132"});
### DEBUG:
my $db_count = keys %{$anvil->data->{database}};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { db_count => $db_count }});
foreach my $uuid (keys %{$anvil->data->{database}})
{
my $host = $anvil->data->{database}{$uuid}{host};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:uuid" => $uuid,
"s2:host" => $host,
}});
}
# Mark that we don't want to check the database now. # Mark that we don't want to check the database now.
$check_if_database_is_configured = 0; $check_if_database_is_configured = 0;
@ -182,22 +170,7 @@ while(1)
} }
# Disconnect from the database(s) and sleep now. # Disconnect from the database(s) and sleep now.
$anvil->Database->disconnect({debug => 2}); $anvil->Database->disconnect();
### DEBUG:
$db_count = 0;
$db_count = keys %{$anvil->data->{database}};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { db_count => $db_count }});
foreach my $uuid (keys %{$anvil->data->{database}})
{
my $host = $anvil->data->{database}{$uuid}{host};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"s1:uuid" => $uuid,
"s2:host" => $host,
}});
}
die;
sleep(1); sleep(1);
} }

Loading…
Cancel
Save