private void snapshotHistoryRecordsState() throws Exception {
        schemaRecordsState.clear();

        if (engineInstanceName != null) {
            schemaRecordsState.add(engineInstanceName);
            Collection<SchemaRecord> records = retrieveHistory(engineInstanceName);
            DocumentWriter writer = DocumentWriter.defaultWriter();
            for (SchemaRecord record : records) {
                schemaRecordsState.add(writer.write(record.toDocument()));
            }
        }
    }
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