Skip to content
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

Merged
merged 1 commit into from Sep 12, 2020

Conversation

harshavardhana
Copy link
Member

No description provided.

Copy link
Collaborator

@ebozduman ebozduman left a 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})
 }

@harshavardhana
Copy link
Member Author

Yes looks like a regression introduced in versioning changes

@harshavardhana
Copy link
Member Author

This is fixed @ebozduman

Copy link
Collaborator

@kannappanr kannappanr left a comment

Choose a reason for hiding this comment

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

LGTM

@ebozduman

This comment has been minimized.

@harshavardhana
Copy link
Member Author

@ebozduman resolved this fully.

cmd/difference.go Show resolved Hide resolved
Copy link
Collaborator

@ebozduman ebozduman left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants