Repository navigation
Conversation
5b2283c to
64191c5
Compare
8569c10 to
014a5ac
Compare
|
Scope note for reviewers: per-bucket detail for historical rebalances This PR keeps But It is easier to enable this API: Keeping it out of this PR keeps the review surface small and leaves one design point open for discussion:
The follow-up also changes one contract: |
014a5ac to
8757b6a
Compare
affo
left a comment
There was a problem hiding this comment.
Thanks, this is a well-structured change — the bottom-up layering is clean, the failover restore paths and the final-status-before-history ordering are handled carefully, and the test coverage matches the claims in the description. I went through it layer by layer and found no blocking issues.
One design suggestion (splitting the SQL procedure instead of overloading it) and a handful of smaller points inline. The procedure split is the only one I'd push on before merge, since it also removes the two-RPC staleness window flagged in the description.
|
addressed: procedure split applied (sys.list_rebalances added, staleness window gone) and all inline comments addressed in the linked commit |
affo
left a comment
There was a problem hiding this comment.
Thanks for addressing! Now looks good to me!
3bb4ad6 to
0a14c88
Compare
0a14c88 to
2aca48b
Compare
c453793 to
1403167
Compare
1403167 to
9236017
Compare
| } | ||
|
|
||
| message ListRebalancesResponse { | ||
| repeated PbRebalanceInfo rebalance_infos = 1; |
There was a problem hiding this comment.
I have a few related questions about the API and history storage design:
-
Could we extend the existing RPC? For example, add an optional
include_historyfield toListRebalanceProgressRequestand arepeated PbRebalanceInfofield to its response, while retaining the existing fields and the current single-rebalance behavior when the flag is absent. A separate Admin method and SQL procedure could still use the same RPC underneath. This seems worth considering before introducing another RPC. We would also need to define the interaction withrebalance_idand handle older servers explicitly, so an unsupported history request cannot silently return an incomplete result. -
What should
PbRebalanceInforepresent? Should it be a summary, or also contain table/bucket details throughrepeated PbRebalanceProgressForTable(which includes the plan)? I would avoid returning every historical plan by default. If this is intended to summarize outcomes, could we include an optional, conciseerror_messageorfailure_reason? A status such asFAILEDalone does not explain what went wrong. The reason would need to be captured and persisted when the failure occurs to remain useful after coordinator failover. Full plan details could remain available through the by-ID query, depending on the retention decision below. -
Can we align the history storage with [server] Store rebalance tasks in remote storage #5133? That PR moves rebalance tasks into remote storage to address large serialized plans exceeding ZooKeeper's znode size limit. Here, each
/cluster/rebalance_history/<rebalanceId>still stores a completeRebalanceTask. Keeping only 10 entries bounds the count, but does not bound an individual entry's size; even the summary listing currently reads and decodes those complete tasks. Do we need to retain the full plan for historical rebalances, or would summary metadata and diagnostic information be sufficient? If historical plan lookup is required, could history retain metadata plus a remote reference, aligned with [server] Store rebalance tasks in remote storage #5133, with cleanup preserving files referenced by retained history? If we choose summary-only retention instead, we should explicitly adjust the historical detail-query contract. -
Could we name the new SQL procedure
sys.list_all_rebalances()? Its multi-row summary schema and use case differ substantially fromsys.list_rebalance([id]), which returns one rebalance's detailed progress and plan. The more explicit name would make that distinction clearer than the singular/plural difference alone. The documentation should clarify that "all" means the current rebalance plus retained history, rather than an unbounded audit history.
There was a problem hiding this comment.
Thanks @wuchong, I am going to follow-up on your suggestions and findings and address them soon🤞
|
Btw, is it really necessary to display the results of the last 10 rebalances? Based on our operational experience, showing only the most recent result should be sufficient. What do you think @swuferhong ? |
9236017 to
8af0a09
Compare
I haven’t encountered this requirement either. I’d recommend using the existing List Rebalance Process API to implement this rather than introducing a new API. |
b7975cd to
f2872bf
Compare
|
Hello @wuchong, @swuferhong Thanks for your detailed and on point reviews, your suggestions made the design simpler. I pushed two follow-up commits. Single RPCI removed
|
|
Hi, @morazow I still think the current implementation is too complex. Could we split it into smaller steps—first adding a timestamp to the plan, then adding rebalance history support in a follow-up PR? |
|
Thank @swuferhong for suggestions, changing 👍 I'll ping you once done |
f2872bf to
1c6cf8b
Compare
Record when a rebalance started and when it reached a final status, and
return both from listRebalanceProgress.
- RebalanceTask carries startedAtMs/completedAtMs (JSON serde v3). A task
written by an older coordinator reads back as -1 (unset).
- RebalanceManager sets the start time when it generates the task and the
completion time when it persists the final status. The cancellation
task keeps the start time. Recovery restores both.
- ListRebalanceProgressResponse gets optional started_at_ms and
completed_at_ms fields. No API version bump: an older server omits them
and the client maps that to -1.
- RebalanceProgress gains startedAtMs()/completedAtMs(), and
RebalanceProgressJsonSerializer writes them when set.
- sys.list_rebalance gets started_at/completed_at TIMESTAMP_LTZ(3) columns.
- The Rust client exposes both on RebalanceProgress.
- RebalanceProgress#formatAsPercentage uses Locale.ROOT, so the output
does not depend on the machine locale ("100%", not "100 %").
1c6cf8b to
1d126a0
Compare
|
Hi @swuferhong, thanks for the suggestion. I split the PR as you proposed. This PR (#3985) now only adds the start and completion timestamps. It covers what @wuchong mentioned: The rebalance history ( Please have another look 🙏 |
Purpose
Linked issue: part of #3965
Admin#listRebalanceProgressdoes not say when a rebalance started or finished, so"when did the cluster last rebalance, and how long did it take?" can only be answered from
server logs.
This PR adds the start and completion timestamps. Following review, it is the first of two
steps: the bounded rebalance history (listing finished rebalances) moves to a follow-up PR
that builds on this one.
Brief change log
Server
RebalanceTaskcarriesstartedAtMsandcompletedAtMs. Its JSON format in ZooKeepergoes to version 3. A task written by an older coordinator reads back with both set to
-1(unset). Older coordinators still read version 3, because the reader looks fields upby name and ignores unknown ones.
RebalanceManagersets the start time when it generates the task and the completion timewhen it persists the final status. A cancel keeps the start time. Recovery after a
coordinator failover restores both.
RPC and client
ListRebalanceProgressResponsegets two optional fields,started_at_msandcompleted_at_ms. There is no API version bump: an older server omits them and theclient maps an absent field to
-1. An older client ignores them.RebalanceProgressgainsstartedAtMs()andcompletedAtMs()(-1if unknown, or forcompletedAtMs()while still running).RebalanceProgressJsonSerializerwrites themwhen set.
RebalanceProgress#formatAsPercentagenow usesLocale.ROOT, so the output no longerdepends on the machine locale (
100%, not100 %). Without it,RebalanceProgressJsonSerializerTestfails on some locales.RebalanceProgressexposesstarted_at_msandcompleted_at_ms.Flink
sys.list_rebalancegets two new trailing columns,started_atandcompleted_at(
TIMESTAMP_LTZ(3)),NULLwhen unset.Tests
RebalanceTaskJsonSerdeTest: version 3 round-trip; a version 1 task reads back with-1timestamps.RebalanceManagerTest: start time on task generation, completion time on the finalstatus, start time kept across a cancel, both restored on recovery.
RebalanceProgressJsonSerializerTest: timestamps written when set, omitted when unset.RebalanceITCase: timestamps on a completed rebalance against a live cluster.FlinkProcedureITCase: the newsys.list_rebalancecolumns, withcompleted_at >= started_at.RebalanceProgress::from_pbkeeps the timestamps.API and Format
RebalanceProgress. Theexisting constructor is unchanged.
ListRebalanceProgressResponse, wire compatible in bothdirections.
fields). Both directions stay readable.
sys.list_rebalanceoutput gains two trailing columns.Documentation
website/docs/engine-flink/procedures.md(new columns) andwebsite/docs/maintenance/operations/rebalance.md(duration example).🤖 Generated with Claude Code