From d6a4fa902ba4deb51990be1fef622178f0cfd287 Mon Sep 17 00:00:00 2001 From: Masayuki Ishii Date: Mon, 28 Aug 2023 05:51:28 +0000 Subject: [PATCH 1/6] Fix retry message when gathering mysqld status Signed-off-by: Masayuki Ishii --- clustering/status.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/clustering/status.go b/clustering/status.go index e9a98a592..7594b55f1 100644 --- a/clustering/status.go +++ b/clustering/status.go @@ -197,15 +197,20 @@ func (p *managerProcess) GatherStatus(ctx context.Context) (*StatusSet, error) { go func(index int) { defer wg.Done() - for j := 0; j < statusCheckRetryMax; j++ { + for j := 0; j <= statusCheckRetryMax; j++ { ist, err := ss.DBOps[index].GetStatus(ctx) if err == dbop.ErrNop { return } if err != nil { - logFromContext(ctx).Error(err, "failed to get mysqld status") - time.Sleep(statusCheckRetryInterval) - continue + if j == statusCheckRetryMax { + logFromContext(ctx).Error(err, "failed to get mysqld status, mysqld is not ready") + return + } else { + logFromContext(ctx).Error(err, "failed to get mysqld status, will retry") + time.Sleep(statusCheckRetryInterval) + continue + } } ss.MySQLStatus[index] = ist return From 76c95b8ac4e6139440ed6a11b91b4d818b72ac3f Mon Sep 17 00:00:00 2001 From: Masayuki Ishii Date: Mon, 28 Aug 2023 06:15:29 +0000 Subject: [PATCH 2/6] reflect comments Signed-off-by: Masayuki Ishii --- clustering/status.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/clustering/status.go b/clustering/status.go index 7594b55f1..47f188a3c 100644 --- a/clustering/status.go +++ b/clustering/status.go @@ -203,17 +203,16 @@ func (p *managerProcess) GatherStatus(ctx context.Context) (*StatusSet, error) { return } if err != nil { - if j == statusCheckRetryMax { - logFromContext(ctx).Error(err, "failed to get mysqld status, mysqld is not ready") - return - } else { - logFromContext(ctx).Error(err, "failed to get mysqld status, will retry") - time.Sleep(statusCheckRetryInterval) - continue - } + ss.MySQLStatus[index] = ist + return + } + // process errors + if j == statusCheckRetryMax { + logFromContext(ctx).Error(err, "failed to get mysqld status, mysqld is not ready") + return } - ss.MySQLStatus[index] = ist - return + logFromContext(ctx).Error(err, "failed to get mysqld status, will retry") + time.Sleep(statusCheckRetryInterval) } }(i) } From 17371db6bf94c5318fbcbf0c89989616cd33b63d Mon Sep 17 00:00:00 2001 From: Masayuki Ishii Date: Mon, 28 Aug 2023 15:40:05 +0900 Subject: [PATCH 3/6] Update clustering/status.go Co-authored-by: Yamamoto, Hirotaka --- clustering/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clustering/status.go b/clustering/status.go index 47f188a3c..e1b4c7e43 100644 --- a/clustering/status.go +++ b/clustering/status.go @@ -202,7 +202,7 @@ func (p *managerProcess) GatherStatus(ctx context.Context) (*StatusSet, error) { if err == dbop.ErrNop { return } - if err != nil { + if err == nil { ss.MySQLStatus[index] = ist return } From 40d01448c71efe343248209f56ebca994667e387 Mon Sep 17 00:00:00 2001 From: Masayuki Ishii Date: Mon, 28 Aug 2023 08:19:04 +0000 Subject: [PATCH 4/6] Increase eventually timeout Signed-off-by: Masayuki Ishii --- e2e/suite_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/suite_test.go b/e2e/suite_test.go index 2d4970faa..4d9179db1 100644 --- a/e2e/suite_test.go +++ b/e2e/suite_test.go @@ -14,7 +14,7 @@ func TestE2e(t *testing.T) { t.Skip("no RUN_E2E environment variable") } RegisterFailHandler(Fail) - SetDefaultEventuallyTimeout(5 * time.Minute) + SetDefaultEventuallyTimeout(10 * time.Minute) SetDefaultEventuallyPollingInterval(100 * time.Millisecond) RunSpecs(t, "E2e Suite") } From 915db048472458b010b598686c526ec7dcea0960 Mon Sep 17 00:00:00 2001 From: Masayuki Ishii Date: Tue, 29 Aug 2023 04:54:54 +0000 Subject: [PATCH 5/6] fix Signed-off-by: Masayuki Ishii --- clustering/status.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clustering/status.go b/clustering/status.go index e1b4c7e43..db8dc3839 100644 --- a/clustering/status.go +++ b/clustering/status.go @@ -19,7 +19,7 @@ import ( ) var ( - statusCheckRetryMax = 3 + statusCheckRetryMax = 2 statusCheckRetryInterval = 3 * time.Second ) From d773c9f6fd67c695d4ec2da6788c68ea0cc1ba18 Mon Sep 17 00:00:00 2001 From: Masayuki Ishii Date: Tue, 29 Aug 2023 04:55:46 +0000 Subject: [PATCH 6/6] Revert "Increase eventually timeout" This reverts commit 40d01448c71efe343248209f56ebca994667e387. --- e2e/suite_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/suite_test.go b/e2e/suite_test.go index 4d9179db1..2d4970faa 100644 --- a/e2e/suite_test.go +++ b/e2e/suite_test.go @@ -14,7 +14,7 @@ func TestE2e(t *testing.T) { t.Skip("no RUN_E2E environment variable") } RegisterFailHandler(Fail) - SetDefaultEventuallyTimeout(10 * time.Minute) + SetDefaultEventuallyTimeout(5 * time.Minute) SetDefaultEventuallyPollingInterval(100 * time.Millisecond) RunSpecs(t, "E2e Suite") }