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

SQLite & MySQL: improve perf of Set operations with first-write-wins #3159

Merged
merged 7 commits into from Nov 1, 2023

Conversation

ItalyPaleAle
Copy link
Contributor

@ItalyPaleAle ItalyPaleAle commented Sep 30, 2023

For MySQL & SQLite state stores, improves the performance of Set operations that use first-write wins (common in actors).

This is done by avoiding the need to start a transaction with 2 queries (SQLite) or a stored procedure (MySQL), using a single, atomic query that uses a Common Table Expression instead.

This avoids locking the database for longer (in SQLite, transactions lock the entire database), and reduces the number of round-trips to the DB from (up to) 4 to 1.

Avoids the needs to start a transaction with 2 queries, using a single, atomic query instead. This avoids locking the database for longer (in SQLite, transactions lock the entire database), and reduces the number of round-trips to the DB from 4 to 1.

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
@ItalyPaleAle ItalyPaleAle requested review from a team as code owners September 30, 2023 17:19
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
@ItalyPaleAle ItalyPaleAle changed the title SQLite: improve perf of Set operations with first-write-wins SQLite & MySQL: improve perf of Set operations with first-write-wins Sep 30, 2023
@ItalyPaleAle
Copy link
Contributor Author

/ok-to-test

@dapr-bot
Copy link
Collaborator

Complete Build Matrix

The build status is currently not updated here. Please visit the action run below directly.

🔗 Link to Action run

Commit ref: 9c6c9e1

@dapr-bot
Copy link
Collaborator

dapr-bot commented Sep 30, 2023

Components certification test

🔗 Link to Action run

Commit ref: 9c6c9e1

❌ Some certification tests failed

These tests failed:

  • bindings.aws.s3
  • pubsub.gcp.pubsub
  • pubsub.kafka
  • pubsub.mqtt3
  • pubsub.pulsar
  • state.gcp.firestore

@dapr-bot
Copy link
Collaborator

dapr-bot commented Sep 30, 2023

Components conformance test

🔗 Link to Action run

Commit ref: 9c6c9e1

✅ All conformance tests passed

All tests have reported a successful status

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
@ItalyPaleAle ItalyPaleAle added this to the v1.13 milestone Oct 13, 2023
@ItalyPaleAle ItalyPaleAle added this pull request to the merge queue Nov 1, 2023
@berndverst berndverst removed this pull request from the merge queue due to a manual request Nov 1, 2023
@berndverst berndverst merged commit 7114fd0 into dapr:master Nov 1, 2023
5 of 20 checks passed
ItalyPaleAle added a commit to ItalyPaleAle/dapr-components-contrib that referenced this pull request Nov 2, 2023
dapr#3159 introduced a regression that caused sets with first-write-wins fail if the table was empty

The issue was due to a "FROM" statement in the CTE that should not have been there.

Also improved how the SQLite component detects etag failures when FWW is used

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
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.

None yet

3 participants