Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change agedFailoverTimeMultiplier config to enablePriorityLeaseAssignment #1317

Merged

Conversation

lucienlu-aws
Copy link
Contributor

Issue #, if available:

Description of changes:

Change the agedFailoverTimeMultiplier config to doPriorityLeaseTaking. This allows clients to disable the priority lease taking logic entirely if they choose

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

@@ -87,7 +87,7 @@ public void setWorkerId(String workerId) {
@ConfigurationSettable(configurationClass = LeaseManagementConfig.class)
private long failoverTimeMillis;
@ConfigurationSettable(configurationClass = LeaseManagementConfig.class)
private int agedFailoverTimeMultiplier;
private Boolean doPriorityLeaseTaking;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After doing some testing, I found that when this value is a primitive boolean, the config isn't set properly. This applies to all other boolean configs in multilang as well. Will make another PR fixing it for other configs

@@ -57,7 +57,7 @@ public class LeaseManagementConfig {
public static final long DEFAULT_COMPLETED_LEASE_CLEANUP_INTERVAL_MILLIS = Duration.ofMinutes(5).toMillis();
public static final long DEFAULT_GARBAGE_LEASE_CLEANUP_INTERVAL_MILLIS = Duration.ofMinutes(30).toMillis();
public static final long DEFAULT_PERIODIC_SHARD_SYNC_INTERVAL_MILLIS = 2 * 60 * 1000L;
public static final int DEFAULT_AGED_FAILOVER_TIME_MULTIPLIER = 3;
public static final boolean DEFAULT_DO_PRIORITY_LEASE_TAKING = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe consider renaming to enable_priority_lease_assignment ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like that naming better, updated

* (agedFailoverTimeMultiplier * failoverTimeMillis) are taken with priority, disregarding the target
* but obeying the maximum limit per worker.
* Whether workers should take very expired leases at priority. A very expired lease is when a worker does not
* renew its lease in 3 * {@link LeaseManagementConfig#failoverTimeMillis}. Very expired leases will be taken at
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also mentioned newly created leases due to shard mutation that are not assigned to any worker are also considered very-expired ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

final List<Lease> allLeases = new ArrayList<>();
allLeases.add(createLease("foo", "2", MOCK_CURRENT_TIME));
allLeases.add(createLease("bar", "3", veryOldThreshold - 1));
allLeases.add(createLease("baz", "4", veryOldThreshold + 1));
Copy link
Contributor

Choose a reason for hiding this comment

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

Also add some leases not assigned to any worker?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

@lucienlu-aws lucienlu-aws merged commit 96be30b into awslabs:master Apr 22, 2024
2 checks passed
@lucienlu-aws lucienlu-aws deleted the priority-lease-taking-config branch April 22, 2024 17:35
akidambisrinivasan pushed a commit to akidambisrinivasan/amazon-kinesis-client that referenced this pull request Apr 29, 2024
…slabs#1317)

* Change agedFailoverTimeMultiplier config to doPriorityLeaseTaking
@lucienlu-aws lucienlu-aws changed the title Change agedFailoverTimeMultiplier config to doPriorityLeaseTaking Change agedFailoverTimeMultiplier config to enablePriorityLeaseAssignment May 1, 2024
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.

2 participants