minio / mc

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

feat: support `mc mirror --remove alias1/ alias2/bucket/` or `mc mirror --remove alias2/bucket alias1/` #5069

Open jiuker opened 1 month ago

jiuker commented 1 month ago

Expected behavior

when do that command, mc will not compare bucket and delete bucket.

Actual behavior

will remove bucket

Steps to reproduce the behavior

mc.exe alias set source http://192.168.2.12:9000 minioadmin minioadmin
mc.exe mb source/sourcebucket01
mc.exe mb source/sourcebucket02
mc.exe cp issue.sh source/sourcebucket01/testfile01
mc.exe cp issue.sh source/sourcebucket01/testfile02
mc.exe cp issue.sh source/sourcebucket02/testfile03
mc.exe cp issue.sh source/sourcebucket02/testfile04
mc.exe ls -r source

mc.exe alias set target http://192.168.2.12:9001 minioadmin minioadmin

mc.exe mb target/targetbucket01

mc.exe mirror --watch --overwrite source target/targetbucket01
mc.exe ls -r target

mc.exe mb target/targetbucket02

mc.exe mirror --watch --overwrite --remove source target/targetbucket01  <---------- will delete `targetbucket01` here

mc --version

System information

zveinn commented 1 month ago

Are you sure it's not the scanner that's removing the empty bucket ? I remember having this happen to me a while back

klauspost commented 1 month ago

It shouldn't either way ;)

jiuker commented 1 month ago

Are you sure it's not the scanner that's removing the empty bucket ? I remember having this happen to me a while back

Yesh. Sure. Checked from code and reproduce it locally. @zveinn @klauspost