Skip to content

fix: handle CAS batch result row ordering for ScyllaDB compatibility#9485

Merged
bergundy merged 2 commits intotemporalio:mainfrom
mykaul:fix/cas-batch-ordering
Mar 16, 2026
Merged

fix: handle CAS batch result row ordering for ScyllaDB compatibility#9485
bergundy merged 2 commits intotemporalio:mainfrom
mykaul:fix/cas-batch-ordering

Conversation

@mykaul
Copy link
Copy Markdown
Contributor

@mykaul mykaul commented Mar 11, 2026

Cassandra returns CAS batch result rows in clustering key order, while ScyllaDB returns them in statement order. The nexus endpoint store assumed Cassandra's ordering, causing the partition-status and endpoint rows to be swapped on ScyllaDB.

What changed?

Add classifyBatchCASRows() that inspects the "type" column to assign rows to their correct roles regardless of iteration order. Reorder the DELETE batch so the table-version update comes first, satisfying both databases' ordering.

Why?

See above.

How did you test it?

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

Potential risks

Verified it works well against both.

@mykaul mykaul requested review from a team as code owners March 11, 2026 21:51
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 11, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@bergundy bergundy left a comment

Choose a reason for hiding this comment

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

Thanks!
LGTM, but please fix the function name as suggested.

Cassandra returns CAS batch result rows in clustering key order, while
ScyllaDB returns them in statement order. The nexus endpoint store
assumed Cassandra's ordering, causing the partition-status and endpoint
rows to be swapped on ScyllaDB.

Add classifyBatchCASRows() that inspects the "type" column to assign
rows to their correct roles regardless of iteration order. Reorder the
DELETE batch so the table-version update comes first, satisfying both
databases' ordering.
@mykaul mykaul force-pushed the fix/cas-batch-ordering branch from 2015280 to d48653f Compare March 12, 2026 13:40
@bergundy bergundy enabled auto-merge (squash) March 13, 2026 20:56
@bergundy bergundy merged commit 2cb06c7 into temporalio:main Mar 16, 2026
116 of 118 checks passed
birme pushed a commit to eyevinn-osaas/temporal that referenced this pull request Mar 23, 2026
…emporalio#9485)

Cassandra returns CAS batch result rows in clustering key order, while
ScyllaDB returns them in statement order. The nexus endpoint store
assumed Cassandra's ordering, causing the partition-status and endpoint
rows to be swapped on ScyllaDB.

## What changed?
Add classifyBatchCASRows() that inspects the "type" column to assign
rows to their correct roles regardless of iteration order. Reorder the
DELETE batch so the table-version update comes first, satisfying both
databases' ordering.

## Why?
See above.

## How did you test it?
- [x] built
- [x] run locally and tested manually - against both.
- [ ] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)

## Potential risks
Verified it works well against both.
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.

4 participants