Skip to content

Commit

Permalink
cdc: update info message for ‘/api/v2/changefeeds/{changefeed_id}/syn…
Browse files Browse the repository at this point in the history
…ced’ (#10399)

ref #10289
  • Loading branch information
hongyunyan authored Jan 2, 2024
1 parent fb5aa10 commit 36aed02
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions cdc/api/v2/changefeed.go
Original file line number Diff line number Diff line change
Expand Up @@ -1002,12 +1002,12 @@ func (h *OpenAPIV2) synced(c *gin.Context) {
var message string
if (oracle.ExtractPhysical(status.PullerResolvedTs) - oracle.ExtractPhysical(status.CheckpointTs)) <
cfg.ReplicaConfig.SyncedStatus.CheckpointInterval*1000 {
message = fmt.Sprintf("Please check whether pd is healthy and tikv region is all available. " +
"If pd is not healthy or tikv region is not available, the data syncing is finished. " +
"When pd is offline means that pd is not healthy. For tikv region, you can check the grafana info " +
"in 'TiKV-Details-Resolved-Ts-Max Leader Resolved TS gap'. If the gap is a large value, such as a few minutes, " +
"it means some regions in tikv are unavailable. " +
" Otherwise the data syncing is not finished, please wait")
message = fmt.Sprintf("Please check whether PD is online and TiKV Regions are all available. " +
"If PD is offline or some TiKV regions are not available, it means that the data syncing process is complete. " +
"To check whether TiKV regions are all available, you can view " +
"'TiKV-Details' > 'Resolved-Ts' > 'Max Leader Resolved TS gap' on Grafana. " +
"If the gap is large, such as a few minutes, it means that some regions in TiKV are unavailable. " +
"Otherwise, if the gap is small and PD is online, it means the data syncing is incomplete, so please wait")
} else {
message = "The data syncing is not finished, please wait"
}
Expand Down
12 changes: 6 additions & 6 deletions cdc/api/v2/changefeed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1115,12 +1115,12 @@ func TestChangefeedSynced(t *testing.T) {
err := json.NewDecoder(w.Body).Decode(&resp)
require.Nil(t, err)
require.Equal(t, false, resp.Synced)
require.Equal(t, "Please check whether pd is healthy and tikv region is all available. "+
"If pd is not healthy or tikv region is not available, the data syncing is finished. "+
"When pd is offline means that pd is not healthy. For tikv region, you can check the grafana info "+
"in 'TiKV-Details-Resolved-Ts-Max Leader Resolved TS gap'. If the gap is a large value, such as a few minutes, "+
"it means some regions in tikv are unavailable. "+
" Otherwise the data syncing is not finished, please wait", resp.Info)
require.Equal(t, "Please check whether PD is online and TiKV Regions are all available. "+
"If PD is offline or some TiKV regions are not available, it means that the data syncing process is complete. "+
"To check whether TiKV regions are all available, you can view "+
"'TiKV-Details' > 'Resolved-Ts' > 'Max Leader Resolved TS gap' on Grafana. "+
"If the gap is large, such as a few minutes, it means that some regions in TiKV are unavailable. "+
"Otherwise, if the gap is small and PD is online, it means the data syncing is incomplete, so please wait", resp.Info)
}

{
Expand Down
24 changes: 12 additions & 12 deletions tests/integration_tests/synced_status/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ function run_case_with_unavailable_tikv() {
exit 1
fi
info=$(echo $synced_status | jq -r '.info')
target_message="Please check whether pd is healthy and tikv region is all available. \
If pd is not healthy or tikv region is not available, the data syncing is finished. \
When pd is offline means that pd is not healthy. For tikv region, you can check the grafana info \
in 'TiKV-Details-Resolved-Ts-Max Leader Resolved TS gap'. If the gap is a large value, such as a few minutes, \
it means some regions in tikv are unavailable. \
Otherwise the data syncing is not finished, please wait"
target_message="Please check whether PD is online and TiKV Regions are all available. \
If PD is offline or some TiKV regions are not available, it means that the data syncing process is complete. \
To check whether TiKV regions are all available, you can view \
'TiKV-Details' > 'Resolved-Ts' > 'Max Leader Resolved TS gap' on Grafana. \
If the gap is large, such as a few minutes, it means that some regions in TiKV are unavailable. \
Otherwise, if the gap is small and PD is online, it means the data syncing is incomplete, so please wait"

if [ "$info" != "$target_message" ]; then
echo "synced status info is not correct"
Expand Down Expand Up @@ -275,12 +275,12 @@ function run_case_with_failpoint() {
exit 1
fi
info=$(echo $synced_status | jq -r '.info')
target_message="Please check whether pd is healthy and tikv region is all available. \
If pd is not healthy or tikv region is not available, the data syncing is finished. \
When pd is offline means that pd is not healthy. For tikv region, you can check the grafana info \
in 'TiKV-Details-Resolved-Ts-Max Leader Resolved TS gap'. If the gap is a large value, such as a few minutes, \
it means some regions in tikv are unavailable. \
Otherwise the data syncing is not finished, please wait"
target_message="Please check whether PD is online and TiKV Regions are all available. \
If PD is offline or some TiKV regions are not available, it means that the data syncing process is complete. \
To check whether TiKV regions are all available, you can view \
'TiKV-Details' > 'Resolved-Ts' > 'Max Leader Resolved TS gap' on Grafana. \
If the gap is large, such as a few minutes, it means that some regions in TiKV are unavailable. \
Otherwise, if the gap is small and PD is online, it means the data syncing is incomplete, so please wait"
if [ "$info" != "$target_message" ]; then
echo "synced status info is not correct"
exit 1
Expand Down

0 comments on commit 36aed02

Please sign in to comment.