Skip to content

fix(logservice): fail non-progressing Tan EOF reads - #30288

Merged
mergify[bot] merged 6 commits into
mainfrom
fix/tan-eof-progress-30219
Oct 17, 2026
Merged

mergify[bot] merged 6 commits into
mainfrom
fix/tan-eof-progress-30219

Conversation

@LeftHandCold

@LeftHandCold LeftHandCold commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • BUG
  • Test and CI

Which issue(s) this PR fixes:

Fixes #30219 (the Tan EOF non-progress loop, not repair of missing committed log records).

Official dependency — merge prerequisite resolved

The dependency fix, matrixorigin/dragonboat#19, merged on 2026-10-16 at official commit 0b20c95f67f8e5eb119d1913b18fa8c9b09612b9.

This PR now selects github.com/matrixorigin/dragonboat/v4 v4.0.0-20261016015224-0b20c95f67f8, with its official module checksums. The temporary personal-fork replacement and checksums have been removed.

The official commit and the previously tested fork commit ca11de296963e7f10269654476aab1b88d81cb7e have the same Git tree, 5dd8f8b2110c3ce2fdaffc5d0a3dfc7c3c848271. A recursive comparison of the downloaded Go module directories also found no differences. The focused regression, race repetitions and complete LogService package were rerun against the final official pin, as requested in review.

What this PR does / why we need it:

Tan readLog returns nil on EOF. When a persisted entry index points at EOF, no entry callback advances passed, but getEntries reopens the same position indefinitely. This blocks the Raft worker inside storage I/O iteration, so it cannot observe its stop channel. The issue's repeated open/seek/entry-loader stacks match this path.

The dependency fix detects a scan that consumes no index entry, returns a contextual storage error and preserves the normal size-limit early return. It does not alter normal EOF semantics used by rotation/rebuild, rewrite files, skip missing entries, change the persistent format or introduce a background task. The error follows the existing fail-stop Raft worker path; this is not automatic data recovery.

9ef6a64061dadddfdcb9b80082fe6ae1c31421b3 introduced this loop in Dragonboat on 2022-11-15. That identifies the origin of the loop, not why the reporter's log bytes went missing. The original MatrixOne dependency tree abc3d2fce5a6 is identical to the upstream fix's base 18a1f46a2ea64eb42a2b330ef98d662ca68a1365, so this pin adds no unrelated production changes.

The new MatrixOne test uses the actual configured LogDB factory from getNodeHostConfig. It writes and reads a real Tan entry on an isolated in-memory FS, injects EOF at the indexed position, requires an error after a single open, then verifies the original entry remains readable. A bounded fake-FS open count makes the old dependency fail deterministically instead of hanging CI. Cleanup checks file closure.

Local validation on host 50

Final-pin validation used MatrixOne head 74034855150160b7e83e284de59fdf312d5ff684 plus the official dependency/checksum substitution; merge base c46b893f6160902e74b3581fc968666cb9d07003. This review update changes only go.mod and go.sum; the regression test is unchanged.

Linux amd64, Go 1.27.1, GOMAXPROCS=4, package parallelism -p=2. Tests used .agents/skills/mo-dev/scripts/mo-cgo-test with repository native-artifact provenance checks. No module-cache edits or copied native libraries were used.

Check on final official pin Result
go list -m -json github.com/lni/dragonboat/v4 Resolves the official MatrixOrigin module/version above
Official vs previously tested dependency Git trees and extracted module directories Identical
TestTanIndexedEOFReturnsError plus TestStoreCanBeCreatedAndClosed, -count=1 -timeout=120s PASS, 0.053 seconds
Complete ./pkg/logservice, -count=1 -timeout=600s PASS, 63.176 seconds
TestTanIndexedEOFReturnsError, -race -count=100 -timeout=120s PASS, all 100 repetitions, 1.482 seconds including package overhead
git diff --check PASS

Earlier counterexample evidence: the new test with the original abc3d2fce5a6 pin failed as intended when a repeated open reached the injected-error guard. The dependency PR separately passed Tan/LogReader/Raft package tests, Tan race tests, vet and a full Dragonboat build. Its persisted-index reopen tests cover EOF, a valid prefix before EOF and a state-only indexed position, plus healthy prefix/size-limit behavior; existing tests cover rotation, overwrite, restart, compaction and torn-tail recovery. These are prior results, not additional executions claimed for this dependency-only update.

Self-review / scope

Contract Conclusion
Q1 cleanup Existing file and read-state ownership unchanged; error-path closure tested. No new production resource owner.
Q2 termination Each outer scan advances its index cursor or returns; normal size-limited reads still return successfully.
Q3 growth No new goroutine, queue, timer, persistent metadata or accumulation.
Delivery Only the dependency pin/checksums and one regression test change in MatrixOne. The dependency now comes from the official repository at an immutable, merged revision.

No SQL BVT: the changed contract is the persisted Raft-log reader below SQL, tested at Tan, LogReader and MatrixOne's configured LogDB boundaries. The original multi-GB issue archives were not replayed in this validation; the exact bad-index/EOF condition was injected into small fixtures, including a persisted/reopened fixture in the dependency tests. We do not claim the missing source records were recovered, the missing-byte origin is established, or 4.2 has already received this change.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 74034855150160b7e83e284de59fdf312d5ff684

Assessment: request_changes

Reviewed the complete three-file delta and exact dependency changes. The progress guard belongs in Tan’s indexed reader, preserves normal EOF and size-limit behavior, and reuses existing cleanup/error handling. It adds constant per-scan work without new shared state or I/O. Regression checks passed, but the declared production-dependency prerequisite remains unresolved.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

  • P2 go.mod:304: Merging this non-draft head retains github.com/LeftHandCold/dragonboat/v4 as the production dependency.
    Impact: This ships the explicitly temporary review/CI pin before the declared official-dependency and final-validation requirements are fulfilled. Replace it with an immutable MatrixOrigin revision containing the fix, update checksums, compare its contents with the tested revision, and validate the focused regression plus LogService package against that final pin.
    Evidence: The frozen PR description explicitly identifies ca11de296963 as temporary and requires the official replacement before readiness. Current go.mod still selects that fork; evidence.json marks the PR non-draft and supplies no final-pin validation. Existing CI and the local checks cover the temporary dependency only.

Validation:

  • Verified clean frozen source and checksum-verified both dependency archives. Their only differences are internal/tan/db.go and the new read_progress_test.go.

  • Isolation preflight passed. Thirteen selected Tan tests passed in 1.341s, covering non-progress reads, overwrite, rotation, restart, rebuild, torn tails and size limits. Receipt: checks/1792119704395320037-3.json; log: tan-regression.log.

  • The diagnostic old-reader control failed as expected in all three non-progress cases with the bounded repeated-open error. Receipt: checks/1792119786932844266-4.json; log: tan-old-reader-copy-control.log.

  • Reconciled commands, source fingerprints, exit receipts, logs and control-input hashes in validation-audit.json. Audit receipt: checks/1792119877254617043-4.json. Artifacts are retained under the assigned attempt-1 directory.

  • Frozen-head CI reports successful Ubuntu UT, Linux/arm64 SCA, builds and proxy/pessimistic multi-CN BVT.

Limitations:

  • No local full LogService or race rerun; CI raw test logs and traceable author-run artifacts were not supplied.

  • The initial old-reader overlay attempt was rejected before execution; the diagnostic-copy control subsequently executed successfully.

  • Original incident archives were not replayed. Missing-record origin and data recovery remain outside this fix.

  • Performance costs were assessed from code and callers; no benchmark was run.

@LeftHandCold

Copy link
Copy Markdown
Collaborator Author

已修复本轮 review 的依赖交付阻断,更新提交:62ac3eb230。

  • Dragonboat Add Go/AVX2/AVX512 implementations to SUM operator #19 已合并;go.mod 现在固定到官方 github.com/matrixorigin/dragonboat/v4 v4.0.0-20261016015224-0b20c95f67f8,同步更新 go.sum,移除个人 fork 的引用和校验和。
  • 官方提交与之前验证的 ca11de296963 的 Git tree 均为 5dd8f8b2110c3ce2fdaffc5d0a3dfc7c3c848271;下载后的完整 Go module 目录递归比较也无差异,没有附带其他依赖源码变化。
  • 最终官方 pin 上重新执行:针对性回归+Store 创建/关闭测试通过;完整 ./pkg/logservice 通过(63.176s);EOF 回归 -race -count=100 全部通过(1.482s);git diff --check 通过。均使用仓库的 CGo 测试 wrapper。
  • PR 描述已移除过期的临时依赖/Draft 前提,补充最终依赖与本轮验证结果。原修复逻辑和回归测试未改动。

本次只解决“不再无限读取同一 EOF 位置”,仍不宣称修复或恢复已经缺失的日志记录。新 Head 的 GitHub CI 由推送触发,本地通过不替代该轮 CI 结果。

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 62ac3eb2302f628e46001550260cdc9ce565c708

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 62ac3eb2302f628e46001550260cdc9ce565c708

Assessment: approve

Reviewed the complete MatrixOne and dependency deltas. The official dependency prerequisite is resolved. Tan owns the progress invariant, and the guard preserves legitimate EOF and size-limit behavior while reusing existing cleanup and fail-stop error handling. It adds constant per-scan bookkeeping without new shared state or healthy-path I/O. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

Validation:

  • Verified official module resolution and checksums. The complete base-to-head dependency comparison changes only the indexed-reader implementation and its regression tests.

  • Full LogService suite passed: 377 tests, no skips, 64.439 seconds, with vet enabled. The configured-factory EOF regression also passed 100 race repetitions.

  • Full Tan package passed under race: 87 tests, no skips. Coverage includes persisted/reopened EOF, valid-prefix and state-only cases, size limits, overwrite, rotation, restart, compaction and torn-tail handling.

  • The new MatrixOne regression with the original dependency pin failed as expected at the bounded repeated-open guard, confirming it detects the original defect.

  • Isolation preflight, fresh native build, provenance checks, formatting and diff checks passed. Source remained unchanged. Receipts, log hashes and terminal test events are reconciled in /home/xupeng/.local/state/mo-bot/jobs/0e92db1486af76ce639bf7d1/attempt-1/validation-audit.json; detailed review notes are retained alongside it.

Limitations:

  • Original incident archives were not replayed. Missing-record cause and data recovery remain outside this fix; the storage error follows the existing Raft fail-stop path.

  • The linked issue body and raw author/CI execution artifacts were absent from frozen evidence. Local checks independently validated the final pin.

  • Performance effects were assessed from implementation and callers; no benchmark was run.

@mergify

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

@mergify mergify Bot added the queued label Oct 17, 2026
@mergify

mergify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-17 01:12 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-17 02:05 UTC · at aa4b6eddfdad54d11be6fd75a5675eb9801f6690 · squash

This pull request spent 53 minutes 14 seconds in the queue, including 52 minutes 36 seconds running CI.

Required conditions to merge

This branch was previously deployed

1 inactive deployment
ci — 43584c8a Deployed Oct 17, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/test-ci size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tan EOF read makes no index progress, blocking LogService recovery and shutdown

3 participants