fix(tasks): 单片/单文件读不到跳过它,缺数据不许冒充已收齐

三处"一颗坏项拖垮整批"与一处假绿本体:

- BrandTaskStorageService:一片载荷读不到就整份聚合丢掉,而三个调用方
  (finalizeTask/abort/tryRecoverCompletedRunningTask)都没有就地 try;改逐片跳过长
  WARN,并把 receivedChunkCount/completed 的判据从 chunks.size()(DB 行数)改成
  真正读到的片数——拿行数比 chunkTotal 正是"118/119 行没数据仍判已完成"的形状;
  解析缓存与汇总状态两处同型"整批抛出"一并改成逐条跳过。
- AppearancePatentLlmBatchPipeline:候选收集跑在批循环之前,一抛就走不到循环体内
  那道 finally releaseRowInspection,本轮已申领的行要挂满处理中 TTL(15 分钟),
  且 terminalizeRoundExhaustedRows 跟着不执行(轮次到顶的行因此永不判死);改逐片容错。
- TransientPayloadStorageService:跨实例判据枚成 public 常量并提供 cause 链走法。
  resolvePayload 会把真实原因 rewrap 成「<errorMessage>: <pointer>」,消费端只摸顶层
  消息时「only exists on instance=」「does not exist」两处判定恒 false——跨实例留痕
  从未下过笔、"跳过该分片"分支是死代码。消费端(ChunkPayloadSupport/
  HistoryAssembler/ResultRowReader)全部改走共享常量+cause 链。
- SimilarAsinHistoryAssemblerTest 的假绿桩删除:改前它桩的是生产者早已不再产出的
  英文旧串,断言照旧绿;现在跑真实 resolvePayload 取异常(只 mock RustFS 边界),
  改前 15 跑 1 红、改后 15/15 绿。
- SimilarAsinStaleReopenSupport:客户端卡死尾句枚成常量、整句文案唯一出口,生产者
  与重开白名单共用;此前只是碰巧被前缀命中,生产者一改前缀就会"永不重开"。
This commit is contained in:
2026-10-27 15:09:41 +08:00
parent f3445c21c8
commit 07f973d9df
14 changed files with 1027 additions and 44 deletions
@@ -296,8 +296,23 @@ public class AppearancePatentLlmBatchPipeline {
int judgedSkipped = 0;
int noDataSkipped = 0;
int chunkRows = 0;
int unreadableChunks = 0;
for (TaskChunkEntity chunk : chunks) {
Map<String, AppearancePatentResultRowDto> persistedRows = readChunkRows(chunk);
Map<String, AppearancePatentResultRowDto> persistedRows;
try {
persistedRows = readChunkRows(chunk);
} catch (Exception ex) {
// 单片载荷读不到不许把整轮候选收集炸掉:本方法跑在批循环**之前**,而释放处理中标记的
// finally 在循环体内——这里一抛就永远走不到那道 release,本轮已申领的行要挂满
// IN_FLIGHT_TTL(15 分钟)才回来,且 terminalizeRoundExhaustedRows 收的是本方法的返回值,
// 跟着一起不执行(轮次到顶的行因此永不判死)。跳过这一片、继续读其余片,
// 与 AppearancePatentResultRowReader#readChunkRows/SimilarAsinChunkPayloadSupport 同口径。
unreadableChunks++;
log.warn("[appearance-patent] 单片载荷读取失败,跳过该分片继续收集候选"
+ " taskId={} scopeHash={} chunk={} err={}",
chunk.getTaskId(), chunk.getScopeHash(), chunk.getChunkIndex(), ex.getMessage());
continue;
}
if (persistedRows.isEmpty()) {
continue;
}
@@ -328,8 +343,9 @@ public class AppearancePatentLlmBatchPipeline {
candidates.add(row);
}
}
log.info("[appearance-patent] 候选收集逐行申领 taskId={} chunkRows={} judgedSkipped={} noDataSkipped={} claimBlocked={} candidates={}",
chunks.get(0).getTaskId(), chunkRows, judgedSkipped, noDataSkipped, claimBlocked, candidates.size());
log.info("[appearance-patent] 候选收集逐行申领 taskId={} chunkRows={} judgedSkipped={} noDataSkipped={} claimBlocked={} unreadableChunks={} candidates={}",
chunks.get(0).getTaskId(), chunkRows, judgedSkipped, noDataSkipped, claimBlocked,
unreadableChunks, candidates.size());
return candidates;
}
@@ -273,17 +273,11 @@ public class AppearancePatentResultRowReader {
}
/** payload 对象已不存在(RustFS 返回 NoSuchKey:message 为 "The specified key does not exist.")。
* 只有这种"重试也没用"的缺失才允许跳过;网络类失败仍照旧抛出以便重试。 */
* 只有这种"重试也没用"的缺失才允许跳过;网络类失败仍照旧抛出以便重试。
* 判据与 cause 链走法都收口在 {@link TransientPayloadStorageService#isObjectMissing}——
* 抛点与判定端各抄一遍字面量时,改一处就静默失效(货源侧那两处就是这么废掉的)。 */
private static boolean isPayloadMissing(Throwable error) {
Throwable cursor = error;
while (cursor != null) {
String message = cursor.getMessage();
if (message != null && message.contains("does not exist")) {
return true;
}
cursor = cursor.getCause();
}
return false;
return TransientPayloadStorageService.isObjectMissing(error);
}
public String rowKey(AppearancePatentParsedRowVo row) {