Skip to content

Commit

Permalink
Merge branch 'master' into fix---TIUP_HOME-is-not-loaded-on-initializ…
Browse files Browse the repository at this point in the history
…es-meta
  • Loading branch information
AstroProfundis authored May 23, 2022
2 parents 5173c55 + dda5c51 commit 708e2a1
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 15 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/integrate-cluster-cmd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,24 @@ jobs:
- name: Collect component log
working-directory: ${{ env.working-directory }}
if: ${{ failure() }}
# if: always()
run: |
docker exec tiup-cluster-control bash /tiup-cluster/tests/tiup-cluster/script/pull_log.sh /tiup-cluster/logs
ls ${{ env.working-directory }}
tar czvf ${{ env.working-directory }}/logs.tar.gz ${{ env.working-directory }}/logs/
- name: Detect error log
working-directory: ${{ env.working-directory }}
# if: always()
run: |
bash ./tests/tiup-cluster/script/detect_error.sh ./logs/
- name: Upload component log
if: ${{ failure() }}
# if: always()
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: component_logs
path: ${{ env.working-directory }}/logs.tar.gz
path: ${{ env.working-directory }}/logs/

- name: Output cluster debug log
working-directory: ${{ env.working-directory }}
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/integrate-cluster-scale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,24 @@ jobs:
- name: Collect component log
working-directory: ${{ env.working-directory }}
if: ${{ failure() }}
# if: always()
run: |
docker exec tiup-cluster-control bash /tiup-cluster/tests/tiup-cluster/script/pull_log.sh /tiup-cluster/logs
ls ${{ env.working-directory }}
tar czvf ${{ env.working-directory }}/logs.tar.gz ${{ env.working-directory }}/logs/
- name: Detect error log
working-directory: ${{ env.working-directory }}
# if: always()
run: |
bash ./tests/tiup-cluster/script/detect_error.sh ./logs/
- name: Upload component log
if: ${{ failure() }}
# if: always()
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: cluster_logs
path: ${{ env.working-directory }}/logs.tar.gz
path: ${{ env.working-directory }}/logs/

- name: Output cluster debug log
working-directory: ${{ env.working-directory }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
TiUP Changelog

## [1.9.6] 2022-05-20

### Fix

- Fix incorrect output of `display` in certain circumstances for `tiup-cluster` ([#1889](https://github.com/pingcap/tiup/pull/1889), [@srstack](https://github.com/srstack))

## [1.9.5] 2022-05-10

### Fixes
Expand Down
3 changes: 0 additions & 3 deletions embed/examples/dm/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ monitoring_servers:

grafana_servers:
- host: 172.19.0.101
# config: # Enable this part if you want to use WebUI, make sure tiup dm -v newer than v1.9.0.
# auth.anonymous.enabled: true
# security.allow_embedding: true

alertmanager_servers:
- host: 172.19.0.101
3 changes: 0 additions & 3 deletions embed/examples/dm/topology.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ grafana_servers:
# deploy_dir: /tidb-deploy/grafana-3000
# grafana dashboard dir on TiUP machine
# dashboard_dir: /home/tidb/dashboards
# config: # Enable this part if you want to use WebUI, make sure tiup dm -v newer than v1.9.0.
# auth.anonymous.enabled: true
# security.allow_embedding: true

alertmanager_servers:
- host: 10.0.1.15
Expand Down
10 changes: 10 additions & 0 deletions pkg/cluster/manager/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"sort"
"strconv"
"strings"
"sync"
"time"

"github.com/fatih/color"
Expand Down Expand Up @@ -362,12 +363,16 @@ func (m *Manager) DisplayTiKVLabels(name string, opt operator.Options) error {
if err != nil {
return err
}

var mu sync.Mutex
topo.IterInstance(func(ins spec.Instance) {
if ins.ComponentName() == spec.ComponentPD {
status := ins.Status(ctx, statusTimeout, tlsCfg, masterList...)
if strings.HasPrefix(status, "Up") || strings.HasPrefix(status, "Healthy") {
instAddr := fmt.Sprintf("%s:%d", ins.GetHost(), ins.GetPort())
mu.Lock()
masterActive = append(masterActive, instAddr)
mu.Unlock()
}
}
}, opt.Concurrency)
Expand Down Expand Up @@ -482,6 +487,7 @@ func (m *Manager) GetClusterTopology(name string, opt operator.Options) ([]InstI
masterActive := make([]string, 0)
masterStatus := make(map[string]string)

var mu sync.Mutex
topo.IterInstance(func(ins spec.Instance) {
if ins.ComponentName() != spec.ComponentPD && ins.ComponentName() != spec.ComponentDMMaster {
return
Expand All @@ -490,7 +496,9 @@ func (m *Manager) GetClusterTopology(name string, opt operator.Options) ([]InstI
status := ins.Status(ctx, statusTimeout, tlsCfg, masterList...)
if strings.HasPrefix(status, "Up") || strings.HasPrefix(status, "Healthy") {
instAddr := fmt.Sprintf("%s:%d", ins.GetHost(), ins.GetPort())
mu.Lock()
masterActive = append(masterActive, instAddr)
mu.Unlock()
}
masterStatus[ins.ID()] = status
}, opt.Concurrency)
Expand Down Expand Up @@ -564,6 +572,7 @@ func (m *Manager) GetClusterTopology(name string, opt operator.Options) ([]InstI
if ins.IsPatched() {
roleName += " (patched)"
}
mu.Lock()
clusterInstInfos = append(clusterInstInfos, InstInfo{
ID: ins.ID(),
Role: roleName,
Expand All @@ -577,6 +586,7 @@ func (m *Manager) GetClusterTopology(name string, opt operator.Options) ([]InstI
Port: ins.GetPort(),
Since: since,
})
mu.Unlock()
}, opt.Concurrency)

// Sort by role,host,ports
Expand Down
2 changes: 1 addition & 1 deletion pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var (
// TiUPVerMinor is the minor version of TiUP
TiUPVerMinor = 9
// TiUPVerPatch is the patch version of TiUP
TiUPVerPatch = 5
TiUPVerPatch = 6
// TiUPVerName is an alternative name of the version
TiUPVerName = "tiup"
// GitHash is the current git commit hash
Expand Down
16 changes: 16 additions & 0 deletions tests/tiup-cluster/script/detect_error.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -eu

err_num=$(find $1 -name "*.log" -exec grep "\[ERROR\]" {} \; | wc -l)
if [ ${err_num} != "0" ]; then
echo "detect ${err_num} [ERROR] log"
exit 1
fi

err_num=$(find $1 -name "*stderr.log" -exec cat {} \; | wc -l)
if [ ${err_num} != "0" ]; then
echo "detect ${err_num} stderr log"
exit 1
fi

echo "no error log found"

0 comments on commit 708e2a1

Please sign in to comment.