Skip to content

Correct shutdown behavior for DDBLeaseCoordinator #1700

Merged
vincentvilo-aws merged 9 commits into
awslabs:masterfrom
vincentvilo-aws:master
Feb 17, 2026
Merged

Correct shutdown behavior for DDBLeaseCoordinator #1700
vincentvilo-aws merged 9 commits into
awslabs:masterfrom
vincentvilo-aws:master

Conversation

@vincentvilo-aws

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes: Moving the leaseGracefulShutdownHandler.stop() and the leaseDiscoveryFuture.cancel() method outside of the takerFuture condition.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

log.info("Stopping lease taker...");
// the method is called in worker graceful shutdown. We want to stop any further lease shutdown
// so we don't interrupt worker shutdown.
Optional.ofNullable(leaseGracefulShutdownHandler).ifPresent(LeaseGracefulShutdownHandler::stop);

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.

Can we also make sure in GracefulShutdownCallable we are stopping WorkerMetricStatsReporter so that the leader can stop assigning leases to this work once the shutdown has begun ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When the scheduler gets shutdown, a shutdown call is made to the initializer here which stops the workerMetricsReporter

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.

We want to do it in the context of graceful shutdown before lease discoverer is stopped to prevent leader from assigning new leases to this worker which is currently going down. We can make it as a followup change, since this CR itself prevent the worker from picking up leases during the graceful shutdown process so its worth getting this in first.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@vincentvilo-aws vincentvilo-aws merged commit 34e19c8 into awslabs:master Feb 17, 2026
6 checks passed
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.

3 participants