change
This commit is contained in:
parent
057d90b4b9
commit
1bdcc0f186
|
@ -104,9 +104,9 @@ public class TaosDemoCommandLineRunner implements CommandLineRunner {
|
|||
private void insertTask(JdbcTaosdemoConfig config) {
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
int numOfTables = config.numOfTables;
|
||||
long numOfTables = config.numOfTables;
|
||||
int numOfTablesPerSQL = config.numOfTablesPerSQL;
|
||||
int numOfRowsPerTable = config.numOfRowsPerTable;
|
||||
long numOfRowsPerTable = config.numOfRowsPerTable;
|
||||
int numOfValuesPerSQL = config.numOfValuesPerSQL;
|
||||
|
||||
Instant now = Instant.now();
|
||||
|
@ -116,22 +116,22 @@ public class TaosDemoCommandLineRunner implements CommandLineRunner {
|
|||
}
|
||||
|
||||
if (numOfRowsPerTable < numOfValuesPerSQL)
|
||||
numOfValuesPerSQL = numOfRowsPerTable;
|
||||
numOfValuesPerSQL = (int) numOfRowsPerTable;
|
||||
if (numOfTables < numOfTablesPerSQL)
|
||||
numOfTablesPerSQL = numOfTables;
|
||||
numOfTablesPerSQL = (int) numOfTables;
|
||||
|
||||
long timeCost = 0;
|
||||
|
||||
// row
|
||||
for (int rowCnt = 0; rowCnt < numOfRowsPerTable; ) {
|
||||
int rowSize = numOfValuesPerSQL;
|
||||
for (long rowCnt = 0; rowCnt < numOfRowsPerTable; ) {
|
||||
long rowSize = numOfValuesPerSQL;
|
||||
if (rowCnt + rowSize > numOfRowsPerTable) {
|
||||
rowSize = numOfRowsPerTable - rowCnt;
|
||||
}
|
||||
|
||||
//table
|
||||
for (int tableCnt = 0; tableCnt < numOfTables; ) {
|
||||
int tableSize = numOfTablesPerSQL;
|
||||
for (long tableCnt = 0; tableCnt < numOfTables; ) {
|
||||
long tableSize = numOfTablesPerSQL;
|
||||
if (tableCnt + tableSize > numOfTables) {
|
||||
tableSize = numOfTables - tableCnt;
|
||||
}
|
||||
|
|
|
@ -49,10 +49,10 @@ public class SubTableService extends AbstractService {
|
|||
return getAffectRows(futureList);
|
||||
}
|
||||
|
||||
public void createSubTable(SuperTableMeta superTableMeta, int numOfTables, String prefixOfTable, int numOfThreadsForCreate) {
|
||||
public void createSubTable(SuperTableMeta superTableMeta, long numOfTables, String prefixOfTable, int numOfThreadsForCreate) {
|
||||
ExecutorService executor = Executors.newFixedThreadPool(numOfThreadsForCreate);
|
||||
for (int i = 0; i < numOfTables; i++) {
|
||||
int tableIndex = i;
|
||||
for (long i = 0; i < numOfTables; i++) {
|
||||
long tableIndex = i;
|
||||
executor.execute(() -> createSubTable(superTableMeta, prefixOfTable + (tableIndex + 1)));
|
||||
}
|
||||
executor.shutdown();
|
||||
|
|
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||
|
||||
public class SubTableValueGenerator {
|
||||
|
||||
public static List<SubTableValue> generate(SuperTableMeta superTableMeta, String prefixOfTables, int tableIndex, int tableSize, int valueSize, long startTime, long timeGap) {
|
||||
public static List<SubTableValue> generate(SuperTableMeta superTableMeta, String prefixOfTables, long tableIndex, long tableSize, long valueSize, long startTime, long timeGap) {
|
||||
List<SubTableValue> subTableValues = new ArrayList<>();
|
||||
for (int i = 1; i <= tableSize; i++) {
|
||||
SubTableValue subTableValue = new SubTableValue();
|
||||
|
|
|
@ -23,8 +23,8 @@ public final class JdbcTaosdemoConfig {
|
|||
public String prefixOfTable = "t";
|
||||
// insert task
|
||||
public boolean autoCreateTable = true;
|
||||
public int numOfTables = 100;
|
||||
public int numOfRowsPerTable = 100;
|
||||
public long numOfTables = 100;
|
||||
public long numOfRowsPerTable = 100;
|
||||
public int numOfTablesPerSQL = 10;
|
||||
public int numOfValuesPerSQL = 10;
|
||||
public int numOfThreadsForCreate = 1;
|
||||
|
@ -146,7 +146,7 @@ public final class JdbcTaosdemoConfig {
|
|||
prefixOfTable = args[++i];
|
||||
}
|
||||
if ("-numOfTables".equals(args[i]) && i < args.length - 1) {
|
||||
numOfTables = Integer.parseInt(args[++i]);
|
||||
numOfTables = Long.parseLong(args[++i]);
|
||||
}
|
||||
if ("-autoCreateTable".equals(args[i]) && i < args.length - 1) {
|
||||
autoCreateTable = Boolean.parseBoolean(args[++i]);
|
||||
|
@ -156,7 +156,7 @@ public final class JdbcTaosdemoConfig {
|
|||
}
|
||||
// insert task
|
||||
if ("-numOfRowsPerTable".equals(args[i]) && i < args.length - 1) {
|
||||
numOfRowsPerTable = Integer.parseInt(args[++i]);
|
||||
numOfRowsPerTable = Long.parseLong(args[++i]);
|
||||
}
|
||||
if ("-numOfThreadsForInsert".equals(args[i]) && i < args.length - 1) {
|
||||
numOfThreadsForInsert = Integer.parseInt(args[++i]);
|
||||
|
|
Loading…
Reference in New Issue