Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tidb status add gethealth info #4844

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
10 changes: 10 additions & 0 deletions docs/api-references/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -16153,6 +16153,16 @@ string
<p>Node hosting pod of this TiDB member.</p>
</td>
</tr>
<tr>
<td>
<code>message</code></br>
<em>
string
</em>
</td>
<td>
</td>
</tr>
</tbody>
</table>
<h3 id="tidbservicespec">TiDBServiceSpec</h3>
Expand Down
3 changes: 3 additions & 0 deletions manifests/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33604,12 +33604,15 @@ spec:
format: date-time
nullable: true
type: string
message:
type: string
name:
type: string
node:
type: string
required:
- health
- message
- name
type: object
type: object
Expand Down
3 changes: 3 additions & 0 deletions manifests/crd/v1/pingcap.com_tidbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20349,12 +20349,15 @@ spec:
format: date-time
nullable: true
type: string
message:
type: string
name:
type: string
node:
type: string
required:
- health
- message
- name
type: object
type: object
Expand Down
3 changes: 3 additions & 0 deletions manifests/crd/v1beta1/pingcap.com_tidbclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20319,12 +20319,15 @@ spec:
format: date-time
nullable: true
type: string
message:
type: string
name:
type: string
node:
type: string
required:
- health
- message
- name
type: object
type: object
Expand Down
3 changes: 3 additions & 0 deletions manifests/crd_v1beta1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33569,12 +33569,15 @@ spec:
format: date-time
nullable: true
type: string
message:
type: string
name:
type: string
node:
type: string
required:
- health
- message
- name
type: object
type: object
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/pingcap/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,7 @@ type TiDBMember struct {
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
// Node hosting pod of this TiDB member.
NodeName string `json:"node,omitempty"`
Message string `json:"message"`
}

// TiDBFailureMember is the tidb failure member information
Expand Down
8 changes: 4 additions & 4 deletions pkg/manager/member/tidb_member_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1049,14 +1049,14 @@ func (m *tidbMemberManager) syncTidbClusterStatus(tc *v1alpha1.TidbCluster, set
for id := range helper.GetPodOrdinals(tc.Status.TiDB.StatefulSet.Replicas, set) {
name := fmt.Sprintf("%s-%d", controller.TiDBMemberName(tc.GetName()), id)
health, err := m.deps.TiDBControl.GetHealth(tc, int32(id))
if err != nil {
return err
}

newTidbMember := v1alpha1.TiDBMember{
Name: name,
Health: health,
}
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to keep the err in _, err = getBodyOK(httpClient, url)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you revert it in a637f81

klog.V(4).Infof("tidb cluster %s/%s sync status get health error:%v", tc.GetNamespace(), tc.GetName(), err)
newTidbMember.Message = err.Error()
}
oldTidbMember, exist := tc.Status.TiDB.Members[name]

newTidbMember.LastTransitionTime = metav1.Now()
Expand Down