Hi, Von: Philip Martin [mailto:philip.mar...@wandisco.com] > Philip Martin <philip.mar...@wandisco.com> writes: > > > Stefan Fuhrmann <stefan.fuhrm...@wandisco.com> writes: > > > >> But we do write the database strictly in revision order. > >> So, if we could simply read the latest record once upon opening the > >> DB. If that refers to a future revision, read "current" and compare. > >> If the DB it still "in the future", abort txn, i.e. prevent any > >> future commit until rep-cache.db gets deleted by the admin. > > > > That might work. The rep-cache for a new revision is not written > > strictly in revision order but is written after updating HEAD. So > > such a check would not be as strong as "highest revision" but would be > > a useful extra check if we can implement it efficiently it without a > > table scan. Is sqlite3_last_insert_rowid() the function we want? > > Bert pointed out that is the wrong function and there isn't really a suitable > function. So to do this check we need something like > Julian's suggestion: a one row table containing the most recent revision added > to the rep-cache that gets updated with each write. It doesn't catch every > possible failure but it does catch some.
To increase the backwards compatibility: Could this row be updated by a trigger? Best regards Markus Schaber CODESYS(r) a trademark of 3S-Smart Software Solutions GmbH Inspiring Automation Solutions 3S-Smart Software Solutions GmbH Dipl.-Inf. Markus Schaber | Product Development Core Technology Memminger Str. 151 | 87439 Kempten | Germany Tel. +49-831-54031-979 | Fax +49-831-54031-50 E-Mail: m.scha...@codesys.com | Web: http://www.codesys.com | CODESYS store: http://store.codesys.com CODESYS forum: http://forum.codesys.com Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade register: Kempten HRB 6186 | Tax ID No.: DE 167014915