From fd8327b38bf78738fe18bc0f29551de7c1b383f9 Mon Sep 17 00:00:00 2001 From: Kanthi Subramanian Date: Fri, 13 Sep 2024 18:21:00 -0400 Subject: [PATCH] Added Batch execution time. --- .../sink/connector/db/batch/PreparedStatementExecutor.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sink-connector/src/main/java/com/altinity/clickhouse/sink/connector/db/batch/PreparedStatementExecutor.java b/sink-connector/src/main/java/com/altinity/clickhouse/sink/connector/db/batch/PreparedStatementExecutor.java index a7b321d08..c7bc0d46f 100644 --- a/sink-connector/src/main/java/com/altinity/clickhouse/sink/connector/db/batch/PreparedStatementExecutor.java +++ b/sink-connector/src/main/java/com/altinity/clickhouse/sink/connector/db/batch/PreparedStatementExecutor.java @@ -108,7 +108,7 @@ private boolean executePreparedStatement(String insertQuery, String topicName, BlockMetaData bmd, ClickHouseSinkConnectorConfig config, ClickHouseConnection conn, String tableName, Map columnToDataTypeMap, DBMetadata.TABLE_ENGINE engine) throws RuntimeException { - + long batchStartTime = System.currentTimeMillis(); AtomicBoolean result = new AtomicBoolean(false); long maxRecordsInBatch = config.getLong(ClickHouseSinkConnectorConfigVariables.BUFFER_MAX_RECORDS.toString()); List failedRecords = new ArrayList<>(); @@ -158,13 +158,13 @@ private boolean executePreparedStatement(String insertQuery, String topicName, // ToDo: should we check for EXECUTE_FAILED int[] batchResult = ps.executeBatch(); - + long batchExecutionTime = System.currentTimeMillis() - batchStartTime; long taskId = config.getLong(ClickHouseSinkConnectorConfigVariables.TASK_ID.toString()); log.info("*************** EXECUTED BATCH Successfully " + "Records: " + batch.size() + "************** " + "task(" + taskId + ")" + " Thread ID: " + Thread.currentThread().getName() + " Result: " + batchResult.toString() + " Database: " - + databaseName + " Table: " + tableName); + + databaseName + " Table: " + tableName + " Time: " + batchExecutionTime + " ms"); result.set(true);