1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-24 15:49:44 +02:00

Boot process logger message consistency and improvements

This commit is contained in:
Harvey Kandola 2018-09-14 13:00:58 +01:00
parent 2336dab69f
commit 4c733ce581
4 changed files with 12 additions and 8 deletions

View file

@ -39,6 +39,8 @@ func InstallUpgrade(runtime *env.Runtime, existingDB bool) (err error) {
return
}
runtime.Log.Info(fmt.Sprintf("Database: loaded %d SQL scripts for provider %s", len(dbTypeScripts), runtime.Storage.Type))
// Get current database version.
currentVersion := 0
if existingDB {
@ -63,7 +65,7 @@ func InstallUpgrade(runtime *env.Runtime, existingDB bool) (err error) {
var err error
amLeader, err = Lock(runtime, len(toProcess))
if err != nil {
runtime.Log.Error("unable to lock DB", err)
runtime.Log.Error("Database: failed to lock existing database for processing", err)
}
} else {
// New installation hopes that you are only spinning up one instance of Documize.

View file

@ -43,12 +43,14 @@ func Lock(runtime *env.Runtime, scriptsToProcess int) (bool, error) {
// Start transaction fotr lock process.
tx, err := runtime.Db.Beginx()
if err != nil {
runtime.Log.Error("Database: unable to start transaction", err)
return false, err
}
// Lock the database.
_, err = tx.Exec(processLockStartQuery(runtime.Storage.Type))
if err != nil {
runtime.Log.Error("Database: unable to lock tables", err)
return false, err
}
@ -83,7 +85,7 @@ func Unlock(runtime *env.Runtime, tx *sqlx.Tx, err error, amLeader bool) error {
if tx != nil {
if err == nil {
tx.Commit()
runtime.Log.Info("Database: ready")
runtime.Log.Info("Database: is ready")
return nil
}
tx.Rollback()