Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,18 @@ public class MongoDBDatabaseSync extends DatabaseSync {
.noDefaultValue()
.withDescription("Table name of the Mongo database to monitor.");

public static final ConfigOption<Integer> SPLIT_META_GROUP_SIZE =
ConfigOptions.key("split.meta.group.size")
.intType()
.noDefaultValue()
.withDescription("The meta group size of split.");

public static final ConfigOption<Boolean> CLOSE_IDLE_READERS =
ConfigOptions.key("close.idle.readers")
.booleanType()
.defaultValue(false)
.withDescription("Whether to close idle readers.");

public MongoDBDatabaseSync() throws SQLException {}

@Override
Expand Down Expand Up @@ -222,6 +234,19 @@ public DataStreamSource<String> buildCdcSource(StreamExecutionEnvironment env) {
default:
throw new IllegalArgumentException("Unsupported startup mode: " + startupMode);
}

config.getOptional(MongoDBSourceOptions.SCAN_INCREMENTAL_SNAPSHOT_CHUNK_SIZE_MB)
.ifPresent(mongoDBSourceBuilder::splitSizeMB);
config.getOptional(MongoDBSourceOptions.SCAN_INCREMENTAL_SNAPSHOT_CHUNK_SAMPLES)
.ifPresent(mongoDBSourceBuilder::samplesPerChunk);
config.getOptional(SPLIT_META_GROUP_SIZE).ifPresent(mongoDBSourceBuilder::splitMetaGroupSize);
config.getOptional(CLOSE_IDLE_READERS)
.ifPresent(mongoDBSourceBuilder::closeIdleReaders);
config.getOptional(MongoDBSourceOptions.FULL_DOCUMENT_PRE_POST_IMAGE)
.ifPresent(mongoDBSourceBuilder::scanFullChangelog);
config.getOptional(MongoDBSourceOptions.SCAN_NO_CURSOR_TIMEOUT)
.ifPresent(mongoDBSourceBuilder::disableCursorTimeout);

MongoDBSource<String> mongoDBSource = mongoDBSourceBuilder.deserializer(schema).build();
return env.fromSource(mongoDBSource, WatermarkStrategy.noWatermarks(), "MongoDB Source");
}
Expand Down