@Override
    public void snapshotState(FunctionSnapshotContext functionSnapshotContext) throws Exception {
        try {
            if (handover.hasError()) {
                LOG.debug("snapshotState() called on closed source");
                throw new FlinkRuntimeException(
                        "Call snapshotState() on closed source, checkpoint failed.");
            } else {
                snapshotOffsetState(functionSnapshotContext.getCheckpointId());
                snapshotHistoryRecordsState();
            }
            if (deserializer instanceof RowDataDebeziumDeserializeSchema) {
                ((RowDataDebeziumDeserializeSchema) deserializer)
                        .updateCurrentCheckpointId(functionSnapshotContext.getCheckpointId());
            }
            if (checkpointStartTimeMap != null) {
                checkpointStartTimeMap.put(functionSnapshotContext.getCheckpointId(), System.currentTimeMillis());
            } else {
                LOG.error("checkpointStartTimeMap is null, can't record the start time of checkpoint");
            }

            if (sourceExactlyMetric != null) {
                sourceExactlyMetric.incNumSnapshotCreate();
            }
        } catch (Exception e) {
            if (sourceExactlyMetric != null) {
                sourceExactlyMetric.incNumSnapshotCreate();
            }
            throw e;
        }
    }
Buffer the events from the source and record the errors from the debezium.
inlong-sort/sort-flink/sort-flink-v1.15/sort-connectors/sqlserver-cdc/src/main/java/org/apache/inlong/sort/sqlserver/DebeziumSourceFunction.java