fix(server): 修复 S3 未知长度上传兼容性与分页探测误报 - #136
Merged
Merged
Conversation
未知长度对象先在私有临时文件中有界接收,再携真实 Content-Length 发出 single PUT,以保留原子条件写而不把大文件缓存在堆中。既有部署因此需要临时磁盘,且完整接收后才开始 S3 上传;同一 deadline 覆盖暂存、PUT 和确认 HEAD,失败时清理资源。 分页探测使用自己的成功写入集合,避免其他上传失败导致分页误报;失败诊断只记录白名单归一的阶段和状态。server 升至 0.22.1。 验证:pnpm verify、全仓 build、干净安装 tarball;真实 R2 两后端能力检查全通过且清理成功。旧短流对照也可成功,未把缺少长度断言为历史远程异常的唯一原因。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
未知长度对象流原先直接交给 S3 single PUT,传输长度依赖运行时和后端兼容性;同时,能力探测把其他检查失败的写入也计入分页预期,会把上传错误误报为分页缺失。现在在私有临时文件中有界接收未知长度流,再按真实 Content-Length 执行 single PUT,保留 If-Match/create-only 条件,并隔离分页探测数据。失败探测新增严格脱敏的阶段/HTTP 状态诊断。server 升至 0.22.1。
既有部署的行为变化:未知长度上传会使用系统临时磁盘,完整接收后才开始 S3 上传;同一时限覆盖暂存、PUT 和确认 HEAD。每次上传保留字节上限、背压和取消,正常及错误退出清理临时文件。持久对象仍保存在 S3;未引入 multipart 或直传。
验证:
证据边界:旧部署日志确认出现过流上传异常,但未保留具体下游错误码;旧实现的短流在本机对照中也成功,因此不将缺少 Content-Length 宣称为历史故障的唯一原因。修复后的真实 R2 结果证明当前传输方案可用;远程 server 0.22.1 部署后,两个后端的全项检查及清理再次通过;Store 默认后端已切换到 R2,读回配置确认生效。