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

Introduce Sqlite WAL journal mode #1011

Merged
merged 1 commit into from
Aug 10, 2023
Merged

Introduce Sqlite WAL journal mode #1011

merged 1 commit into from
Aug 10, 2023

Conversation

lainedfles
Copy link
Contributor

  • Add Write-Ahead Logging option for file mode database
  • Disable by default
  • Migrate journal_mode and related PRAGMA statement handling from _create_tables() to new functions: get_journal_mode()/set_journal_mode()

This yields a significant reduction of constant IO writes on my systems when db file mode is enabled.

Note that PRAGMA synchronous = NORMAL doesn't appear to activate properly. This problem occurs on master branch builds as well. Manual inspection of the db shows that synchronous always = FULL unless manually set directly but this warrants additional discussion elsewhere.

@gustavo-iniguez-goya gustavo-iniguez-goya merged commit 57838e8 into evilsocket:master Aug 10, 2023
@gustavo-iniguez-goya
Copy link
Collaborator

Thank you @lainedfles !

I experienced a lot of DB corruptions using WAL and other modes when I added the option to save events to disk.
That's why I ended up using previous options.

But things has changed a lot since then, and allowing to configure it is great :)

@lainedfles
Copy link
Contributor Author

@gustavo-iniguez-goya I wondered about the implementation based on this comment:

https://github.com/evilsocket/opensnitch/blob/6556eed1aeb124f22d8ef503c4ba960f38918654/ui/opensnitch/database/__init__.py#L90C9-L90C9

So far I've not experienced corruption 🤞🏻. I've created #1014 to track the failure to set NORMAL mode but I wonder if this option warrants an additional GUI configuration for cases where corruption is a problem.

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