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

Make sure to set max connection to 1 #45

Merged
merged 5 commits into from
Apr 25, 2024
Merged

Make sure to set max connection to 1 #45

merged 5 commits into from
Apr 25, 2024

Conversation

muhamadazmy
Copy link
Member

@muhamadazmy muhamadazmy commented Apr 8, 2024

  • Fix issue with sqlite connection locking by making sure pool max number of connections is 1.
  • This PR also fixes an issue with pack that it makes sure pack exits with an error if one or more files failed to upload

If one or more files fail to pack, the entire process
will end up in an error in the end. It will also print out
all failed files
Copy link
Contributor

@steveej steveej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can confirm this work in my use-case of pack'ing a nixos rootfs to s3 on a machine with many cores.

please see the code readability suggestion i made as well.

thank you!

@@ -348,7 +348,10 @@ impl Writer {
.journal_mode(SqliteJournalMode::Delete)
.filename(path);

let pool = SqlitePool::connect_with(opts).await?;
let pool = SqlitePoolOptions::new()
.max_connections(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since there is already an explicit opts variable it's slightly confusing to see this option added here instead of adding it to opts.

Comment on lines +351 to +354
let pool = SqlitePoolOptions::new()
.max_connections(1)
.connect_with(opts)
.await?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let pool = SqlitePoolOptions::new()
.max_connections(1)
.connect_with(opts)
.await?;
let pool = SqlitePool::connect_with(opts).await?;

@@ -348,7 +348,10 @@ impl Writer {
.journal_mode(SqliteJournalMode::Delete)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.journal_mode(SqliteJournalMode::Delete)
.journal_mode(SqliteJournalMode::Delete)
.max_connections(1)

this introduces a single source of truth for the used rust toolchain
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