|
142 | 142 | justification = "Allow catching super class Exception since it's tests") |
143 | 143 | public class TestMinioClient extends TestArgs { |
144 | 144 | private static final int MAX_DELETE_ATTEMPTS = 5; |
145 | | - // Matches the SDK's internal chunk size: MinioAsyncClient sets completed=true on the |
146 | | - // first chunk that returns errors, dropping remaining chunks in the same call. |
147 | | - private static final int DELETE_BATCH_SIZE = 1000; |
148 | 145 | private static final Set<String> TRANSIENT_DELETE_CODES = |
149 | 146 | Collections.unmodifiableSet( |
150 | 147 | new HashSet<>( |
@@ -1056,33 +1053,23 @@ public void removeObjects(String bucketName, List<ObjectWriteResponse> results) |
1056 | 1053 | } |
1057 | 1054 | } |
1058 | 1055 | anyTransient = false; |
1059 | | - IOException nonTransientErr = null; |
1060 | | - for (int i = 0; i < objects.size(); i += DELETE_BATCH_SIZE) { |
1061 | | - List<DeleteRequest.Object> chunk = |
1062 | | - objects.subList(i, Math.min(i + DELETE_BATCH_SIZE, objects.size())); |
1063 | | - for (Result<DeleteResult.Error> r : |
1064 | | - client.removeObjects( |
1065 | | - RemoveObjectsArgs.builder().bucket(bucketName).objects(chunk).build())) { |
1066 | | - DeleteResult.Error err = r.get(); |
1067 | | - String code = err.code(); |
1068 | | - if (!TRANSIENT_DELETE_CODES.contains(code)) { |
1069 | | - if (nonTransientErr == null) { |
1070 | | - nonTransientErr = |
1071 | | - new IOException( |
1072 | | - "non-transient delete error '" |
1073 | | - + code |
1074 | | - + "': " |
1075 | | - + err.message() |
1076 | | - + " on " |
1077 | | - + err.objectName() |
1078 | | - + " in bucket " |
1079 | | - + bucketName); |
1080 | | - } |
1081 | | - continue; // drain current chunk's response before throwing |
1082 | | - } |
1083 | | - anyTransient = true; |
| 1056 | + for (Result<DeleteResult.Error> r : |
| 1057 | + client.removeObjects( |
| 1058 | + RemoveObjectsArgs.builder().bucket(bucketName).objects(objects).build())) { |
| 1059 | + DeleteResult.Error err = r.get(); |
| 1060 | + String code = err.code(); |
| 1061 | + if (!TRANSIENT_DELETE_CODES.contains(code)) { |
| 1062 | + throw new IOException( |
| 1063 | + "non-transient delete error '" |
| 1064 | + + code |
| 1065 | + + "': " |
| 1066 | + + err.message() |
| 1067 | + + " on " |
| 1068 | + + err.objectName() |
| 1069 | + + " in bucket " |
| 1070 | + + bucketName); |
1084 | 1071 | } |
1085 | | - if (nonTransientErr != null) throw nonTransientErr; |
| 1072 | + anyTransient = true; |
1086 | 1073 | } |
1087 | 1074 | if (!anyTransient) break; |
1088 | 1075 | } |
|
0 commit comments