rclone/backend/sftp
Nick Craig-Wood 0537791d14 sftp: Fix performance regression by re-enabling concurrent writes #5197
Betweeen rclone v1.54 and v1.55 there was an approx 3x performance
regression when transferring to distant SFTP servers (in particular
rsync.net).

This turned out to be due to the library github.com/pkg/sftp rclone
uses. Concurrent writes used to be enabled in this library by default
(for v1.12.0 as used in rclone v1.54) but they are no longer enabled
(for v1.13.0 as used in rclone v1.55) for safety reasons and it is
necessary to enable them specifically.

The safety concerns are due to the uncertainty as to whether writes
come in order and whether a half completed file might have holes in
it. This isn't a problem for rclone since a) it doesn't restart
uploads and b) it has a post-transfer checksum test.

This change introduces a new flag `--sftp-disable-concurrent-writes`
to control the feature which defaults to false, meaning that
concurrent writes are enabled as in v1.54.

However this isn't quite enough to fix the problem as the sftp library
needs to be able to sniff the size of the stream from the reader
passed in, so this also adds a `Size` interface to the reader to
enable this. This involved a patch to the library.

The library was reverted to v1.12.0 for v1.55.1 - this patch installs
v1.13.0+master to fix the Size interface problem.

See: https://github.com/pkg/sftp/issues/426
2021-04-26 09:24:28 +01:00
..
sftp_internal_test.go sftp: add About support - fixes #3107 2019-04-25 10:51:15 +01:00
sftp_test.go build: implement a framework for starting test servers during tests 2020-01-18 16:47:37 +00:00
sftp_unsupported.go build: drop support for go1.8 2019-04-15 21:49:58 +01:00
sftp.go sftp: Fix performance regression by re-enabling concurrent writes #5197 2021-04-26 09:24:28 +01:00
stringlock_test.go build: drop support for go1.8 2019-04-15 21:49:58 +01:00
stringlock.go build: drop support for go1.8 2019-04-15 21:49:58 +01:00