Commit Graph

127 Commits

Author SHA1 Message Date
Olivier Goffart
303922b80f Move: add more test and fix move within moves 2019-01-22 08:14:12 +01:00
Olivier Goffart
a4990c0a85 Rename: fix renamed folder moved into renamed folder issue
Issue #6694
2019-01-22 08:14:12 +01:00
Christian Kamm
55eda59d05 Discovery: Ensure selective sync lists are sorted #6958 2019-01-18 11:00:13 +01:00
Christian Kamm
df1723c9b2 vfs: Remove newFilesAreVirtual - use root PinState instead
This unifies how to deal with pin states.

Also enable reading a folders direct pin state vs its effective pin
state.
2019-01-07 10:09:03 +01:00
Christian Kamm
18ab3f5dcd vfs: Separate vfs availability from new-files-virtual
This helps support 2.5 settings where there are virtual files in the
tree but new files aren't created virtual.

It's also a prelude for #6815

There's currently no way of
- upgrading vfs plugins (a silent suffix->winvfs upgrade is attempted
  once only, when moving to master)
- disabling vfs capabilities outright
2018-11-26 13:02:48 +01:00
Christian Kamm
4f56366fd5 vfs: Ensure SyncOptions::_vfs is never null
- Create a VfsOff derived class
- Make it a shared pointer shared with Folder::_vfs
2018-11-26 13:02:48 +01:00
Christian Kamm
6cb071da47 Generalize Result<> class, add Optional<>
To make it nicer to use outside of HTTP results.
2018-11-26 13:02:48 +01:00
Christian Kamm
0c86181013 Fix big-folder detection when vfs is disabled 2018-11-26 12:59:51 +01:00
Christian Kamm
06928a4037 winvfs: initial work
Done by ckamm and dschmidt
2018-11-26 12:53:30 +01:00
Olivier Goffart
a699903122 Merge remote-tracking branch 'origin/master' into new_discovery_algo
Conflicts:
	src/libsync/discoveryphase.cpp
2018-10-31 16:29:29 +01:00
Olivier Goffart
8aee6426af Merge remote-tracking branch 'origin/2.5' 2018-10-31 16:26:45 +01:00
Christian Kamm
7a4792b349 Errors: Include path in discovery error message #6826 2018-10-29 19:56:07 +01:00
Olivier Goffart
4d97480809 Discovery phase: refactor some code in DiscoveryPhase::findAndCancelDeletedJob
Less code duplication
2018-10-16 13:03:24 +02:00
Olivier Goffart
a6e58a1ff0 New Discovery Algorithm: more cleanups
- rename progress() to be more explicit
 - Make some more member of the discovery phase private
2018-10-16 11:04:07 +02:00
Olivier Goffart
91f3af4c12 Fixup commit 835c916337
The previous code considered the also HTTP 207 code without the
application/xml header to have this message.
httpCode 0 does not make much sense anyway.

This change the behavior to consider any 2xx without the xml header
to show this error message
2018-10-15 18:59:23 +02:00
Olivier Goffart
2df0fd936a New discovery algorithm: fixups
Adapt reviews from ckamm in https://github.com/owncloud/client/pull/6738#pullrequestreview-164623532

- SyncJournalFileRecord: initialize everything inline
- Add more comments
- And some ENFORCE
2018-10-15 18:59:09 +02:00
Olivier Goffart
84c871c087 New discovery algorithm: Parallel PROPFIND 2018-10-12 14:46:46 +02:00
Olivier Goffart
442a0e486f New Propagation algorithm: Fetch, and emit, the root etag
Remove the feature to concatenate etags as servers that don't
have a root etag are no longer suported
2018-10-09 15:12:02 +02:00
Olivier Goffart
d29a05aea5 New Discovery Algorithm: Ge tthe size of new folders
Also add a test that this works properly
2018-10-09 14:39:23 +02:00
Olivier Goffart
28f1c95b96 Merge remote-tracking branch 'origin/master' into new_discovery_algo
Conflicts:
	src/csync/csync_reconcile.cpp
	src/csync/csync_update.cpp
	src/libsync/syncengine.cpp
	src/libsync/syncengine.h

Note: csync changes from 5e442f588e
are not included and will be fixed separately
2018-10-04 11:23:19 +02:00
Olivier Goffart
9f56db67ef Delta-Sync: Fix test TestRemoteDiscovery::testRemoteDiscoveryError(MissingPermissions)
The presence of a zsync meta data file should not prevent the client
from detecting missing permissions
2018-09-14 16:13:15 +02:00
Olivier Goffart
0290564d5c Merge remote-tracking branch 'owncloud/master' into delta-sync
Conflicts:
	.gitmodules
	src/cmd/cmd.cpp
	src/gui/generalsettings.ui
	src/libsync/propagatedownload.cpp
	src/libsync/propagateuploadng.cpp
