minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.89k stars 553 forks source link

Return delete markers in mc find #5083

Closed allanrogerr closed 1 week ago

allanrogerr commented 2 weeks ago

Community Contribution License

All community contributions in this pull request are licensed to the project maintainers under the terms of the Apache 2 license. By creating this pull request I represent that I have the right to license the contributions to the project maintainers under the Apache 2 license.

Description

Default to list delete flags if they are part of the result set, so that they are not hidden from the find function

Motivation and Context

The default behaviour of mc find is to not return delete flags. However, for example in the case of ILM, this makes it difficult to detect if there are delete marker candidates for processing, even when the versions flag is specified.

How to test this PR?

Run mc find --versions on a specific bucket where delete markers are known to be present. These delete markers should be part of the result set. e.g.

➜  mc git:(find-versions) ./mc find --smaller 1B local/find --json --versions                     
{
 "status": "success",
 "type": "",
 "lastModified": "2024-11-19T06:35:14.294-04:00",
 "size": 0,
 "key": "local/find/pics/47110640341_df7a79b41b_o.jpg",
 "etag": "",
 "versionId": "3ad022fa-230a-4bbd-86cf-b4dd12a3f4b0"
}
➜  mc git:(find-versions) ./mc find --smaller 1B local/find --json           
➜  mc git:(find-versions) 

Types of changes

Checklist:

klauspost commented 2 weeks ago

Wouldn't this change existing behavior? Maybe do a --with-dm flag?

allanrogerr commented 2 weeks ago

Wouldn't this change existing behavior? Maybe do a --with-dm flag?

It would however @vadmeste opinion was that although it may break in some rare corner cases in the community, it is better than adding a new flag. Your thoughts @klauspost ?

klauspost commented 2 weeks ago

I see potential scripts breaking... And weird stuff people use it for breaking in strange ways... So personally uncomfortable changing it.

allanrogerr commented 2 weeks ago

I see potential scripts breaking... And weird stuff people use it for breaking in strange ways... So personally uncomfortable changing it.

Let me take a closer look.

allanrogerr commented 1 week ago

Simplified the implementation by enabling delete marker listing when using --versions