Hi!

On 26.08.19 14:05, Simon Slavin wrote:
> On 26 Aug 2019, at 12:43pm, Dan Kennedy <danielk1...@gmail.com> wrote:
>> When sqlite3changeset_apply() hits a UNIQUE constraint, it puts the change 
>> into a "retry buffer". Then, once it has attempted all changes in the 
>> changeset, it goes back and retries those in the retry buffer. It keeps 
>> retrying like this until no further progress can be made.

Thanks a lot for the explanation, Dan!  That's good to know.

> That's clever.  You'd think that in something as ordered and predictable as 
> SQL it wouldn't be necessary.  I wonder whether there's a changeset it 
> doesn't work for.

Indeed there is.  If you replace my modification with this:

    UPDATE `mytable` SET `value` = 50 WHERE `id` = 1;
    UPDATE `mytable` SET `value` = 42 WHERE `id` = 2;
    UPDATE `mytable` SET `value` = 100 WHERE `id` = 1;

Then it works processing forward, but the changeset does not apply
anymore (because the three UPDATE's get changed into two (one per ID),
and the change is not possible to do at all with only two UPDATE's).

This case is not so relevant for me in practice, but nevertheless could
in theory happen as well.  Is there something I can do to work around
that as well?  For instance, can I record individual changesets for each
distinct change (rather than combining them)?  That will of course hurt
performance, but may be ok in my situation.

E.g., is it possible to use the pre-update hooks that the sessions
module itself uses to start and extract a changeset right around each
change?  Or would that not work (e.g. due to interactions with the hooks
for sessions itself) / be prohibitively expensive?

Thanks!

Yours,
Daniel

-- 
https://www.domob.eu/
OpenPGP: 1142 850E 6DFF 65BA 63D6  88A8 B249 2AC4 A733 0737
Namecoin: id/domob -> https://nameid.org/?name=domob
--
3.6.0: Bar-Pri-Ran-Rog-Sam-Val-Wiz
To go: Arc-Cav-Hea-Kni-Mon-Tou

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to