Repository navigation
fix(fileservice): retry replayable COS PUT on HTTP EOF - #29820
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
LeftHandCold
left a comment
There was a problem hiding this comment.
代码复核结论:PASS,未发现需要 REQUEST_CHANGES 的问题。复核对象为 c5874c19a94f5ced3cd047780aa59a94702d7136,base/merge-base 为 e5dd4724f782067e1c76c38c9d2f55cebceda4a9。当前登录账号与 PR 作者同为 LeftHandCold,因此这里只提交 COMMENT,不冒充 GitHub APPROVED。
完整检查了两个文件的全部变更,并追踪 Write → putObject → COS SDK / HTTP、共享 retry classifier / backoff、S3FS 调用及小对象 multipart fallback。
- 设计归属正确:只有已经拥有可重放 body 的两个 Write 循环使用新条件;复用现有缓冲、原始 seek offset、attempt limit 和取消路径,没有新增状态机、缓存或重试层。是聚焦修复,无需新功能设计文档。
- 恢复边界准确:SDK 的 RetryError 没有 Unwrap,显式遍历其 Errs 是必要的;新增条件只识别 typed PUT EOF。原始/字符串 EOF、GET/POST EOF、403 和错误长度没有获得新重试条件;原有 502、timeout/reset 等分类保留。multipart-init/part/completion 及其他 provider 路径未改。
- 数据与回归:每次使用相同 key 和完整原始内容;seekable 分支恢复非零原始偏移。真实 HTTP 测试模拟“对象已写完但响应丢失”,断言恰好两次完整相同 body,再从存储端读取验证。重复物理 PUT 的版本/事件语义沿用已有重试约定,不承诺 provider exactly-once。
- 性能:成功时 DoWithRetryContext 在调用 predicate 前返回;没有新增正常路径的数据复制、锁、goroutine 或 I/O。EOF 故障路径可能多次 PUT,使用已有预算,不影响健康请求路径。
| Unhappy-path | 复核结果 |
|---|---|
| Q1 清理责任 | 生产侧没有新增持久资源;每次请求/响应仍由原 HTTP/SDK 路径负责,source 所有权不变。测试显式关闭 hijacked connection、read body 和 server。 |
| Q2 等待终止 | PUT 使用原 context,backoff 可被取消,attempt 数有限;取消与耗尽有直接 oracle。没有新增锁或等待依赖,也没有把已有 source 读取契约宣称为新的超时保证。 |
| Q3 增长边界 | 复用单份已缓冲内容或原 seeker,不累计每次重试的 payload;测试观测 channel 有固定容量且发送不阻塞。 |
验证记录:
- 本轮 Go 1.27.1 gofmt、git diff --check 通过,隔离 review worktree 干净。
- 核对保留的四个新增测试的实际命名 PASS 输出(Linux focused 0.071s),以及作者的 COS/retry/multipart controls、HTTP fixture race×100、macOS/Linux owning-package race 终态日志。两个变更文件的 SHA-256 与已验证文件完全一致。
- 对比已复测 revision
8c0d609c与当前 head:fileservice、moerr、perfcounter、trace、metric、logutil、cgo、thirdparties、Makefile、go.mod/go.sum 均无变化;聚焦 HTTP/retry 证据仍适用。更早的 owning-package 结果是历史证据,不替代最新完整 CI。 - 当前 head 的 CI run shared build 和 UT Coverage 已 success;Ubuntu UT、SCA 与相关 BVT 仍在运行,未宣称全 CI 通过。
- 本轮未重复启动 MO、live COS 或重跑整包 UT。真实 SDK/ObjectStorage HTTP fault→Write→Read 是本修复的消费者验证;完整 SQL rollback、原 Weekly 的网络关闭触发点及 live-provider 重跑不在这份验证结论内。
- 当前没有需要复核闭环的人工 review threads。
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of base/merge-base e5dd4724f782067e1c76c38c9d2f55cebceda4a9 → head c5874c19a94f5ced3cd047780aa59a94702d7136. APPROVE: no remaining blocker found. No subagents; no production source changes.
Design and responsibility: the fix belongs in the two QCloudSDK.Write loops that already own replayable bodies. The additional private predicate preserves the shared classifier and traverses the COS SDK's opaque RetryError only to recognize typed HTTP PUT EOF. Reusing the existing buffer/original seek offset, retry budget, context and backoff is appropriate; there is no new retry state machine, storage, configuration or execution path. This ordinary recovery fix is exempt from the feature-design-document gate.
Read every changed hunk: implementation +21/-2 in one file, tests +181/-0 in one file, documentation 0. Traced S3FS → Write → countingReader → pinned COS SDK Object.Put/net-http, and the reverse read path. Checked the unchanged multipart-init/part/completion paths, including the small/empty fallback into ordinary Write. The added EOF condition does not enable POST/GET or raw source-EOF replay. The existing SDK retry count is zero, so this does not add a nested transport retry budget.
Adversarial boundary: the peer can store the complete object and then lose its response. Both buffered and nonzero-offset seekable cases recover using exactly two identical complete bodies and an actual subsequent read of stored bytes. Nearest negative controls preserve 403 and short-source errors; cancellation/exhaustion retain bounded termination. Q1: HTTP/SDK owns response cleanup and Write retains source ownership; Q2: existing context-aware backoff/attempt limit, with no new wait dependency; Q3: one buffered payload or original seeker, no per-attempt retained payload collection. Existing source-reader blocking contracts are not changed or claimed to become cancelable.
Performance: healthy writes return before evaluating the predicate, so there is no added normal-path allocation, copying, lock or I/O. An EOF failure can issue additional physical PUTs under the existing budget. As with existing ambiguous PUT retries, this is byte-level replay, not an exactly-once promise for provider versions/events. No TP throughput benchmark is claimed.
Comment closure: read issue #29815 and its substantive validation comment, this PR's author self-review, and all review threads (none). The requested recovery boundary is addressed; identifying the original COS/LB/network closure remains outside this fix.
Validation:
- Exact-head isolated Darwin/arm64, Go 1.27.1, native prerequisites built from this source (supported pinned ONNX prebuilt reuse). COS/HTTP/multipart/retry controls passed under
-race, 3.971s; all four new tests selected and passed. TestQCloudSDKWriteRetriesHTTPEOFmeasured 0.03s; adaptive budget selected 100 same-process race repetitions, all passed (5.081s).- Reused exact-head CI run 38032411756: completed success, owning FileService selected in the resource-heavy race-test group; required CI green. Author historical macOS/Linux package runs remain supplemental evidence.
git diff --checkpassed and isolated source worktree is clean. No live-COS/Weekly or complete SQL rollback rerun was performed; the actual SDK HTTP write/read boundary is the consumer oracle for this scoped fix.
Merge Queue Status
This pull request spent 13 minutes 8 seconds in the queue, with no time running CI. ReasonPull request #29820 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Waiting for any of
All conditions
Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #29815
Closes #29815.
What this PR does / why we need it:
The Main Weekly recorded an object-write failure during
insert into ctas_v(id) values (2): the COS SDK returned aRetryErrorcontaining
url.Error(Op="Put", Err=io.EOF). Its reader-length diagnostic isnot proof of an invalid source: the real HTTP regression reproduces that
diagnostic with a correct explicit length and a fully consumed body.
QCloudSDK.Writealready buffers small objects or restores a seekable sourceto its original offset, but the shared retry classifier excludes ordinary EOF.
Consequently this recoverable PUT fails after one request. This is a confirmed
MO recovery gap, not a newly attributed regression or proof of which network
component closed the original connection.
Narrow fix
Writeloops.opaque
RetryErrorand recognize typed HTTP PUT EOF.outside this added condition. Do not change the shared classifier or the
multipart-init/part/completion protocols.
Writebenefit from the same fix; no multipart POST replay is added.
There is no new buffering, retry layer, configuration, lock or algorithm.
The successful-attempt path returns before invoking the error predicate, so
there is no added normal-path allocation or I/O. Replaying an ambiguous PUT
may issue another physical request, as existing PUT retries already do; this
does not promise exactly-once provider events or versions.
Validation
The retained regression uses the actual COS SDK and a real HTTP listener.
Its first PUT stores the complete object, then closes the connection without
a response. Both buffered and nonzero-offset seekable writes must recover
using exactly two identical complete bodies, followed by an actual read of
the stored object.
Controls cover wrapped and raw EOF, unchanged shared policy, GET/POST,
403, short source length, cancellation, retry exhaustion, and existing 502,
multipart-init/abort/part-retry behavior. No source-reader or whole-SQL retry
is introduced.
Tested with:
The first command is an external baseline diagnostic, not a committed
regression asserting buggy behavior. Fix tests live in the existing
qcloud_sdk_test.goand assert the recovered contract.Go 1.27.1; CPU CGo libraries built from the isolated source worktrees. macOS
uses canonical
TMPDIR=/private/tmp: the default/varsymlink exposes anunrelated pre-existing LocalETL directory-sync fault-injection mismatch,
independently reproduced on pristine production source. No tests are skipped
or weakened. Linux uses an isolated disk-backed build/cache directory because
the shared root filesystem was full. Existing services were not modified.
Results: macOS final focused controls passed (1.010s), real-HTTP regression
passed 100 race repetitions (4.742s), and owning package race passed (28.170s).
On shanghai50, all four new focused tests passed (0.071s) and the full owning
package race passed (147.170s, GOMAXPROCS=4, -p 4). Local and remote changed
files have identical SHA-256 hashes. Source baseline is main@62827a1c8b;
the final tested/reviewed commit is 4fdb76b.
After publication, Mergify merged main@888e1ea446 into the branch, producing
head
8c0d609c492f6bb19c5363dc55a9000ee23ae55f. All files inpkg/fileservice,cgo,go.modandgo.sumare identical to the validated fix revision.The focused COS/multipart/retry controls were rerun on this exact current
head and passed (1.021s). The first CI run was cancelled by the head update;
the replacement run is in progress, not declared passed.
This validation proves the MO transport-recovery boundary, not the original
COS/LB/NAT closure trigger. It does not substitute for a full SQL rollback or
live-provider Weekly rerun. Self-review found no remaining implementation
blockers; GitHub CI will be reported separately from these completed tests.