apache/seatunnel · error · java.lang.UnsupportedOperationException

not supported create new Offset by timestamp.

Error message

not supported create new Offset by timestamp.

What it means

LsnOffsetFactory implements the Offset factory interface for DB2 CDC, but only supports creating offsets from filename+position (LSN). The timestamp(long) method is explicitly unsupported because DB2 LSN offsets cannot be derived from an arbitrary timestamp in this implementation.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/offset/LsnOffsetFactory.java:75

        } catch (Exception e) {
            throw new RuntimeException("Read the binlog offset error", e);
        }
    }

    @Override
    public Offset specific(Map<String, String> offset) {
        return LsnOffset.valueOf(offset);
    }

    @Override
    public Offset specific(String filename, Long position) {
        throw new UnsupportedOperationException(
                "not supported create new Offset by filename and position.");
    }

    @Override
    public Offset timestamp(long timestamp) {
        throw new UnsupportedOperationException("not supported create new Offset by timestamp.");
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Use an offset created via the LSN (filename+position) path instead of a timestamp
  2. Set the CDC start mode to initial or earliest rather than timestamp-based
  3. Provide a valid saved offset (LSN) from a previous run's checkpoint/state backend

Example fix

// before
Offset offset = new LsnOffsetFactory().timestamp(1700000000L);
// after
Offset offset = new LsnOffsetFactory().create(filename, lsnPosition);
Defensive patterns

Strategy: try-catch

Validate before calling

if (factory instanceof LsnOffsetFactory) { throw new IllegalArgumentException("timestamp-based offset not supported for DB2 CDC; use LSN offset"); }

Type guard

boolean supportsTimestamp = !(offsetFactory instanceof LsnOffsetFactory);

Try / catch

try { offset = factory.timestamp(ts); } catch (UnsupportedOperationException e) { offset = factory.create(lsnFile, lsnPos); }

Prevention

When it happens

Trigger: Calling LsnOffsetFactory.timestamp(long), typically when the CDC framework attempts to start or restart a snapshot/streaming split from a timestamp-based offset instead of a stored LSN offset.

Common situations: Restoring a job from a state/checkpoint that lacks a valid LSN offset and falls back to timestamp-based startup; configuring a start mode that requests offsets by timestamp; framework code that generically calls Offset.timestamp for offset negotiation.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/e20f81382423b168. Report an issue: GitHub.