fix(events): edge bus Subscribe 拆锁——磁盘回放移出 b.mu 临界区 - #2165
Merged
Conversation
#2154 perf-lane F15(P1):Subscribe 在 b.mu 内调 EventLog.ReadFrom(文件 IO + 逐行 unmarshal),带旧 cursor 的重连客户端可把整个 Publish fanout 停住整个回放时长(日志最大 ~50MiB)。 - ReadFrom 移到取锁之前(eventLog 指针构造期固定,竞态安全);b.mu 内只做 subscriber 注册 + 内存 history 回放 + 合并 - 合并逻辑抽成纯函数 mergeReplayWithLog(gap 注入 / seenSeqs 去重 history 优先 / seq 排序),新增 3 个契约测试 - 语义不变:并发发布仍由 history 去重覆盖,gap 语义与排序与旧实现一致 验证:edge-server 全量 go test -short 绿;events 包 go vet 绿;新增 3 测试绿;git diff --check 干净 Co-authored-by: Cursor <cursor@vectorcontrol.tech>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
范围(#2154 性能 lane F15,P1)
Bus.Subscribe原先在b.mu内调用EventLog.ReadFrom(文件 IO + 逐行 unmarshal,日志最大 ~50MiB):一个带旧 cursor 的重连客户端可把整个 edge 事件的Publishfanout 停住整个回放时长。ReadFrom移到取锁之前执行(eventLog指针在构造期固定,竞态安全)b.mu内只保留 subscriber 注册 + 内存 history 回放 + 合并(纯内存)mergeReplayWithLog(gap 注入 /seenSeqs去重 history 优先 / seq 排序),新增 3 个契约测试验证
go test ./edge-server/... -short -count=1全绿go vet ./internal/events/绿;新增 3 测试绿git diff --check干净