fix(jobs): 留痕清理独立接通历史存储开关;精简死逻辑并对齐陈旧注释
This commit is contained in:
@@ -81,7 +81,7 @@ class Pump(
|
||||
//
|
||||
// 水位以内的行都是收报按 ID 顺序发现并登记的;水位之外的行只可能来自兼容入口
|
||||
// 直接写 PROC_STATE(它不参与水位)。若允许领取,它就会越过那些尚未入队的较小 ID,
|
||||
// 破坏 FIFO(缺口 G2)。这种行在空洞补齐、`W` 追平之后自然可领取。
|
||||
// 破坏 FIFO(不变量"只领取已发现的行",message-lifecycle.md §11)。这种行在空洞补齐、`W` 追平之后自然可领取。
|
||||
val watermark = cursor.load().committedUpTo
|
||||
if (head.msgId > watermark) {
|
||||
warnBeyondWatermark(head.msgId, watermark)
|
||||
@@ -175,21 +175,7 @@ class MessageProcessor(
|
||||
}
|
||||
}
|
||||
|
||||
/** @return 这条消息是否落到终态;回填由扫描驱动,调用方不再据此立即回填。 */
|
||||
private fun processInternal(head: ProcState): Boolean {
|
||||
// 守卫:手工/遗留 FAILED 行若 attempts 已达上限,直接终态(防止退避到期后无限重试)
|
||||
if (head.state == ProcStatus.FAILED && procFailure.scheduler.exhausted(head.attempts)) {
|
||||
log.error("head exhausted at entry -> DEAD msgId={} attempts={}", head.msgId, head.attempts)
|
||||
procState.markTerminal(
|
||||
head.msgId, ProcStatus.DEAD,
|
||||
errorClass = ErrorClass.EXHAUSTED,
|
||||
lastError = head.lastError ?: "max-attempts",
|
||||
attempts = head.attempts,
|
||||
now = clock.instant(),
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
private fun processInternal(head: ProcState) {
|
||||
val raw = inbox.rawOf(head.msgId)
|
||||
if (raw == null) {
|
||||
log.error("raw missing -> DEAD(MALFORMED) msgId={}", head.msgId)
|
||||
@@ -215,7 +201,7 @@ class MessageProcessor(
|
||||
val owner = procState.ownerOfIdentity(identity) ?: -1L
|
||||
log.info("duplicate-of:{} -> SKIPPED msgId={}", owner, head.msgId)
|
||||
procState.markTerminal(head.msgId, ProcStatus.SKIPPED, lastError = "duplicate-of:$owner", now = clock.instant())
|
||||
return true
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,16 +246,14 @@ class MessageProcessor(
|
||||
lastError = result.reason.take(1000),
|
||||
now = clock.instant(),
|
||||
)
|
||||
return true
|
||||
return
|
||||
}
|
||||
|
||||
// Succeeded / ReplaySkipped:SUCCEEDED 终态与回填意图已由处理器在自己的事务内落库
|
||||
log.info("SUCCEEDED msgId={} kind={}", head.msgId, decoded.typeTag)
|
||||
return true
|
||||
}
|
||||
|
||||
private fun deadMalformed(head: ProcState, detail: String): Boolean {
|
||||
private fun deadMalformed(head: ProcState, detail: String) {
|
||||
procState.markTerminal(head.msgId, ProcStatus.DEAD, errorClass = ErrorClass.MALFORMED, lastError = detail, now = clock.instant())
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user