Skip to content

Commit b493cbc

Browse files
tkaymakclaude
andcommitted
Remove dead snapshot.mode override in DebeziumIO.getRecordSchema
getRecordSchema copied the connector configuration, set snapshot.mode on the copy, then passed the original unmodified map to getOneRecord. The override therefore never took effect, and schema inference has always run with the connector's configured snapshot mode. Drop the dead copy rather than start honouring it. getOneRecord derives the schema by sampling an actual data record, so a schema-only snapshot would emit nothing and schema inference would fail with "could not fetch database schema". No behaviour change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 51b2ad6 commit b493cbc

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

  • sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium

sdks/java/io/debezium/src/main/java/org/apache/beam/io/debezium/DebeziumIO.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
import org.apache.beam.sdk.values.PCollection;
3737
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.base.Joiner;
3838
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Lists;
39-
import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.Maps;
4039
import org.apache.kafka.connect.source.SourceConnector;
4140
import org.apache.kafka.connect.source.SourceRecord;
4241
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -313,9 +312,9 @@ protected Schema getRecordSchema() {
313312
new KafkaSourceConsumerFn.OffsetTracker(
314313
new KafkaSourceConsumerFn.OffsetHolder(null, null, 0)));
315314

316-
Map<String, String> connectorConfig =
317-
Maps.newHashMap(getConnectorConfiguration().getConfigurationMap());
318-
connectorConfig.put("snapshot.mode", "schema_only");
315+
// Deliberately runs with the connector's configured snapshot mode: schema inference samples
316+
// an actual data record, which a schema-only snapshot ("no_data", formerly "schema_only")
317+
// would never emit.
319318
SourceRecord sampledRecord =
320319
fn.getOneRecord(getConnectorConfiguration().getConfigurationMap());
321320
fn.reset();

0 commit comments

Comments
 (0)