core: Migrate SQLite schema to MSec, warn of slow
authorShane Synan <digitalcircuit36939@gmail.com>
Sun, 13 May 2018 20:46:11 +0000 (15:46 -0500)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 23 May 2018 22:33:28 +0000 (00:33 +0200)
commit56f686f70bbb212d83803be88adec6fdd225ea8e
treec6c263440c752453e3e8e90ef4733cc9cf7acec9
parentd272e4719d2770a018f9a2856b61d9847eb24201
core: Migrate SQLite schema to MSec, warn of slow

Migrate SQLite schema to read and store time in milliseconds,
offering greater precision matching that of PostgreSQL.

On upgrade, run "UPDATE backlog SET time = time * 1000" to adjust
existing times.  This is a full backlog update, potentially taking
minutes to hours.

Based on testing, this was the fastest "proper" way to migrate an
existing database.  A pessimistic scenario, 328 MB database on a
Raspberry Pi 2 with Ubuntu 16.04 running from a Class 10 SD card
takes...
> In-place update (chosen method): 361.991s
> Create new table, multiply int:  905.749s
> Create new table, numeric:       983.501s

A normal HDD is much faster, e.g. 97.686s for the same database on a
5400 RPM drive, Seagate ST96812AS.
(Thanks @romibi for testing!)

Other methods may be faster, but may be more prone to mistakes down
the road.

Update the schema upgrade message to warn of delays for major
upgrades, and provide feedback when upgrade succeeds.

> Installed Schema (version %1) is not up to date. Upgrading to
> version %2...  This may take a while for major upgrades.

> Installed Schema successfully upgraded to version %1.

CAUTION:  Monolithic does not show any migration GUI.  Monolithic
installs with large databases on slower computers may appear to not
be responsive.  Include a mention of upgrade time in the release
notes.
src/core/SQL/SQLite/version/31/upgrade_000_update_buffer_set_time_extended.sql [new file with mode: 0644]
src/core/abstractsqlstorage.cpp
src/core/sql.qrc
src/core/sqlitestorage.cpp