Fix potential crash in exporttree database due to failure to honor uniqueness constraint
I don't know the circumstances, but have a report of this: git-annex: failed to commit changes to sqlite database: Just SQLite3 returned ErrorConstraint while attempting to perform step. All 3 tables in the export db have uniqueness constraints on them, insertUnique is used for all the rest, but this use of insertMany means it doesn't check the constraint. I guess that's what caused the crash, but I have not been able to test it yet. Use putMany when available, as it should be faster than mapM of insertMany. This commit was sponsored by Brock Spratlen on Patreon.
This commit is contained in:
parent
b8ed97f5d8
commit
def5d8b02c
2 changed files with 5 additions and 3 deletions
|
@ -126,10 +126,10 @@ addExportedLocation h k el = queueDb h $ do
|
|||
let edirs = map
|
||||
(\ed -> ExportedDirectory (toSFilePath (fromExportDirectory ed)) ef)
|
||||
(exportDirectories el)
|
||||
#if MIN_VERSION_persistent(2,1,0)
|
||||
insertMany_ edirs
|
||||
#if MIN_VERSION_persistent(2,8,1)
|
||||
putMany edirs
|
||||
#else
|
||||
void $ insertMany edirs
|
||||
mapM_ insertUnique edirs
|
||||
#endif
|
||||
where
|
||||
ik = toIKey k
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue