Skip to content

Commit

Permalink
Remove sleep in E2EIncrementalTask.run
Browse files Browse the repository at this point in the history
  • Loading branch information
sandynz committed Sep 19, 2023
1 parent a3b4b7d commit 07a8d2c
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.shardingsphere.test.e2e.data.pipeline.cases.task;

import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
Expand All @@ -45,7 +44,6 @@
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;

@RequiredArgsConstructor
@Slf4j
Expand All @@ -72,27 +70,23 @@ public final class E2EIncrementalTask extends BaseIncrementTask {

private final int loopCount;

@SneakyThrows(InterruptedException.class)
@Override
public void run() {
List<Object[]> orderInsertData = PipelineCaseHelper.generateOrderInsertData(databaseType, primaryKeyGenerateAlgorithm, loopCount);
List<Object> primaryKeys = new LinkedList<>();
for (Object[] each : orderInsertData) {
primaryKeys.add(each[0]);
insertOrder(each);
TimeUnit.MILLISECONDS.sleep(100L);
}
ThreadLocalRandom random = ThreadLocalRandom.current();
for (int i = 0; i < Math.max(1, loopCount / 3); i++) {
// TODO 0000-00-00 00:00:00 now will cause consistency check failed of MySQL.
// DataSourceUtil.execute(dataSource, String.format("UPDATE %s SET t_datetime='0000-00-00 00:00:00' WHERE order_id = ?", orderTableName)
updateOrderById(primaryKeys.get(random.nextInt(0, primaryKeys.size())));
TimeUnit.MILLISECONDS.sleep(500L);
}
for (int i = 0; i < Math.max(1, loopCount / 3); i++) {
setNullToAllFields(primaryKeys.get(random.nextInt(0, primaryKeys.size())));
deleteOrderById(primaryKeys.remove(random.nextInt(0, primaryKeys.size())));
TimeUnit.MILLISECONDS.sleep(500L);
}
log.info("increment task runnable execute successfully.");
}
Expand Down

0 comments on commit 07a8d2c

Please sign in to comment.