chickenchickenlove opened a new pull request, #23913: URL: https://github.com/apache/kafka/pull/23913
This PoC makes `CoordinatorTimerImpl` snapshottable, aligning timer state restoration with the Coordinator’s snapshot and rollback lifecycle. The main changes are: 1. `CoordinatorTimerImpl` stores a `TimerState` for each timer in a `TimelineHashMap`, using the same `SnapshotRegistry` as the Coordinator. 2. `TimerState` contains the information needed to recreate a `TimerTask`: its deadline, operation, and retry configuration. Scheduled `TimerTask` instances are managed separately. 3. When a record append succeeds, the existing `updateLastWrittenOffset(offset)` flow creates a snapshot at that offset, including the timer state. Scheduled tasks continue running unchanged. 4. If the append fails, `revertLastWrittenOffset()` restores the timer state to the rollback target snapshot. 5. After restoring the state, `timer.onRollback()` cancels all currently tracked tasks and schedules new tasks based on the restored `TimerState entries`. Each task uses the time remaining until its original deadline, or a delay of zero if the deadline has already passed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
