Skip to content

Add endpoint to return latest event record time - #6986

Open
mrdziuban wants to merge 4 commits into
canton-network:mainfrom
obsidiansystems:mrdziuban/latest-event-record-time/3071
Open

Add endpoint to return latest event record time#6986
mrdziuban wants to merge 4 commits into
canton-network:mainfrom
obsidiansystems:mrdziuban/latest-event-record-time/3071

Conversation

@mrdziuban

Copy link
Copy Markdown
Collaborator

Fixes #3071

Adds a new /v0/events/latest-record-time endpoint that finds the latest record time for which /v0/events will return events. ScanEventStore#getLatestEventRecordTime reuses resolveCurrentMigrationCap to ensure it has the same behavior as getEvents.

I confirmed that the /v0/events/latest-record-time path won't conflict with the parameterized /v0/events/{update_id} path -- the Pekko generator for guardrail sorts routes so all static paths appear before any parameterized paths.

Pull Request Checklist

Cluster Testing

  • If a cluster test is required, comment /cluster_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If an upgrade test is required, comment /upgrade_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a hard-migration test is required (from the latest release), comment /hdm_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.
  • If a logical synchronizer upgrade test is required (from canton-3.5), comment /lsu_test on this PR to request it, and ping someone with access to the DA-internal system to approve it.

PR Guidelines

  • Include any change that might be observable by our partners or affect their deployment in the release notes.
  • Specify fixed issues with Fixes #n, and mention issues worked on using #n
  • Include a screenshot for frontend-related PRs - see README or use your favorite screenshot tool

Merge Guidelines

  • Make the git commit message look sensible when squash-merging on GitHub (most likely: just copy your PR description).

"getLatestEventRecordTime returns None when there are no events" in {
for {
ctx <- newEventStore()
latest <- ctx.eventStore.getLatestEventRecordTime(domainMigrationId)(traceContext)

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.

perhaps a test with just an insertUpdate could be added.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, added

@mrdziuban
mrdziuban force-pushed the mrdziuban/latest-event-record-time/3071 branch from eb02ac1 to 1ffabdc Compare August 27, 2026 12:17
@mrdziuban
mrdziuban force-pushed the mrdziuban/latest-event-record-time/3071 branch from 1ffabdc to 1838fed Compare September 3, 2026 12:08
@mrdziuban

Copy link
Copy Markdown
Collaborator Author

@ray-roestenburg-da I think the static checks failure should be fixed by #7024. I just rebased, would you mind running CI again? Thank you!

@ray-roestenburg-da

Copy link
Copy Markdown
Contributor

@mrdziuban Please add the new API endpoint to release_notes_upcoming.rst .

@mrdziuban

Copy link
Copy Markdown
Collaborator Author

@mrdziuban Please add the new API endpoint to release_notes_upcoming.rst .

Thanks for the reminder, added it.

Fixes canton-network#3071

Adds a new `/v0/events/latest-record-time` endpoint that finds the latest record time for which `/v0/events` will return events. `ScanEventStore#getLatestEventRecordTime` reuses `resolveCurrentMigrationCap` to ensure it has the same behavior as `getEvents`.

Signed-off-by: Matt Dziuban <mrdziuban@gmail.com>
…ring`.

Sphinx doesn't like the plain `type: string`, plus this aligns with the convention used for all other endpoints.

Signed-off-by: Matt Dziuban <mrdziuban@gmail.com>
Signed-off-by: Matt Dziuban <mrdziuban@gmail.com>
Signed-off-by: Matt Dziuban <mrdziuban@gmail.com>
@mrdziuban
mrdziuban force-pushed the mrdziuban/latest-event-record-time/3071 branch from a8872dd to 6cc339a Compare September 4, 2026 11:57
)(implicit tc: TraceContext): Future[Option[CantonTimestamp]] =
resolveCurrentMigrationCap(
verdictStore.lastIngestedRecordTime,
updateHistory.lastIngestedRecordTime,

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.

Note: Looking at if this is bounded, as long as the ingested record time is advanced at least once, getLastEventRecordTime is bounded. There might be some time where the max has to be retrieved from the DB (before the record time is advanced by ingestion), but I think that is fine.

@ray-roestenburg-da ray-roestenburg-da 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.

Thanks!

@mrdziuban

Copy link
Copy Markdown
Collaborator Author

Is it possible the test failure is intermittent?

Found problems in log/canton_before_shutdown.clog:
***"@timestamp":"2026-09-04T12:33:26.887Z","message":"Failed to fetch P2P server authentication token to P2PUrl(\"http://localhost:5310\"): Status***code=PERMISSION_DENIED, description=Member SEQ::sv4::1220617614ad... access is disabled, cause=null***","logger_name":"c.d.c.s.s.b.b.b.p.g.a.P2PAddAuthTokenHeaderGrpcServerInterceptor$P2PAuthenticatorServerCall:sequencer=globalSequencerSv4/psid=global-domain::12208fb9486e::35-0","thread_name":"canton-env-ec-231","level":"WARN","trace-id":"68a74424ec25f8e21d04ebd9340a8688","span-id":"ab32bd14d4cfe78d"***

@ray-roestenburg-da

ray-roestenburg-da commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Re-running, you ran into a known intermittent issue (which we've just triaged yesterday).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create an endpoint that returns the latest record time for which /v0/events will be able to return events.

6 participants