Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBZ-7616 Add query timeout on JdbcConnection controlled by query.timeout.ms property #5483

Merged
merged 4 commits into from Apr 22, 2024

Conversation

mfvitale
Copy link
Member

@mfvitale mfvitale force-pushed the DBZ-7616 branch 2 times, most recently from 7421997 to e2ec02a Compare April 12, 2024 08:08
@mfvitale mfvitale marked this pull request as draft April 12, 2024 08:12
@mfvitale mfvitale force-pushed the DBZ-7616 branch 3 times, most recently from fc6566e to a2cdefb Compare April 15, 2024 10:33
@mfvitale
Copy link
Member Author

mfvitale commented Apr 15, 2024

Note about the 'MariaDB/MySQL" changes:

Adding query timeout with statement.setQueryTimeout() will produce query prefixed with SET STATEMENT max_statement_time=60 FOR SELECT * for MariaDB.

Before this PR all statement starting with SET STATEMENT .* was skipped by ddl.filter properties due to some automatic query done by Amazon RDS prefixed with the query time out statement. The side effect of that was that an user DDL starting with SET STATEMENT .* was also, IMHO, wrongly skipped.

After this PR just the statement from Amazon RDS will be skipped meanwhile the others will be correctly processed.

@Naros This can maybe be relevant for your Maria DB stuff.

@mfvitale
Copy link
Member Author

Seems that this change lead to an issue with Informix

After sometimes I started to see tests failing with

2024-04-15 16:10:07,205 ERROR IncrementalSnapshotIT||engine Engine has failed with  [io.debezium.embedded.async.AsyncEmbeddedEngine]
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Couldn't obtain database name
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at io.debezium.embedded.async.AsyncEmbeddedEngine.startSourceTasks(AsyncEmbeddedEngine.java:411)
	at io.debezium.embedded.async.AsyncEmbeddedEngine.run(AsyncEmbeddedEngine.java:202)
	at io.debezium.embedded.async.TestingAsyncEmbeddedEngine.run(TestingAsyncEmbeddedEngine.java:27)
	at io.debezium.embedded.AbstractConnectorTest.lambda$start$8(AbstractConnectorTest.java:423)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Couldn't obtain database name
	at io.debezium.connector.informix.InformixConnection.retrieveRealDatabaseName(InformixConnection.java:112)
	at io.debezium.connector.informix.InformixConnection.<init>(InformixConnection.java:80)
	at io.debezium.connector.informix.InformixConnectorTask.lambda$start$0(InformixConnectorTask.java:73)
	at io.debezium.jdbc.DefaultMainConnectionProvidingConnectionFactory.newConnection(DefaultMainConnectionProvidingConnectionFactory.java:26)
	at io.debezium.connector.informix.InformixConnectorTask.start(InformixConnectorTask.java:97)
	at io.debezium.connector.common.BaseSourceTask.start(BaseSourceTask.java:240)
	at io.debezium.embedded.async.AsyncEmbeddedEngine.lambda$startSourceTasks$2(AsyncEmbeddedEngine.java:394)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	... 3 common frames omitted
Caused by: java.sql.SQLException: Cannot create a user thread.
	at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1348)
	at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:167)
	at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$1(JdbcConnection.java:246)
	at io.debezium.jdbc.JdbcConnection$ConnectionFactoryDecorator.connect(JdbcConnection.java:132)
	at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:894)
	at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:889)
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:633)
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:506)
	at io.debezium.connector.informix.InformixConnection.retrieveRealDatabaseName(InformixConnection.java:109)
	... 12 common frames omitted
Caused by: com.informix.asf.IfxASFRemoteException: 
	at com.informix.asf.Connection.recvConnectionResponse(Connection.java:589)
	at com.informix.asf.Connection.establishConnection(Connection.java:1418)
	at com.informix.asf.Connection.connect(Connection.java:333)
	at com.informix.asf.Connection.<init>(Connection.java:325)
	at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1248)
	... 20 common frames omitted

and the database starts to log

14:09:49.083 IFX >>>2024-04-15 14:09:49.083  Warning: The IBM IDS Developer Edition license restriction limits
14:09:49.083 IFX >>>2024-04-15 14:09:49.083  the number of connections to this server to 25.
14:09:49.083 IFX >>>2024-04-15 14:09:49.083  You already have 25 connections at this time. Any further connections
14:09:49.083 IFX >>>2024-04-15 14:09:49.083  attempts will be rejected.

@nrkljo any hint/idea?

@Naros
Copy link
Member

Naros commented Apr 15, 2024

Adding a note here so it gets recorded in the PR #5434, need to review these and incorporate once merged.

