litetree icon indicating copy to clipboard operation
litetree copied to clipboard

Document how to merge newer SQLite releases

Open snej opened this issue 5 years ago • 6 comments

As a fork, LiteTree is inevitably going to need updating as newer versions of SQLite are released (At the moment SQLite is up to 3.30, while litetree is still based on 3.27.2.) Keeping up with SQLite can be very important if one needs new features or bug fixes.

How does one perform such an update? All I see in here are heavily modified versions of sqlite3.c and sqlite3.h, not any tools for updating the source. Does one just run a 3-way-merge tool and feed it litetree's source, the unmodified version of the same SQLite release, and the new SQLite release?

It would be good to document this, so potential users of the library can feel that they're not going to be stuck on an old release of SQLite forever, or be dependent on someone else to keep it up to date for them.

snej avatar Nov 06 '19 19:11 snej

I diffed sqlite3.c against the stock 3.27.2 version. It looks like you've been developing with individual files but only committing the amalgamation here — I see auto-generated comments like --- begin file branches.c ---. It would be very helpful if this repo contained the actual files you're working on, not just the amalgamation.

snej avatar Nov 07 '19 18:11 snej

Hi!

I edit the amalgamation file directly. That comment is just to follow the rules.

The update will be done on next month (I am busy now) probably against SQLite 3.31 (with virtual/generated columns). Documentation can be made at the same time.

kroggen avatar Nov 08 '19 12:11 kroggen

This might be a crazy idea - but what are the chances of getting the litetree functionality actually merged into SQLite core, e.g. as an optional extra feature which could be enabled at compile-time or even run-time? If that was possible, this problem would vanish :-)

aspiers avatar Feb 08 '20 13:02 aspiers

Yes, this idea was considered when it was developed.

But there are at least 2 items that make it unpractical:

  1. The format of the pragma commands used by LiteTree is not the default one of SQLite, so it requires to pre-parse these commands before SQLite engine does that.

  2. SQLite does not expect a change in schema and it does not reload the cache on normal commands. LiteTree does a required reload of all of these when a command to change to another branch is executed.

I have not analyzed the source now but it may have other reasons too.

kroggen avatar Feb 10 '20 23:02 kroggen

Thanks for the reply! Couldn't those differences be encapsulated within #ifdef LITETREE blocks or similar?

I guess the other option is to standardise on a workflow based on git merge or rebase, but that sounds to me like it would probably be a lot more painful in the long run.

aspiers avatar Feb 11 '20 13:02 aspiers

Sometimes a new version of SQLite comes with changes exactly where the patches would be applied or even on other places that affect the functionality.

Running the functional tests help to discover if something was broken, but it is not guaranteed that the tests will cover all cases. This is why I make a manual review of the changes.

kroggen avatar Feb 12 '20 00:02 kroggen