-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
SQLite should not be a hard dependency #1036
Comments
I have observed that a real world system doesn't work. NixOps specifically failed. So, if your confidence in SQLite is near infinite, are you saying it's an application bug then in NixOps or a Apple file system bug or ...? Please fill in the blanks. Bugs don't just happen out of thin air. |
I'm getting this frequently too, on linux.
Though I don't have version information handy, I believe my colleague @christian-marie has seen the same thing while running NixOS. We recently added a git precommit hook to integrity-check the statefile, though it hasn't yet given me enough information to reproduce reliably. It has allowed us to find older instances of corruption which cause the integrity check to fail, but had not affected Edit: similar-sounding |
Just tracked down one of the corruption instances from before we added the precommit hook (this one went unnoticed for a while because it didn't break
The corruption occurred after running a |
@olorin how did you fix the corruption? And I'm curious what does your pre-commit hook do? $ nix run -f '<nixpkgs>' sqlite -c sqlite3 /yl/keybase/private/ylcodes/shabka/deployments.nixops .dump | grep 'INSERT INTO ResourceAttrs' | perl -pe 's/INSERT INTO ResourceAttrs VALUES\((\d+),([^,]+),.*$/$1,$2/g' | sort | uniq -d
76,'configsPath'
76,'ec2.accessKeyId'
76,'route53.accessKeyId'
76,'route53.hostName'
76,'route53.ttl'
76,'startTime'
76,'toplevel'
77,'ec2.policy'
77,'ec2.roleName'
77,'state'
78,'ec2.securityGroupDescription'
78,'ec2.securityGroupRules'
78,'state'
79,'ec2.securityGroupRules'
79,'state'
86,'creationTime'
86,'index'
86,'none.sshPrivateKey' |
Nothing fancy, just filtered the duplicate sqlite3 state.nixops .dump > state.sql
# <remove duplicate INSERTS from state.sql>
sqlite3 state-new.nixops < state.sql
sqlite3 state-new.nixops "pragma integrty_check"
mv state-new.nixops state.nixops
Just runs the sqlite integrity check over any state databases which were touched in the commit. This is the contents of As a sidenote, we've now stopped tracking the sqlite databases themselves in git; instead, we're storing the JSON dumps from |
I wonder if pre-exit corruption detection would be enough to track this down for now? |
Just chiming in in defence of SQLite: The errors described in the last few comments are definitely application-level issues with sqlite. The "malformed image" error in the OP is definitely a hardware, OS, or misuse error - see How To Corrupt An SQLite Database File SQLite is not the problem in either case. The broken unique constraints cannot happen unless they are present before the unique index is added, or the constraint checking is temporarily disabled. I don't see any code that would do that, so I'm guessing maybe data files were corrupt but still legible? |
@edolstra just wondering if there is still interest in #969? I'm trying to manage the same deployments from multiple computers and struggling to do this with SQLite--seems easy to corrupt database by syncing with git, dropbox, etc, and having a remote database strikes me as the most sane option. Alternatively, curious if you have another workflow for managing deployments from multiple machines? Thanks for all the work on NixOps, super slick piece of software :) |
@tbenst Yes, I'm definitely interested in that. |
Getting
SQLiteException “database disk image is malformed”
seems to be common with other pieces of software built on top of SQLite. Now, it might be that these are application bugs, but perhaps it's just an unfortunate decision to ever start using SQLite in NixOps. I expect it to be a platform specific bug of NixOps on a Mac, but managing such important state in what is a fairly simplistic database might just not be the way to go.I would love to see a different backend (e.g. Postgres), because I have zero confidence in SQLite.
The text was updated successfully, but these errors were encountered: