[FLINK-39391][cdc-connector] Propagate scan.snapshot.fetch.size to Debezium properties in Oracle, SqlServer, DB2, and Postgres connectors#4359
Conversation
…bezium properties in Oracle, SqlServer, DB2, and Postgres connectors The user-configured scan.snapshot.fetch.size is stored in JdbcSourceConfig.fetchSize but was never written into the Debezium Properties object. The snapshot execution path reads fetchSize from Debezium ConnectorConfig (query.fetch.size for Oracle/SqlServer/DB2, snapshot.fetch.size for Postgres) instead of JdbcSourceConfig, so the user value was silently ignored. For Oracle/SqlServer/DB2 this defaults to 0, which causes the JDBC driver to use its own default (e.g. Oracle defaults to fetchSize=10). On high-latency networks this leads to severe performance degradation (observed ~9x slowdown at 31ms RTT vs 3ms RTT). This commit propagates fetchSize into the corresponding Debezium property before the user-defined debezium properties override, so explicit debezium.query.fetch.size / debezium.snapshot.fetch.size overrides still take precedence. MySQL connector is not affected as it already sets database.fetchSize. Made-with: Cursor
… to Debezium properties Verify that scan.snapshot.fetch.size is correctly propagated to the underlying Debezium query.fetch.size (Oracle/SqlServer/DB2) and snapshot.fetch.size (Postgres) properties, including default value propagation and user-provided debezium property override behavior. Made-with: Cursor
|
Thank you for your contribution and i see that snapshot.fetch.size instand of |
|
Thanks for pointing this out. I checked the latest upstream master before updating the PR. The issue has not been fixed there yet: Oracle, SQLServer, and DB2 scan fetch tasks still read You are right that I have updated the PR accordingly:
I also ran the related factory/config tests locally and they passed. |
|
@yuxiqian cc |
This closes FLINK-39391.
The user-configured
scan.snapshot.fetch.sizeoption has no effect on the actual JDBCfetchSizeused during the incremental snapshot phase for Oracle, SqlServer, DB2, and Postgres connectors.The value is correctly parsed and stored in
JdbcSourceConfig.fetchSize, but is never written into the DebeziumPropertiesobject that the snapshot execution path actually reads.For Oracle/SqlServer/DB2, the snapshot task calls
connectorConfig.getQueryFetchSize(), which reads Debezium'squery.fetch.size— defaulting to0. This causes the JDBC driver to fall back to its own small default (e.g., Oracle defaults tofetchSize=10). On high-latency networks this results in order-of-magnitude performance degradation: ~440 rows/s instead of ~3,500 rows/s with 4 parallel readers on ~31ms RTT.For Postgres, the snapshot task reads
snapshot.fetch.sizewhich defaults to2000, so the impact is less severe but the user-configured value is still silently ignored.MySQL is NOT affected —
MySqlSourceConfigFactoryalready correctly setsprops.setProperty("database.fetchSize", ...).The fix adds a
props.setProperty()call in each affectedSourceConfigFactory.create()before thedbzProperties.putAll()block, so that explicit user overrides viadebezium.query.fetch.size/debezium.snapshot.fetch.sizestill take precedence.