Skip to content

Commit 9a94ae6

Browse files
committed
Forced flashing to disk when wait_async_insert=1
1 parent 2559750 commit 9a94ae6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

jdbc-v2/src/test/java/com/clickhouse/jdbc/StatementTest.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import java.util.List;
2727
import java.util.Map;
2828
import java.util.Properties;
29+
import java.util.UUID;
2930
import java.util.concurrent.CountDownLatch;
3031

3132
import static org.testng.Assert.assertEquals;
@@ -273,20 +274,24 @@ public static Object[][] asyncInsertSettingsDP() {
273274
{ServerSettings.OFF, ServerSettings.OFF, ASYNC_INSERT_SETTINGS_DP_ROWS, ASYNC_INSERT_SETTINGS_DP_ROWS},
274275
{ServerSettings.OFF, ServerSettings.ON, ASYNC_INSERT_SETTINGS_DP_ROWS, ASYNC_INSERT_SETTINGS_DP_ROWS},
275276
{ServerSettings.ON, ServerSettings.OFF, 0, -1},
276-
{ServerSettings.ON, ServerSettings.ON, 0, ASYNC_INSERT_SETTINGS_DP_ROWS}
277+
{ServerSettings.ON, ServerSettings.ON, ASYNC_INSERT_SETTINGS_DP_ROWS, ASYNC_INSERT_SETTINGS_DP_ROWS}
277278
};
278279
}
279280

280281
@Test(groups = {"integration"}, dataProvider = "asyncInsertSettingsDP")
281282
public void testInsertWithAsyncInsert(String asyncInsert, String waitAsyncInsert, int expectedUpdateCount, int expectedSelectCount) throws Exception {
282-
String tableName = "test_async_insert_param_" + asyncInsert + "_" + waitAsyncInsert;
283+
String tableName = "test_async_insert_param_" + asyncInsert + "_" + waitAsyncInsert + "_" + UUID.randomUUID().toString().replace("-", "_");
283284

284285
Properties props = new Properties();
285286
props.setProperty(ClientConfigProperties.serverSetting(ServerSettings.ASYNC_INSERT), asyncInsert);
286287
props.setProperty(ClientConfigProperties.serverSetting(ServerSettings.WAIT_ASYNC_INSERT), waitAsyncInsert);
287288
// Wait end of query off for isolation of this logic
288289
props.setProperty(ClientConfigProperties.serverSetting(ServerSettings.WAIT_END_OF_QUERY), ServerSettings.OFF);
289-
props.setProperty(ClientConfigProperties.serverSetting("insert_deduplicate"), ServerSettings.OFF);
290+
291+
if (waitAsyncInsert.equals(ServerSettings.ON)) {
292+
// make it flash to disk to check that we get result. If buffer is bigger server may wait flashing to disk.
293+
props.setProperty(ClientConfigProperties.serverSetting("async_insert_max_data_size"), "3488890");
294+
}
290295

291296
try (Connection conn = getJdbcConnection(props)) {
292297
try (Statement stmt = conn.createStatement()) {

0 commit comments

Comments
 (0)