2018-09-14 15:25:59 +02:00
Olivier Goffart
7209fd27a0 Virtual files: don't check for new big folders
https://github.com/owncloud/client/issues/6724#issuecomment-417368475
2018-08-31 16:40:27 +02:00
Olivier Goffart
597c28f316 Merge remote-tracking branch 'master' into new_discovery_algo 2018-08-21 11:22:38 +02:00
Christian Kamm
c8ecbc30ed RemotePermissions: Fix empty vs null
Fixes two bugs that appeared since the introduction of the struct:
- when reading permissions from the journal, null ("") was read as
  empty-not-null
- when reading permissinos from the server, empty ("") was read as null

Addresses #4608
2018-08-16 09:08:17 +02:00
Olivier Goffart
58d6632eaf Data-Fingerprint: Fix backup detection when fingerprint is empty
Add a test to test the data fingerprint feature make me realize it was broken.
The code was relying in the distinction between empty and null QByteArray,
but this was a bad idea as this difference is lost when going through QString.
2018-08-14 10:57:20 +02:00
Olivier Goffart
b6db624198 New discovery algorithm: Call FolderDiscovered 2018-08-06 12:53:51 +02:00
Olivier Goffart
2e82518516 New Discovery algorithm: Refactor a bit the way the signal are emited 2018-08-06 12:41:59 +02:00
Olivier Goffart
926c27a73d New Discovery Phase: fix a few FIXME
Some FIXME were already fixed.
2018-08-06 11:30:21 +02:00
Olivier Goffart
3d9ab56453 New discovery phase: read the direct download URL and Cookie 2018-07-26 13:55:13 +02:00
Olivier Goffart
eb669c997e More cleanup of csync remains 2018-07-26 13:55:02 +02:00
Olivier Goffart
04da4365f9 Remove csync_update and csync_reconcile
I guess some other csync utilities can also be remove dnow but
that will be for later
2018-07-25 16:00:16 +02:00
Olivier Goffart
835c916337 New Discovery Algorithm: handle server errors 2018-07-25 15:24:30 +02:00
Christian Kamm
597d76137b Do not require server replies to contain an mtime
The check was added for #6317 in commit
13eb64584f.

We did see missing mtimes in replies in tests with live servers though.
Possibly those were old incomplete responses cached in the stat cache?
2018-07-25 14:24:35 +02:00
Olivier Goffart
1df50836ca New Discovery algorithm: Handle of move within a moved directory 2018-07-16 16:38:24 +02:00
Olivier Goffart
9bbd807571 New discovery algo
Make TestSyncEngine::testSelectiveSyncBug pass
2018-07-10 15:05:01 +02:00
Olivier Goffart
888f2aae2f csync: refactor csync_s::error_string to avoid valgrind error
The problem here is that we were sometimes allocating the error_string with
qstrdup, which need to be released with delete[] and not free().

Simplify the code by using QString instead.

```
==7230== Mismatched free() / delete / delete []
==7230==    at 0x4C2E10B: free (vg_replace_malloc.c:530)
==7230==    by 0x57C2321: csync_s::reinitialize() (csync.cpp:247)
==7230==    by 0x548130F: OCC::SyncEngine::finalize(bool) (syncengine.cpp:1212)
==7230==    by 0x5481223: OCC::SyncEngine::handleSyncError(csync_s*, char const*) (syncengine.cpp:746)
==7230==    by 0x5483E78: OCC::SyncEngine::slotDiscoveryJobFinished(int) (syncengine.cpp:965)
==7230==    by 0x5495E34: QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<int>, void, void (OCC::SyncEngine::*)(int)>::call(void (OCC::SyncEngine::*)(int), OCC::SyncEngine*, void**) (qobjectdefs_impl.h:134)
==7230==    by 0x5495D92: void QtPrivate::FunctionPointer<void (OCC::SyncEngine::*)(int)>::call<QtPrivate::List<int>, void>(void (OCC::SyncEngine::*)(int), OCC::SyncEngine*, void**) (qobjectdefs_impl.h:167)
==7230==    by 0x5495CB5: QtPrivate::QSlotObject<void (OCC::SyncEngine::*)(int), QtPrivate::List<int>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobjectdefs_impl.h:396)
==7230==    by 0xA9BF2E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x64BE983: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0x64C625A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0xA994BC8: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==  Address 0x225b2640 is 0 bytes inside a block of size 50 alloc'd
==7230==    at 0x4C2DC6F: operator new[](unsigned long) (vg_replace_malloc.c:423)
==7230==    by 0xA7E8FC8: qstrdup(char const*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x53F5750: OCC::DiscoveryJob::remote_vio_opendir_hook(char const*, void*) (discoveryphase.cpp:666)
==7230==    by 0x57E1278: csync_vio_opendir(csync_s*, char const*) (csync_vio.cpp:39)
==7230==    by 0x57D718F: csync_ftw(csync_s*, char const*, int (*)(csync_s*, std::unique_ptr<csync_file_stat_s, std::default_delete<csync_file_stat_s> >), unsigned int) (csync_update.cpp:674)
==7230==    by 0x57C1B05: csync_update(csync_s*) (csync.cpp:109)
==7230==    by 0x53F5BCC: OCC::DiscoveryJob::start() (discoveryphase.cpp:718)
==7230==    by 0x54B8F74: OCC::DiscoveryJob::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_discoveryphase.cpp:494)
==7230==    by 0xA9BF2E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==    by 0x64BE983: QApplicationPrivate::notify_helper(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0x64C625A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libQt5Widgets.so.5.11.0)
==7230==    by 0xA994BC8: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.11.0)
==7230==
```
2018-06-04 08:57:24 +02:00
Olivier Goffart
b6aaa6fd2b CSync: Remove unused error codes
None of the removed ERRNO code were ever set.
So none of the removed error hapenned anymore
2018-03-14 10:25:45 +01:00
Christian Kamm
a5aebac6a7 slotFolderDiscovered: Fix 'local' always being false
It was unused, so no harm done.
2018-03-06 13:02:54 +01:00
Christian Kamm
13eb64584f Discovery: Error if properties are missing #6317 2018-03-06 13:01:53 +01:00
Christian Kamm
110ce283d8 Merge remote-tracking branch 'ahmedammar/master' into delta-sync 2018-01-30 11:16:45 +01:00
Ahmed Ammar
12aeb890c9 Implementation of delta-sync support on client-side.
This commit adds client-side support for delta-sync, this adds a new
3rdparty submodule `gh:ahmedammar/zsync`. This zsync tree is a modified
version of upstream, adding some needed support for the upload path and
other requirements.

