Skip to content

feat(matching): Invalidate TaskListPartitionConfig on Attempted Writes to Read-Only Partitions#7618

Merged
natemort merged 5 commits intocadence-workflow:masterfrom
joannalauu:feat/invalid-readonly
Jan 26, 2026
Merged

feat(matching): Invalidate TaskListPartitionConfig on Attempted Writes to Read-Only Partitions#7618
natemort merged 5 commits intocadence-workflow:masterfrom
joannalauu:feat/invalid-readonly

Conversation

@joannalauu
Copy link
Contributor

@joannalauu joannalauu commented Jan 18, 2026

What changed?

  • Updated IDL with new changes from cadence-idl
  • Updated mappers with type ReadOnlyPartitionError
  • Updated AddTask function to return ReadOnlyPartitionError on attempted writes to read-only partitions
  • Created InvalidatePartitionCache function that deletes the partition cache
  • Called InvalidatePartitionCache when ReadOnlyPartitionError is returned

Why?
We want to invalidate the TaskListPartitionConfig cache if it is read-only. The history host should then route the request to the partition root, which will return the new config. This prevents the history host from accidentally picking the read-only partition again, which causes wasted task processing attempts.

Fixes: #7560

How did you test it?

  • Unit tests

Potential risks

  • When the partition cache is invalidated, all write traffic will get routed to root partition, so there will be a sudden traffic spike in that partition

Release notes

Documentation Changes

resp, err := c.client.AddActivityTask(ctx, request, append(opts, yarpc.WithShardKey(peer))...)
if err != nil {
// ReadOnlyPartitionError indicates the partition is being drained - invalidate cache to force next request to route to root partition
if _, ok := err.(*types.ReadOnlyPartitionError); ok {
Copy link
Member

Choose a reason for hiding this comment

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

While we're not consistent within the repo, we should use errors.As to check error types to ensure we correctly handle wrapped errors. There's an example in the package documentation.

Signed-off-by: Joanna Lau <118241363+joannalauu@users.noreply.github.com>
Signed-off-by: Joanna Lau <118241363+joannalauu@users.noreply.github.com>
…dOnlyPartitionError is returned

Signed-off-by: Joanna Lau <118241363+joannalauu@users.noreply.github.com>
Signed-off-by: Joanna Lau <118241363+joannalauu@users.noreply.github.com>
Signed-off-by: Joanna Lau <118241363+joannalauu@users.noreply.github.com>
@natemort natemort merged commit fcc24e1 into cadence-workflow:master Jan 26, 2026
41 checks passed
@natemort
Copy link
Member

Awesome work, thanks for your contribution!

@joannalauu joannalauu deleted the feat/invalid-readonly branch February 3, 2026 15:05
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.

Invalidate TaskListPartitionConfig on Attempted Writes to Read-Only Partitions

3 participants