Skip to content

Conversation

@yux0
Copy link
Contributor

@yux0 yux0 commented Jan 8, 2026

What changed?

Update replication task rate limiter priority based on active/standby state

Why?

The replication task should have higher priority than standby task

How did you test it?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s)
  • added new functional test(s)

Potential risks

There is a task processing priority change requires review

@yux0 yux0 requested a review from yycptt January 9, 2026 18:56
namespaceName = ns.Name().String()
}
if ns.ActiveInCluster(clusterMetadata.GetCurrentClusterName()) {
return quotas.NewRequest(e.GetType().String(), taskSchedulerToken, namespaceName, e.GetPriority().CallerType(), 0, "")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not changed

if ns.ActiveInCluster(clusterMetadata.GetCurrentClusterName()) {
return quotas.NewRequest(e.GetType().String(), taskSchedulerToken, namespaceName, e.GetPriority().CallerType(), 0, "")
} else {
return quotas.NewRequest(e.GetType().String(), taskSchedulerToken, namespaceName, headers.CallerTypePreemptable, 0, "")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use lowest level for standby tasks

}

return quotas.NewRequest(e.GetType().String(), taskSchedulerToken, namespaceName.String(), e.GetPriority().CallerType(), 0, "")
if ns.ActiveInCluster(clusterMetadata.GetCurrentClusterName()) {
Copy link
Member

Choose a reason for hiding this comment

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

will this cause NPE if ns is nil?

Copy link
Member

Choose a reason for hiding this comment

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

hmm guess ideally we should only set priority once on creation and later when failover happens.
The whole activeness check for task processing probably needs to be refactored.

I think for now, can we move this logic into priority assigner and also update priority here?

rateLimiter SchedulerRateLimiter,
timeSource clock.TimeSource,
chasmRegistry *chasm.Registry,
clusterMetadata cluster.Metadata,
Copy link
Member

Choose a reason for hiding this comment

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

shall we just pass in current cluster name here and avoid getting it from clusterMetadata for each task?

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.

2 participants