diff --git a/src/common/syncjournaldb.cpp b/src/common/syncjournaldb.cpp index 610d85ddf..c745e7939 100644 --- a/src/common/syncjournaldb.cpp +++ b/src/common/syncjournaldb.cpp @@ -1161,57 +1161,6 @@ bool SyncJournalDb::getFilesBelowPath(const QByteArray &path, const std::functio return true; } -bool SyncJournalDb::postSyncCleanup(const QSet &filepathsToKeep, - const QSet &prefixesToKeep) -{ - QMutexLocker locker(&_mutex); - - if (!checkConnect()) { - return false; - } - - SqlQuery query(_db); - query.prepare("SELECT phash, path, e2eMangledName FROM metadata order by path"); - - if (!query.exec()) { - return false; - } - - QByteArrayList superfluousItems; - - while (query.next()) { - const auto file = QString(query.baValue(1)); - const auto mangledPath = QString(query.baValue(2)); - bool keep = filepathsToKeep.contains(file) || filepathsToKeep.contains(mangledPath); - if (!keep) { - foreach (const QString &prefix, prefixesToKeep) { - if (file.startsWith(prefix) || mangledPath.startsWith(prefix)) { - keep = true; - break; - } - } - } - if (!keep) { - superfluousItems.append(query.baValue(0)); - } - } - - if (superfluousItems.count()) { - QByteArray sql = "DELETE FROM metadata WHERE phash in (" + superfluousItems.join(",") + ")"; - qCInfo(lcDb) << "Sync Journal cleanup for" << superfluousItems; - SqlQuery delQuery(_db); - delQuery.prepare(sql); - if (!delQuery.exec()) { - return false; - } - } - - // Incorporate results back into main DB - walCheckpoint(); - - return true; -} - int SyncJournalDb::getFileRecordCount() { QMutexLocker locker(&_mutex); diff --git a/src/common/syncjournaldb.h b/src/common/syncjournaldb.h index f9992a71e..31e757a94 100644 --- a/src/common/syncjournaldb.h +++ b/src/common/syncjournaldb.h @@ -184,9 +184,6 @@ public: */ void forceRemoteDiscoveryNextSync(); - bool postSyncCleanup(const QSet &filepathsToKeep, - const QSet &prefixesToKeep); - /* Because sqlite transactions are really slow, we encapsulate everything in big transactions * Commit will actually commit the transaction and create a new one. */ diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 718f8107c..6b063f775 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -417,7 +417,6 @@ void SyncEngine::startSync() _hasForwardInTimeFiles = false; _backInTimeFiles = 0; _seenFiles.clear(); - _temporarilyUnavailablePaths.clear(); _progressInfo->reset(); @@ -812,10 +811,6 @@ void SyncEngine::slotFinished(bool success) _journal->setDataFingerprint(_discoveryPhase->_dataFingerprint); } - if (success && !_journal->postSyncCleanup(_seenFiles, _temporarilyUnavailablePaths)) { - qCDebug(lcEngine) << "Cleaning of synced "; - } - conflictRecordMaintenance(); _journal->commit("All Finished.", false); @@ -844,7 +839,6 @@ void SyncEngine::finalize(bool success) // Delete the propagator only after emitting the signal. _propagator.clear(); _seenFiles.clear(); - _temporarilyUnavailablePaths.clear(); _uniqueErrors.clear(); _localDiscoveryPaths.clear(); _localDiscoveryStyle = LocalDiscoveryStyle::FilesystemOnly; diff --git a/src/libsync/syncengine.h b/src/libsync/syncengine.h index 1343fc493..ac41798ac 100644 --- a/src/libsync/syncengine.h +++ b/src/libsync/syncengine.h @@ -231,21 +231,9 @@ private: QScopedPointer _discoveryPhase; QSharedPointer _propagator; - // After a sync, only the syncdb entries whose filenames appear in this - // set will be kept. See _temporarilyUnavailablePaths. + // List of all files we seen QSet _seenFiles; - // Some paths might be temporarily unavailable on the server, for - // example due to 503 Storage not available. Deleting information - // about the files from the database in these cases would lead to - // incorrect synchronization. - // Therefore all syncdb entries whose filename starts with one of - // the paths in this set will be kept. - // The specific case that fails otherwise is deleting a local file - // while the remote says storage not available. - QSet _temporarilyUnavailablePaths; - - QScopedPointer _progressInfo; QScopedPointer _excludedFiles;