From dc7b909bfca2548daf7d17cc9b9084992a87e541 Mon Sep 17 00:00:00 2001 From: digimer Date: Tue, 18 Apr 2023 19:14:59 -0400 Subject: [PATCH] More logging to debug storage group race condition Signed-off-by: digimer --- Anvil/Tools/Database.pm | 8 ++++---- notes | 2 ++ tools/anvil-manage-dr | 2 +- tools/anvil-manage-storage-groups | 2 +- tools/anvil-provision-server | 2 +- tools/anvil-report-usage | 5 ++++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index a05d6a43..1e842e1d 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -6051,11 +6051,11 @@ WHERE }}); my $query = "DELETE FROM history.storage_group_members WHERE storage_group_member_uuid = ".$anvil->Database->quote($storage_group_member_uuid).";"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { query => $query }}); $anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__}); $query = "DELETE FROM storage_group_members WHERE storage_group_member_uuid = ".$anvil->Database->quote($storage_group_member_uuid).";"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { query => $query }}); $anvil->Database->write({query => $query, source => $THIS_FILE, line => __LINE__}); } } @@ -13948,11 +13948,11 @@ SET WHERE storage_group_member_uuid = ".$anvil->Database->quote($storage_group_member_uuid)." ;"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { query => $query }}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); $query = "DELETE FROM storage_group_members WHERE storage_group_member_uuid = ".$anvil->Database->quote($storage_group_member_uuid).";"; - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { query => $query }}); $anvil->Database->write({uuid => $uuid, query => $query, source => $file ? $file." -> ".$THIS_FILE : $THIS_FILE, line => $line ? $line." -> ".__LINE__ : __LINE__}); } } diff --git a/notes b/notes index e302d858..628d8f1b 100644 --- a/notes +++ b/notes @@ -16,6 +16,8 @@ Common queries; * SELECT a.job_uuid, b.host_name, a.job_command, a.job_data, a.job_progress, a.job_status FROM jobs a, hosts b WHERE a.job_host_uuid = b.host_uuid AND a.job_progress != 100; * SELECT a.host_name, b.file_name, c.file_location_active FROM hosts a, files b, file_locations c WHERE a.host_uuid = c.file_location_host_uuid AND b.file_uuid = c.file_location_file_uuid ORDER BY b.file_name ASC, a.host_name ASC; * SELECT a.dr_link_uuid, b.host_name, c.anvil_name, a.dr_link_note FROM dr_links a, hosts b, anvils c WHERE a.dr_link_host_uuid = b.host_uuid AND a.dr_link_anvil_uuid = c.anvil_uuid ORDER BY c.anvil_name ASC, b.host_name ASC; +* SELECT a.storage_group_uuid, d.storage_group_member_uuid, b.anvil_name, a.storage_group_name, c.host_name, d.storage_group_member_vg_uuid, d.storage_group_member_note FROM storage_groups a, anvils b, hosts c, storage_group_members d WHERE a.storage_group_uuid = d.storage_group_member_storage_group_uuid AND a.storage_group_anvil_uuid = b.anvil_uuid AND c.host_uuid = d.storage_group_member_host_uuid ORDER BY a.storage_group_name ASC, c.host_name ASC; + # Fail a resource for testing purposes. crm_resource --fail --resource srv02-b -N vm-a01n01 diff --git a/tools/anvil-manage-dr b/tools/anvil-manage-dr index 9a10b28b..ec9c0ce2 100755 --- a/tools/anvil-manage-dr +++ b/tools/anvil-manage-dr @@ -534,7 +534,7 @@ sub sanity_check # Get the Anvil! details. $anvil->Database->get_hosts(); $anvil->Database->get_anvils(); - $anvil->Database->get_storage_group_data(); + $anvil->Database->get_storage_group_data({debug => 2}); $anvil->Database->get_dr_links({debug => 2}); # Does this Anvil! have at least one DR node? If there's only one, use it. If more than one, we need diff --git a/tools/anvil-manage-storage-groups b/tools/anvil-manage-storage-groups index 12dc6a34..62500ca2 100755 --- a/tools/anvil-manage-storage-groups +++ b/tools/anvil-manage-storage-groups @@ -60,7 +60,7 @@ if (not $anvil->data->{sys}{database}{connections}) $anvil->Database->get_hosts({include_deleted => 1}); $anvil->Database->get_anvils(); -$anvil->Database->get_storage_group_data(); +$anvil->Database->get_storage_group_data({debug => 2}); get_vg_data($anvil); get_storage_data($anvil); diff --git a/tools/anvil-provision-server b/tools/anvil-provision-server index 97dea740..3ccee7dc 100755 --- a/tools/anvil-provision-server +++ b/tools/anvil-provision-server @@ -2417,7 +2417,7 @@ sub interactive_ask_server_storage_size }}); $anvil->Database->get_anvils(); - $anvil->Database->get_storage_group_data(); + $anvil->Database->get_storage_group_data({debug => 2}); $anvil->Get->available_resources({ debug => 2, anvil_uuid => $anvil_uuid, diff --git a/tools/anvil-report-usage b/tools/anvil-report-usage index 291fcdae..d158a0b1 100755 --- a/tools/anvil-report-usage +++ b/tools/anvil-report-usage @@ -116,7 +116,10 @@ sub collect_anvil_data }}); } - $anvil->Get->available_resources({anvil_uuid => $anvil_uuid}); + $anvil->Get->available_resources({ + debug => 2, + anvil_uuid => $anvil_uuid, + }); my $cpu_cores = $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{cores}; my $cpu_threads = $anvil->data->{anvil_resources}{$anvil_uuid}{cpu}{threads}; my $say_cpu = $anvil->Words->string({key => "message_0289", variables => {