New Propagation algorithm: Fetch, and emit, the root etag
authorOlivier Goffart <ogoffart@woboq.com>
Tue, 9 Oct 2018 13:12:02 +0000 (15:12 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:07 +0000 (10:58 +0100)
Remove the feature to concatenate etags as servers that don't
have a root etag are no longer suported

src/libsync/account.cpp
src/libsync/account.h
src/libsync/discovery.cpp
src/libsync/discovery.h
src/libsync/discoveryphase.cpp
src/libsync/discoveryphase.h
src/libsync/networkjobs.cpp
src/libsync/syncengine.cpp

index ee4ee1ffaf058a6b027e13198a8a03acd1fa88b5..3f3c592b45f1e8d35f3aefae921c7c0aab19e35a 100644 (file)
@@ -513,11 +513,6 @@ void Account::setServerVersion(const QString &version)
     emit serverVersionChanged(this, oldServerVersion, version);
 }
 
-bool Account::rootEtagChangesNotOnlySubFolderEtags()
-{
-    return (serverVersionInt() >= makeServerVersion(8, 1, 0));
-}
-
 void Account::setNonShib(bool nonShib)
 {
     if (nonShib) {
index 92008ff0824f14330a036ffb292a2c165eefbd0d..7036072a52e96df887959676f15e837419c58175 100644 (file)
@@ -219,10 +219,6 @@ public:
      */
     bool serverVersionUnsupported() const;
 
-    // Fixed from 8.1 https://github.com/owncloud/client/issues/3730
-    /** Detects a specific bug in older server versions */
-    bool rootEtagChangesNotOnlySubFolderEtags();
-
     /** True when the server connection is using HTTP2  */
     bool isHttp2Supported() { return _http2Supported; }
     void setHttp2Supported(bool value) { _http2Supported = value; }
index a5433b9b48b81eecebec65d004e7d6ee2603adbc..0f1e298088c4ff65aaa59e4b567709588de4ea11 100644 (file)
@@ -37,6 +37,7 @@ void ProcessDirectoryJob::start()
     if (_queryServer == NormalQuery) {
         serverJob = new DiscoverySingleDirectoryJob(_discoveryData->_account,
             _discoveryData->_remoteFolder + _currentFolder._server, this);
+        connect(serverJob, &DiscoverySingleDirectoryJob::etag, this, &ProcessDirectoryJob::etag);
         connect(serverJob, &DiscoverySingleDirectoryJob::finished, this, [this, serverJob](const auto &results) {
             if (results) {
                 _serverEntries = *results;
index 4677b1ab4c61910a5b54450f4ec7acd446351435..783280f774707ac04b02640f455d1220470e0810 100644 (file)
@@ -107,5 +107,7 @@ private:
 
 signals:
     void finished();
+    // The root etag of this directory was fetched
+    void etag(const QString &);
 };
 }
index f645b63a875b7a09e59efc518cb2bc35fb1f733b..65491f60035b8660b3533bba4687aedd81ee2f33 100644 (file)
@@ -311,8 +311,6 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file, con
 
     //This works in concerto with the RequestEtagJob and the Folder object to check if the remote folder changed.
     if (map.contains("getetag")) {
-        _etagConcatenation += map.value("getetag");
-
         if (_firstEtag.isEmpty()) {
             _firstEtag = map.value("getetag"); // for directory itself
         }
@@ -333,7 +331,6 @@ void DiscoverySingleDirectoryJob::lsJobFinishedWithoutErrorSlot()
         return;
     }
     emit etag(_firstEtag);
-    emit etagConcatenation(_etagConcatenation);
     emit finished(_results);
     deleteLater();
 }
index 8a6c001024efdf5d6699d3aac2bc05d95bc7cc93..c447a595bd6956428cc0c4dd0bc12ea5ac236ba3 100644 (file)
@@ -92,7 +92,6 @@ public:
     // This is not actually a network job, it is just a job
 signals:
     void firstDirectoryPermissions(RemotePermissions);
-    void etagConcatenation(const QString &);
     void etag(const QString &);
     void finished(const Result<QVector<RemoteInfo>> &result);
 private slots:
@@ -103,7 +102,6 @@ private slots:
 private:
     QVector<RemoteInfo> _results;
     QString _subPath;
-    QString _etagConcatenation;
     QString _firstEtag;
     AccountPtr _account;
     // The first result is for the directory itself and need to be ignored.
index 2e2eacd473eecdb67a7a6a73b9ff660d98e83acf..ccedf4d28194b925b788ddad7e680fab583cad48 100644 (file)
@@ -62,16 +62,7 @@ RequestEtagJob::RequestEtagJob(AccountPtr account, const QString &path, QObject
 void RequestEtagJob::start()
 {
     QNetworkRequest req;
-    if (_account && _account->rootEtagChangesNotOnlySubFolderEtags()) {
-        // Fixed from 8.1 https://github.com/owncloud/client/issues/3730
-        req.setRawHeader("Depth", "0");
-    } else {
-        // Let's always request all entries inside a directory. There are/were bugs in the server
-        // where a root or root-folder ETag is not updated when its contents change. We work around
-        // this by concatenating the ETags of the root and its contents.
-        req.setRawHeader("Depth", "1");
-        // See https://github.com/owncloud/core/issues/5255 and others
-    }
+    req.setRawHeader("Depth", "0");
 
     QByteArray xml("<?xml version=\"1.0\" ?>\n"
                    "<d:propfind xmlns:d=\"DAV:\">\n"
index c6d4aa2f20c8803dfc537bfec86863acf62a21c7..718f8107c34b1c6df570623ce61c75360d728eb2 100644 (file)
@@ -618,16 +618,7 @@ void SyncEngine::slotStartDiscovery()
     auto discoveryJob = new ProcessDirectoryJob(SyncFileItemPtr(), ProcessDirectoryJob::NormalQuery, ProcessDirectoryJob::NormalQuery,
         _discoveryPhase.data(), _discoveryPhase.data());
     _discoveryPhase->startJob(discoveryJob);
-
-    /*
-     * FIXME
-    if (account()->rootEtagChangesNotOnlySubFolderEtags()) {
-        connect(_discoveryMainThread.data(), &DiscoveryMainThread::etag, this, &SyncEngine::slotRootEtagReceived);
-    } else {
-        connect(_discoveryMainThread.data(), &DiscoveryMainThread::etagConcatenation, this, &SyncEngine::slotRootEtagReceived);
-    }
-
-    */
+    connect(discoveryJob, &ProcessDirectoryJob::etag, this, &SyncEngine::slotRootEtagReceived);
 }
 
 void SyncEngine::slotFolderDiscovered(bool local, const QString &folder)