Skip to content

cluster: persist formation timestamp in controller#31080

Closed
WillemKauf wants to merge 2 commits into
redpanda-data:devfrom
WillemKauf:formation-timestamp
Closed

cluster: persist formation timestamp in controller#31080
WillemKauf wants to merge 2 commits into
redpanda-data:devfrom
WillemKauf:formation-timestamp

Conversation

@WillemKauf

Copy link
Copy Markdown
Contributor
  • Persist the cluster formation timestamp in the controller log & snapshot, using the existing bootstrap_cluster_cmd_data command.
  • add cluster_formation_timestamp admin endpoint

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v26.1.x
  • v25.3.x
  • v25.2.x

Release Notes

  • none

Copilot AI review requested due to automatic review settings July 13, 2026 17:24
@WillemKauf WillemKauf requested a review from a team as a code owner July 13, 2026 17:24
@WillemKauf WillemKauf force-pushed the formation-timestamp branch from 7e7ab98 to a785218 Compare July 13, 2026 17:25
@WillemKauf WillemKauf force-pushed the formation-timestamp branch from a785218 to cb6e7b7 Compare July 13, 2026 17:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_data and controller snapshot bootstrap state to carry an optional formation_timestamp.
  • Store the timestamp in storage::api during bootstrap/snapshot application and expose it via GET /v1/cluster/formation_timestamp.
  • Add rptest coverage and an Admin client 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.
@WillemKauf WillemKauf force-pushed the formation-timestamp branch from cb6e7b7 to 1de5653 Compare July 13, 2026 18:03
@WillemKauf WillemKauf closed this Jul 13, 2026
@vbotbuildovich

Copy link
Copy Markdown
Collaborator

CI test results

test results on build#87024
test_status test_class test_method test_arguments test_kind job_url passed reason test_history
FLAKY(PASS) ShadowLinkTopicFailoverTests test_producer_ids_failover {"storage_mode": "tiered_v2"} integration https://buildkite.com/redpanda/redpanda/builds/87024#019f5cb1-1001-4015-a2cb-aedcccb872f8 10/11 Test PASSES after retries.No significant increase in flaky rate(baseline=0.0000, p0=1.0000, reject_threshold=0.0100. adj_baseline=0.1000, p1=0.3487, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=ShadowLinkTopicFailoverTests&test_method=test_producer_ids_failover
FLAKY(PASS) KafkaStreamsAnomalyDetection test_kafka_streams null integration https://buildkite.com/redpanda/redpanda/builds/87024#019f5cb2-50af-49a8-ba9d-8e88dc4c9316 10/11 Test PASSES after retries.No significant increase in flaky rate(baseline=0.0000, p0=1.0000, reject_threshold=0.0100. adj_baseline=0.1000, p1=0.3487, trust_threshold=0.5000) https://redpanda.metabaseapp.com/dashboard/87-tests?tab=142-dt-individual-test-history&test_class=KafkaStreamsAnomalyDetection&test_method=test_kafka_streams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants