Classify chunked items correctly. Issue #5850
authorPiotr Mrowczynski <mrow4a@yahoo.com>
Tue, 20 Jun 2017 18:27:26 +0000 (20:27 +0200)
committerMarkus Goetz <markus@woboq.com>
Mon, 3 Jul 2017 12:41:53 +0000 (14:41 +0200)
src/libsync/discoveryphase.h
src/libsync/owncloudpropagator.cpp
src/libsync/propagateupload.h
src/libsync/propagateuploadng.cpp

index 9603c39ab062628d1d88f3b221259fdbbcad76ab..b7d252c675aa9618e68c24e8e67436cc597f208c 100644 (file)
@@ -53,9 +53,10 @@ struct SyncOptions
     /** If a confirmation should be asked for external storages */
     bool _confirmExternalStorage;
 
-    /** The initial un-adjusted chunk size in bytes for chunked uploads
+    /** The initial un-adjusted chunk size in bytes for chunked uploads, both
+     * for old and new chunking algorithm, which classifies the item to be chunked
      *
-     * When dynamic chunk size adjustments are done, this is the
+     * In chunkingNG, when dynamic chunk size adjustments are done, this is the
      * starting value and is then gradually adjusted within the
      * minChunkSize / maxChunkSize bounds.
      */
index 62f12f023202441358413ef07dea7499142bbc70..f77dfd860ec18079b32ab1cc932712c6ade236c4 100644 (file)
@@ -379,7 +379,8 @@ PropagateItemJob *OwncloudPropagator::createJob(const SyncFileItemPtr &item)
             return job;
         } else {
             PropagateUploadFileCommon *job = 0;
-            if (item->_size > _chunkSize && account()->capabilities().chunkingNg()) {
+            if (item->_size > syncOptions()._initialChunkSize && account()->capabilities().chunkingNg()) {
+                // Item is above _initialChunkSize, thus will be classified as to be chunked
                 job = new PropagateUploadFileNG(this, item);
             } else {
                 job = new PropagateUploadFileV1(this, item);
index 5e16b5ff9842a2f6cadce8d5dc6d6e28143df3d2..030c43020a849910720ad6c1c4e3fd6f56bbc177 100644 (file)
@@ -307,7 +307,11 @@ private:
     int _chunkCount; /// Total number of chunks for this file
     int _transferId; /// transfer id (part of the url)
 
-    quint64 chunkSize() const { return propagator()->syncOptions()._initialChunkSize; }
+    quint64 chunkSize() const {
+        // Old chunking does not use dynamic chunking algorithm, and does not adjusts the chunk size respectively,
+        // thus this value should be used as the one classifing item to be chunked
+        return propagator()->syncOptions()._initialChunkSize;
+    }
 
 
 public:
index 45768102da69d076e76ea0a8dbfde00169cc5fcb..dd918e80b9e4cb2408e7eda91310d45df025a1a1 100644 (file)
@@ -400,6 +400,7 @@ void PropagateUploadFileNG::slotPutFinished()
         // the chunk sizes a bit.
         quint64 targetSize = (propagator()->_chunkSize + predictedGoodSize) / 2;
 
+        // Adjust the dynamic chunk size _chunkSize used for sizing of the item's chunks to be send
         propagator()->_chunkSize = qBound(
             propagator()->syncOptions()._minChunkSize,
             targetSize,