Commit 14bcc29
fix(retry): address bala review batch on PR #1701 review 4250022733
Five reviewer threads addressed plus a WHY-only comment trim across the
touched files. Each thread is mapped to the reviewer's discussion ID and
verified locally against :api:check / :api:javadoc / a production-cluster
repro on the local mint-erasure compose.
r3205524097 / r3206746125 ("we should not wrap")
- BaseS3Client.java: drop wrapWithRetry() and the matching call sites in
both ctors. Caller-supplied OkHttpClient is now used verbatim — no
newBuilder(), no interceptor strip-and-add, no retryOnConnectionFailure
override — per bala's principle that the user's client is the user's
client. Field/Javadoc updates to setMaxRetries, executeAsync, the
copy-ctor, and the maxRetries field reflect the new contract.
- Http.java: add newDefaultClient(IntSupplier) overload so the SDK-default
client can have its retry budget bound to BaseS3Client.maxRetries via a
supplier. The no-arg form delegates with () -> Retry.MAX_RETRY for
backward compatibility (MinioAdminClient, functional/TestArgs).
- MinioAsyncClient.java: Builder.build() constructs the client first, then
assigns httpClient via the supplier-bound newDefaultClient when the
caller didn't supply one. Builder.httpClient(...) and Builder.maxRetries
Javadocs spell out the new caller-supplied-client contract.
- RetryTest.java: replace testUserSuppliedClientStillRetries (which
exercised the now-gone wrap behaviour) with two contract tests:
testUserSuppliedClientWithoutInterceptorDoesNotRetry and
testUserSuppliedClientWithInterceptorRetries.
r3205557447 (thread-safety on this.httpClient reassignment)
- BaseS3Client.java:114: protected OkHttpClient httpClient ->
protected volatile OkHttpClient httpClient. Matches the precedent of
volatile int maxRetries on the same class. Provides JMM happens-before
between writers (setTimeout / ignoreCertCheck reassigning the field)
and readers (executeAsync). The local-snapshot pattern bala originally
proposed does not solve the visibility problem; the field qualifier
does. The "no two timeouts mid-call" property bala raised separately
is already guaranteed by OkHttp Call binding (a Call captures its
OkHttpClient at newCall time and the chain reuses it for retries).
r3205580978 ("createBody save/restore not needed")
- Checksum.java: rewrite the RandomAccessFile branch of update() to use
positional FileChannel.read(ByteBuffer, long) so the method no longer
mutates the file pointer. Side-effect-free helper now; callers don't
need to bracket with getFilePointer / seek.
- BaseS3Client.java: drop the createBody fileStartPos capture and the
matching seek-back. Empirically verified on a live MinIO erasure
cluster: client.putObject(PutObjectAPIArgs) with a RandomAccessFile
body and no pre-set checksum headers now completes successfully (the
prior incorrect "remove these lines" world fails with EOFException
because Http.RequestBody captures the post-checksum EOF position).
- MinioAsyncClient.java: drop the two cousin save/restore patterns
around Checksum.update at lines ~2010 and ~3560 — both are now
redundant for the same reason.
r3205604391 ("don't probe S3 error codes")
- Retry.java: drop RETRYABLE_S3_CODES (12-element set) and
isS3CodeRetryable(String). Class is now narrower: HTTP status set,
IOException classifier, and full-jitter backoff formula. minio-go-
parity comment removed since the SDK no longer mirrors that list.
- Http.java: drop MAX_PEEK_BYTES, S3_ERROR_CODE_PATTERN, the
peekS3ErrorCode helper, and the body-probing branch in
RetryInterceptor.intercept. RetryInterceptor Javadoc updated to drop
the S3-code bullet from "Retries on:". Unused
java.util.regex.Pattern import removed (Matcher is still used
elsewhere in the file).
- RetryTest.java: drop testIsS3CodeRetryable_retryable,
testIsS3CodeRetryable_notRetryable, and the integration test
testRetryOnRetryableS3CodeIn400Body. 28 RetryTest cases remain,
all PASS.
r3206792852 ("we already have RANDOM")
- MinioAsyncClient.java:96, 3382: drop the
java.util.concurrent.ThreadLocalRandom import and swap
ThreadLocalRandom.current() for the inherited
BaseS3Client.RANDOM at the fan-out object-name suffix site. The
ThreadLocalRandom usage in Retry.exponentialBackoffMs is a
separate, hot-path concern (added in 60aeaed to address Copilot
review 3191258329 about RANDOM contention); bala did not flag it
and it remains.
Comment trim
- WHY-only comments across the six files: removed restatements of
what the code does, kept only non-obvious rationale (order
constraints, cross-class contracts, gotchas). Javadocs trimmed to
the user-facing contract; mechanics moved out.
Validated on Java 17:
- :api:check (compile + spotless + spotbugs + 28 RetryTest cases) PASS
- :api:javadoc PASS
- Live mint-erasure compose cluster + ReproUploadObject driving the
no-pre-set-checksum-headers PUT path: PASS
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 9a5c8e4 commit 14bcc29
6 files changed
Lines changed: 124 additions & 227 deletions
File tree
- api/src
- main/java/io/minio
- test/java/io/minio
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
| 118 | + | |
| 119 | + | |
122 | 120 | | |
123 | 121 | | |
124 | 122 | | |
| |||
127 | 125 | | |
128 | 126 | | |
129 | 127 | | |
130 | | - | |
| 128 | + | |
131 | 129 | | |
132 | 130 | | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
| 140 | + | |
159 | 141 | | |
160 | 142 | | |
161 | 143 | | |
162 | 144 | | |
163 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
164 | 149 | | |
165 | 150 | | |
166 | 151 | | |
| |||
315 | 300 | | |
316 | 301 | | |
317 | 302 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
| 303 | + | |
| 304 | + | |
323 | 305 | | |
324 | 306 | | |
325 | 307 | | |
| |||
1269 | 1251 | | |
1270 | 1252 | | |
1271 | 1253 | | |
1272 | | - | |
1273 | | - | |
1274 | | - | |
1275 | | - | |
1276 | | - | |
1277 | | - | |
1278 | | - | |
1279 | | - | |
1280 | | - | |
1281 | 1254 | | |
1282 | 1255 | | |
1283 | 1256 | | |
| |||
1333 | 1306 | | |
1334 | 1307 | | |
1335 | 1308 | | |
1336 | | - | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
1342 | | - | |
1343 | | - | |
1344 | 1309 | | |
1345 | 1310 | | |
1346 | 1311 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
107 | 120 | | |
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
111 | 124 | | |
112 | | - | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
113 | 132 | | |
114 | 133 | | |
115 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| |||
612 | 611 | | |
613 | 612 | | |
614 | 613 | | |
615 | | - | |
616 | | - | |
| 614 | + | |
| 615 | + | |
617 | 616 | | |
618 | 617 | | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
619 | 626 | | |
620 | 627 | | |
621 | 628 | | |
| |||
624 | 631 | | |
625 | 632 | | |
626 | 633 | | |
627 | | - | |
| 634 | + | |
628 | 635 | | |
629 | 636 | | |
630 | 637 | | |
| |||
691 | 698 | | |
692 | 699 | | |
693 | 700 | | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
698 | 706 | | |
699 | 707 | | |
700 | 708 | | |
701 | 709 | | |
702 | 710 | | |
703 | 711 | | |
704 | 712 | | |
705 | | - | |
706 | | - | |
707 | 713 | | |
708 | 714 | | |
709 | 715 | | |
710 | | - | |
711 | | - | |
712 | | - | |
| 716 | + | |
| 717 | + | |
713 | 718 | | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
718 | 722 | | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
| 723 | + | |
| 724 | + | |
723 | 725 | | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
731 | 731 | | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
743 | 737 | | |
744 | 738 | | |
745 | | - | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | 739 | | |
751 | 740 | | |
752 | | - | |
| 741 | + | |
753 | 742 | | |
754 | 743 | | |
755 | 744 | | |
756 | 745 | | |
757 | 746 | | |
758 | | - | |
759 | | - | |
| 747 | + | |
| 748 | + | |
760 | 749 | | |
761 | 750 | | |
762 | 751 | | |
| |||
812 | 801 | | |
813 | 802 | | |
814 | 803 | | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | 804 | | |
824 | 805 | | |
825 | 806 | | |
826 | 807 | | |
827 | 808 | | |
828 | 809 | | |
829 | | - | |
830 | | - | |
831 | | - | |
832 | | - | |
833 | | - | |
834 | | - | |
835 | | - | |
836 | | - | |
837 | | - | |
838 | | - | |
839 | | - | |
840 | | - | |
841 | 810 | | |
842 | 811 | | |
843 | 812 | | |
| |||
0 commit comments