Hi Niklaus
(1) The update process should stop if a "fatal" error occurs, but not,
if a "nonfatal" error occurs.
And it should display the very exact SQL statement that failed and not
just some "SQL Error happend".
But what is a nonfatal error?
An example: In my setting it happens quite frequently, that an updater
tries to create a column which already exists. This throws an error, but
that error should not stop the rest of the update process. In the
initial design of the update process, database errors were deliberately
considered nonfatal and just logged. Otherwise, a lot of updates and
reinstalls of plugins might fail consequently.
Since it is not possible to decide programmatically if an SQL-Error is
fatal or not, I would recomemmend, that the Updater shows a message with
the error message and asks the user, if it should continue or stop or
rollback.
(2) I would not consider explicit transactions such an important thing.
In any case I strongly suggest to run some benchmark tests before.
Thanks®ards,
Gerry
On 16.02.2018 12:31, Niklaus Giger wrote:
> Hi
>
> I was investigating the logs emitted when using
> demoDB_3.0_with_administrator.zip
> This emits a lot of warnings because the SQL statements for creating the
> database are not correct.
>
> Therefore I would like to make the DbUpgrade more strict by:
> * Logging all SQL statement executed (as DEBUG_MSG) (we already trace all
> select in Query)
> * Stop the upgrade when a SQL statement cannot be executed
> * Exit Elexis when the upgrade is not successfull
> The two last points I would skip if the vmarg -
> Dch.elexis.dbupdate.ignore_errors is set to true
>
> I am also tempted to add the in ch.rgw.tools.JdbcLink the methods
> * startTransaction
> * rollbackTransaction
> * commitTransaction
> via Jdbc.setAutocommit(false) see
> https://www.tutorialspoint.com/jdbc/jdbc-transactions.htm
>
> In a second step I would use a transaction for the whole dbupgrade for
> PostGreSQL databases, as MySQL and H2 always commit a transaction when a alter
> db schema command is issued.
>
> Any suggestions/remarks?
>
> Best regards
>
> Niklaus
|