alibaba/canal · error · NullPointerException

Not implement yet

Error message

Not implement yet

What it means

MysqlConnection.dump(long timestamp, SinkFunction func) is declared as part of the ErosaConnection contract but was never implemented — the body literally throws new NullPointerException("Not implement yet"). Canal only supports binlog replication by filename+offset, by GTID, or (coprocessor variants) — timestamp-based dumping with a SinkFunction was never wired up. Hitting this means the parser was configured to start replication by timestamp using the legacy SinkFunction dump path.

Source

Thrown at parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlConnection.java:255

                List<LogEvent> iterateEvents = decoder.processIterateDecode(event, context);
                if (!iterateEvents.isEmpty()) {
                    // 处理compress event
                    for (LogEvent itEvent : iterateEvents) {
                        if (!func.sink(event)) {
                            break;
                        }
                    }
                } else {
                    if (!func.sink(event)) {
                        break;
                    }
                }
            }
        }
    }

    public void dump(long timestamp, SinkFunction func) throws IOException {
        throw new NullPointerException("Not implement yet");
    }

    @Override
    public void dump(String binlogfilename, Long binlogPosition, MultiStageCoprocessor coprocessor) throws IOException {
        updateSettings();
        loadBinlogChecksum();
        loadVersionComment();
        sendRegisterSlave();
        sendBinlogDump(binlogfilename, binlogPosition);
        ((MysqlMultiStageCoprocessor) coprocessor).setConnection(this);
        ((MysqlMultiStageCoprocessor) coprocessor).setBinlogChecksum(binlogChecksum);
        ((MysqlMultiStageCoprocessor) coprocessor).setCompatiablePercona(compatiablePercona);
        try (DirectLogFetcher fetcher = new DirectLogFetcher(connector.getReceiveBufferSize())) {
            fetcher.start(connector.getChannel());
            while (fetcher.fetch()) {
                accumulateReceivedBytes(fetcher.limit());
                LogBuffer buffer = fetcher.duplicate();
                fetcher.consume(fetcher.limit());

View on GitHub (pinned to 87be50e876)

Solutions

  1. Supply a concrete binlog filename + position (journalName + position) instead of a bare timestamp so the dump(String,Long,SinkFunction) path is used.
  2. Enable GTID mode (canal.instance.gtidon=true) and provide a GTID set so dump(GTIDSet,...) is used.
  3. If you actually need timestamp-based subscription, use the coprocessor path (MultiStageCoprocessor) — but note dump(long,MultiStageCoprocessor) at line 282 is ALSO unimplemented, so timestamp dumping is unsupported entirely; resolve to filename/position or GTID.

Example fix

// before: timestamp-only position causes unimplemented dump
masterPosition = new EntryPosition();
masterPosition.setTimestamp(1690000000000L);
// after: provide filename + position
EntryPosition pos = new EntryPosition("mysql-bin.000001", 4L);
pos.setTimestamp(1690000000000L);
Defensive patterns

Strategy: validation

Validate before calling

// Before requesting a dump, ensure a timestamp-only start is never used
EntryPosition pos = resolveStartPosition();
if (pos.getJournalName() == null || pos.getJournalName().isEmpty()) {
    if (pos.getGtid() == null) {
        throw new IllegalArgumentException(
            "Timestamp-only start positions are unsupported by MysqlConnection.dump(long,SinkFunction). " +
            "Provide a binlog filename+position or enable GTID.");
    }
}

Prevention

When it happens

Trigger: Calling MysqlConnection.dump(long, SinkFunction) directly, or configuring the parser so that findStartPosition resolves to a timestamp-only entry position and the dump dispatch selects the timestamp+SinkFunction overload.

Common situations: Setting canal.instance.master.timestamp (or an EntryPosition with only a timestamp and no journalName/position) while the MultiStageCoprocessor is disabled, forcing the SinkFunction-based dump code path. Custom ErosaConnection usage that calls the timestamp dump overload.

Related errors


AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14). Data as JSON: /api/errors/7718bc85f1796340. Report an issue: GitHub.