Skip to content

Commit

Permalink
executor: keep progress in information_schema.tiflash_replica two dig…
Browse files Browse the repository at this point in the history
…its after the decimal point (#38415)

close #38412
  • Loading branch information
hehechen committed Oct 12, 2022
1 parent aff7287 commit 78d3307
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ddl/ddl_tiflash_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ func getTiFlashTableSyncProgress(pollTiFlashContext *TiFlashManagementContext, t
zap.Int64("tableID", tableID), zap.Int("tiflashPeerCount", tiflashPeerCount), zap.Int("regionCount", regionCount), zap.Uint64("replicaCount", replicaCount))
progress = 1
}
if progress < 1 {
logutil.BgLogger().Debug("TiFlash replica progress < 1.",
zap.Int64("tableID", tableID), zap.Int("tiflashPeerCount", tiflashPeerCount), zap.Int("regionCount", regionCount), zap.Uint64("replicaCount", replicaCount))
}
return types.TruncateFloatToString(progress, 2), nil
}

Expand Down
2 changes: 2 additions & 0 deletions executor/infoschema_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -2223,6 +2223,8 @@ func (e *memtableRetriever) dataForTableTiFlashReplica(ctx sessionctx.Context, s
progress += progressMap[p.ID]
}
progress = progress / float64(len(pi.Definitions))
progressString := types.TruncateFloatToString(progress, 2)
progress, _ = strconv.ParseFloat(progressString, 64)
} else {
progress = progressMap[tbl.ID]
}
Expand Down

0 comments on commit 78d3307

Please sign in to comment.