This commit is contained in:
zyyang 2020-12-22 11:32:50 +08:00
parent 6b538b4afb
commit fd8fa36dd7
3 changed files with 3 additions and 7 deletions

View File

@ -87,7 +87,7 @@ public class TaosDemoApplication {
start = System.currentTimeMillis();
// multi threads to insert
int affectedRows = subTableService.insertAutoCreateTable(superTableMeta, threadSize, tableSize, startTime, gap, config);
int affectedRows = subTableService.insertMultiThreads(superTableMeta, threadSize, tableSize, startTime, gap, config);
end = System.currentTimeMillis();
logger.info("insert " + affectedRows + " rows, time cost: " + (end - start) + " ms");
/**********************************************************************************/
@ -100,7 +100,7 @@ public class TaosDemoApplication {
private static long getProperStartTime(long startTime, int keep) {
Instant now = Instant.now();
long earliest = now.minus(Duration.ofDays(keep)).toEpochMilli();
long earliest = now.minus(Duration.ofDays(keep+1)).toEpochMilli();
if (startTime == 0 || startTime < earliest) {
startTime = earliest;
}

View File

@ -76,7 +76,7 @@ public class SubTableService extends AbstractService {
return mapper.insertMultiTableMultiValuesUsingSuperTable(subTableValues);
}
public int insertAutoCreateTable(SuperTableMeta superTableMeta, int threadSize, long tableSize, long startTime, long gap, JdbcTaosdemoConfig config) {
public int insertMultiThreads(SuperTableMeta superTableMeta, int threadSize, long tableSize, long startTime, long gap, JdbcTaosdemoConfig config) {
long start = System.currentTimeMillis();
List<FutureTask> taskList = new ArrayList<>();

View File

@ -141,10 +141,6 @@ public class SqlSpeller {
public static String createTable(TableMeta tableMeta) {
// create table if not exists ${database}.${name}
// <foreach collection="fields" item="field" index="index" open="(" close=")" separator=",">
// ${field.name} ${field.type}
// </foreach>
StringBuilder sb = new StringBuilder();
sb.append("create table if not exists ").append(tableMeta.getDatabase()).append(".").append(tableMeta.getName()).append(" ");
String fields = tableMeta.getFields().stream()