From c014b2e66bb75730891548fb701aa51e3334f6dd Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Wed, 7 Aug 2019 16:40:26 +0100 Subject: [PATCH] rcat: fix slowdown on systems with multiple hashes Before this fix rclone calculated all the hashes on transfer. This was particularly slow for the local backend. After the fix we just calculate one hash which is enough for data integrity. --- fs/operations/operations.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/operations/operations.go b/fs/operations/operations.go index ad5d20b0a..81c723174 100644 --- a/fs/operations/operations.go +++ b/fs/operations/operations.go @@ -1222,8 +1222,9 @@ func Rcat(ctx context.Context, fdst fs.Fs, dstFileName string, in io.ReadCloser, }() in = tr.Account(in).WithBuffer() - hashOption := &fs.HashesOption{Hashes: fdst.Hashes()} - hash, err := hash.NewMultiHasherTypes(fdst.Hashes()) + hashes := hash.NewHashSet(fdst.Hashes().GetOne()) // just pick one hash + hashOption := &fs.HashesOption{Hashes: hashes} + hash, err := hash.NewMultiHasherTypes(hashes) if err != nil { return nil, err }