Quarantine missing platform log batches

This commit is contained in:
npc0-hue
2026-08-31 00:18:10 +08:00
parent 34e240dc56
commit f63f0966ff
2 changed files with 19 additions and 0 deletions
+9
View File
@@ -1227,6 +1227,10 @@ func (client sessionLogBatchClient) IngestLogBatch(ctx context.Context, batch pr
batch.Checksum = checksum
}
response, err := client.client.IngestLogBatch(ctx, batch)
if err != nil && logBatchNotFoundError(err) {
log.Printf("RUN phase=durable_uploaders.logs status=spool_quarantine stream=%s firstSeq=%d lastSeq=%d reason=platform_not_found error=%s", safeOptional(batch.LogStreamID), batch.FirstSeq, batch.LastSeq, RedactText(err.Error()))
return protocol.LogBatchIngestResponse{}, spool.PermanentLogBatchRejection("platform_not_found", err)
}
if err != nil && (logBatchSequenceGapError(err) || logBatchAcknowledgedRangeConflict(err)) {
reason := "platform_sequence_gap"
if logBatchAcknowledgedRangeConflict(err) {
@@ -1246,6 +1250,11 @@ func (client sessionLogBatchClient) IngestLogBatch(ctx context.Context, batch pr
return response, err
}
func logBatchNotFoundError(err error) bool {
var httpErr interface{ HTTPStatus() int }
return errors.As(err, &httpErr) && httpErr.HTTPStatus() == http.StatusNotFound
}
func logBatchSequenceGapError(err error) bool {
var gapError interface{ LogBatchSequenceGap() bool }
return errors.As(err, &gapError) && gapError.LogBatchSequenceGap()