From 038501a61d96b7cf95a4261ffb033107a2024643 Mon Sep 17 00:00:00 2001 From: lucklove Date: Mon, 5 Apr 2021 21:53:47 +0800 Subject: [PATCH 1/3] Revert "Fix tiflash not start with newest nightly PD (#902)" This reverts commit 402079dbc40bc7397d4b136eccacee833c81d898. We should reverts #902 because it introduced an issue: https://github.com/pingcap/tiup/issues/1279 BTW, PD itself fixes #888 in https://github.com/tikv/pd/pull/3163 So we don't need #902 anymore with recently released PD. However, after revert #902, *** old PDs (before #3163) may not work with tiup-playground *** --- components/playground/instance/tiflash.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/playground/instance/tiflash.go b/components/playground/instance/tiflash.go index e7b5db11e8..ef71252c72 100644 --- a/components/playground/instance/tiflash.go +++ b/components/playground/instance/tiflash.go @@ -76,8 +76,7 @@ type scheduleConfig struct { } type replicateMaxReplicaConfig struct { - MaxReplicas int `json:"max-replicas"` - EnablePlacementRules string `json:"enable-placement-rules"` + MaxReplicas int `json:"max-replicas"` } type replicateEnablePlacementRulesConfig struct { @@ -123,8 +122,7 @@ func (inst *TiFlashInstance) Start(ctx context.Context, version utils.Version) e } // Update maxReplicas before placement rules so that it would not be overwritten maxReplicas, err := json.Marshal(replicateMaxReplicaConfig{ - MaxReplicas: 1, - EnablePlacementRules: "false", + MaxReplicas: 1, }) if err != nil { return err From 0cc9d28fcb6bacedfcf4b39ab5a471e44ff2dcf6 Mon Sep 17 00:00:00 2001 From: lucklove Date: Mon, 5 Apr 2021 22:24:16 +0800 Subject: [PATCH 2/3] Add test --- tests/tiup-playground/test_playground.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tests/tiup-playground/test_playground.sh b/tests/tiup-playground/test_playground.sh index 7c3edc36e9..e840491ada 100755 --- a/tests/tiup-playground/test_playground.sh +++ b/tests/tiup-playground/test_playground.sh @@ -47,15 +47,16 @@ function kill_all() { killall -9 grafana-server || true killall -9 tiup-playground || true killall -9 prometheus || true + cat $outfile } outfile=/tmp/tiup-playground-test.out -tiup-playground v4.0.10 --tiflash 0 > $outfile 2>&1 & +tiup-playground nightly > $outfile 2>&1 & # wait $outfile generated sleep 3 -trap "kill_all > /dev/null 2>&1" EXIT +trap "kill_all" EXIT # wait start cluster successfully timeout 300 grep -q "CLUSTER START SUCCESSFULLY" <(tail -f $outfile) @@ -97,4 +98,17 @@ tiup-playground display | grep -E "terminated|exit" | wc -l | grep -q "1" killall -2 tiup-playground.test || killall -2 tiup-playground +sleep 60 + +# test restart with same data +tiup-playground nightly > $outfile 2>&1 & + +# wait $outfile generated +sleep 3 + +# wait start cluster successfully +timeout 300 grep -q "CLUSTER START SUCCESSFULLY" <(tail -f $outfile) + +cat $outfile | grep ":3930" | grep -q "Done" + echo -e "\033[0;36m<<< Run all test success >>>\033[0m" From 9cdefccfcc2796757709076e4d09be3e9ff764dd Mon Sep 17 00:00:00 2001 From: lucklove Date: Tue, 6 Apr 2021 13:37:11 +0800 Subject: [PATCH 3/3] Fix download --- components/playground/instance/tiflash.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/playground/instance/tiflash.go b/components/playground/instance/tiflash.go index ef71252c72..b63f9cf638 100644 --- a/components/playground/instance/tiflash.go +++ b/components/playground/instance/tiflash.go @@ -152,7 +152,7 @@ func (inst *TiFlashInstance) Start(ctx context.Context, version utils.Version) e if err != nil { return err } - if version, err = env.GetComponentInstalledVersion("tiflash", version); err != nil { + if version, err = env.DownloadComponentIfMissing("tiflash", version); err != nil { return err } // version may be empty, we will use the latest stable version later in Start cmd.