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
re-implement metadata handling to preserve nanosecs as well #3402
Conversation
0bf7a1b
to
995b946
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found an issue during mc mirror -a <local-dir> <minio-bucket>
command in case the destination already has the same object with the same size as source, but older modification time than the source. The expectation is to still mirror/copy the object, but it doesn't.
Here are the reproduction steps:
1. mkdir tmp tmp1
2. echo "this is some random content" > tmp/content.txt
3. mc mb myminio/dst
4. mc mirror -a tmp/ myminio/dst/
5. echo "this is SOME rand0m c0ntent" > tmp1/content.txt
6. mc mirror -a tmp1/ myminio/dst/
and here is the fix for it:
$ git diff cmd/client-s3.go
diff --git a/cmd/client-s3.go b/cmd/client-s3.go
index a4d9ffb51..180375f50 100644
--- a/cmd/client-s3.go
+++ b/cmd/client-s3.go
@@ -1331,7 +1331,7 @@ func (c *S3Client) SetAccess(ctx context.Context, bucketPolicy string, isJSON bo
}
// listObjectWrapper - select ObjectList mode depending on arguments
-func (c *S3Client) listObjectWrapper(ctx context.Context, bucket, object string, isRecursive bool, timeRef time.Time, withVersions, withDeleteMarkers bool, metadata bool) <-chan minio.ObjectInfo {
+func (c *S3Client) listObjectWrapper(ctx context.Context, bucket, object string, isRecursive bool, timeRef time.Time, withVersions, withDeleteMarkers, metadata bool) <-chan minio.ObjectInfo {
if !timeRef.IsZero() || withVersions {
return c.listVersions(ctx, bucket, object, isRecursive, timeRef, withVersions, withDeleteMarkers)
}
@@ -1342,7 +1342,7 @@ func (c *S3Client) listObjectWrapper(ctx context.Context, bucket, object string,
return c.api.ListObjects(ctx, bucket, minio.ListObjectsOptions{Prefix: object, Recursive: isRecursive, UseV1: true})
}
if metadata {
- return c.api.ListObjects(ctx, bucket, minio.ListObjectsOptions{Prefix: object, Recursive: isRecursive})
+ return c.api.ListObjects(ctx, bucket, minio.ListObjectsOptions{WithMetadata: true, Prefix: object, Recursive: isRecursive})
}
return c.api.ListObjects(ctx, bucket, minio.ListObjectsOptions{Prefix: object, Recursive: isRecursive})
}
Yes looks like a regression introduced in versioning changes |
995b946
to
337f5f8
Compare
This is fixed @ebozduman |
337f5f8
to
6d6a5af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This comment has been minimized.
This comment has been minimized.
6d6a5af
to
0dfc711
Compare
@ebozduman resolved this fully. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.