Skip to content

don't bother with transactions for client DB - #8861

Merged
vito merged 2 commits into
dagger:mainfrom
vito:no-transactions
Nov 6, 2024
Merged

vito merged 2 commits into
dagger:mainfrom
vito:no-transactions

Conversation

@vito

@vito vito commented Nov 5, 2024

Copy link
Copy Markdown
Contributor

Some users are still hitting 'database is locked' errors despite SQLite being tuned properly as far as I can tell. We really don't need transactions for this, so just remove them.

Some users are still hitting 'database is locked' errors despite SQLite
being tuned properly as far as I can tell. We really don't need
transactions for this, so just remove them.

Signed-off-by: Alex Suraci <[email protected]>
@vito
vito marked this pull request as ready for review November 5, 2024 22:22
Signed-off-by: Alex Suraci <[email protected]>
@vito
vito requested a review from sipsma November 6, 2024 16:46
@vito
vito merged commit 925cf02 into dagger:main Nov 6, 2024
@vito
vito deleted the no-transactions branch November 6, 2024 20:47
@sipsma

sipsma commented Nov 6, 2024

Copy link
Copy Markdown
Contributor

@vito is it the busy_timeout setting that allows concurrent writes to work with no locking? Just curious

@vito

vito commented Nov 6, 2024

Copy link
Copy Markdown
Contributor Author

@sipsma I think journal_mode=WAL is closer to that - busy_timeout just controls how long it'll wait for a lock. This post does a quick rundown of common settings, but we already set all of them. (Even that post doesn't cover all of it btw, there's more in the comments here - which we also already configure.)

It's a bit surprising this happened considering we already tune all the "magic knobs" I know of and even have one-db-per-client, but I'm pretty certain we don't actually need transactions for this, so it seems worth trying and might help perf a bit. Merged this a bit aggressively so that I can hand the CI-pushed image ref to the affected user and see if it fixes things for them. Will keep an eye out for any sketchiness.

vito added a commit to vito/dagger that referenced this pull request Nov 14, 2024
This reverts commit 925cf02.

This didn't end up helping the one user it affected, and it feels better
for each request to be all-or-nothing considering OTel will retry
requests.

Signed-off-by: Alex Suraci <[email protected]>
vito added a commit that referenced this pull request Nov 14, 2024
* engine: set synchronous=OFF for client DBs

All of this data is ephemeral - we don't care if we lose it on a system
crash. Setting synchronous=NORMAL opens up to slowdowns from random I/O
blocks, as observed when running `test all`.

Without this change we could occasionally see a span insert blocking for
more than 10 seconds, triggering a timeout when shutting down the OTel
proxy server. The odds of this happening in `test all` were pretty high
- at least one in two runs.

After this change I have been able to run `test all` 8 times and none of
them hit that particular issue. (Three failed, but that's neither here
nor there.)

Signed-off-by: Alex Suraci <[email protected]>

* Revert "don't bother with transactions for client DB (#8861)"

This reverts commit 925cf02.

This didn't end up helping the one user it affected, and it feels better
for each request to be all-or-nothing considering OTel will retry
requests.

Signed-off-by: Alex Suraci <[email protected]>

---------

Signed-off-by: Alex Suraci <[email protected]>
TomChv pushed a commit to TomChv/dagger that referenced this pull request Nov 21, 2024
* engine: set synchronous=OFF for client DBs

All of this data is ephemeral - we don't care if we lose it on a system
crash. Setting synchronous=NORMAL opens up to slowdowns from random I/O
blocks, as observed when running `test all`.

Without this change we could occasionally see a span insert blocking for
more than 10 seconds, triggering a timeout when shutting down the OTel
proxy server. The odds of this happening in `test all` were pretty high
- at least one in two runs.

After this change I have been able to run `test all` 8 times and none of
them hit that particular issue. (Three failed, but that's neither here
nor there.)

Signed-off-by: Alex Suraci <[email protected]>

* Revert "don't bother with transactions for client DB (dagger#8861)"

This reverts commit 925cf02.

This didn't end up helping the one user it affected, and it feels better
for each request to be all-or-nothing considering OTel will retry
requests.

Signed-off-by: Alex Suraci <[email protected]>

---------

Signed-off-by: Alex Suraci <[email protected]>
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.

3 participants