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

Fix sort key/range key ordering in dynamodb events table #115

Merged

Conversation

chriscosgriff
Copy link
Contributor

PR #110 correctly removed the commitStamp from the derived rowKey value in the dynamodb provider to resolve a concurrency issue, however it has also revealed an issue with the events table sort key/range key (provided by the derived "rowKey" value)

Queries/Scans against aggregates with more than 10 revisions are currently being returned with an incorrect sort order from the dynamodb events table due to the stream revision value not being padded.

e.g. (current)

aggregateId rowKey
myagg1 ::0
myagg1 ::1
myagg1 ::10
myagg1 ::2
myagg1 ::3
...
myagg1 ::9

e.g. (with fix by padding the stream revision value during rowKey derivation)

aggregateId rowKey
myagg1 ::000
myagg1 ::001
myagg1 ::002
myagg1 ::003
...
myagg1 ::009
myagg1 ::010

I have set the padding amount to 16 digits, which represents the number of digits in the Number.MAX_SAFE_INTEGER value.

@adrai adrai merged commit 33f7ddc into thenativeweb:master Oct 27, 2017
@chriscosgriff chriscosgriff deleted the fix-dynamodb-row-key-sort-order branch October 29, 2017 12:25
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