[Pkg-owncloud-commits] [owncloud-client] 127/211: SyncEngine/SyncJournalDB: Fix creation of .csync_journal

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat Oct 25 09:10:36 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit cb36a37779161b46c2401f973c9f51d548969959
Author: Markus Goetz <markus at woboq.com>
Date:   Mon Oct 20 14:25:22 2014 +0200

    SyncEngine/SyncJournalDB: Fix creation of .csync_journal
---
 src/mirall/syncengine.cpp    | 19 ++++++++++++++++++-
 src/mirall/syncjournaldb.cpp |  9 +++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp
index 1458d3d..8951866 100644
--- a/src/mirall/syncengine.cpp
+++ b/src/mirall/syncengine.cpp
@@ -525,19 +525,36 @@ void SyncEngine::startSync()
 
     csync_resume(_csync_ctx);
 
+    bool usingSelectiveSync = (!_selectiveSyncBlackList.isEmpty());
+    qDebug() << (usingSelectiveSync ? "====Using Selective Sync" : "====NOT Using Selective Sync");
+
+    int fileRecordCount = -1;
     if (!_journal->exists()) {
+        fileRecordCount = _journal->getFileRecordCount(); // this creates the DB
+        _journal->close(); // Close again so it doesn't interfere with the sync in the the other thread in csync_update
+
+        if( fileRecordCount == -1 ) {
+            // FIXME de-duplicate with logic below
+            qDebug() << "No way to create a sync journal!";
+            emit csyncError(tr("Unable to initialize a sync journal."));
+            finalize();
+            return;
+            // database creation error!
+        }
+
         qDebug() << "=====sync looks new (no DB exists), activating recursive PROPFIND if csync supports it";
         bool no_recursive_propfind = false;
         csync_set_module_property(_csync_ctx, "no_recursive_propfind", &no_recursive_propfind);
     } else {
         // retrieve the file count from the db and close it afterwards because
         // csync_update also opens the database.
-        int fileRecordCount = 0;
+
         fileRecordCount = _journal->getFileRecordCount();
         bool isUpdateFrom_1_5 = _journal->isUpdateFrom_1_5();
         _journal->close();
 
         if( fileRecordCount == -1 ) {
+            // FIXME de-duplicate with logic above
             qDebug() << "No way to create a sync journal!";
             emit csyncError(tr("Unable to initialize a sync journal."));
             finalize();
diff --git a/src/mirall/syncjournaldb.cpp b/src/mirall/syncjournaldb.cpp
index dd34dea..3a07869 100644
--- a/src/mirall/syncjournaldb.cpp
+++ b/src/mirall/syncjournaldb.cpp
@@ -94,8 +94,8 @@ bool SyncJournalDb::checkConnect()
         return true;
     }
 
-    if( _dbFile.isEmpty() || !QFile::exists(_dbFile) ) {
-        qDebug() << "Database " + _dbFile + " is empty or does not exist";
+    if( _dbFile.isEmpty()) {
+        qDebug() << "Database filename" + _dbFile + " is empty";
         return false;
     }
 
@@ -105,6 +105,11 @@ bool SyncJournalDb::checkConnect()
         return false;
     }
 
+    if( !QFile::exists(_dbFile) ) {
+        qDebug() << "Database file" + _dbFile + " does not exist";
+        return false;
+    }
+
     SqlQuery pragma1(_db);
     pragma1.prepare("SELECT sqlite_version();");
     if (!pragma1.exec()) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list