1
0
Fork 0
Commit Graph

221 Commits

Author SHA1 Message Date
Christian Kamm 96126a53d3
PropagateUpload: Remove unused PropagateUploadFileCommon::abort 2018-06-07 08:53:10 +02:00
Christian Kamm a2675b559b
Upload: Simplify 'finished' flag
* Sometimes there was 'finished' and '_finished'
* Make each done() call automatically set _finished to true
2018-05-16 20:57:26 +02:00
Tomaz Canabrava 96115be0c6 Unlock folder in case of error 2018-03-25 21:54:08 +02:00
Daniel Nicoletti 99117078f3 Remove table for e2e and add an e2eMangledName column (#169)
If the code was not complex enough syncing two tables
already started to give UNIQUE constrains errors on
simple sync operations, this also adds initial support
remote delete of an encrypted file
2018-02-12 12:50:51 +01:00
Tomaz Canabrava d24a1e542e Merge branch 'master' into clientSideEncryptionV3 2018-01-29 14:06:12 +01:00
Tomaz Canabrava e8849a2cf9 [CSE] Save the relation of the file / encrypted file names on the db 2018-01-28 22:26:07 +01:00
Olivier Goffart b8539eb329 Get rid of the StopWatch in the PropagateUpload job
For issue #6318

The StopWatch is using memory, and we are not really using it.
2018-01-19 13:37:48 +01:00
Daniel Nicoletti e2c895e61f Fix encrypted file location on the server 2017-12-29 17:28:35 +01:00
Daniel Nicoletti a63d34f870 Prepend "nextcloud" for all logging categories
Thus making easier to exclude logging from kio, qt
and only enable "nextcloud.*"
2017-12-28 17:33:10 -02:00
Tomaz Canabrava efc039863b [CSE] Tons of debugs. 2017-12-24 17:08:04 +01:00
Tomaz Canabrava 06c34ed617 [CSE] Assorted fixes
- Unlock the folder even on error
- Use the correct name of the file for upload
2017-12-24 16:30:39 +01:00
Tomaz Canabrava b72113a53d [CSE] Prepare the beginning of the upload.
I still need to send the metadata.
2017-12-21 00:35:23 +01:00
Tomaz Canabrava 7be5f0a736 [CSE] Update the finished signal 2017-12-20 23:36:49 +01:00
Tomaz Canabrava aa36cc4a5c [CSE] Reduce probability of conflicts when rebasing
Creates a new file/class to handle upload,
propagateuploadencrypted.h/cpp. This should have all the logic to deal
with the encryption and upload.
2017-12-17 22:38:43 +01:00
Christian Kamm a7c0cfc8eb Upload conflict files #4557
If the server has the 'uploadConflictFiles' capability conflict
files will be uploaded instead of ignored.

Uploaded conflict files have the following headers set during upload
  OC-Conflict: 1
  OC-ConflictBaseFileId: 172489174instanceid
  OC-ConflictBaseMtime: 1235789213
  OC-ConflictBaseEtag: myetag
when the data is available. Downloads accept the same headers in return
when downloading a conflict file.

In the absence of server support clients will identify conflict files
through the file name pattern and attempt to deduce the base fileid.
Base etag and mtime can't be deduced though.

The upload job for a new conflict file will be triggered directly from
the job that created the conflict file now. No second sync run is
necessary anymore.

This commit does not yet introduce a 'username' like identifier that
automatically gets added to conflict file filenames (to name the files
foo_conflict-Fred-1345.txt instead of just foo_conflict-1345.txt).
2017-12-15 18:03:53 +01:00
Tomaz Canabrava 2127b2629d [CSE] Move encryption related network jobs to its own file
Move encryption related network jobs to it's own file,
the original file was starting to be just way too big.
2017-12-12 19:36:47 +01:00
Tomaz Canabrava 0a58ea76e5 [CSE] Start the work with an existing metadata 2017-12-12 15:35:53 +01:00
Tomaz Canabrava e6f835d138 [CSE] Unlock the folder after a lock
This makes sure the folder will be unlocked for next tests
2017-12-12 11:26:54 +01:00
Tomaz Canabrava a08a32ceca [CSE] Fetch the metadata for the upload. 2017-12-08 10:32:05 +01:00
Tomaz Canabrava 6745777ca3 [CSE] Save folder id and token for the lock
So we can unlock it later. - perhaps we should store this
on the disk or something, to make it harder to lose.
2017-12-08 10:19:56 +01:00
Tomaz Canabrava 70d562668c [CSE] Add handling for side-by-side uploads. 2017-12-07 21:51:42 +01:00
Tomaz Canabrava ccd8cff4db [CSE] Try to lock repeteadly the folder if needed.
The upload is made in an event loop with more than one
upload at the same time, this confuses the hell out of the
folder locking mechanism.

We need to lock the folder and ask the other trials to try
again in a few seconds in the future to give time for the
uploader to actually upload the current file that's locking
the folder.
2017-12-07 21:31:20 +01:00
Tomaz Canabrava 9f678652f8 [CSE] Lock the folder to upload a file. 2017-12-07 20:52:54 +01:00
Tomaz Canabrava 76916b6c48 [CSE] Request the Folder ID. 2017-12-07 19:39:30 +01:00
Tomaz Canabrava 7fe4dd2163 [CSE] Renane GetFolderEncryptStatus to GetFolderEncryptStatusJob
it's a network job after all
2017-12-07 18:06:55 +01:00
Tomaz Canabrava 863e86138f [CSE] Pass the folder to the GetEncryptionStatus
Sometimes we are only interested in folders.
2017-12-07 17:32:35 +01:00
Tomaz Canabrava 66aecb9626 [CSE] Handle normal uploads in CSE enabled instances 2017-12-04 22:45:10 +01:00
Tomaz Canabrava 6f35cbff6b [CSE] Fetch the Folder information for encryption status 2017-12-04 22:27:13 +01:00
Tomaz Canabrava 387737d908 [CSE] Start to create the upload logic. 2017-12-04 21:33:43 +01:00
Tomaz Canabrava 8c4928d9f6 Merge branch 'uploadImprovements' into clientSideEncryptionV3 2017-12-03 18:15:33 +01:00
Tomaz Canabrava a623b14209 [uploadImprovements] use the new struct info in PropagateUploadV1
Add a new member for the UploadFileInfo in PropagateUploadCommon
to hold the full file path - as it can change if we use a temporary
file to upload.

Adapt propagateuploadv1 to use the new calls.
2017-11-28 22:17:29 +01:00
Tomaz Canabrava f609336bfc Split file to upload from the file on disk
They can be conceptually equal - I can upload the file
on disk, and that's what I do right now. But if we want
to accept filters in the future, filters that change
the file on disk like shrinking an image, the current
information used is wrong and we need a way to separate those.

This patch introduces a new struct that holds the *actual*
file that will be uploaded, be it a temporary one or
the original file.
2017-11-28 21:28:06 +01:00
Tomaz Canabrava c4d3d0987d [CSE] Find the start of the upload 2017-11-27 22:20:24 +01:00
Piotr Mrowczynski e10775d34f Fix paused sync file move issue #5949
Dont abort final chunk immedietally

Use sync and async aborts
2017-10-17 09:44:52 +02:00
Olivier Goffart 13e0cc6b50 Use QDateTime::currentDateTimeUtc instead of the non utc version
QDateTime::currentDateTime is terribly slow.
2017-09-26 16:14:17 +02:00
Olivier Goffart ff4213b59f Use the Qt5 connection syntax (automated with clazy)
This is motivated by the fact that QMetaObject::noralizeSignature takes 7.35%
CPU of the LargeSyncBench. (Mostly from ABstractNetworkJob::setupConnections and
PropagateUploadFileV1::startNextChunk). It could be fixed by using normalized
signature in the connection statement, but i tought it was a good oportunity
to modernize the code.

This commit only contains calls that were automatically converted with clazy.
2017-09-21 14:05:39 +02:00
Jocelyn Turcotte a1f1775d15 Move SyncJournalDB to src/common 2017-09-18 14:00:52 +02:00
Jocelyn Turcotte 5fbed0d1cd Reverse the dependency between SyncJournalFileRecord and SyncFileItem
This will allow us to also use the SyncJournalDB in csync.
2017-09-18 14:00:52 +02:00
Christian Kamm 3a55ff2119 PropagateUpload: Model of remote quota, avoid some uploads #5537
When we see a 507 error, assume that quota is < uploaded size.
2017-09-15 09:27:07 +02:00
Christian Kamm 0c99673581 Make DetailError different from BlacklistedError
It's quite different in regard to blacklist handling and overall
sync failure changes.
2017-09-15 09:27:07 +02:00
Jocelyn Turcotte cf15cbf0b3 Move Utility to a new common static library
Now that csync builds as C++, this will avoid having to implement
functionalities needed by csync mandatorily in csync itself.

This library is built as part of libocsync and symbols exported
through it.
This requires a relicense of Utility as LGPL. All classes moved into
this library from src/libsync will need to be relicensed as well.
2017-09-05 17:25:19 +02:00
Olivier Goffart 3cea550d08 PropagateUpload: Remove the Qt workaround against data corruption
This was only for Qt <= 5.4, which we don't really support anymore.
And even then, the data corruption is happens very seldomly anyway.
2017-07-17 10:12:48 +02:00
Olivier Goffart 520923b5a7 HTTP/2 Support
We need Qt 5.9 for HTTP2 because, even if Qt 5.8 already has support
for it, there is some critical bug in the HTTP2 implementation which
make it unusable [ https://codereview.qt-project.org/186050 and
https://codereview.qt-project.org/186066 ]

When using HTTP2, we can use many more parallel network request, this
is especially good for small file handling

Lower the priority of the GET and PUT propagation jobs, so the quota
or selective sync ui PROPFIND will not be blocked by them
2017-07-17 08:20:17 +02:00
Christian Kamm cd1b89475c PropagateUpload: Better messaging for 507 #5537
It now produces a summary error message indicating the problem.

Adjust blacklist database table to contain 'errorCategory'. This is
useful for two things:
  - Reestablishing summary messages based on blacklisted errors. For
    example if we don't retry a 507ed file, we still want to show the
    message about space on the server
  - Selectively wiping the blacklist: When we have ui for something like
    "I deleted some files, please retry all files now!", we want to
    delete all blacklist entries of a specific category only.
2017-07-12 09:04:27 +02:00
Christian Kamm 5d90b48790 PropagateUpload: Put upload error handling in one function 2017-07-12 09:04:27 +02:00
Christian Kamm 8160963110 Compare the hash of files with identical mtime/size #5589
* For conflicts where mtime and size are identical:

  a) If there's no remote checksum, skip (unchanged)
  b) If there's a remote checksum that's a useful hash, create a
     PropagateDownload job and compute the local hash. If the hashes
     are identical, don't download the file and just update metadata.

