{"record":{"id":"b086464e27247f90","repo":"apache/seatunnel","slug":"commit-row-has-no-matched-prewrite-row-yet-hold-i","errorCode":null,"errorMessage":"Commit row has no matched prewrite row yet, hold it and stop advancing resolvedTs. commitTs: {}, startTs: {}, key: {}","messagePattern":"Commit row has no matched prewrite row yet, hold it and stop advancing resolvedTs\\. commitTs: (.+?), startTs: (.+?), key: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-tidb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/tidb/source/reader/TiDBSourceReader.java","lineNumber":402,"sourceCode":"            default:\n                log.warn(\"Unsupported row type:\" + row.getType());\n        }\n        return true;\n    }\n\n    protected void flushRows(final long resolvedTs) throws Exception {\n        flushRowsAndGetSafeResolvedTs(resolvedTs);\n    }\n\n    private long flushRowsAndGetSafeResolvedTs(final long resolvedTs) throws Exception {\n        long safeResolvedTs = resolvedTs;\n        while (!commits.isEmpty() && commits.firstKey().getTimestamp() <= resolvedTs) {\n            final RowKeyWithTs commitKey = commits.firstKey();\n            final Cdcpb.Event.Row commitRow = commits.firstEntry().getValue();\n            final Cdcpb.Event.Row prewriteRow = preWrites.remove(RowKeyWithTs.ofStart(commitRow));\n            if (prewriteRow == null) {\n                safeResolvedTs = Math.min(safeResolvedTs, commitKey.getTimestamp() - 1);\n                log.warn(\n                        \"Commit row has no matched prewrite row yet, hold it and stop advancing resolvedTs. \"\n                                + \"commitTs: {}, startTs: {}, key: {}\",\n                        commitRow.getCommitTs(),\n                        commitRow.getStartTs(),\n                        commitRow.getKey());\n                break;\n            }\n            commits.pollFirstEntry();\n            // if pull cdc event block when region split, cdc event will lose.\n            committedEvents.offer(prewriteRow);\n            totalCommittedRows++;\n        }\n        return safeResolvedTs;\n    }\n\n    private void logStreamingStats(\n            TiDBSourceSplit split,\n            long startResolvedTs,","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-tidb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/tidb/source/reader/TiDBSourceReader.java#L384-L420","documentation":"When flushing resolved TS events, if a COMMIT row has no matching PREWRITE row in the preWrites buffer (preWrites.remove returned null), the reader cannot pair them. It holds the commit row, lowers safeResolvedTs to commitTs-1 to stop advancing, logs this warning and breaks. This protects against emitting out-of-order/incomplete transactions.","triggerScenarios":"flushRowsAndGetSafeResolvedTs processes commits whose prewrite event has not yet been received from TiKV (out-of-order delivery across regions, or the prewrite was consumed under a type the connector skipped).","commonSituations":"TiKV region rescheduling/split-merge causing event reordering; very long-running prewrites; previous 'Unsupported row type' warnings having silently dropped the matching prewrite row.","solutions":["Check preceding warnings (3192 unsupported row types) that may have dropped the prewrite; upgrade the connector if so.","Restart the CDC job from a checkpoint/snapshot to resync prewrite/commit streams.","If it stalls permanently, verify TiKV cluster health (region balance) and TiCDC protocol version alignment."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep checkpoints enabled so a stalled resolvedTs can be recovered by restart","Monitor TiKV region health and avoid frequent rescheduling during CDC runs","Address any 'Unsupported row type' warnings that could drop prewrites"],"tags":["cdc","tidb","tikv","event-ordering","resolved-ts"],"backgroundTag":"internal-invariant-violation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}