Cloud Backed SQLite

Clarification / edge cases when polling the manifest
Login

Clarification / edge cases when polling the manifest

(1) By nick.tessier on 2024-11-19 20:41:35 [link] [source]

Hello, just wanted to make sure that this behavior we're seeing is intentional.

If we have a container with an open database and we call sqlite3_bcvfs_poll which pulls in new changes for that open database... Is it correct that the open database will continue to use the old version of the manifest until that database is closed and reopened? I've written a test which seems to confirm this but wanted to double check that was also true from your point of view. Along the same line of thinking, another question I have which I didn't confirm:

Will other unopened databases in that same container use the new version of the manifest if they're opened after the poll, but before the originally open database has been closed?

we were thinking of adding a line to our documentation something like:

* - any open database within the container at the time of calling checkForChanges will not reflect any new changes pulled in, if any, until the database is closed and reopened.

(2) By Dan Kennedy (dan) on 2024-11-20 13:51:43 in reply to 1 [source]

That doesn't sound right to me. An existing client should continue to see the old data for the remainder of any open transaction, but then the next transaction should see the new data. You should not have to open and close the db to see the new data.

There are tests to verify this in at least some cases. Does your test use daemon or regular mode?

Dan.

(3) By nick.tessier on 2024-11-20 13:54:10 in reply to 2 [link] [source]

Ah okay, its totally possible that its transaction based. I went straight for closing and reopening, and never tested a new transaction. This is regular mode.

(4) By nick.tessier on 2024-11-20 14:06:23 in reply to 2 [link] [source]

Changed my test to start a new transaction and you're correct. That is enough to see the new data.

(5) By keith on 2024-11-20 14:25:11 in reply to 2 [link] [source]

Dan,

The question wasn't so much about whether the new data is visible to new transactions, but that an existing transaction will continue to download data from the "old" manifest indefintely.

Keith

(6) By Dan Kennedy (dan) on 2024-11-20 14:32:27 in reply to 5 [link] [source]

Sorry - managed to miss that. Any existing transaction will continue to use the old manifest and may continue to download blocks corresponding to old data until it is finished. Or until it finds one of the blocks it needs has been deleted by a call to sqlite3_bcv_cleanup().

Thanks,

Dan.