If the server does not announce the required zsync capability then a
full upload/download is fallen back to. Delta synchronization can be
enabled/disabled using command line, config, or gui options.

On both upload and download paths, a check is made for the existance of
a zsync metadata file on the server for a given path. This is provided
by a dav property called `zsync`, found during discovery phase. If it
doesn't exist the code reverts back to a complete upload or download,
i.e. previous implementations. In the case of upload, a new zsync
metadata file will be uploaded as part of the chunked upload and future
synchronizations will be delta-sync capable.

Chunked uploads no longer use sequential file names for each chunk id,
instead, they are named as the byte offset into the remote file, this is
a minimally intrusive modification to allow fo delta-sync and legacy
code paths to run seamlessly. A new http header OC-Total-File-Length is
sent, which informs the server of the final expected size of the file
not just the total transmitted bytes as reported by OC-Total-Length.

The seeding and generation of the zsync metadata file is done in a
separate thread since this is a cpu intensive task, ensuring main thread
is not blocked.

This commit closes owncloud/client#179.
2018-01-15 10:34:57 -05:00
Olivier Goffart
3ddd4b6f16 Get rid of csync_log
We use Qt's debugging code everywhere
2018-01-13 13:58:17 +01:00
Olivier Goffart
257d8142b1 Build system: Get rid of QtVersionAbstraction.cmake
Use modern cmake with target_link_libraries and Qt5:: that
automatically add the include path and compile flags
2018-01-13 13:58:17 +01:00
Christian Kamm
8eebc53728 Unify item type enum
Previously, there was csync_ftw_type_e and SyncFileItem::Type. Having
two enums lead to a bug where Type::Unknown == Type::File that went
unnoticed for a good while.

This patch keeps only a single enum.
2017-12-15 18:02:04 +01:00
Christian Kamm
7ab127ad53 Excludes: Refactor for pending improvements
Make ExcludedFiles something that is instantiated outside of
the CSYNC context and then given to it as a hook.

ExcludedFiles still lives in csync_exclude and the internal
workings haven't been touched.
2017-12-07 14:38:21 +01:00
Christian Kamm
ceac18c554 Reconcile: Rename maps are consistent with update phase #6212
For duplicate file ids the update phase and reconcile phase determined
the rename mappings independently. If they disagreed (due to different
order of processing), complicated misbehavior would result.

This patch fixes it by letting reconcile try to use the mapping that the
update phase has computed first.
2017-12-06 16:42:11 +01:00
Olivier Goffart
480932a58a Checksum: Ignore unkown OC-Checksum header when downloading...
And if there are several checksums, pick the "best" one.

The case of several checksum was reported in
https://github.com/nextcloud/client_theming/issues/213
2017-11-20 10:51:15 +01:00
Markus Goetz
3a1a56c7ad Excludes: During directory traversal, use QRegularExpression
On Mac, this halves the time spent in csync_excluded_traversal
when using check_csync_excluded_performance. A similar performance
increase is seen on linux.
2017-10-05 10:19:48 +02:00
Olivier Goffart
95d23b1914 RemotePermissions: Store in a class rather than in a QByteArray to save memory
Create a specific type that parses the permissions so we can store
it in a short rather than in a QByteArray

Note: in RemotePermissions::toString, we make sure the string is not
empty by adding a space, this was already existing before commit
e8f7adc7ca where it was removed by mistake.
2017-09-22 09:29:08 +02:00