-
Notifications
You must be signed in to change notification settings - Fork 670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replicate: Send source modtime in time nano format #1428
Conversation
If we already have a time with nano precision, let's send it the server.
This would require server changes as well to parse with RFC3339Nano |
git diff
diff --git a/cmd/bucket-replication.go b/cmd/bucket-replication.go
index a5071df94..fef2e0d0e 100644
--- a/cmd/bucket-replication.go
+++ b/cmd/bucket-replication.go
@@ -287,7 +287,7 @@ func getCopyObjMetadata(oi ObjectInfo, dest replication.Destination) map[string]
if oi.UserTags != "" {
meta[xhttp.AmzObjectTagging] = oi.UserTags
}
- meta[xhttp.MinIOSourceMTime] = oi.ModTime.Format(time.RFC3339)
+ meta[xhttp.MinIOSourceMTime] = oi.ModTime.Format(time.RFC3339Nano)
meta[xhttp.MinIOSourceETag] = oi.ETag
meta[xhttp.AmzBucketReplicationStatus] = replication.Replica.String()
return meta
@@ -330,7 +330,7 @@ func putReplicationOpts(ctx context.Context, dest replication.Destination, objIn
putOpts.Mode = rmode
}
if retainDateStr, ok := objInfo.UserDefined[xhttp.AmzObjectLockRetainUntilDate]; ok {
- rdate, err := time.Parse(time.RFC3339, retainDateStr)
+ rdate, err := time.Parse(time.RFC3339Nano, retainDateStr)
if err != nil {
return
}
diff --git a/cmd/object-api-options.go b/cmd/object-api-options.go
index a89c004c5..a793e331b 100644
--- a/cmd/object-api-options.go
+++ b/cmd/object-api-options.go
@@ -187,7 +187,7 @@ func delOpts(ctx context.Context, r *http.Request, bucket, object string) (opts
mtime := strings.TrimSpace(r.Header.Get(xhttp.MinIOSourceMTime))
if mtime != "" {
- opts.MTime, err = time.Parse(time.RFC3339, mtime)
+ opts.MTime, err = time.Parse(time.RFC3339Nano, mtime)
if err != nil {
return opts, InvalidArgument{
Bucket: bucket, |
You don't have to do that, as per I tested, you can parse a string nano time with RFC3339 alone without losing any information. |
I would double test it once @vadmeste RFC3339 specifically skils nanosecond precision so if we are saving this information on disk if we need it we should make sure we have it. |
Oh yes, I didn't see that part. What I wanted to say is that RFC3339 can parse a date/time with nano precision, will send a PR. |
If we already have a time with nano precision, let's send it the server.
The purpose of this PR is to fix minio/mc#3532