@mfvitale
Copy link
Member Author

Seems that this change lead to an issue with Informix

After sometimes I started to see tests failing with

2024-04-15 16:10:07,205 ERROR IncrementalSnapshotIT||engine Engine has failed with  [io.debezium.embedded.async.AsyncEmbeddedEngine]
java.util.concurrent.ExecutionException: java.lang.RuntimeException: Couldn't obtain database name
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at io.debezium.embedded.async.AsyncEmbeddedEngine.startSourceTasks(AsyncEmbeddedEngine.java:411)
	at io.debezium.embedded.async.AsyncEmbeddedEngine.run(AsyncEmbeddedEngine.java:202)
	at io.debezium.embedded.async.TestingAsyncEmbeddedEngine.run(TestingAsyncEmbeddedEngine.java:27)
	at io.debezium.embedded.AbstractConnectorTest.lambda$start$8(AbstractConnectorTest.java:423)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Couldn't obtain database name
	at io.debezium.connector.informix.InformixConnection.retrieveRealDatabaseName(InformixConnection.java:112)
	at io.debezium.connector.informix.InformixConnection.<init>(InformixConnection.java:80)
	at io.debezium.connector.informix.InformixConnectorTask.lambda$start$0(InformixConnectorTask.java:73)
	at io.debezium.jdbc.DefaultMainConnectionProvidingConnectionFactory.newConnection(DefaultMainConnectionProvidingConnectionFactory.java:26)
	at io.debezium.connector.informix.InformixConnectorTask.start(InformixConnectorTask.java:97)
	at io.debezium.connector.common.BaseSourceTask.start(BaseSourceTask.java:240)
	at io.debezium.embedded.async.AsyncEmbeddedEngine.lambda$startSourceTasks$2(AsyncEmbeddedEngine.java:394)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	... 3 common frames omitted
Caused by: java.sql.SQLException: Cannot create a user thread.
	at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1348)
	at com.informix.jdbc.IfxDriver.connect(IfxDriver.java:167)
	at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$1(JdbcConnection.java:246)
	at io.debezium.jdbc.JdbcConnection$ConnectionFactoryDecorator.connect(JdbcConnection.java:132)
	at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:894)
	at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:889)
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:633)
	at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:506)
	at io.debezium.connector.informix.InformixConnection.retrieveRealDatabaseName(InformixConnection.java:109)
	... 12 common frames omitted
Caused by: com.informix.asf.IfxASFRemoteException: 
	at com.informix.asf.Connection.recvConnectionResponse(Connection.java:589)
	at com.informix.asf.Connection.establishConnection(Connection.java:1418)
	at com.informix.asf.Connection.connect(Connection.java:333)
	at com.informix.asf.Connection.<init>(Connection.java:325)
	at com.informix.jdbc.IfxSqliConnect.<init>(IfxSqliConnect.java:1248)
	... 20 common frames omitted

and the database starts to log

14:09:49.083 IFX >>>2024-04-15 14:09:49.083  Warning: The IBM IDS Developer Edition license restriction limits
14:09:49.083 IFX >>>2024-04-15 14:09:49.083  the number of connections to this server to 25.
14:09:49.083 IFX >>>2024-04-15 14:09:49.083  You already have 25 connections at this time. Any further connections
14:09:49.083 IFX >>>2024-04-15 14:09:49.083  attempts will be rejected.

@nrkljo any hint/idea?

This should solve the Informix issue debezium/debezium-connector-informix#46

@mfvitale
Copy link
Member Author

/packit test --labels oracle

@nrkljo
Copy link
Contributor

nrkljo commented Apr 16, 2024

@mfvitale I believe you're on to something there. The connection limit in Informix Developer Edition sometimes creates problems and better reuse of connections should adress this, to som extent...

@mfvitale
Copy link
Member Author

/packit test --labels oracle

@mfvitale
Copy link
Member Author

/packit test --identifier oracle-21-xs

@mfvitale mfvitale marked this pull request as ready for review April 17, 2024 13:45
@mfvitale
Copy link
Member Author

/packit test --labels oracle

@mfvitale
Copy link
Member Author

/packit test --labels oracle

Copy link
Contributor

@jpechane jpechane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfvitale LGTM, thanks! I left one comment related to using inhertiance instead of condition. When addressed and CI passes please feel free to merge PR yourself.

@mfvitale
Copy link
Member Author

/packit test --labels oracle

@mfvitale mfvitale merged commit 7ee8935 into debezium:main Apr 22, 2024
36 of 39 checks passed
@mfvitale mfvitale deleted the DBZ-7616 branch April 22, 2024 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants