Skip to content

sync: add option to always skip hashsum check - #4856

Closed
zhucan wants to merge 1 commit into
rclone:masterfrom
zhucan:bugfix-4793
Closed

zhucan wants to merge 1 commit into
rclone:masterfrom
zhucan:bugfix-4793

Conversation

@zhucan

@zhucan zhucan commented Dec 10, 2020

Copy link
Copy Markdown
Contributor
Signed-off-by: zhuc <[email protected]>

What is the purpose of this change?

add option to always skip hashsum check

Was the change discussed in an issue or in the forum before?

#4793

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks OK, however docs are missing from docs/content/docs.md

What this flag does is

While syncing, if the size matches and the modtime is different then assume the files are equal without doing a checksum test. This then sets the modification time of the destination file unless --no-update-modtime

I have a problem with the name --no-checksum - it isn't descriptive enough for a flag which probably should never be used by the average user

I also have a problem working out why you would ever want this flag. If you set the flag then you are effectively matching sizes on the source and dest and if they are equal then you are setting the modification time on the dest. This is a really unreliable sync! So it has the worst parts of the --size-only sync.

I need a really good use case for this flag to go in the docs if it is to be merged.

@zhucan

zhucan commented Dec 11, 2020

Copy link
Copy Markdown
Contributor Author

I also have a problem working out why you would ever want this flag. If you set the flag then you are effectively matching sizes on the source and dest and if they are equal then you are setting the modification time on the dest. This is a really unreliable sync! So it has the worst parts of the --size-only sync.

I use the flag on rclone copy. I know if not check sum, it's really unreliable. But user know the source and dest are the same, only mtime is not same, It's no need to check sum. Because of more check sum operation will cause more read pressure on backend storage .

@ivandeex

ivandeex commented Feb 1, 2021

Copy link
Copy Markdown
Member

Remaining open items:

  • docs in docs/content/docs.md with technical details of what this flag does
  • name --no-checksum isn't descriptive enough, choose better name
  • add a real life use case in the docs (billions of files? petabytes of storage? the way you use rclone in your project? etc)

@zhucan

zhucan commented Feb 3, 2021

Copy link
Copy Markdown
Contributor Author

@ivandeex Is there better suggestion name for the flags? I thinks we can determine the name first and add docs to it.

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's think about what to call this...

Firstly exactly what does it do

While syncing, if the size matches and the modtime is different then assume the files are equal without doing a checksum test. This then sets the modification time of the destination file unless --no-update-modtime

This flag reminds me of --refresh-times which has the help

The --refresh-times flag can be used to update modification times of existing files when they are out of sync on backends which don't support hashes.

So maybe this flag should be called --refresh-times-ignore-checksum

Which would make its help something like

The --refresh-times-ignore-checksum flag can be used to update modification times of existing files when they are out of sync. It works like --refresh-times except it doesn't attempt to check checksums. Instead if the size only of the source and destination files match then it will update the modification time in the destination.

We could also possibly change the --refresh-times flag to do what this flag does. It emphasises in the help that --refresh-times should only be used on backends which don't support checksums, so all existing uses should have ht == hash.None always and --refresh-times is equivalent to --refresh-times-ignore-checksum.

        if !ci.NoCheckSum {
		// Check if the hashes are the same
		same, ht, _ := CheckHashes(ctx, src, dst)
		if !same {
			fs.Debugf(src, "%v differ", ht)
			return false
		}
		if ht == hash.None && !ci.RefreshTimes {
			// if couldn't check hash, return that they differ
			return false
		}
	}

So another possibility would be to move the check of ci.RefreshTimes into the place we hae ci.NoChecksum now.

This would mean then we only have just the one crazy --refresh-times flag.

Thoughts? @ivandeex ?

flags.StringArrayVarP(flagSet, &downloadHeaders, "header-download", "", nil, "Set HTTP header for download transactions")
flags.StringArrayVarP(flagSet, &headers, "header", "", nil, "Set HTTP header for all transactions")
flags.BoolVarP(flagSet, &ci.RefreshTimes, "refresh-times", "", ci.RefreshTimes, "Refresh the modtime of remote files.")
flags.BoolVarP(flagSet, &ci.LogSystemdSupport, "log-systemd", "", ci.LogSystemdSupport, "Activate systemd integration for the logger.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be a spurious addition here?

@zhucan

zhucan commented Feb 5, 2021

Copy link
Copy Markdown
Contributor Author

The --refresh-times-ignore-checksum flag can be used to update modification times of existing files when they are out of sync. It works like --refresh-times except it doesn't attempt to check checksums. Instead if the size only of the source and destination files match then it will update the modification time in the destination.

It's ok. Any other thoughts or suggestions?

@zhucan

zhucan commented Feb 5, 2021

Copy link
Copy Markdown
Contributor Author

The use cases: There is only "incremental write" in source backend, only the mtime of the file in source backend maybe modified, so we only need to check size or mtime, no need to checksum, if there are many files on the source backend, checksum will cause many pressure on source backend;This is customer's real case. @ncw

@ivandeex ivandeex linked an issue Feb 10, 2021 that may be closed by this pull request
@ivandeex

Copy link
Copy Markdown
Member

@ncw marking "regional" as I expect this thread to take long

@ivandeex ivandeex removed their assignment Feb 17, 2021
@ivandeex
ivandeex marked this pull request as draft February 17, 2021 19:27
@ivandeex

ivandeex commented Feb 17, 2021 •

Copy link
Copy Markdown
Member

I think we can determine the name first and add docs to it.

The problem here is that we don't understand what problem you are trying to solve and why you use the sequence of _if_s you use. Other people who use rclone will be happy to understand what this feature can do for them, too. Otherwise it's going to be your private flag, which is useless for others.

Is there better suggestion name for the flags?

As long as I don't have any insight, I will internally call this flag --zhucan-quirk3 (it's not the first, I expect there can be more)
Or just describe the sequence of _if_s --check-only-maybe-mtime-not-checksum

