批处理与流处理
Question: 批处理和流处理在 Week 7 怎么组合?
历史回填用 batch,近实时 view/activity 用 stream;读端统一看派生视图。
把 YouTube, Top K, Strava 收敛为一个机制地图:truth, derived views, replay, stale tolerance, idempotency, metrics.
| 08:50-09:00 | Set target 写下本周一句话:publication truth and view/activity truth are not the same as derived views. |
|---|---|
| 09:00-10:05 | Weakest answer repair 重做 YouTube or Top K or Strava 最弱答案;必须包含 invariant, failure window, recovery, metrics. |
| 10:05-10:45 | Synthesis 完成 Week 7 mechanism map and DDIA question-to-section recap. |
| 10:45-10:55 | Spoken close 英文 2 分钟:replay and stale derived views across all three systems. |
| 14:30-16:15 | NeetCode Trees Exactly three contiguous Trees slots. Each slot is 30m solve + 5m pattern/invariant/bug/complexity evidence. |
| 20:30-21:15 | Recall / Q&A / repair 20:30-21:15 填 scorecard,确认 assets, links, visual smoke, and READY_FOR_REVIEW. |
Use original Hello Interview titles and current canonical anchors. Inline Bad/Good/Great headings without standalone live anchors link to their parent canonical section.
| Original title / direct link | Disposition | Use |
|---|---|---|
| Week 7 Scorecard | acceptance | evidence gate |
| Week 7 Production Record | record | coverage and validation evidence |
Only exact Ch11/Ch12/Ch13 sections that change today's design are assigned.
Question: 批处理和流处理在 Week 7 怎么组合?
历史回填用 batch,近实时 view/activity 用 stream;读端统一看派生视图。
Question: 派生状态为什么允许短暂陈旧?
publication truth、view truth、activity truth 与 CDN/TopK/feed 派生视图分离。
Question: 重新处理旧事件时如何避免破坏当前线上榜单?
重处理写新版本视图,验证后原子切换 alias/cache key。
Question: 缓存和物化视图 stale 到什么程度可接受?
CDN manifest、TopK cache、activity feed 都需要 TTL/freshness/SLO,而不是假装强一致。
Question: 如何把重复请求压成一次操作?
client request id、upload chunk fingerprint、activity sample id、view event id 都是重复抑制键。
Contiguous live NeetCode Trees order. No reviews. Three slots per day.
| # | Problem / mode | Pattern | Invariant | Bug risk | Time | Space |
|---|---|---|---|---|---|---|
| 19 | Binary Tree Longest Consecutive Sequence NEW - 30m solve + 5m evidence | DFS 传递长度 | child.val == parent.val + 1 时延长,否则重置。 | 没有在断链处重置为 1。 | O(n) | O(h) |
| 20 | Binary Tree Longest Consecutive Sequence II NEW - 30m solve + 5m evidence | 后序递增/递减链 | 节点可连接一条递减链和一条递增链。 | 只保留单方向导致漏过拐点。 | O(n) | O(h) |
| 21 | Count Univalue Subtrees NEW - 30m solve + 5m evidence | 后序布尔返回 | 子树全同值要求左右子树全同且子节点值匹配 root。 | 空子树应视为满足条件。 | O(n) | O(h) |
| Output | Scorecard, synthesis map, repaired spoken answer, production record gate. |
|---|---|
| Hard fail | Passive reading without a spoken answer; missing invariant/failure/recovery/metric; any day outside Week 7 touched. |
| Repair | Pick the weakest answer and redo it for 8 minutes with one new failure window. |