* Avoid exposing the existence of checksumTypeId beyond the database
  layer. This makes handling checksums easier in general because they
  can usually be treated as a single blob.

  This change was prompted by the difficulty of producing file_stat_t
  entries uniformly from PROPFINDs and the database.
2017-06-15 13:54:16 +02:00
Christian Kamm c8d0f788e0 Apply clang-format 2017-05-17 12:26:27 +02:00
Jocelyn Turcotte 7fd2f292e7 Promote a few more logs to info/warning 2017-05-11 17:22:59 +02:00
Jocelyn Turcotte b7553d5bdf Upgrade some qCDebug to qCInfo or qCWarning
Use qCInfo for anything that has general value for support and
development. Use qCWarning for any recoverable error and qCCritical
for anything that could result in data loss or would identify a serious
issue with the code.

Issue #5647
2017-05-11 17:22:59 +02:00
Jocelyn Turcotte 4ad190a558 Use Qt logging categories for logging
This gives more insight about the logs and allow setting fine-tuned
logging rules. The categories are set to only output Info by default
so this allows us to provide more concise logging while keeping the
ability to extract more information for a specific category when
developping or debugging customer issues.

Issue #5647
2017-05-11 17:22:59 +02:00
Christian Kamm f1b42cedda Port PollJob responses to Qt5's QJson #5710 2017-05-08 11:50:33 +02:00
Kiril Vladimiroff 3a31694147 Remove all conditional checks for Qt 4.x (#5505) 2017-04-21 18:13:32 +02:00
Christian Kamm 35af03b2e5 Improve http error messages; cleanup
By default QNetworkReply::errorString() often produces messages like
   "Error downloading <url> - server replied: <reason>"
but the "downloading" part invariably confuses people since the
error might very well have been produced by a PUT request.

This commit produces clearer error messages for HTTP errors.

Additionally:
* Remove some unnecessary null checks from slots connected to
  network job signals and document that these signals never send
  null replies.
* There was a bug where AbstractNetworkJob::_timedout wasn't
  set when derived classes overrode slotTimeout. We now ensure
  it's always set by disallowing overrides of slotTimeout.
  Instead it now calls onTimedOut, which allows custom handling.
* Several subclasses declared errorString, isTimedOut. Move
  these to AbstractNetworkJob.
* Unify handling of OC-ErrorString (via the new, general
  Job::errorString)
* Add documentation in various places.
2017-04-04 09:27:37 +02:00
Christian Kamm e86499d990 dynamic chunking: cleanup, fixes, improvements
* make target duration a client option instead of a capability
* simplify algorithm for determining chunk size significantly
* preserve chunk size for the whole propagation, not just per upload
* move options to SyncOptions to avoid depending on ConfigFile
  in the propagator
* move chunk-size adjustment to after a chunk finishes, not when
  a new chunk starts
2017-03-28 11:32:10 +02:00
Christian Kamm 13b2568358 Windows/NTFS: Do not attempt to upload inaccessible files #5544
It is possible to create files with filenames that differ
only by case in NTFS, but most operations such as stat and
open only target one of these by default.

When that happens, we want to avoid uploading incorrect data
and give up on the file.

Typically this situation should never occurr during normal use
of Windows. It can happen, however, when a NTFS partition is
mounted in another OS.
2017-03-14 16:03:08 +01:00
Christian Kamm 4a1a5fa076 AbstractNetworkJob: Improve redirect handling #5555
* For requests:
  - reuse the original QNetworkRequest, so headers and attributes
    are the same as in the original request
  - determine the original http method from the reply and the request
    attributes
  - keep the original request body around such that it can be sent
    again in case the request is redirected

* Simplify the interface that is used for creating new requests in
  AbstractNetworkJob.
2017-03-07 13:18:01 +01:00
Christian Kamm 4c1fdf1dee Double check usage of asserts #5429
A few are supposed to be fatal.
2017-02-08 15:15:19 +01:00
Jocelyn Turcotte f1e9be4fa8 Don't use the StopWatch for each job in production builds #5456
This accounted for more than 10% of the peak memory usage while only
providing value through the debugging log.
2017-01-26 17:13:54 +01:00
Jocelyn Turcotte 9db23d4df1 Remove SyncFileItem::_requestDuration #5456
This will save a QElapsedTimer in each job that was used only for
.owncloudsync.log (for which the request duration doesn't bring much
value).
2017-01-26 17:13:54 +01:00
Christian Kamm 29b39acfbe PropagatorJob: Access propagator through function #5453 2017-01-17 14:47:38 +01:00
ckamm d76e0ec6d8 Reset stuck chunked uploads eventually #5344 (#5443)
Previously this wasn't happening for errors that were not
NormalErrors because they don't end up in the blacklist.

This revises the resetting logic to be independent of the
error blacklist and make use of UploadInfo::errorCount
instead.

412 errors should reset chunked uploads because they might be
indicative of a checksum error.

Additionally, server bugs might require that additional
errors cause an upload reset. To allow that, a new capability
is added that can be used to advise the client about this.
2017-01-13 14:44:45 +01:00
Olivier Goffart a1558100b8 WIP: new chunking algorithm
Current limitations of this WiP
 - No resuming implemented yet
 - No parallel chunks
 - Hackish way to get the webdav paths
2016-08-31 10:28:15 +02:00
Olivier Goffart 4f3f642da6 Upload: refactor the upload in two classes so the new chuning can be implemented 2016-08-31 10:28:15 +02:00
Olivier Goffart d2bde5489f Propagator, remove the QNAM in the name as the alternative has been removed a long time ago 2016-08-31 10:25:06 +02:00
Jocelyn Turcotte edfd75949d Reduce the memory usage of the StopWatch during propagation
Use a QMap to avoid using a full hashtable for only a few entries, and
clear the QMap once we're done with the measuring. This saves a few
hundred bytes per job during propagation that would otherwise only be
freed at the end of the sync.
2016-06-17 19:20:53 +02:00
Jocelyn Turcotte 7fb134b4e0 Delete the ComputeChecksum object when the job is finished
Each object takes almost 1k and we don't need it once the propagation is
done.
2016-06-17 19:20:53 +02:00
Olivier Goffart 6dade0b114 PropagateUpload: fix crash in PUTFileJob::slotTimeout
Same fix as in commit 60c101d9

From the crash reporter:

Crash
EXCEPTION_ACCESS_VIOLATION_READ at 0x4
qnetworkreply.cpp in QNetworkReply::request at line 476
propagateupload.cpp in OCC::PUTFileJob::slotTimeout at line 100
moc_abstractnetworkjob.cpp in OCC::AbstractNetworkJob::qt_static_metacall at line 98
qobject.cpp in QMetaObject::activate at line 3716
moc_qtimer.cpp in QTimer::timeout at line 192
qtimer.cpp in QTimer::timerEvent at line 247
qobject.cpp in QObject::event at line 1267
qapplication.cpp in QApplicationPrivate::notify_helper at line 3722
qapplication.cpp in QApplication::notify at line 3505
qcoreapplication.cpp in QCoreApplication::notifyInternal at line 932
2016-06-15 14:32:25 +02:00
ckamm bf02ccc1e8 Remember to upload files that are locked during a sync run (#4865)
See owncloud/enterprise#1342
2016-05-23 09:03:03 +02:00
Olivier Goffart 03e3b3bf50 Upload: put the job in the active list while doing the checksum computation.
This fixes an issue in which too many jobs are started un parallel
while uploading many files, which could cause too much memory usage as the
chunks are stored in memory.

Probably the fix for #4611
2016-05-20 16:28:27 +02:00
Markus Goetz a038c99232 Upload: Remove bandwidth quota debug message #4837 2016-05-18 16:18:13 +02:00
Christian Kamm 09eea7f5f2 Checksums: Use the first supported type if nothing is preferred 2016-04-26 13:10:53 +02:00
Christian Kamm ea40e314d4 Add server capabilities for checksums #4638
* Add checksums/supportedTypes and checksums/preferredUploadType
  capabilities. The default is that no checksum types are supported.

* Remove the transmissionChecksum config option. Servers must now
  use the capabilities to indicate that they are fine with the
  client sending checksums.

Note: This intentionally breaks brandings that overrode
Theme::transmissionChecksum. The override must be removed and the
server's capabilities must be adjusted to include the new values.
2016-04-15 10:58:14 +02:00
Olivier Goffart 6ee7e82913 Handle setFileRecord errors #4632 2016-04-11 14:11:11 +02:00
ckamm 25baa995ec Merge pull request #4532 from ckamm/content-checksum
Enable content checksums #4375
2016-03-14 09:49:31 +01:00
Markus Goetz 266508b691 Merge pull request #4529 from owncloud/dynamic_parallelism_scaling
Propagator: Pump in more requests if we think current ones are quick
2016-03-02 15:23:58 +01:00
Markus Goetz d78c3679e7 Propagator: Pump in more requests if we think current ones are quick
Helps with small file sync #331
When I benchmarked this, it went up to 6 parallelism and
was about 1/3 faster than the previous fixed 3 parallelism.
Doing more than 6 is dangerous because QNAM limits to 6 TCP
connections and also the server might become a bottleneck.

Should also help for #4081
2016-03-02 15:22:21 +01:00
Christian Kamm 7ed7512f27 Checksums: Content checksums for all uploads #4375 2016-03-02 14:28:20 +01:00
Olivier Goffart e6f81d3965 Checksums: keep the transfer checksum in the database as the content checksum
Currently, we only use this for .eml files. But we can just store this checksum
in the database if it was computed anyway.

Issue #4487
2016-02-25 17:17:14 +01:00
Olivier Goffart d12c0939b9 Upload: Chunk size can be changed in the config file
Added a new "chunkSize" entry in the General group of the owncloud.cfg
which can be set to the size, in bytes, of the chunks.

This allow user with hude bandwidth to select more optimal chunk size

Issue #4354
2016-01-15 13:16:52 +01:00
Olivier Goffart bbedeed1c5 SyncEngine: For server older than 8.1, ignore invalid char in new directories
Server older than 8.1 cannot cope with invalid char in the filename
so we must not send them from the client. We were already checking
for new files, but not for renames or new directories.

https://github.com/owncloud/enterprise/issues/1009
2016-01-13 17:53:12 +01:00
Christian Kamm abf5a5ad1e Propagation: Fix dir <-> file changes propagating to server #4302
* Ensure every time a file becomes a directory or the other way around
  the item is flagged as INSTRUCTION_TYPE_CHANGE.
* Delete the badly-typed entity if necessary in the propagation jobs.
2016-01-08 05:38:08 +01:00
Christian Kamm adea301e5b Blacklist: Clear on successful chunk upload #3934 2015-11-24 10:09:55 +01:00
Christian Kamm 2458f07ca1 Checksums: Reuse the discovery checksum where possible 2015-11-23 14:13:10 +01:00
Christian Kamm 10db6cee6c Rename files 2015-11-23 12:09:25 +01:00
Christian Kamm a25f094c4c Checksums: Don't reupload if size and checksum are unchanged #3235
* Compute the content checksum (in addition to the optional
  transmission checksum) during upload (.eml files only)

* Add hook to compute and compare the checksum in csync_update

* Add content checksum to database, remove transmission checksum
2015-11-23 11:59:56 +01:00
Olivier Goffart 0020211857 owncloudcmd: Don't do a check that file are older than 2s (#4160)
This is required for the smashbox test to pass
2015-11-20 15:16:09 +01:00
Olivier Goffart 0fde7f0e6b Propagator: Keep a meaningfull error with old server and invalid file names
We changed the discovery code not to ignore files whose filename contains
charachter invalid on windows. (Because newer versions of the server
supports them)
Servers older than 8.1 will just say "Bad Request" as an error and it's a
regression against previous client version. So keep nice error even with
older server.

Relates to #3736
2015-10-29 12:44:08 +01:00
ckamm 251679253a Merge pull request #3951 from ckamm/checksum
Checksums stored in database #3735
2015-10-29 10:40:24 +01:00
Christian Kamm 496b1e907d Checksum: Don't lose it on metadata update #3735
Also improve tests.
2015-10-28 14:49:55 +01:00
Christian Kamm 566131209d Checksum: Fixes after review 2015-10-28 14:46:20 +01:00
Christian Kamm b7823dc648 Checksum: Put checksum type into separate column #3735 2015-10-28 14:46:20 +01:00
Markus Goetz a6c9e8c5b4 Merge branch 'kill_legacy_propagator' 2015-10-28 11:06:50 +01:00
Christian Kamm b9fc4c5994 Checksum: Fix recomputation when forced in cfg file #3735
Don't recompute the checksum on each upload when the server does not
advertise supporting checksums.
2015-10-28 09:56:39 +01:00
Christian Kamm f1b500d3e0 Checksum: Add env variables to disable #3735 2015-10-28 09:56:39 +01:00
Christian Kamm dff37e11eb Propagate: Store computed checksums in db during upload #3735 2015-10-28 09:56:39 +01:00
Christian Kamm 0354289795 Checksums: Improvement in async computation and validation #3735 2015-10-28 09:56:39 +01:00
Christian Kamm 7c5e70ac3c PropagateUpload: Fix double-emission of finished #3844 2015-10-28 09:53:54 +01:00
Markus Goetz c8590c4468 Remove legacy propagator and neon
The code was already uneeded/unbuilt on Windows and OS X.
2015-10-20 17:57:43 +02:00
Markus Goetz ccec186b98 ETagJob: Depth 0 for server >= 8.1 #3730 2015-10-19 15:31:27 +02:00
Olivier Goffart df135a0bb2 Merge branch '2.0'
Conflicts:
	src/gui/folder.cpp
2015-10-19 10:57:37 +02:00