superfly/litefs

SQLITE_CONSTRAINT_CHECK error and rollback stops syncing with other nodes

Opened this issue · 2 comments

I had a bug in my app which resulted in a number of SQLITE_CONSTRAINT_CHECK errors.

I was inserting thousands of records across a number of tables all in a named transaction, when the constraint check failed it rolled the transaction back.

When a number of these happen close together the data stopped being sent to the non primary node.

When you restarted the primary server it got an error like this

cannot open store: open databases: open database("sqlite.db"): verify database file: database checksum (f6b0461071c271bd) does not match latest LTX checksum

The only way to get the primary back up again was to delete the /litefs/dbs/<database.sqlite> folder and restart the machine.

There were no errors reported by litefs when this issue occured, it was only that i noticed the filesize had stopped growing on the secondary node.

@rkrdeano I'm sorry to hear about the issue. What version of LiteFS were you running when you hit the bug?

@benbjohnson Thats ok these things happen. Just took me a while to work out what was going on.

I was using 0.5.11.

I saw found another issue mentioning FTS5, I am using that in my application too, so not sure if that contributes to the issue? I have some triggers that add and remove records from the virtual table, and this would have happened during the transaction too.