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]: Restore not working corectly #236

Closed
jingsno opened this issue Jul 23, 2023 · 3 comments · Fixed by #263
Closed

[Bug]: Restore not working corectly #236

jingsno opened this issue Jul 23, 2023 · 3 comments · Fixed by #263
Labels
bug Something isn't working
Milestone

Comments

@jingsno
Copy link

jingsno commented Jul 23, 2023

Binner version

v.2.6.0

Operating System

Windows / Linux

Describe the bug and the steps to reproduce it

When trying to restore the database with the "restore function", the software states "Binner restored successfully!", but no inventory is restored. The "Your Overview" still shows zero inventory.

If I observe the filesystem during restore, I can see that the correct binner.db file is written to the filesystem, from the "binner-backup-xxxx-x-xx.bak" file. If restart the Binner service, the Inventory still shows zero parts.

I can also observe that when I stop the Binner service to restart, the binner.db file is replaced with a smaler (I presume empty) database file.

If i copy the extracted Binner.bak file from the backup file, into the correct directory, as "binner.db", when the service is stopped, the restore works fine, and the inventory is back.

I've observed this on both Windows, and the linux version.

Would you like to attach your appsetings.json configuration?

No response

Screenshots or Videos (Optional, but they help!)

No response

Are you able to contribute a PR? (No is ok!)

None

@jingsno jingsno added the bug Something isn't working label Jul 23, 2023
@replaysMike replaysMike added the in-progress This ticket is currently being worked on label Apr 8, 2024
@replaysMike replaysMike added this to the v2.6.3 milestone Apr 8, 2024
@replaysMike
Copy link
Owner

definitely something wrong here, looking into the issue.

@replaysMike
Copy link
Owner

I think I've figured out what's going on here. After restoring, the database file is copied to the configured location at C:\Binner\Binner.db. However, even though the backup database is copied overtop the existing one the SQLite driver seems to overwrite it immediately after restore. Restarting the service puts you back into the original database instead of the overwritten one. If I manually copy the db file while the service is not running all the data is restored.

This may have been some behavioral change with SQLite, as this used to work. I'll see if I can come up with a workaround.

replaysMike added a commit that referenced this issue Apr 23, 2024
came up with a solution to forcefully release the lock on the sqlite database file.
ensured all contexts are being disposed properly.
@replaysMike replaysMike removed the in-progress This ticket is currently being worked on label Apr 23, 2024
@replaysMike
Copy link
Owner

Came up with a way to get SQLite to forcefully release the lock on the file. Fix is in v2.6.3

replaysMike added a commit that referenced this issue Apr 23, 2024
came up with a solution to forcefully release the lock on the sqlite database file.
ensured all contexts are being disposed properly.
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.

2 participants