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

Use Hikari Connection Pool for handling Clickhouse connections #893

Open
wants to merge 5 commits into
base: 2.5.0
Choose a base branch
from
Open
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions sink-connector-lightweight/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@
<!-- <scope>test</scope>-->
</dependency>

<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
Expand Down Expand Up @@ -319,6 +324,18 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
<version>1.8.2</version>
<scope>test</scope>
</dependency>
<dependency> <!-- necessary for Java 9+ -->
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.json.simple.parser.ParseException;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
Expand Down Expand Up @@ -85,7 +86,7 @@ public class DebeziumChangeEventCapture {
DebeziumEngine<ChangeEvent<SourceRecord, SourceRecord>> engine;

// Keep one clickhouse connection.
private ClickHouseConnection conn;
private Connection conn;

ClickHouseBatchWriter singleThreadedWriter;

Expand Down Expand Up @@ -189,7 +190,7 @@ private String getDatabaseName(SourceRecord sr) {
private BaseDbWriter createWriter(ClickHouseSinkConnectorConfig config, String databaseName) {
DBCredentials dbCredentials = parseDBConfiguration(config);
String jdbcUrl = BaseDbWriter.getConnectionString(dbCredentials.getHostName(), dbCredentials.getPort(), databaseName);
ClickHouseConnection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1", dbCredentials.getUserName(), dbCredentials.getPassword(), config);
Connection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1", dbCredentials.getUserName(), dbCredentials.getPassword(), config);
return new BaseDbWriter(dbCredentials.getHostName(), dbCredentials.getPort(), databaseName, dbCredentials.getUserName(), dbCredentials.getPassword(), config, conn);
}

Expand Down Expand Up @@ -353,7 +354,7 @@ private void createDatabaseForDebeziumStorage(ClickHouseSinkConnectorConfig conf

String jdbcUrl = BaseDbWriter.getConnectionString(dbCredentials.getHostName(), dbCredentials.getPort(),
"system");
ClickHouseConnection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",dbCredentials.getUserName(), dbCredentials.getPassword(), config);
Connection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",dbCredentials.getUserName(), dbCredentials.getPassword(), config);
BaseDbWriter writer = new BaseDbWriter(dbCredentials.getHostName(), dbCredentials.getPort(),
"system", dbCredentials.getUserName(),
dbCredentials.getPassword(), config, conn);
Expand Down Expand Up @@ -385,7 +386,7 @@ private void createViewForShowReplicaStatus(ClickHouseSinkConnectorConfig config

String jdbcUrl = BaseDbWriter.getConnectionString(dbCredentials.getHostName(), dbCredentials.getPort(),
"system");
ClickHouseConnection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",dbCredentials.getUserName(), dbCredentials.getPassword(), config);
Connection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",dbCredentials.getUserName(), dbCredentials.getPassword(), config);
BaseDbWriter writer = new BaseDbWriter(dbCredentials.getHostName(), dbCredentials.getPort(),
"system", dbCredentials.getUserName(),
dbCredentials.getPassword(), config, conn);
Expand Down Expand Up @@ -475,7 +476,7 @@ public String getDebeziumStorageStatus(ClickHouseSinkConnectorConfig config, Pro
log.error("**** Connection to ClickHouse is not established, re-initiating ****");
String jdbcUrl = BaseDbWriter.getConnectionString(dbCredentials.getHostName(), dbCredentials.getPort(),
databaseName);
ClickHouseConnection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
dbCredentials.getUserName(), dbCredentials.getPassword(), config);
writer = new BaseDbWriter(dbCredentials.getHostName(), dbCredentials.getPort(),
databaseName, dbCredentials.getUserName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -92,7 +93,7 @@

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"public");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
Expand All @@ -106,7 +107,7 @@


int tmCount = 0;
ResultSet chRs = writer.getConnection().prepareStatement("select count(*) from tm").executeQuery();

Check failure on line 110 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/ClickHouseDebeziumEmbeddedPostgresDecoderBufsDockerIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

ClickHouseDebeziumEmbeddedPostgresDecoderBufsDockerIT.testDecoderBufsPlugin

Code: 60. DB::Exception: Unknown table expression identifier 'tm' in scope SELECT count(*) FROM tm. (UNKNOWN_TABLE) (version 24.10.1.2812 (official build)) , server ClickHouseNode [uri=http://localhost:32774/system, options={custom_settings=allow_experimental_object_type=1,insert_allow_materialized_columns=1,client_name=Sink Connector Lightweight}]@-2083674500
Raw output
java.sql.BatchUpdateException: 
Code: 60. DB::Exception: Unknown table expression identifier 'tm' in scope SELECT count(*) FROM tm. (UNKNOWN_TABLE) (version 24.10.1.2812 (official build))
, server ClickHouseNode [uri=http://localhost:32774/system, options={custom_settings=allow_experimental_object_type=1,insert_allow_materialized_columns=1,client_name=Sink Connector Lightweight}]@-2083674500
	at com.altinity.clickhouse.debezium.embedded.ClickHouseDebeziumEmbeddedPostgresDecoderBufsDockerIT.testDecoderBufsPlugin(ClickHouseDebeziumEmbeddedPostgresDecoderBufsDockerIT.java:110)
while(chRs.next()) {
tmCount = chRs.getInt(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -96,7 +97,7 @@
// Create connection.
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"public");
ClickHouseConnection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
Expand All @@ -110,7 +111,7 @@


int tmCount = 0;
ResultSet chRs = writer.getConnection().prepareStatement("select count(*) from tm").executeQuery();

Check failure on line 114 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/ClickHouseDebeziumEmbeddedPostgresPgoutputDockerIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

ClickHouseDebeziumEmbeddedPostgresPgoutputDockerIT.testPgOutputPlugin

Code: 60. DB::Exception: Unknown table expression identifier 'tm' in scope SELECT count(*) FROM tm. (UNKNOWN_TABLE) (version 24.10.1.2812 (official build)) , server ClickHouseNode [uri=http://localhost:32774/system, options={custom_settings=allow_experimental_object_type=1,insert_allow_materialized_columns=1,client_name=Sink Connector Lightweight}]@-2083674500
Raw output
java.sql.BatchUpdateException: 
Code: 60. DB::Exception: Unknown table expression identifier 'tm' in scope SELECT count(*) FROM tm. (UNKNOWN_TABLE) (version 24.10.1.2812 (official build))
, server ClickHouseNode [uri=http://localhost:32774/system, options={custom_settings=allow_experimental_object_type=1,insert_allow_materialized_columns=1,client_name=Sink Connector Lightweight}]@-2083674500
	at com.altinity.clickhouse.debezium.embedded.ClickHouseDebeziumEmbeddedPostgresPgoutputDockerIT.testPgOutputPlugin(ClickHouseDebeziumEmbeddedPostgresPgoutputDockerIT.java:114)
while(chRs.next()) {
tmCount = chRs.getInt(1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
// Create connection to clickhouse and validate if the tables are replicated.
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"system");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
Expand All @@ -135,7 +135,7 @@
// query clickhouse connection and get data for test_table1 and test_table2


ResultSet rs = writer.executeQueryWithResultSet("SELECT * FROM employees.audience");

Check failure on line 138 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/MariaDBIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

MariaDBIT.testMultipleDatabases

Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
Raw output
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
	at com.altinity.clickhouse.debezium.embedded.MariaDBIT.testMultipleDatabases(MariaDBIT.java:138)
// Validate the data
boolean recordFound = false;
while(rs.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@
Thread.sleep(20000);

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(), "employees");
ClickHouseConnection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
Connection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, connection);
Map<String, String> columnsToDataTypeMap = writer.getColumnsDataTypesForTable("contacts");

Assert.assertTrue(columnsToDataTypeMap.get("id").equalsIgnoreCase("Int32"));

Check failure on line 107 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/MySQLGenerateColumnsTest.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

MySQLGenerateColumnsTest.testMySQLGeneratedColumns

Cannot invoke "String.equalsIgnoreCase(String)" because the return value of "java.util.Map.get(Object)" is null
Raw output
java.lang.NullPointerException: Cannot invoke "String.equalsIgnoreCase(String)" because the return value of "java.util.Map.get(Object)" is null
	at com.altinity.clickhouse.debezium.embedded.MySQLGenerateColumnsTest.testMySQLGeneratedColumns(MySQLGenerateColumnsTest.java:107)
Assert.assertTrue(columnsToDataTypeMap.get("first_name").equalsIgnoreCase("String"));
Assert.assertTrue(columnsToDataTypeMap.get("last_name").equalsIgnoreCase("String"));
Assert.assertTrue(columnsToDataTypeMap.get("fullname").equalsIgnoreCase("Nullable(String)"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
// Create connection to clickhouse and validate if the tables are replicated.
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"system");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
Expand All @@ -128,7 +128,7 @@
// query clickhouse connection and get data for test_table1 and test_table2


ResultSet rs = writer.executeQueryWithResultSet("SELECT * FROM employees.audience");

Check failure on line 131 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/MySQLJsonIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

MySQLJsonIT.testMultipleDatabases

Code: 60. DB::Exception: Unknown table expression identifier 'employees.audience' in scope SELECT * FROM employees.audience. (UNKNOWN_TABLE) (version 24.10.1.2812 (official build)) , server ClickHouseNode [uri=http://localhost:32774/system, options={custom_settings=allow_experimental_object_type=1,insert_allow_materialized_columns=1,client_name=Sink Connector Lightweight}]@-2083674500
Raw output
java.sql.BatchUpdateException: 
Code: 60. DB::Exception: Unknown table expression identifier 'employees.audience' in scope SELECT * FROM employees.audience. (UNKNOWN_TABLE) (version 24.10.1.2812 (official build))
, server ClickHouseNode [uri=http://localhost:32774/system, options={custom_settings=allow_experimental_object_type=1,insert_allow_materialized_columns=1,client_name=Sink Connector Lightweight}]@-2083674500
	at com.altinity.clickhouse.debezium.embedded.MySQLJsonIT.testMultipleDatabases(MySQLJsonIT.java:131)
// Validate the data
boolean recordFound = false;
while(rs.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -93,13 +94,13 @@

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"public");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"public", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, chConn);
Map<String, String> tmColumns = writer.getColumnsDataTypesForTable("tm");
Assert.assertTrue(tmColumns.size() == 22);

Check failure on line 103 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/PostgresInitialDockerIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

PostgresInitialDockerIT.testDecoderBufsPlugin

java.lang.AssertionError at com.altinity.clickhouse.debezium.embedded.PostgresInitialDockerIT.testDecoderBufsPlugin(PostgresInitialDockerIT.java:103)
Raw output
java.lang.AssertionError
	at com.altinity.clickhouse.debezium.embedded.PostgresInitialDockerIT.testDecoderBufsPlugin(PostgresInitialDockerIT.java:103)
Assert.assertTrue(tmColumns.get("id").equalsIgnoreCase("UUID"));
Assert.assertTrue(tmColumns.get("secid").equalsIgnoreCase("Nullable(UUID)"));
//Assert.assertTrue(tmColumns.get("am").equalsIgnoreCase("Nullable(Decimal(21,5))"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.utility.DockerImageName;

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -116,13 +117,13 @@

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"public");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"public", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, chConn);
Map<String, String> tmColumns = writer.getColumnsDataTypesForTable("tm");
Assert.assertTrue(tmColumns.size() == 22);

Check failure on line 126 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/PostgresInitialDockerWKeeperMapStorageIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

PostgresInitialDockerWKeeperMapStorageIT.testDecoderBufsPlugin

java.lang.AssertionError at com.altinity.clickhouse.debezium.embedded.PostgresInitialDockerWKeeperMapStorageIT.testDecoderBufsPlugin(PostgresInitialDockerWKeeperMapStorageIT.java:126)
Raw output
java.lang.AssertionError
	at com.altinity.clickhouse.debezium.embedded.PostgresInitialDockerWKeeperMapStorageIT.testDecoderBufsPlugin(PostgresInitialDockerWKeeperMapStorageIT.java:126)
Assert.assertTrue(tmColumns.get("id").equalsIgnoreCase("UUID"));
Assert.assertTrue(tmColumns.get("secid").equalsIgnoreCase("Nullable(UUID)"));
//Assert.assertTrue(tmColumns.get("am").equalsIgnoreCase("Nullable(Decimal(21,5))"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
// Create connection.
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"public");
ClickHouseConnection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection conn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
Expand All @@ -125,7 +125,7 @@
tmCount = chRs.getInt(1);
}

Assert.assertTrue(tmCount == 2);

Check failure on line 128 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/PostgresPgoutputMultipleSchemaIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

PostgresPgoutputMultipleSchemaIT.testMultipleSchemaReplication

java.lang.AssertionError at com.altinity.clickhouse.debezium.embedded.PostgresPgoutputMultipleSchemaIT.testMultipleSchemaReplication(PostgresPgoutputMultipleSchemaIT.java:128)
Raw output
java.lang.AssertionError
	at com.altinity.clickhouse.debezium.embedded.PostgresPgoutputMultipleSchemaIT.testMultipleSchemaReplication(PostgresPgoutputMultipleSchemaIT.java:128)


int tm2Count = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@
Connection conn = ITCommon.connectToMySQL(mySqlContainer);

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(), "employees");
ClickHouseConnection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
Connection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, connection);

ResultSet rs = writer.executeQueryWithResultSet("show create table string_types_MEDIUMTEXT_utf8mb4");

Check failure on line 109 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/ReplicatedRMTClickHouse22TIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

ReplicatedRMTClickHouse22TIT.testReplicatedRMTAutoCreate{String}[1]

Code: 390. DB::Exception: Table `string_types_MEDIUMTEXT_utf8mb4` doesn't exist. (CANNOT_GET_CREATE_TABLE_QUERY) (version 24.10.1.2812 (official build)) , server ClickHouseNode [uri=http://localhost:32774/system, options={custom_settings=allow_experimental_object_type=1,insert_allow_materialized_columns=1,client_name=Sink Connector Lightweight}]@-2083674500
Raw output
java.sql.BatchUpdateException: 
Code: 390. DB::Exception: Table `string_types_MEDIUMTEXT_utf8mb4` doesn't exist. (CANNOT_GET_CREATE_TABLE_QUERY) (version 24.10.1.2812 (official build))
, server ClickHouseNode [uri=http://localhost:32774/system, options={custom_settings=allow_experimental_object_type=1,insert_allow_materialized_columns=1,client_name=Sink Connector Lightweight}]@-2083674500
	at com.altinity.clickhouse.debezium.embedded.ReplicatedRMTClickHouse22TIT.testReplicatedRMTAutoCreate(ReplicatedRMTClickHouse22TIT.java:109)
// Validate that all the tables are created.
boolean resultValidated = false;
while(rs.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@
Connection conn = ITCommon.connectToMySQL(mySqlContainer);

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(), "employees");
ClickHouseConnection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
Connection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, connection);

ResultSet rs = writer.executeQueryWithResultSet("show create table string_types_MEDIUMTEXT_utf8mb4");

Check failure on line 111 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/ReplicatedRMTDDLClickHouse22TIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

ReplicatedRMTDDLClickHouse22TIT.testReplicatedRMTAutoCreate{String}[1]

Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
Raw output
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
	at com.altinity.clickhouse.debezium.embedded.ReplicatedRMTDDLClickHouse22TIT.testReplicatedRMTAutoCreate(ReplicatedRMTDDLClickHouse22TIT.java:111)
// Validate that all the tables are created.
boolean resultValidated = false;
while(rs.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
Connection conn = ITCommon.connectToMySQL(mySqlContainer);

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(), "employees");
ClickHouseConnection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
Connection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, connection);

ResultSet rs = writer.executeQueryWithResultSet("show create table string_types_MEDIUMTEXT_utf8mb4");

Check failure on line 114 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/ReplicatedRMTDDLIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

ReplicatedRMTDDLIT.testReplicatedRMTAutoCreate{String}[1]

Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
Raw output
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
	at com.altinity.clickhouse.debezium.embedded.ReplicatedRMTDDLIT.testReplicatedRMTAutoCreate(ReplicatedRMTDDLIT.java:114)
// Validate that all the tables are created.
boolean resultValidated = false;
while(rs.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@
Connection conn = ITCommon.connectToMySQL(mySqlContainer);

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(), "employees");
ClickHouseConnection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
Connection connection = BaseDbWriter.createConnection(jdbcUrl, "client_1", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, connection);

ResultSet rs = writer.executeQueryWithResultSet("show create table string_types_MEDIUMTEXT_utf8mb4");

Check failure on line 112 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/ReplicatedRMTIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

ReplicatedRMTIT.testReplicatedRMTAutoCreate{String}[1]

Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
Raw output
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
	at com.altinity.clickhouse.debezium.embedded.ReplicatedRMTIT.testReplicatedRMTAutoCreate(ReplicatedRMTIT.java:112)
// Validate that all the tables are created.
boolean resultValidated = false;
while(rs.next()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public void testBatchRetryOnCHFailure() throws Exception {
// Check if Batch was inserted.
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void testClickHouseDelayedStart() throws Exception {
// Check if Batch was inserted.
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));

BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
Expand Down Expand Up @@ -148,7 +148,7 @@ public void debeziumStorageView() throws Exception {
// Connect to clickhouse and validate that the view was created successfully.
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"altinity_sink_connector");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"altinity_sink_connector", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, chConn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@
// Validate in Clickhouse the last record written is 29999
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"system");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, chConn);

long col2 = 0L;
ResultSet version1Result = writer.executeQueryWithResultSet("select col2 from employees2.newtable final where col1 = 'a'");

Check failure on line 128 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/cdc/DatabaseOverrideIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

DatabaseOverrideIT.testDatabaseOverride

Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
Raw output
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
	at com.altinity.clickhouse.debezium.embedded.cdc.DatabaseOverrideIT.testDatabaseOverride(DatabaseOverrideIT.java:128)
while(version1Result.next()) {
col2 = version1Result.getLong("col2");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@
// Validate in Clickhouse the last record written is 29999
String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"system");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, chConn);

long col2 = 0L;
ResultSet version1Result = writer.executeQueryWithResultSet("select col2 from employees2.newtable final where col1 = 'a'");

Check failure on line 111 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/cdc/DatabaseOverrideInitialIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

DatabaseOverrideInitialIT.testDatabaseOverride

Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
Raw output
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
	at com.altinity.clickhouse.debezium.embedded.cdc.DatabaseOverrideInitialIT.testDatabaseOverride(DatabaseOverrideInitialIT.java:111)
while(version1Result.next()) {
col2 = version1Result.getLong("col2");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@

String jdbcUrl = BaseDbWriter.getConnectionString(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"system");
ClickHouseConnection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
Connection chConn = BaseDbWriter.createConnection(jdbcUrl, "Client_1",
clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), new ClickHouseSinkConnectorConfig(new HashMap<>()));
BaseDbWriter writer = new BaseDbWriter(clickHouseContainer.getHost(), clickHouseContainer.getFirstMappedPort(),
"employees", clickHouseContainer.getUsername(), clickHouseContainer.getPassword(), null, chConn);

writer.executeQuery("CREATE DATABASE employees2");

Check failure on line 94 in sink-connector-lightweight/src/test/java/com/altinity/clickhouse/debezium/embedded/cdc/DatabaseOverrideRRMTIT.java

View workflow job for this annotation

GitHub Actions / JUnit Test Report

DatabaseOverrideRRMTIT.testDatabaseOverride

Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
Raw output
java.lang.NullPointerException: Cannot invoke "java.sql.Connection.prepareStatement(String)" because "this.conn" is null
	at com.altinity.clickhouse.debezium.embedded.cdc.DatabaseOverrideRRMTIT.testDatabaseOverride(DatabaseOverrideRRMTIT.java:94)
writer.executeQuery("CREATE DATABASE productsnew");

Thread.sleep(10000);
Expand Down
Loading
Loading