Hello community, here is the log from the commit of package akonadi-server for openSUSE:Factory checked in at 2016-01-23 01:05:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/akonadi-server (Old) and /work/SRC/openSUSE:Factory/.akonadi-server.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "akonadi-server" Changes: -------- --- /work/SRC/openSUSE:Factory/akonadi-server/akonadi-server.changes 2016-01-07 00:19:50.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.akonadi-server.new/akonadi-server.changes 2016-01-23 01:05:20.000000000 +0100 @@ -1,0 +2,9 @@ +Sat Jan 9 18:08:35 UTC 2016 - tittiatc...@gmail.com + +- Update to KDE Applications 15.12.1 + * KDE Applications 15.12.1 + * https://www.kde.org/announcements/announce-applications-15.12.1.php + * boo#961265 + + +------------------------------------------------------------------- Old: ---- akonadi-15.12.0.tar.xz New: ---- akonadi-15.12.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ akonadi-server.spec ++++++ --- /var/tmp/diff_new_pack.Dcl4qp/_old 2016-01-23 01:05:21.000000000 +0100 +++ /var/tmp/diff_new_pack.Dcl4qp/_new 2016-01-23 01:05:21.000000000 +0100 @@ -17,7 +17,7 @@ Name: akonadi-server -Version: 15.12.0 +Version: 15.12.1 Release: 0 %define rname akonadi Summary: PIM Storage Service ++++++ akonadi-15.12.0.tar.xz -> akonadi-15.12.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/autotests/server/fakeakonadiserver.cpp new/akonadi-15.12.1/autotests/server/fakeakonadiserver.cpp --- old/akonadi-15.12.0/autotests/server/fakeakonadiserver.cpp 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/autotests/server/fakeakonadiserver.cpp 2015-12-17 23:42:16.000000000 +0100 @@ -182,17 +182,20 @@ } const QLatin1String initCon("initConnection"); - QSqlDatabase db = QSqlDatabase::addDatabase(DbConfig::configuredDatabase()->driverName(), initCon); - DbConfig::configuredDatabase()->apply(db); - db.setDatabaseName(DbConfig::configuredDatabase()->databaseName()); - if (!db.isDriverAvailable(DbConfig::configuredDatabase()->driverName())) { - throw FakeAkonadiServerException(QString::fromLatin1("SQL driver %s not available").arg(db.driverName())); - } - if (!db.isValid()) { - throw FakeAkonadiServerException("Got invalid database"); - } - if (db.open()) { - qWarning() << "Database" << dbConfig->configuredDatabase()->databaseName() << "already exists, the test is not running in a clean environment!"; + { + QSqlDatabase db = QSqlDatabase::addDatabase(DbConfig::configuredDatabase()->driverName(), initCon); + DbConfig::configuredDatabase()->apply(db); + db.setDatabaseName(DbConfig::configuredDatabase()->databaseName()); + if (!db.isDriverAvailable(DbConfig::configuredDatabase()->driverName())) { + throw FakeAkonadiServerException(QString::fromLatin1("SQL driver %s not available").arg(db.driverName())); + } + if (!db.isValid()) { + throw FakeAkonadiServerException("Got invalid database"); + } + if (db.open()) { + qWarning() << "Database" << dbConfig->configuredDatabase()->databaseName() << "already exists, the test is not running in a clean environment!"; + } + db.close(); } QSqlDatabase::removeDatabase(initCon); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/src/server/connection.cpp new/akonadi-15.12.1/src/server/connection.cpp --- old/akonadi-15.12.0/src/server/connection.cpp 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/src/server/connection.cpp 2015-12-17 23:42:16.000000000 +0100 @@ -41,9 +41,12 @@ #include <private/datastream_p_p.h> #include <private/standarddirs_p.h> + using namespace Akonadi; using namespace Akonadi::Server; +#define IDLE_TIMER_TIMEOUT 180000 // 3 min + Connection::Connection(QObject *parent) : QObject(parent) , m_socketDescriptor(0) @@ -92,6 +95,8 @@ this, &Connection::slotNewData); connect(socket, &QLocalSocket::disconnected, this, &Connection::disconnected); + connect(&m_idleTimer, &QTimer::timeout, + this, &Connection::slotConnectionIdle); // don't send before the event loop is active, since waitForBytesWritten() can cause interesting reentrancy issues // TODO should be QueueConnection, but unfortunately that doesn't work (yet), since @@ -131,6 +136,24 @@ if (m_reportTime) { reportTime(); } + + m_idleTimer.stop(); +} + +void Connection::slotConnectionIdle() +{ + Q_ASSERT(m_currentHandler == 0); + if (m_backend && m_backend->isOpened() ) { + if (m_backend->inTransaction()) { + // This is a programming error, the timer should not have fired. + // But it is safer to abort and leave the connection open, until + // a later operation causes the idle timer to fire (than crash + // the akonadi server). + akDebug() << "NOT Closing idle db connection; we are in transaction"; + return; + } + m_backend->close(); + } } void Connection::slotNewData() @@ -140,6 +163,14 @@ return; } + m_idleTimer.stop(); + + // will only open() a previously idle backend. + // Otherwise, a new backend could lazily be constructed by later calls. + if (!storageBackend()->isOpened()) { + m_backend->open(); + } + QString currentCommand; while (m_socket->bytesAvailable() > (int) sizeof(qint64)) { QDataStream stream(m_socket); @@ -160,7 +191,6 @@ slotConnectionStateChange(Server::LoggingOut); return; } - if (cmd.type() == Protocol::Command::Invalid) { qDebug() << "Received an invalid command: resetting connection"; slotConnectionStateChange(Server::LoggingOut); @@ -214,6 +244,9 @@ delete m_currentHandler; m_currentHandler = 0; } + + // reset, arm the timer + m_idleTimer.start(IDLE_TIMER_TIMEOUT); } CommandContext *Connection::context() const diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/src/server/connection.h new/akonadi-15.12.1/src/server/connection.h --- old/akonadi-15.12.0/src/server/connection.h 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/src/server/connection.h 2015-12-17 23:42:16.000000000 +0100 @@ -22,6 +22,7 @@ #include <QtCore/QPointer> #include <QtCore/QThread> +#include <QtCore/QTimer> #include <QtNetwork/QLocalSocket> #include <QtCore/QDataStream> @@ -86,6 +87,7 @@ */ void slotNewData(); void slotConnectionStateChange(ConnectionState state); + void slotConnectionIdle(); void slotSendHello(); @@ -106,6 +108,7 @@ QByteArray m_sessionId; bool m_verifyCacheOnRetrieval; CommandContext m_context; + QTimer m_idleTimer; QTime m_time; qint64 m_totalTime; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/src/server/storage/datastore.cpp new/akonadi-15.12.1/src/server/storage/datastore.cpp --- old/akonadi-15.12.0/src/server/storage/datastore.cpp 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/src/server/storage/datastore.cpp 2015-12-17 23:42:16.000000000 +0100 @@ -86,7 +86,6 @@ , mNotificationCollector(0) , m_keepAliveTimer(0) { - open(); notificationCollector(); if (DbConfig::configuredDatabase()->driverName() == QLatin1String("QMYSQL")) { @@ -103,7 +102,9 @@ DataStore::~DataStore() { - close(); + if (m_dbOpened) { + close(); + } } void DataStore::open() @@ -129,6 +130,14 @@ DbConfig::configuredDatabase()->initSession(m_database); } +QSqlDatabase DataStore::database() +{ + if (!m_dbOpened) { + open(); + } + return m_database; +} + void DataStore::close() { @@ -160,7 +169,7 @@ Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread()); AkonadiSchema schema; - DbInitializer::Ptr initializer = DbInitializer::createInstance(m_database, &schema); + DbInitializer::Ptr initializer = DbInitializer::createInstance(database(), &schema); if (!initializer->run()) { akError() << initializer->errorMsg(); return false; @@ -168,7 +177,7 @@ s_hasForeignKeyConstraints = initializer->hasForeignKeyConstraints(); if (QFile::exists(QStringLiteral(":dbupdate.xml"))) { - DbUpdater updater(m_database, QStringLiteral(":dbupdate.xml")); + DbUpdater updater(database(), QStringLiteral(":dbupdate.xml")); if (!updater.run()) { return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/src/server/storage/datastore.h new/akonadi-15.12.1/src/server/storage/datastore.h --- old/akonadi-15.12.0/src/server/storage/datastore.h 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/src/server/storage/datastore.h 2015-12-17 23:42:16.000000000 +0100 @@ -258,11 +258,10 @@ /** Returns the QSqlDatabase object. Use this for generating queries yourself. + + Will [re-]open the database, if it is closed. */ - QSqlDatabase database() const - { - return m_database; - } + QSqlDatabase database(); /** Sets the current session id. @@ -272,6 +271,11 @@ mSessionId = sessionId; } + /** + Returns if the database is currently open + */ + bool isOpened() const { return m_dbOpened ; } + Q_SIGNALS: /** Emitted if a transaction has been successfully committed. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/src/server/storage/dbconfigpostgresql.cpp new/akonadi-15.12.1/src/server/storage/dbconfigpostgresql.cpp --- old/akonadi-15.12.0/src/server/storage/dbconfigpostgresql.cpp 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/src/server/storage/dbconfigpostgresql.cpp 2015-12-17 23:42:16.000000000 +0100 @@ -39,7 +39,8 @@ using namespace Akonadi::Server; DbConfigPostgresql::DbConfigPostgresql() - : mInternalServer(true) + : mHostPort(0) + , mInternalServer(true) { } @@ -102,6 +103,7 @@ if (mHostName.isEmpty()) { mHostName = defaultHostName; } + mHostPort = settings.value(QStringLiteral("Port")).toInt(); // User, password and Options can be empty and still valid, so don't override them mUserName = settings.value(QStringLiteral("User")).toString(); mPassword = settings.value(QStringLiteral("Password")).toString(); @@ -124,6 +126,9 @@ settings.beginGroup(driverName()); settings.setValue(QStringLiteral("Name"), mDatabaseName); settings.setValue(QStringLiteral("Host"), mHostName); + if (mHostPort) { + settings.setValue(QStringLiteral("Port"), mHostPort); + } settings.setValue(QStringLiteral("Options"), mConnectionOptions); settings.setValue(QStringLiteral("ServerPath"), mServerPath); settings.setValue(QStringLiteral("InitDbPath"), mInitDbPath); @@ -142,6 +147,9 @@ if (!mHostName.isEmpty()) { database.setHostName(mHostName); } + if (mHostPort > 0 && mHostPort < 65535) { + database.setPort(mHostPort); + } if (!mUserName.isEmpty()) { database.setUserName(mUserName); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/src/server/storage/dbconfigpostgresql.h new/akonadi-15.12.1/src/server/storage/dbconfigpostgresql.h --- old/akonadi-15.12.0/src/server/storage/dbconfigpostgresql.h 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/src/server/storage/dbconfigpostgresql.h 2015-12-17 23:42:16.000000000 +0100 @@ -77,6 +77,7 @@ QString mDatabaseName; QString mHostName; + int mHostPort; QString mUserName; QString mPassword; QString mConnectionOptions; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/src/server/storage/dbconfigsqlite.cpp new/akonadi-15.12.1/src/server/storage/dbconfigsqlite.cpp --- old/akonadi-15.12.0/src/server/storage/dbconfigsqlite.cpp 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/src/server/storage/dbconfigsqlite.cpp 2015-12-17 23:42:16.000000000 +0100 @@ -143,112 +143,114 @@ { const QLatin1String connectionName("initConnection"); - QSqlDatabase db = QSqlDatabase::addDatabase(driverName(), connectionName); + { + QSqlDatabase db = QSqlDatabase::addDatabase(driverName(), connectionName); - if (!db.isValid()) { - akDebug() << "Invalid database for " - << mDatabaseName - << " with driver " - << driverName(); - return; - } + if (!db.isValid()) { + akDebug() << "Invalid database for " + << mDatabaseName + << " with driver " + << driverName(); + return; + } - QFileInfo finfo(mDatabaseName); - if (!finfo.dir().exists()) { - QDir dir; - dir.mkpath(finfo.path()); - } + QFileInfo finfo(mDatabaseName); + if (!finfo.dir().exists()) { + QDir dir; + dir.mkpath(finfo.path()); + } -#ifdef Q_OS_LINUX - QFile dbFile(mDatabaseName); - // It is recommended to disable CoW feature when running on Btrfs to improve - // database performance. It does not have any effect on non-empty files, so - // we check, whether the database has not yet been initialized. - if (dbFile.size() == 0) { - if (Utils::getDirectoryFileSystem(mDatabaseName) == QLatin1String("btrfs")) { - Utils::disableCoW(mDatabaseName); + #ifdef Q_OS_LINUX + QFile dbFile(mDatabaseName); + // It is recommended to disable CoW feature when running on Btrfs to improve + // database performance. It does not have any effect on non-empty files, so + // we check, whether the database has not yet been initialized. + if (dbFile.size() == 0) { + if (Utils::getDirectoryFileSystem(mDatabaseName) == QLatin1String("btrfs")) { + Utils::disableCoW(mDatabaseName); + } } - } -#endif + #endif - db.setDatabaseName(mDatabaseName); - if (!db.open()) { - akDebug() << "Could not open sqlite database " - << mDatabaseName - << " with driver " - << driverName() - << " for initialization"; - db.close(); - return; - } + db.setDatabaseName(mDatabaseName); + if (!db.open()) { + akDebug() << "Could not open sqlite database " + << mDatabaseName + << " with driver " + << driverName() + << " for initialization"; + db.close(); + return; + } - apply(db); + apply(db); - QSqlQuery query(db); - if (!query.exec(QStringLiteral("SELECT sqlite_version()"))) { - akDebug() << "Could not query sqlite version"; - akDebug() << "Database: " << mDatabaseName; - akDebug() << "Query error: " << query.lastError().text(); - akDebug() << "Database error: " << db.lastError().text(); - db.close(); - return; - } + QSqlQuery query(db); + if (!query.exec(QStringLiteral("SELECT sqlite_version()"))) { + akDebug() << "Could not query sqlite version"; + akDebug() << "Database: " << mDatabaseName; + akDebug() << "Query error: " << query.lastError().text(); + akDebug() << "Database error: " << db.lastError().text(); + db.close(); + return; + } - if (!query.next()) { // should never occur - akDebug() << "Could not query sqlite version"; - akDebug() << "Database: " << mDatabaseName; - akDebug() << "Query error: " << query.lastError().text(); - akDebug() << "Database error: " << db.lastError().text(); - db.close(); - return; - } + if (!query.next()) { // should never occur + akDebug() << "Could not query sqlite version"; + akDebug() << "Database: " << mDatabaseName; + akDebug() << "Query error: " << query.lastError().text(); + akDebug() << "Database error: " << db.lastError().text(); + db.close(); + return; + } - const QString sqliteVersion = query.value(0).toString(); - akDebug() << "sqlite version is " << sqliteVersion; + const QString sqliteVersion = query.value(0).toString(); + akDebug() << "sqlite version is " << sqliteVersion; - const QStringList list = sqliteVersion.split(QLatin1Char('.')); - const int sqliteVersionMajor = list[0].toInt(); - const int sqliteVersionMinor = list[1].toInt(); - - // set synchronous mode to NORMAL; see http://www.sqlite.org/pragma.html#pragma_synchronous - if (!query.exec(QStringLiteral("PRAGMA synchronous = 1"))) { - akDebug() << "Could not set sqlite synchronous mode to NORMAL"; - akDebug() << "Database: " << mDatabaseName; - akDebug() << "Query error: " << query.lastError().text(); - akDebug() << "Database error: " << db.lastError().text(); - db.close(); - return; - } + const QStringList list = sqliteVersion.split(QLatin1Char('.')); + const int sqliteVersionMajor = list[0].toInt(); + const int sqliteVersionMinor = list[1].toInt(); + + // set synchronous mode to NORMAL; see http://www.sqlite.org/pragma.html#pragma_synchronous + if (!query.exec(QStringLiteral("PRAGMA synchronous = 1"))) { + akDebug() << "Could not set sqlite synchronous mode to NORMAL"; + akDebug() << "Database: " << mDatabaseName; + akDebug() << "Query error: " << query.lastError().text(); + akDebug() << "Database error: " << db.lastError().text(); + db.close(); + return; + } - if (sqliteVersionMajor < 3 && sqliteVersionMinor < 7) { - // wal mode is only supported with >= sqlite 3.7.0 - db.close(); - return; - } + if (sqliteVersionMajor < 3 && sqliteVersionMinor < 7) { + // wal mode is only supported with >= sqlite 3.7.0 + db.close(); + return; + } - // set write-ahead-log mode; see http://www.sqlite.org/wal.html - if (!query.exec(QStringLiteral("PRAGMA journal_mode=wal"))) { - akDebug() << "Could not set sqlite write-ahead-log journal mode"; - akDebug() << "Database: " << mDatabaseName; - akDebug() << "Query error: " << query.lastError().text(); - akDebug() << "Database error: " << db.lastError().text(); - db.close(); - return; - } + // set write-ahead-log mode; see http://www.sqlite.org/wal.html + if (!query.exec(QStringLiteral("PRAGMA journal_mode=wal"))) { + akDebug() << "Could not set sqlite write-ahead-log journal mode"; + akDebug() << "Database: " << mDatabaseName; + akDebug() << "Query error: " << query.lastError().text(); + akDebug() << "Database error: " << db.lastError().text(); + db.close(); + return; + } - if (!query.next()) { // should never occur - akDebug() << "Could not query sqlite journal mode"; - akDebug() << "Database: " << mDatabaseName; - akDebug() << "Query error: " << query.lastError().text(); - akDebug() << "Database error: " << db.lastError().text(); - db.close(); - return; - } + if (!query.next()) { // should never occur + akDebug() << "Could not query sqlite journal mode"; + akDebug() << "Database: " << mDatabaseName; + akDebug() << "Query error: " << query.lastError().text(); + akDebug() << "Database error: " << db.lastError().text(); + db.close(); + return; + } - const QString journalMode = query.value(0).toString(); - akDebug() << "sqlite journal mode is " << journalMode; + const QString journalMode = query.value(0).toString(); + akDebug() << "sqlite journal mode is " << journalMode; - db.close(); + db.close(); + } QSqlDatabase::removeDatabase(connectionName); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/akonadi-15.12.0/src/server/storage/querybuilder.cpp new/akonadi-15.12.1/src/server/storage/querybuilder.cpp --- old/akonadi-15.12.0/src/server/storage/querybuilder.cpp 2015-11-14 14:42:31.000000000 +0100 +++ new/akonadi-15.12.1/src/server/storage/querybuilder.cpp 2015-12-17 23:42:16.000000000 +0100 @@ -99,7 +99,6 @@ : mTable(table) #ifndef QUERYBUILDER_UNITTEST , mDatabaseType(DbType::type(DataStore::self()->database())) - , mQuery(DataStore::self()->database()) #else , mDatabaseType(DbType::Unknown) #endif @@ -355,6 +354,7 @@ if (QueryCache::contains(statement)) { mQuery = QueryCache::query(statement); } else { + mQuery = QSqlQuery(DataStore::self()->database()); mQuery.prepare(statement); QueryCache::insert(statement, mQuery); }