Repository navigation
Retry transient MinIO InvalidPart on S3 CompleteMultipartUpload - #109364
alexey-milovidov merged 2 commits into
Conversation
completeMultipartUpload() retried only NO_SUCH_KEY. MinIO also transiently reports a just-uploaded part as missing on completion with InvalidPart (and can with InvalidPartOrder), the same eventual-consistency class as the already-handled NO_SUCH_KEY. Those fell into the else branch and threw immediately (Code 499), failing e.g. the hits_s3 stateful fixture load. InvalidPart / InvalidPartOrder are not in the typed S3Errors enum, so the AWS SDK leaves GetErrorType() == UNKNOWN and keeps the raw code only in GetExceptionName() (see AWSErrorMarshaller::Marshall). Match by exception name, mirroring the existing PreconditionFailed string check in the single-part path. The retry stays bounded by max_unexpected_write_error_retries; the terminal throw now reports the actual last error instead of a hardcoded NO_SUCH_KEY. The mock in gtest_writebuffer_s3.cpp builds DB::S3::Client directly, bypassing ClientFactory::create() which fills retryStrategy; set it here too so chassert(client_configuration.retryStrategy) does not abort the suite in debug/sanitizer builds. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-2:20260703-201700 |
|
cc @CheSema @kssenii — could you review? This extends the existing |
|
Workflow [PR], commit [30e8098] Summary: ✅
AI ReviewSummaryThis PR widens the transient Final Verdict
|
…path The retry predicate was only in WriteBufferFromS3::completeMultipartUpload(). UploadHelper::completeMultipartUpload() in copyS3File.cpp (which backs copyDataToS3File / copyS3File, i.e. MinIO-backed backups and DiskObjectStorage server-side copies) still retried only NO_SUCH_KEY, so those flows could still fail with Code 499 InvalidPart on multipart completion. Extract the predicate into a shared isTransientCompleteMultipartUploadError() in S3Common (single source of truth for NO_SUCH_KEY / InvalidPart / InvalidPartOrder) and use it from both completion sites. Add a copyDataToS3File regression test that injects InvalidPart on the first CompleteMultipartUpload and asserts the copy still succeeds. Reading the mock request body by content length (istream::read) instead of operator<<(rdbuf) so it works with the ReadBuffer-backed body used by the copy path. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Follow-up to @clickhouse-gh[bot]'s review: the fix now covers both multipart-completion sites via a shared predicate. Updated pre-PR validation gate for the widened scope. Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-3:20260703-215300 |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 106/111 (95.50%) · Uncovered code |
…mpletempu-invalidpart-retry Retry transient MinIO InvalidPart on S3 CompleteMultipartUpload
|
Have to backport this to fix CI |
Backport #109364 to 26.3: Retry transient MinIO InvalidPart on S3 CompleteMultipartUpload
… on S3 CompleteMultipartUpload
Closes: #93192
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a transient
Code: 499 ... InvalidPart(S3_ERROR) failure on S3 multipart uploads (for exampleINSERT INTO ... hits_s3). MinIO can briefly report a just-uploaded part as missing onCompleteMultipartUpload; this error is now retried like the already-handledNoSuchKey, bounded bys3_max_unexpected_write_error_retries.Description
WriteBufferFromS3::completeMultipartUpload()had a retry loop bounded bymax_unexpected_write_error_retriesthat tolerated one known MinIO eventual-consistency quirk, but onlyNoSuchKey. MinIO also transiently reports a just-uploaded part as missing on completion withInvalidPart(and can withInvalidPartOrder), which is the same class of flake. Those fell into theelsebranch and threw immediately:Root cause of the "Unable to parse ExceptionName" wording:
InvalidPart/InvalidPartOrderare not in the AWS SDK's typedS3Errorsenum and are not mapped byS3ErrorMapper, soAWSErrorMarshaller::MarshallleavesGetErrorType() == UNKNOWNand keeps the raw code only inGetExceptionName(). A fix keyed on the typed enum would not match, so the retry predicate matches by exception name, mirroring the existingPreconditionFailedstring check in the single-part path.The retry stays bounded by
max_unexpected_write_error_retries, logs at INFO like the existing branch, and the terminal throw now reports the actual last error instead of a hardcodedNoSuchKey.InvalidPartis aCompleteMultipartUpload-only error, so the single-partPutObjectpath is intentionally left unchanged. Sorting parts in ascending order is guaranteed by the request builder, so a genuine (non-transient)InvalidPartOrdercannot originate here.Regression test:
src/IO/tests/gtest_writebuffer_s3.cpp(WBS3/SyncAsync.CompleteMPURetriesInvalidPart) injectsInvalidParton the firstCompleteMultipartUploadand asserts the upload then succeeds. It fails onmasterand passes with this change. The test also fillsretryStrategyin the mock client config (the mock buildsDB::S3::Clientdirectly, bypassingClientFactory::createwhich normally sets it), unblocking the whole MockS3 suite underchassertin debug/sanitizer builds.Version info
26.7.1.838-master(included in26.7and later)26.3.40.15