diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index 3ee83f85..2dfadcb9 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -803,7 +803,7 @@ sub configure_pgsql # Make sure we have an entry in our own anvil.conf. my $local_uuid = $anvil->Database->get_local_uuid(); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { local_uuid => $local_uuid }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { local_uuid => $local_uuid }}); # If we didn't get the $local_uuid, then there is no entry for this system in anvil.conf yet, so we'll add it. if (not $local_uuid) @@ -15393,12 +15393,27 @@ sub query } # Do the query. - my $DBreq = $anvil->data->{cache}{database_handle}{$uuid}->prepare($query) or $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0075", variables => { + local $@; + my $DBreq = eval { $anvil->data->{cache}{database_handle}{$uuid}->prepare($query) or $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0075", variables => { query => (not $secure) ? $query : $anvil->Log->is_secure($query), server => $say_server, db_error => $DBI::errstr, + }}); }; + if ($@) + { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0675", variables => { + query => (not $secure) ? $query : $anvil->Log->is_secure($query), + server => $say_server, + eval_error => $@, }}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { DBreq => $DBreq }}); + return("!!error!!"); + } + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { + uuid => $uuid, + query => (not $secure) ? $query : $anvil->Log->is_secure($query), + say_server => $say_server, + DBreq => $DBreq, + }}); # Execute on the query $DBreq->execute() or $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "log_0076", variables => { @@ -15667,6 +15682,7 @@ sub resync_databases ### to avoid trouble with primary/foreign keys. # We're going to use the array of tables assembles by _find_behind_databases() stored in # 'sys::database::check_tables' + my $start_time = time; foreach my $table (@{$anvil->data->{sys}{database}{check_tables}}) { # We don't sync 'states' as it's transient and sometimes per-DB. @@ -16117,6 +16133,10 @@ sub resync_databases $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} }}); + my $time_taken = time - $start_time; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { time_taken => $time_taken }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0674", variables => { took => $time_taken }}); + return(0); } diff --git a/share/words.xml b/share/words.xml index 1c75d45f..ba99971f 100644 --- a/share/words.xml +++ b/share/words.xml @@ -2064,6 +2064,8 @@ The file: [#!variable!file!#] needs to be updated. The difference is: The host: [#!variable!host_name!#] was powered off for an unknown reason, and 'feature::scancore::disable::boot-unknown-stop' is set to: [#!data!feature::scancore::disable::boot-unknown-stop!#]. Will not boot this host. The host: [#!variable!host_name!#] was powered off for an unknown reason, and 'feature::scancore::disable::boot-unknown-stop' is set to: [#!data!feature::scancore::disable::boot-unknown-stop!#]. If power and temperature looks good, we'll boot it. The host: [#!variable!host_name!#] has good power and temperature readings. Booting it back up now. + The resync has completed in: [#!variable!took!#] second(s). + Log->secure' is not set. ]]> The host name: [#!variable!target!#] does not resolve to an IP address. diff --git a/tools/anvil-daemon b/tools/anvil-daemon index 29142c78..2db260ce 100755 --- a/tools/anvil-daemon +++ b/tools/anvil-daemon @@ -92,7 +92,6 @@ $anvil->System->_check_anvil_conf(); # Connect to the database(s). If we have no connections, we'll proceed anyway as one of the 'run_once' tasks # is to setup the database server. $anvil->Database->connect({ - debug => 2, check_if_configured => 1, check_for_resync => 1, }); @@ -109,7 +108,7 @@ if (not $anvil->data->{sys}{database}{connections}) prep_database($anvil); # Try connecting again - $anvil->Database->connect({debug => 2, check_if_configured => 1, check_for_resync => 1}); + $anvil->Database->connect({check_if_configured => 1, check_for_resync => 1}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0132"}); if (not $anvil->data->{sys}{database}{connections}) {