|
26 | 26 | import java.util.List; |
27 | 27 | import java.util.Map; |
28 | 28 | import java.util.Properties; |
| 29 | +import java.util.UUID; |
29 | 30 | import java.util.concurrent.CountDownLatch; |
30 | 31 |
|
31 | 32 | import static org.testng.Assert.assertEquals; |
@@ -273,20 +274,24 @@ public static Object[][] asyncInsertSettingsDP() { |
273 | 274 | {ServerSettings.OFF, ServerSettings.OFF, ASYNC_INSERT_SETTINGS_DP_ROWS, ASYNC_INSERT_SETTINGS_DP_ROWS}, |
274 | 275 | {ServerSettings.OFF, ServerSettings.ON, ASYNC_INSERT_SETTINGS_DP_ROWS, ASYNC_INSERT_SETTINGS_DP_ROWS}, |
275 | 276 | {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} |
277 | 278 | }; |
278 | 279 | } |
279 | 280 |
|
280 | 281 | @Test(groups = {"integration"}, dataProvider = "asyncInsertSettingsDP") |
281 | 282 | 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("-", "_"); |
283 | 284 |
|
284 | 285 | Properties props = new Properties(); |
285 | 286 | props.setProperty(ClientConfigProperties.serverSetting(ServerSettings.ASYNC_INSERT), asyncInsert); |
286 | 287 | props.setProperty(ClientConfigProperties.serverSetting(ServerSettings.WAIT_ASYNC_INSERT), waitAsyncInsert); |
287 | 288 | // Wait end of query off for isolation of this logic |
288 | 289 | 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 | + } |
290 | 295 |
|
291 | 296 | try (Connection conn = getJdbcConnection(props)) { |
292 | 297 | try (Statement stmt = conn.createStatement()) { |
|
0 commit comments