From ac4962bc89f7f90cf855669f694d5ce41362f044 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Tue, 21 May 2013 06:54:53 +0100 Subject: [PATCH] Upgrade should only try once .. since it prohibits startup when fails. .. suspect there is an issue with optimise() on a new index .. have also added more logging to watch this. --- src/GcUpgrade.cpp | 3 +++ src/MetricAggregator.cpp | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/GcUpgrade.cpp b/src/GcUpgrade.cpp index 363d88935..416d4cd47 100644 --- a/src/GcUpgrade.cpp +++ b/src/GcUpgrade.cpp @@ -56,6 +56,9 @@ GcUpgrade::upgrade(const QDir &home) // 4. Set default weight to 75kg if currently zero double weight_ = appsettings->cvalue(home.dirName(), GC_WEIGHT, "75.0").toString().toDouble(); if (weight_ <= 0.00) appsettings->setCValue(home.dirName(), GC_WEIGHT, "75.0"); + + // 5. Set latest version - so only tries to upgrade once + appsettings->setCValue(home.dirName(), GC_VERSION_USED, VERSION_LATEST); } } return 0; diff --git a/src/MetricAggregator.cpp b/src/MetricAggregator.cpp index a4266366f..1f9707cc8 100644 --- a/src/MetricAggregator.cpp +++ b/src/MetricAggregator.cpp @@ -188,18 +188,22 @@ void MetricAggregator::refreshMetrics(QDateTime forceAfterThisDate) } } - // stop logging - out << "METRIC REFRESH ENDS: " << QDateTime::currentDateTime().toString() + "\r\n"; - log.close(); - // end LUW -- now syncs DB + out << "COMMIT: " << QDateTime::currentDateTime().toString() + "\r\n"; dbaccess->connection().commit(); + #ifdef GC_HAVE_LUCENE + out << "OPTIMISE: " << QDateTime::currentDateTime().toString() + "\r\n"; main->lucene->optimise(); #endif main->isclean = true; + // stop logging + out << "SIGNAL DATA CHANGED: " << QDateTime::currentDateTime().toString() + "\r\n"; dataChanged(); // notify models/views + + out << "METRIC REFRESH ENDS: " << QDateTime::currentDateTime().toString() + "\r\n"; + log.close(); } /*----------------------------------------------------------------------