From 3d9be8410df3e2bfa62be457554578b017fa4eee Mon Sep 17 00:00:00 2001 From: chejinge <945997690@qq.com> Date: Thu, 9 May 2024 19:38:11 +0800 Subject: [PATCH 1/2] fix:slots rebalance error and replication stats error when use pika operater * Update replication_test.go --------- Co-authored-by: chejinge --- tests/integration/replication_test.go | 2 +- tools/kubeblocks_helm/installdebug.sh | 4 ++++ tools/kubeblocks_helm/pika/script/admin.sh | 12 +++++++++++- tools/kubeblocks_helm/reinstall.sh | 3 +++ 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 tools/kubeblocks_helm/installdebug.sh create mode 100644 tools/kubeblocks_helm/reinstall.sh diff --git a/tests/integration/replication_test.go b/tests/integration/replication_test.go index 9fe2d6a42..51a8ad00b 100644 --- a/tests/integration/replication_test.go +++ b/tests/integration/replication_test.go @@ -749,7 +749,7 @@ var _ = Describe("should replication ", func() { setkey2 := clientMaster.Set(ctx, "Tnxkey2", "Tnxvalue2", 0) Expect(setkey2.Err()).NotTo(HaveOccurred()) - Expect(get.Val()).To(Equal("QUEUED")) + Expect(setkey2.Val()).To(Equal("QUEUED")) r2 := clientMaster.Do(ctx, "EXEC") Expect(r2.Err()).NotTo(HaveOccurred()) diff --git a/tools/kubeblocks_helm/installdebug.sh b/tools/kubeblocks_helm/installdebug.sh new file mode 100644 index 000000000..53a496ad6 --- /dev/null +++ b/tools/kubeblocks_helm/installdebug.sh @@ -0,0 +1,4 @@ +# helm install pika ./pika && helm install pika-cluster ./pika-cluster + +helm template pika ./pika --output-dir ./output/pika +#helm template pika-cluster ./pika-cluster --output-dir ./output/pika-cluster \ No newline at end of file diff --git a/tools/kubeblocks_helm/pika/script/admin.sh b/tools/kubeblocks_helm/pika/script/admin.sh index f2ce0143f..29f3c2e4b 100755 --- a/tools/kubeblocks_helm/pika/script/admin.sh +++ b/tools/kubeblocks_helm/pika/script/admin.sh @@ -45,6 +45,15 @@ wait_master_registered() { done } +wait_all_master_registered() { + for ((group_id=1; group_id <= GROUP_ID; group_id++)); do + until $CODIS_ADMIN --list-group | jq -r '.[] | select(.id == '${group_id}') | .servers[] | select(.role == "master") | .server'; do + echo "Waiting for master to be registered in group $group_id" + sleep 2 + done + done +} + # confirm group has the max index of all groups confirm_max_group() { max_group_id=0 @@ -72,7 +81,7 @@ reload_until_success() { register_server() { reload_until_success - if [ ${POD_ID} -gt 0 ]; then wait_master_registered; fi + if [ ${POD_ID} -gt 0 ]; then wait_all_master_registered; fi $CODIS_ADMIN --create-group --gid=${GROUP_ID} 1>/dev/null 2>&1 $CODIS_ADMIN --group-add --gid=${GROUP_ID} --addr=${KB_POD_FQDN}:9221 $CODIS_ADMIN --sync-action --create --addr=${KB_POD_FQDN}:9221 1>/dev/null 2>&1 @@ -123,6 +132,7 @@ if [ $# -eq 1 ]; then wait_dashboard_running confirm_max_group wait_master_registered + wait_all_master_registered rebalance exit 0 ;; diff --git a/tools/kubeblocks_helm/reinstall.sh b/tools/kubeblocks_helm/reinstall.sh new file mode 100644 index 000000000..667172476 --- /dev/null +++ b/tools/kubeblocks_helm/reinstall.sh @@ -0,0 +1,3 @@ +helm uninstall pika && helm uninstall pika-cluster +sleep 5 +helm install pika ./pika && helm install pika-cluster ./pika-cluster \ No newline at end of file From b64fc3a3c6dbf95ccd0a5fc4579ea7b1b028a21d Mon Sep 17 00:00:00 2001 From: chejinge Date: Tue, 14 May 2024 18:28:23 +0800 Subject: [PATCH 2/2] fix:slots rebalance error and replication stats error when use pika operater * Update replication_test.go --------- Co-authored-by: chejinge --- tools/kubeblocks_helm/pika/script/admin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/kubeblocks_helm/pika/script/admin.sh b/tools/kubeblocks_helm/pika/script/admin.sh index 29f3c2e4b..b51af92f3 100755 --- a/tools/kubeblocks_helm/pika/script/admin.sh +++ b/tools/kubeblocks_helm/pika/script/admin.sh @@ -46,7 +46,7 @@ wait_master_registered() { } wait_all_master_registered() { - for ((group_id=1; group_id <= GROUP_ID; group_id++)); do + for ((group_id = 1; group_id <= GROUP_ID; group_id++)); do until $CODIS_ADMIN --list-group | jq -r '.[] | select(.id == '${group_id}') | .servers[] | select(.role == "master") | .server'; do echo "Waiting for master to be registered in group $group_id" sleep 2