cluster: persist formation timestamp in controller#31080
Closed
WillemKauf wants to merge 2 commits into
Closed
Conversation
7e7ab98 to
a785218
Compare
a785218 to
cb6e7b7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for recording the cluster formation wall-clock timestamp at bootstrap, persisting it through controller snapshots, and exposing it via a new admin API endpoint for retrieval (with an rptest asserting stability across restarts and node joins).
Changes:
- Extend
bootstrap_cluster_cmd_dataand controller snapshot bootstrap state to carry an optionalformation_timestamp. - Store the timestamp in
storage::apiduring bootstrap/snapshot application and expose it viaGET /v1/cluster/formation_timestamp. - Add rptest coverage and an
Adminclient helper for the new endpoint.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/rptest/tests/controller_snapshot_test.py | Adds assertions that formation timestamp is present, stable across restarts, and consistent across nodes/late joiners. |
| tests/rptest/services/admin.py | Adds an Admin client helper for /v1/cluster/formation_timestamp. |
| src/v/storage/api.h | Adds in-memory storage for the optional cluster formation timestamp. |
| src/v/redpanda/admin/server.cc | Registers the new admin route and returns the timestamp if present. |
| src/v/redpanda/admin/api-doc/cluster.json | Documents the new endpoint and response model. |
| src/v/cluster/types.h | Adds formation_timestamp to bootstrap_cluster_cmd_data and bumps serde version. |
| src/v/cluster/controller.cc | Sets formation_timestamp = model::timestamp::now() when forming a cluster. |
| src/v/cluster/controller_snapshot.h | Persists formation timestamp in controller snapshot bootstrap section (serde version bump). |
| src/v/cluster/bootstrap_backend.h | Tracks applied formation timestamp and exposes accessor. |
| src/v/cluster/bootstrap_backend.cc | Applies formation timestamp from bootstrap cmd/snapshot and includes it in snapshots. |
Comment on lines
+81
to
+89
| "responses": { | ||
| "200": { | ||
| "description": "OK", | ||
| "schema": { | ||
| "$ref": "#/models/cluster_formation_timestamp" | ||
| } | ||
| } | ||
| }, | ||
| "parameters": [] |
Comment on lines
263
to
268
| // when bootstrap_backend processes the bootstrap_cluster_cmd command, it | ||
| // must dispatch updates to other parts of the controller stm | ||
| // (members_manager, feature_table, credential_store). But if we are | ||
| // applying a controller snapshot, these updates will be handled by the | ||
| // sub-stms themselves. Here we only need to initialize the cluster uuid. | ||
|
|
Persist the cluster formation timestamp in the controller log & snapshot, using the existing `bootstrap_cluster_cmd_data` command.
cb6e7b7 to
1de5653
Compare
Collaborator
CI test resultstest results on build#87024 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bootstrap_cluster_cmd_datacommand.cluster_formation_timestampadmin endpointBackports Required
Release Notes