Skip to content

Conversation

@shawnhathaway
Copy link
Contributor

@shawnhathaway shawnhathaway commented Jul 20, 2020

What Changed?
Move the auto-increment Id for BufferedEvents below the primary key to make this a bit more explicit of the true ordering necessary. This is not necessary for Vitess but should make any future alterations here easier by physically clustering records together that are part of the same runId. Additionally, the true solution is to use the nextEventId in the database, but this is not currently guaranteed to be unique, so nesting the auto-incrementing Id should make a key change to an application specified id simpler in the future.

Re: Vitess - This should not require a Vitess sequences table as the VIndex that should be used by Vitess here (shard_id) will does not use the AutoIncrement table and we are okay with local ordering for each MySQL instance.

Risks?
No major risks as application code changes are not required as the application currently uses (shard_id, namespace_id, workflow_id, run_id) as the lookup key. This should see some read performance increases by reducing fragmentation on the read path. Write performance could theoretically suffer slightly in a non-sharded MySQL setup. Will watch our stress tests for any changes.

@shawnhathaway shawnhathaway requested review from a team, alexshtin and mfateev July 20, 2020 18:13
@shawnhathaway shawnhathaway requested a review from samarabbas July 20, 2020 22:59
@shawnhathaway shawnhathaway merged commit ed8f902 into temporalio:master Jul 21, 2020
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