Or --refresh-times-ignore-checksum proposed by @ncw above

There is only "incremental write" in source backend, only the mtime of the file in source backend maybe modified, so we only need to check size or mtime, no need to checksum, if there are many files on the source backend, checksum will cause many pressure on source backend

This is actually a description of the sequence of conditional statements in the patch, not a use case. I'll try to shed some light again. Generally I can see that you do something large and exotic, bigdata or something like that.

"many" - What is amount of data? Several petabyte-size objects or millions of megabyte-size objects or what?
How do you measure "pressure"? Time to wait for I/O? Bandwidth? Else?
How much gain in your units of pressure does this patch give you?
Did you consider removing time check and update too?
You use "Ceph", I recall. Did you consider removing gateway?
If you use ceph over network, maybe you should use network cards with direct access to remove Linux kernel (if you use Linux) from access path?
Maybe rclone is wrong tool for your very specific project. Did you try other tools for your task? Maybe some very fast "Ceph Rados" management client?
Maybe writing a custom high-performance data cracker in pure C can solve your particular task?

Without answering at least some of these questions I don't understand how we can test this change or measure its success.
Waiting for your docs.

Last but not least - testing. You didn't write any unit test for your feature. Does the current integration test pass with this flag on, at least?

@ivandeex

ivandeex commented Feb 18, 2021 •

Copy link
Copy Markdown
Member

Copy-pasting here another attempt (from linked issue) by @ncw to understand what's going on in your testbed
(which wasn't answered either....)

Because of there is hundreds of millions of small files will cause great read pressure on storage, if we check hash. so we want to only check modtime and size under the condition that the customer can guarantee the consistency of md5.

Why do you have 100s of millions of files which has

  • size the same
  • modtime different

That isn't a usual situation. Are you trying to get the modtimes set on all the files that didn't have them set before?

What you want is a flag which says "if mod times are the same then don't check the checksum, transfer anyway".
I looked to see if rsync has a flag which does this - it doesn't!

(See my question above about other tools you've tried to resolve your unspoken task.....)

That thread had more proposals from @ncw for the flag name

So we could make a flag called --no-checksum-if-same-age

Another idea would be to only do the checksum calculation if we are not using --no-update-modtime but that would mean that if you had --no-update-modtime=true then rclone would transfer identical files which is undesirable.

Bottomline:

It's ok. Any other thoughts or suggestions?

Yes, plenty of thoughts, request for docs and four suggestions for flag name.

@ivandeex

Copy link
Copy Markdown
Member

@zhucan ping

@ivandeex

ivandeex commented Apr 13, 2021 •

Copy link
Copy Markdown
Member

@zhucan
Probably you could write an automatic unit test or describe below a manual test that presents your use case and demonstrates performance improvement introduced by your patch. It does not have to involve bulk or production data. If it shows e.g. 1sec (or N-better "pressure") improvement on average with a test dataset, that would give us input for extrapolation.
Thank you

@zhucan

zhucan commented Apr 14, 2021

Copy link
Copy Markdown
Contributor Author

@zhucan
Probably you could write an automatic unit test or describe below a manual test that presents your use case and demonstrates performance improvement introduced by your patch. It does not have to involve bulk or production data. If it shows e.g. 1sec (or N-better "pressure") improvement on average with a test dataset, that would give us input for extrapolation.
Thank you

I'm sorry, now, I have no time to do this, I will do it out of day

@ivandeex ivandeex mentioned this pull request May 18, 2021
38 tasks done
@ivandeex

Copy link
Copy Markdown
Member

This pull request is nearly abandoned.
Open questions are waiting for resolution since 2021-02-17, ~4 months.
It can become eligible for closing after ~6 months of radio silence!
cc @ncw @zhucan

@ivandeex

Copy link
Copy Markdown
Member

This PR is abandoned by author and waits for volunteers.
cc @ncw @zhucan

@ivandeex

Copy link
Copy Markdown
Member

Closing as abandoned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sync: add option to always skip hashsum check

3 participants