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

[bug] WASM SQLite build + default config is slow on not-Linux #2962

Closed
2 tasks
daenney opened this issue Jun 4, 2024 · 8 comments
Closed
2 tasks

[bug] WASM SQLite build + default config is slow on not-Linux #2962

daenney opened this issue Jun 4, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@daenney
Copy link
Member

daenney commented Jun 4, 2024

Describe the bug with a clear and concise description of what the bug is.

When running with the WASM SQLite build on anything other than Linux, db-sqlite-journal-mode must not be set to WAL as that can currently lead to database corruption as otherwise performance will be atrocious.

Instead, we should use TRUNCATE in those cases. This has a slight performance impact, but should be fine in practice for small instances especially while this is still in the experimental stages.

What's your GoToSocial Version?

main

GoToSocial Arch

No response

What happened?

No response

What you expected to happen?

No response

How to reproduce it?

No response

Anything else we need to know?

We should do two things:

  • Add some documentation about this
  • Update the config parser to check for runtime.GOOS and if that's not Linux on the WASM build throw an error if the journal mode is set to WAL
@daenney daenney added the bug Something isn't working label Jun 4, 2024
@NyaaaWhatsUpDoc
Copy link
Member

i think we should be careful what we claim to support. not to say we don't add checks, but we should be careful with what we claim to officially support.

i know for certain that our storage library will only work on Unix like filesystems, and may possibly cause issues on systems outside of Linux / BSDs

@daenney
Copy link
Member Author

daenney commented Jun 4, 2024

Aye, we don't have to support everything under the sun.

The WAL mode issue affects the BSDs however. Given we already publish a FreeBSD binary ourselves and we're packaged in pkgsrc etc. I think we should fix that case because that's a bit of a footgun now. That's what I meant with not-Linux since Windows isn't something we support in the first place (and folks can use WSL).

daenney added a commit that referenced this issue Jun 4, 2024
Adds documentation and a configuration validation check to ensure that
when folks run with the WASM SQLite build on anything other than Linux
we don't allow them to run with journaling set to WAL. That will result
in database corruption until ncruces/go-sqlite3#85 is resolved. It's
otherwise safe to use the WASM build.

Fixes #2962
@ncruces
Copy link

ncruces commented Jun 4, 2024

Do you have a reference on database corruption? I'm guessing this may be a misunderstanding.

You should never get corrupted databases with a default build of github.com/ncruces/go-sqlite3.

Without a fix for ncruces/go-sqlite3#85 WAL mode should perform awfully, to the point that you can't open a database, but it should not corrupt data.

@daenney
Copy link
Member Author

daenney commented Jun 4, 2024

Ah sorry. Then yes, that's a misunderstanding on my part. Let me update that.

@daenney daenney changed the title [bug] WASM SQLite build + default config is dangerous on not-Linux [bug] WASM SQLite build + default config is slow on not-Linux Jun 4, 2024
daenney added a commit that referenced this issue Jun 4, 2024
Adds documentation and a configuration validation check to ensure that
when folks run with the WASM SQLite build on anything other than Linux
we don't allow them to run with journaling set to WAL. That will result
in abysmal performance until ncruces/go-sqlite3#85 is resolved.

Fixes #2962
@ncruces
Copy link

ncruces commented Jun 4, 2024

No problem! I understand the subtly of the topic, but that's why I tried hard to default to safe "I will never corrupt your data" default settings.

Also… macOS is fine, it just works.

And I don't think you are using EXCLUSIVE locking mode, nor should you. You'd need to use SetMaxOpenConns(1), and that's not realistic, really.

Finally, I think ncruces/go-sqlite3#90 is almost done.

@daenney
Copy link
Member Author

daenney commented Jun 4, 2024

That's awesome, thank you for doing these things for us. There's no rush on our side, I think with the warning PR I've raised it's fine and we can ship with that for a while until the BSD WAL shakes out and you're happy and confident in the implementation.

We don't intend to switch to it yet by default for 0.16, but we might go for it for 0.17 if there's no known issues then. We release every 2-3 months and I'm guessing 0.16 might be an end-of-June type of affair.

@ncruces
Copy link

ncruces commented Jun 4, 2024

That's awesome, thank you for doing these things for us.

No problem, you're an great nerd sniper.
It was in my TODO list, if someone wants to try it, all the better.
I'm now pretty confident in this solution; just missing docs, clean up.

@daenney
Copy link
Member Author

daenney commented Jun 5, 2024

Issue has been resolved on the go-sqlite3 side so we'll upgrade when a new release comes out instead.

@daenney daenney closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
daenney added a commit that referenced this issue Jun 7, 2024
This includes support for journal mode set to WAL on the BSDs.

Relates to: #1753, #2962
daenney added a commit that referenced this issue Jun 7, 2024
This includes support for journal mode set to WAL on the BSDs.

Relates to: #1753, #2962
nyarla pushed a commit to nyarla/gotosocial-modded that referenced this issue Jun 19, 2024
nyarla pushed a commit to nyarla/gotosocial-modded that referenced this issue Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants