提交 b3176287 编写于 作者: sangshuduo's avatar sangshuduo

Merge branch 'develop' into feature/sangshuduo/snap

......@@ -295,27 +295,30 @@ $ taos
这时,因为电流超过了10A,您应该可以看到示例程序将它输出到了屏幕上。
您可以继续插入一些数据观察示例程序的输出。
### jdbc使用数据订阅功能
### Java 使用数据订阅功能
(1)使用订阅功能前的数据准备
订阅功能也提供了 Java 开发接口,相关说明请见 [Java Connector](https://www.taosdata.com/cn/documentation20/connector/)。需要注意的是,目前 Java 接口没有提供异步订阅模式,但用户程序可以通过创建 `TimerTask` 等方式达到同样的效果。
```shell
# 创建power库
下面以一个示例程序介绍其具体使用方法。它所完成的功能与前面介绍的 C 语言示例基本相同,也是订阅数据库中所有电流超过 10A 的记录。
#### 准备数据
```sql
# 创建 power
taos> create database power;
# 切换库
taos> use power;
# 创建超级表
taos> create table meters(ts timestamp, current float, voltage int, phase int) tags(location binary(64), groupI
d int);
taos> create table meters(ts timestamp, current float, voltage int, phase int) tags(location binary(64), groupId int);
# 创建表
taos> create table d1001 using meters tags ("Beijing.Chaoyang",2);
taos> create table d1002 using meters tags ("Beijing.Haidian",2);
taos> create table d1001 using meters tags ("Beijing.Chaoyang", 2);
taos> create table d1002 using meters tags ("Beijing.Haidian", 2);
# 插入测试数据
taos> insert into d1001 values("2020-08-15 12:00:00.000", 12, 220, 1),("2020-08-15 12:10:00.000", 12.3, 220, 2),("2020-08-15 12:20:00.000", 12.2, 220, 1);
taos> insert into d1002 values("2020-08-15 12:00:00.000", 9.9, 220, 1),("2020-08-15 12:10:00.000", 10.3, 220, 1),("2020-08-15 12:20:00.000", 11.2, 220, 1);
# 从超级表meters查询current大于10的数据
# 从超级表 meters 查询电流大于 10A 的记录
taos> select * from meters where current > 10;
ts | current | voltage | phase| location | groupid |
ts | current | voltage | phase | location | groupid |
===========================================================================================================
2020-08-15 12:10:00.000 | 10.30000 | 220 | 1 | Beijing.Haidian | 2 |
2020-08-15 12:20:00.000 | 11.20000 | 220 | 1 | Beijing.Haidian | 2 |
......@@ -325,7 +328,7 @@ taos> select * from meters where current > 10;
Query OK, 5 row(s) in set (0.004896s)
```
(2)使用jdbc提供的订阅功能
#### 示例程序
```java
public class SubscribeDemo {
......@@ -337,42 +340,36 @@ public class SubscribeDemo {
TSDBSubscribe subscribe = null;
try {
// 加载驱动
Class.forName("com.taosdata.jdbc.TSDBDriver");
// 获取Connectin
Properties properties = new Properties();
properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
String jdbcUrl = "jdbc:TAOS://127.0.0.1:6030/power?user=root&password=taosdata";
connection = DriverManager.getConnection(jdbcUrl, properties);
// 创建Subscribe,topic为主题名称,sql为查询语句,restar为true代表每次订阅消费历史数据
subscribe = ((TSDBConnection) connection).subscribe(topic, sql, true);
subscribe = ((TSDBConnection) connection).subscribe(topic, sql, true); // 创建订阅
int count = 0;
while (true) {
// 消费数据
TSDBResultSet resultSet = subscribe.consume();
// 打印结果集
if (resultSet != null) {
ResultSetMetaData metaData = resultSet.getMetaData();
while (resultSet.next()) {
int columnCount = metaData.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
System.out.print(metaData.getColumnLabel(i) + " : " + resultSet.getString(i) + "\t");
}
System.out.println("\n====================");
count++;
while (count < 10) {
TimeUnit.SECONDS.sleep(1); // 等待1秒,避免频繁调用 consume,给服务端造成压力
TSDBResultSet resultSet = subscribe.consume(); // 消费数据
if (resultSet == null) {
continue;
}
ResultSetMetaData metaData = resultSet.getMetaData();
while (resultSet.next()) {
int columnCount = metaData.getColumnCount();
for (int i = 1; i <= columnCount; i++) {
System.out.print(metaData.getColumnLabel(i) + ": " + resultSet.getString(i) + "\t");
}
System.out.println();
count++;
}
if (count > 10)
break;
TimeUnit.SECONDS.sleep(1);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (null != subscribe)
subscribe.close(true);
subscribe.close(true); // 关闭订阅
if (connection != null)
connection.close();
} catch (SQLException throwables) {
......@@ -383,38 +380,30 @@ public class SubscribeDemo {
}
```
(3)订阅功能演示
运行demo,首先,subscribe会将满足情况的历史数据消费
运行示例程序,首先,它会消费符合查询条件的所有历史数据:
```shell
# java -jar subscribe.jar
ts : 1597464000000 current : 12.0 voltage : 220 phase : 1 location : Beijing.Chaoyang groupid : 2
====================
ts : 1597464600000 current : 12.3 voltage : 220 phase : 2 location : Beijing.Chaoyang groupid : 2
====================
ts : 1597465200000 current : 12.2 voltage : 220 phase : 1 location : Beijing.Chaoyang groupid : 2
====================
ts : 1597464600000 current : 10.3 voltage : 220 phase : 1 location : Beijing.Haidian groupid : 2
====================
ts : 1597465200000 current : 11.2 voltage : 220 phase : 1 location : Beijing.Haidian groupid : 2
====================
ts: 1597464000000 current: 12.0 voltage: 220 phase: 1 location: Beijing.Chaoyang groupid : 2
ts: 1597464600000 current: 12.3 voltage: 220 phase: 2 location: Beijing.Chaoyang groupid : 2
ts: 1597465200000 current: 12.2 voltage: 220 phase: 1 location: Beijing.Chaoyang groupid : 2
ts: 1597464600000 current: 10.3 voltage: 220 phase: 1 location: Beijing.Haidian groupid : 2
ts: 1597465200000 current: 11.2 voltage: 220 phase: 1 location: Beijing.Haidian groupid : 2
```
接着,使用taos客户端向表中新增数据
接着,使用 taos 客户端向表中新增一条数据:
```shell
```sql
# taos
taos> use power
taos> insert into d1001 values("2020-08-15 12:40:00.000", 12.4, 220, 1);
```
查看数据消费情况
因为这条数据的电流大于10A,示例程序会将其消费:
```shell
ts : 1597466400000 current : 12.4 voltage : 220 phase : 1 location : Beijing.Chaoyang groupid : 2
====================
ts: 1597466400000 current: 12.4 voltage: 220 phase: 1 location: Beijing.Chaoyang groupid: 2
```
......
......@@ -14,12 +14,9 @@
# local fully qualified domain name (FQDN)
# fqdn hostname
# first port number for the connection (10 continuous UDP/TCP port number are used)
# first port number for the connection (12 continuous UDP/TCP port number are used)
# serverPort 6030
# http service port, default tcp [6041]
# httpPort 6041
# log file's directory
# logDir /var/log/taos
......
......@@ -904,6 +904,11 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
sToken = tStrGetToken(sql, &index, true, numOfIgnoreToken, &ignoreTokenTypes);
sql += index;
if (TK_ILLEGAL == sToken.type) {
tdDestroyKVRowBuilder(&kvRowBuilder);
return TSDB_CODE_TSC_INVALID_SQL;
}
if (sToken.n == 0 || sToken.type == TK_RP) {
break;
}
......
......@@ -1158,8 +1158,9 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
int32_t ret = exprTreeFromSqlExpr(pCmd, &pNode, pItem->pNode, pQueryInfo->exprList, pQueryInfo, colList);
if (ret != TSDB_CODE_SUCCESS) {
tExprTreeDestroy(&pNode, NULL);
taosTFree(arithmeticExprStr);
taosArrayDestroy(colList);
tExprTreeDestroy(&pNode, NULL);
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
}
......@@ -1168,6 +1169,8 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
SColIndex* pIndex = taosArrayGet(colList, k);
if (pIndex->flag == 1) {
taosTFree(arithmeticExprStr);
taosArrayDestroy(colList);
tExprTreeDestroy(&pNode, NULL);
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
}
}
......
......@@ -158,6 +158,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if (pRsp->killConnection) {
tscKillConnection(pObj);
return;
} else {
if (pRsp->queryId) tscKillQuery(pObj, htonl(pRsp->queryId));
if (pRsp->streamId) tscKillStream(pObj, htonl(pRsp->streamId));
......
......@@ -684,6 +684,8 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
freeJoinSubqueryObj(pParentSql);
pParentSql->res.code = code;
tscQueueAsyncRes(pParentSql);
taosArrayDestroy(s1);
taosArrayDestroy(s2);
return;
}
......@@ -1296,7 +1298,9 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) {
tscError("%p tableIndex:%d, failed to allocate join support object, abort further query", pSql, i);
pState->numOfRemain = i;
pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY;
if (0 == i) {
taosTFree(pState);
}
return pSql->res.code;
}
......@@ -1304,7 +1308,9 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) {
if (code != TSDB_CODE_SUCCESS) { // failed to create subquery object, quit query
tscDestroyJoinSupporter(pSupporter);
pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY;
if (0 == i) {
taosTFree(pState);
}
break;
}
}
......@@ -2091,17 +2097,17 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) {
// return;
// }
tscFetchDatablockFromSubquery(pSql);
if (pRes->code != TSDB_CODE_SUCCESS) {
return;
}
// tscFetchDatablockFromSubquery(pSql);
// if (pRes->code != TSDB_CODE_SUCCESS) {
// return;
// }
}
if (pSql->res.code == TSDB_CODE_SUCCESS) {
(*pSql->fp)(pSql->param, pSql, pRes->numOfRows);
} else {
tscQueueAsyncRes(pSql);
}
// if (pSql->res.code == TSDB_CODE_SUCCESS) {
// (*pSql->fp)(pSql->param, pSql, pRes->numOfRows);
// } else {
// tscQueueAsyncRes(pSql);
// }
}
static void transferNcharData(SSqlObj *pSql, int32_t columnIndex, TAOS_FIELD *pField) {
......
......@@ -158,7 +158,7 @@ public class TSDBStatement implements Statement {
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL));
} else if (resultSetPointer == TSDBConstants.JNI_NULL_POINTER) {
// no result set is retrieved
this.connecter.freeResultSet(pSql);
this.connecter.freeResultSet(pSql);
res = false;
}
......
......@@ -132,7 +132,7 @@ int tsdbOpenFileH(STsdbRepo *pRepo) {
char *fname = malloc(strlen(tDataDir) + strlen(dp->d_name) + 2);
if (fname == NULL) goto _err;
sprintf(fname, "%s/%s", tDataDir, dp->d_name);
remove(fname);
(void)remove(fname);
free(fname);
} else if (code == REG_NOMATCH) {
tsdbError("vgId:%d invalid file %s exists, ignore it", REPO_ID(pRepo), dp->d_name);
......@@ -447,6 +447,8 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int32_t *size) {
*magic = info.magic;
*size = (int32_t)offset;
return;
_err:
if (fd >= 0) close(fd);
*magic = TSDB_FILE_INIT_MAGIC;
......
......@@ -246,22 +246,22 @@ uint32_t tsdbGetFileInfo(TSDB_REPO_T *repo, char *name, uint32_t *index, uint32_
}
}
strcpy(name, fname + prefixLen);
} else { // get the named file at the specified index. If not there, return 0
if (*index == TSDB_META_FILE_INDEX) { // get meta file
fname = malloc(prefixLen + strlen(name) + 2);
sprintf(fname, "%s/%s", prefix, name);
tsdbGetStoreInfo(fname, &magic, size);
} else { // get the named file at the specified index. If not there, return 0
fname = malloc(prefixLen + strlen(name) + 2);
sprintf(fname, "%s/%s", prefix, name);
if (access(fname, F_OK) != 0) {
taosFree(fname);
taosFree(sdup);
return magic;
return 0;
}
if (*index == TSDB_META_FILE_INDEX) { // get meta file
tsdbGetStoreInfo(fname, &magic, size);
} else {
fname = malloc(prefixLen + strlen(name) + 2);
sprintf(fname, "%s/%s", prefix, name);
tsdbGetFileInfoImpl(fname, &magic, size);
taosFree(fname);
taosFree(sdup);
return magic;
}
taosFree(fname);
taosFree(sdup);
return magic;
}
if (stat(fname, &fState) < 0) {
......
......@@ -683,11 +683,11 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe
pthread_rwlock_wrlock(&(pFileH->fhlock));
rename(helperNewHeadF(pHelper)->fname, helperHeadF(pHelper)->fname);
(void)rename(helperNewHeadF(pHelper)->fname, helperHeadF(pHelper)->fname);
pGroup->files[TSDB_FILE_TYPE_HEAD].info = helperNewHeadF(pHelper)->info;
if (newLast) {
rename(helperNewLastF(pHelper)->fname, helperLastF(pHelper)->fname);
(void)rename(helperNewLastF(pHelper)->fname, helperLastF(pHelper)->fname);
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperNewLastF(pHelper)->info;
} else {
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperLastF(pHelper)->info;
......
......@@ -351,6 +351,8 @@ void tsdbGetStoreInfo(char *fname, uint32_t *magic, int32_t *size) {
*magic = info.magic;
*size = (int32_t)offset;
return;
_err:
if (fd >= 0) close(fd);
*magic = TD_KVSTORE_INIT_MAGIC;
......
......@@ -8,4 +8,3 @@ select * from devices where devgroup='60';
select * from devices where devgroup='70';
select * from devices where devgroup='80';
select * from devices where devgroup='90';
......@@ -58,4 +58,3 @@ select spread(temperature) from devices where devgroup=~/[1-7][0-9]/;
select spread(temperature) from devices where devgroup=~/[1-8][0-9]/;
select spread(temperature) from devices where devgroup=~/[1-9][0-9]/;
select spread(temperature) from devices;
......@@ -8,4 +8,3 @@ select count(temperature), sum(temperature), mean(temperature) from devices wher
select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-8][0-9]/ group by devgroup;
select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-9][0-9]/ group by devgroup;
select count(temperature), sum(temperature), mean(temperature) from devices group by devgroup;
......@@ -8,4 +8,3 @@ select count(temperature), sum(temperature), mean(temperature) from devices wher
select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-8][0-9]/ group by time(1m);
select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-9][0-9]/ group by time(1m);
select count(temperature), sum(temperature), mean(temperature) from devices group by time(1m);
#!/bin/bash
NUM_LOOP=5
function printTo {
if $verbose ; then
echo $1
fi
}
INFLUXDBTESTQ1OUT=influxdbTestQ1.out
function runTest {
totalG0=0
totalG10=0
totalG20=0
totalG30=0
totalG40=0
totalG50=0
totalG60=0
totalG70=0
totalG80=0
totalG90=0
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INFLUXDBTEST_DIR/infludbTest \
-sql $INFLUXDBTEST_DIR/q1.txt"
$INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q1.txt 2>&1 \
| tee $INFLUXDBTESTQ1OUT
G0=`grep "devgroup='0'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG0=`echo "scale=4; $totalG0 + $G0" | bc`
G10=`grep "devgroup='10'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG10=`echo "scale=4; $totalG10 + $G10" | bc`
G20=`grep "devgroup='20'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG20=`echo "scale=4; $totalG20 + $G20" | bc`
G30=`grep "devgroup='30'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG30=`echo "scale=4; $totalG30 + $G30" | bc`
G40=`grep "devgroup='40'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG40=`echo "scale=4; $totalG40 + $G40" | bc`
G50=`grep "devgroup='50'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG50=`echo "scale=4; $totalG50 + $G50" | bc`
G60=`grep "devgroup='60'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG60=`echo "scale=4; $totalG60 + $G60" | bc`
G70=`grep "devgroup='70'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG70=`echo "scale=4; $totalG70 + $G70" | bc`
G80=`grep "devgroup='80'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG80=`echo "scale=4; $totalG80 + $G80" | bc`
G90=`grep "devgroup='90'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG90=`echo "scale=4; $totalG90 + $G90" | bc`
done
avgG0=`echo "scale=4; x = $totalG0 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG10=`echo "scale=4; x = $totalG10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG20=`echo "scale=4; x = $totalG20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG30=`echo "scale=4; x = $totalG30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG40=`echo "scale=4; x = $totalG40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG50=`echo "scale=4; x = $totalG50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG60=`echo "scale=4; x = $totalG60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG70=`echo "scale=4; x = $totalG70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG80=`echo "scale=4; x = $totalG80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG90=`echo "scale=4; x = $totalG90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
echo "Latency, G-0, G-10, G-20, G-30, G-40, G-50, G-60, G-70, G-80, G-90"
echo "InfluxDB, $avgG0, $avgG10, $avgG20, $avgG30, $avgG40, $avgG50, $avgG60, $avgG70, $avgG80, $avgG90"
}
################ Main ################
master=false
develop=true
verbose=false
clients=1
while : ; do
case $1 in
-v)
verbose=true
shift ;;
-c)
clients=$2
shift 2;;
-n)
NUM_LOOP=$2
shift 2;;
*)
break ;;
esac
done
WORK_DIR=/mnt/root/TDengine
INFLUXDBTEST_DIR=$WORK_DIR/tests/comparisonTest/influxdb
runTest
printTo "Test done!"
#!/bin/bash
NUM_LOOP=5
function printTo {
if $verbose ; then
echo $1
fi
}
INFLUXDBTESTQ2OUT=influxdbTestQ2.out
function runTest {
totalCount10=0
totalCount20=0
totalCount30=0
totalCount40=0
totalCount50=0
totalCount60=0
totalCount70=0
totalCount80=0
totalCount90=0
totalCount100=0
totalMean10=0
totalMean20=0
totalMean30=0
totalMean40=0
totalMean50=0
totalMean60=0
totalMean70=0
totalMean80=0
totalMean90=0
totalMean100=0
totalSum10=0
totalSum20=0
totalSum30=0
totalSum40=0
totalSum50=0
totalSum60=0
totalSum70=0
totalSum80=0
totalSum90=0
totalSum100=0
totalMax10=0
totalMax20=0
totalMax30=0
totalMax40=0
totalMax50=0
totalMax60=0
totalMax70=0
totalMax80=0
totalMax90=0
totalMax100=0
totalMin10=0
totalMin20=0
totalMin30=0
totalMin40=0
totalMin50=0
totalMin60=0
totalMin70=0
totalMin80=0
totalMin90=0
totalMin100=0
totalSpread10=0
totalSpread20=0
totalSpread30=0
totalSpread40=0
totalSpread50=0
totalSpread60=0
totalSpread70=0
totalSpread80=0
totalSpread90=0
totalSpread100=0
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q2.txt"
$INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q2.txt 2>&1 \
| tee $INFLUXDBTESTQ2OUT
Count10=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalCount10=`echo "scale=4; $totalCount10 + $Count10" | bc`
Count20=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalCount20=`echo "scale=4; $totalCount20 + $Count20" | bc`
Count30=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalCount30=`echo "scale=4; $totalCount30 + $Count30" | bc`
Count40=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalCount40=`echo "scale=4; $totalCount40 + $Count40" | bc`
Count50=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalCount50=`echo "scale=4; $totalCount50 + $Count50" | bc`
Count60=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalCount60=`echo "scale=4; $totalCount60 + $Count60" | bc`
Count70=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalCount70=`echo "scale=4; $totalCount70 + $Count70" | bc`
Count80=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalCount80=`echo "scale=4; $totalCount80 + $Count80" | bc`
Count90=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalCount90=`echo "scale=4; $totalCount90 + $Count90" | bc`
Count100=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devices;" | awk '{print $5}'`
totalCount100=`echo "scale=4; $totalCount100 + $Count100" | bc`
Mean10=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalMean10=`echo "scale=4; $totalMean10 + $Mean10" | bc`
Mean20=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalMean20=`echo "scale=4; $totalMean20 + $Mean20" | bc`
Mean30=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalMean30=`echo "scale=4; $totalMean30 + $Mean30" | bc`
Mean40=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalMean40=`echo "scale=4; $totalMean40 + $Mean40" | bc`
Mean50=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalMean50=`echo "scale=4; $totalMean50 + $Mean50" | bc`
Mean60=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalMean60=`echo "scale=4; $totalMean60 + $Mean60" | bc`
Mean70=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalMean70=`echo "scale=4; $totalMean70 + $Mean70" | bc`
Mean80=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalMean80=`echo "scale=4; $totalMean80 + $Mean80" | bc`
Mean90=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalMean90=`echo "scale=4; $totalMean90 + $Mean90" | bc`
Mean100=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devices;" | awk '{print $5}'`
totalMean100=`echo "scale=4; $totalMean100 + $Mean100" | bc`
Sum10=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalSum10=`echo "scale=4; $totalSum10 + $Sum10" | bc`
Sum20=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalSum20=`echo "scale=4; $totalSum20 + $Sum20" | bc`
Sum30=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalSum30=`echo "scale=4; $totalSum30 + $Sum30" | bc`
Sum40=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalSum40=`echo "scale=4; $totalSum40 + $Sum40" | bc`
Sum50=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalSum50=`echo "scale=4; $totalSum50 + $Sum50" | bc`
Sum60=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalSum60=`echo "scale=4; $totalSum60 + $Sum60" | bc`
Sum70=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalSum70=`echo "scale=4; $totalSum70 + $Sum70" | bc`
Sum80=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalSum80=`echo "scale=4; $totalSum80 + $Sum80" | bc`
Sum90=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalSum90=`echo "scale=4; $totalSum90 + $Sum90" | bc`
Sum100=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devices;" | awk '{print $5}'`
totalSum100=`echo "scale=4; $totalSum100 + $Sum100" | bc`
Max10=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalMax10=`echo "scale=4; $totalMax10 + $Max10" | bc`
Max20=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalMax20=`echo "scale=4; $totalMax20 + $Max20" | bc`
Max30=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalMax30=`echo "scale=4; $totalMax30 + $Max30" | bc`
Max40=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalMax40=`echo "scale=4; $totalMax40 + $Max40" | bc`
Max50=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalMax50=`echo "scale=4; $totalMax50 + $Max50" | bc`
Max60=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalMax60=`echo "scale=4; $totalMax60 + $Max60" | bc`
Max70=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalMax70=`echo "scale=4; $totalMax70 + $Max70" | bc`
Max80=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalMax80=`echo "scale=4; $totalMax80 + $Max80" | bc`
Max90=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalMax90=`echo "scale=4; $totalMax90 + $Max90" | bc`
Max100=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devices;" | awk '{print $5}'`
totalMax100=`echo "scale=4; $totalMax100 + $Max100" | bc`
Min10=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalMin10=`echo "scale=4; $totalMin10 + $Min10" | bc`
Min20=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalMin20=`echo "scale=4; $totalMin20 + $Min20" | bc`
Min30=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalMin30=`echo "scale=4; $totalMin30 + $Min30" | bc`
Min40=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalMin40=`echo "scale=4; $totalMin40 + $Min40" | bc`
Min50=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalMin50=`echo "scale=4; $totalMin50 + $Min50" | bc`
Min60=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalMin60=`echo "scale=4; $totalMin60 + $Min60" | bc`
Min70=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalMin70=`echo "scale=4; $totalMin70 + $Min70" | bc`
Min80=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalMin80=`echo "scale=4; $totalMin80 + $Min80" | bc`
Min90=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalMin90=`echo "scale=4; $totalMin90 + $Min90" | bc`
Min100=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devices;" | awk '{print $5}'`
totalMin100=`echo "scale=4; $totalMin100 + $Min100" | bc`
Spread10=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalSpread10=`echo "scale=4; $totalSpread10 + $Spread10" | bc`
Spread20=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalSpread20=`echo "scale=4; $totalSpread20 + $Spread20" | bc`
Spread30=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalSpread30=`echo "scale=4; $totalSpread30 + $Spread30" | bc`
Spread40=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalSpread40=`echo "scale=4; $totalSpread40 + $Spread40" | bc`
Spread50=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalSpread50=`echo "scale=4; $totalSpread50 + $Spread50" | bc`
Spread60=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalSpread60=`echo "scale=4; $totalSpread60 + $Spread60" | bc`
Spread70=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalSpread70=`echo "scale=4; $totalSpread70 + $Spread70" | bc`
Spread80=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalSpread80=`echo "scale=4; $totalSpread80 + $Spread80" | bc`
Spread90=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalSpread90=`echo "scale=4; $totalSpread90 + $Spread90" | bc`
Spread100=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devices;" | awk '{print $5}'`
totalSpread100=`echo "scale=4; $totalSpread100 + $Spread100" | bc`
done
avgCount10=`echo "scale=4; x = $totalCount10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount20=`echo "scale=4; x = $totalCount20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount30=`echo "scale=4; x = $totalCount30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount40=`echo "scale=4; x = $totalCount40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount50=`echo "scale=4; x = $totalCount50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount60=`echo "scale=4; x = $totalCount60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount70=`echo "scale=4; x = $totalCount70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount80=`echo "scale=4; x = $totalCount80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount90=`echo "scale=4; x = $totalCount90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount100=`echo "scale=4; x = $totalCount100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean10=`echo "scale=4; x = $totalMean10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean20=`echo "scale=4; x = $totalMean20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean30=`echo "scale=4; x = $totalMean30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean40=`echo "scale=4; x = $totalMean40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean50=`echo "scale=4; x = $totalMean50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean60=`echo "scale=4; x = $totalMean60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean70=`echo "scale=4; x = $totalMean70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean80=`echo "scale=4; x = $totalMean80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean90=`echo "scale=4; x = $totalMean90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean100=`echo "scale=4; x = $totalMean100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum10=`echo "scale=4; x = $totalSum10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum20=`echo "scale=4; x = $totalSum20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum30=`echo "scale=4; x = $totalSum30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum40=`echo "scale=4; x = $totalSum40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum50=`echo "scale=4; x = $totalSum50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum60=`echo "scale=4; x = $totalSum60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum70=`echo "scale=4; x = $totalSum70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum80=`echo "scale=4; x = $totalSum80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum90=`echo "scale=4; x = $totalSum90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum100=`echo "scale=4; x = $totalSum100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax10=`echo "scale=4; x = $totalMax10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax20=`echo "scale=4; x = $totalMax20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax30=`echo "scale=4; x = $totalMax30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax40=`echo "scale=4; x = $totalMax40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax50=`echo "scale=4; x = $totalMax50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax60=`echo "scale=4; x = $totalMax60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax70=`echo "scale=4; x = $totalMax70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax80=`echo "scale=4; x = $totalMax80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax90=`echo "scale=4; x = $totalMax90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax100=`echo "scale=4; x = $totalMax100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin10=`echo "scale=4; x = $totalMin10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin20=`echo "scale=4; x = $totalMin20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin30=`echo "scale=4; x = $totalMin30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin40=`echo "scale=4; x = $totalMin40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin50=`echo "scale=4; x = $totalMin50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin60=`echo "scale=4; x = $totalMin60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin70=`echo "scale=4; x = $totalMin70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin80=`echo "scale=4; x = $totalMin80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin90=`echo "scale=4; x = $totalMin90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin100=`echo "scale=4; x = $totalMin100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread10=`echo "scale=4; x = $totalSpread10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread20=`echo "scale=4; x = $totalSpread20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread30=`echo "scale=4; x = $totalSpread30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread40=`echo "scale=4; x = $totalSpread40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread50=`echo "scale=4; x = $totalSpread50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread60=`echo "scale=4; x = $totalSpread60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread70=`echo "scale=4; x = $totalSpread70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread80=`echo "scale=4; x = $totalSpread80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread90=`echo "scale=4; x = $totalSpread90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread100=`echo "scale=4; x = $totalSpread100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
echo "Latency, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%"
echo "Count, $avgCount10, $avgCount20, $avgCount30, $avgCount40, $avgCount50, $avgCount60, $avgCount70, $avgCount80, $avgCount90, $avgCount100"
echo "Mean, $avgMean10, $avgMean20, $avgMean30, $avgMean40, $avgMean50, $avgMean60, $avgMean70, $avgMean80, $avgMean90, $avgMean100"
echo "Sum, $avgSum10, $avgSum20, $avgSum30, $avgSum40, $avgSum50, $avgSum60, $avgSum70, $avgSum80, $avgSum90, $avgSum100"
echo "Max, $avgMax10, $avgMax20, $avgMax30, $avgMax40, $avgMax50, $avgMax60, $avgMax70, $avgMax80, $avgMax90, $avgMax100"
echo "Min, $avgMin10, $avgMin20, $avgMin30, $avgMin40, $avgMin50, $avgMin60, $avgMin70, $avgMin80, $avgMin90, $avgMin100"
echo "Spread, $avgSpread10, $avgSpread20, $avgSpread30, $avgSpread40, $avgSpread50, $avgSpread60, $avgSpread70, $avgSpread80, $avgSpread90, $avgSpread100"
}
################ Main ################
verbose=false
for arg in "$@"
do
case $arg in
-v)
verbose=true
shift ;;
-c)
clients=$2
shift 2;;
-n)
NUM_LOOP=$2
shift 2;;
*)
;;
esac
done
WORK_DIR=/mnt/root/TDengine
INFLUXDBTEST_DIR=$WORK_DIR/tests/comparisonTest/influxdb
runTest
printTo "Test done!"
#!/bin/bash
NUM_LOOP=5
function printTo {
if $verbose ; then
echo $1
fi
}
INFLUXDBTESTQ3OUT=opentsdbTestQ3.out
function runTest {
totalG10=0
totalG20=0
totalG30=0
totalG40=0
totalG50=0
totalG60=0
totalG70=0
totalG80=0
totalG90=0
totalG100=0
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q3.txt"
$INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q3.txt 2>&1 \
| tee $INFLUXDBTESTQ3OUT
G10=`grep -w "devgroup=~\/\[1-1\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG10=`echo "scale=4; $totalG10 + $G10" | bc`
G20=`grep -w "devgroup=~\/\[1-2\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG20=`echo "scale=4; $totalG20 + $G20" | bc`
G30=`grep -w "devgroup=~\/\[1-3\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG30=`echo "scale=4; $totalG30 + $G30" | bc`
G40=`grep -w "devgroup=~\/\[1-4\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG40=`echo "scale=4; $totalG40 + $G40" | bc`
G50=`grep -w "devgroup=~\/\[1-5\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG50=`echo "scale=4; $totalG50 + $G50" | bc`
G60=`grep -w "devgroup=~\/\[1-6\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG60=`echo "scale=4; $totalG60 + $G60" | bc`
G70=`grep -w "devgroup=~\/\[1-7\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG70=`echo "scale=4; $totalG70 + $G70" | bc`
G80=`grep -w "devgroup=~\/\[1-8\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG80=`echo "scale=4; $totalG80 + $G80" | bc`
G90=`grep -w "devgroup=~\/\[1-9\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG90=`echo "scale=4; $totalG90 + $G90" | bc`
G100=`grep -w "devices group by devgroup;" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG100=`echo "scale=4; $totalG100 + $G100" | bc`
done
avgG10=`echo "scale=4; x = $totalG10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG20=`echo "scale=4; x = $totalG20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG30=`echo "scale=4; x = $totalG30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG40=`echo "scale=4; x = $totalG40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG50=`echo "scale=4; x = $totalG50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG60=`echo "scale=4; x = $totalG60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG70=`echo "scale=4; x = $totalG70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG80=`echo "scale=4; x = $totalG80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG90=`echo "scale=4; x = $totalG90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG100=`echo "scale=4; x = $totalG100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
echo "Latency, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%"
echo "InfluxDB, $avgG10, $avgG20, $avgG30, $avgG40, $avgG50, $avgG60, $avgG70, $avgG80, $avgG90, $avgG100"
}
################ Main ################
verbose=false
for arg in "$@"
do
case $arg in
-v)
verbose=true
shift ;;
-c)
clients=$2
shift 2;;
-n)
NUM_LOOP=$2
shift 2;;
*)
;;
esac
done
WORK_DIR=/mnt/root/TDengine
INFLUXDBTEST_DIR=$WORK_DIR/tests/comparisonTest/influxdb
runTest
printTo "Test done!"
#!/bin/bash -x
DATA_DIR=/mnt/root/testdata
NUM_LOOP=5
function printTo {
if $verbose ; then
echo $1
fi
}
INFLUXDBTESTQ4OUT=influxdbTestQ4.out
function runTest {
totalG10=0
totalG20=0
totalG30=0
totalG40=0
totalG50=0
totalG60=0
totalG70=0
totalG80=0
totalG90=0
totalG100=0
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q4.txt"
$INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q4.txt 2>&1 |
tee $INFLUXDBTESTQ4OUT
G10=`grep -w "devgroup=~\/\[1-1\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG10=`echo "scale=4; $totalG10 + $G10" | bc`
G20=`grep -w "devgroup=~\/\[1-2\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG20=`echo "scale=4; $totalG20 + $G20" | bc`
G30=`grep -w "devgroup=~\/\[1-3\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG30=`echo "scale=4; $totalG30 + $G30" | bc`
G40=`grep -w "devgroup=~\/\[1-4\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG40=`echo "scale=4; $totalG40 + $G40" | bc`
G50=`grep -w "devgroup=~\/\[1-5\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG50=`echo "scale=4; $totalG50 + $G50" | bc`
G60=`grep -w "devgroup=~\/\[1-6\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG60=`echo "scale=4; $totalG60 + $G60" | bc`
G70=`grep -w "devgroup=~\/\[1-7\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG70=`echo "scale=4; $totalG70 + $G70" | bc`
G80=`grep -w "devgroup=~\/\[1-8\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG80=`echo "scale=4; $totalG80 + $G80" | bc`
G90=`grep -w "devgroup=~\/\[1-9\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG90=`echo "scale=4; $totalG90 + $G90" | bc`
G100=`grep -w "devices group by time" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG100=`echo "scale=4; $totalG100 + $G100" | bc`
done
avgG10=`echo "scale=4; x = $totalG10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG20=`echo "scale=4; x = $totalG20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG30=`echo "scale=4; x = $totalG30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG40=`echo "scale=4; x = $totalG40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG50=`echo "scale=4; x = $totalG50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG60=`echo "scale=4; x = $totalG60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG70=`echo "scale=4; x = $totalG70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG80=`echo "scale=4; x = $totalG80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG90=`echo "scale=4; x = $totalG90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG100=`echo "scale=4; x = $totalG100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
echo "Latency, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%"
echo "InfluxDB, $avgG10, $avgG20, $avgG30, $avgG40, $avgG50, $avgG60, $avgG70, $avgG80, $avgG90, $avgG100"
}
################ Main ################
verbose=false
regeneratedata=false
for arg in "$@"
do
case $arg in
-v)
verbose=true
shift ;;
-c)
clients=$2
shift 2;;
-r)
regeneratedata=true
;;
-n)
NUM_LOOP=$2
shift 2;;
*)
;;
esac
done
WORK_DIR=/mnt/root/TDengine
INFLUXDBTEST_DIR=$WORK_DIR/tests/comparisonTest/influxdb
runTest
printTo "Test done!"
......@@ -21,17 +21,16 @@ function runTest {
done
done
for r in ${rowsPerRequest[@]}; do
for r in ${!rowsPerRequest[@]}; do
if [ "$r" == "1" ] || [ "$r" == "100" ] || [ "$r" == "1000" ]; then
NUM_OF_FILES=$clients
else
NUM_OF_FILES=100
fi
printf "$r, "
for c in `seq 1 $clients`; do
totalRPR=0
OUTPUT_FILE=influxdbTestWrite-RPR$r-clients$c.out
OUTPUT_FILE=influxdbTestWrite-RPR${rowsPerRequest[$r]}-clients$c.out
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INF_TEST_DIR/influxdbTest \
-dataDir $DATA_DIR \
......@@ -43,7 +42,7 @@ function runTest {
-numOfFiles $NUM_OF_FILES \
-writeClients $c \
-rowsPerRequest $r 2>&1 \
> $OUTPUT_FILE
| tee $OUTPUT_FILE
RPR=`cat $OUTPUT_FILE | grep speed | awk '{print $(NF-1)}'`
totalRPR=`echo "scale=4; $totalRPR + $RPR" | bc`
printTo "rows:$r, clients:$c, i:$i RPR:$RPR"
......
#!/bin/bash
DATA_DIR=/mnt/root/testdata
NUM_LOOP=1
NUM_LOOP=5
NUM_OF_FILES=100
rowsPerRequest=(1 100 500 1000 2000)
......@@ -13,20 +13,19 @@ function printTo {
}
function runTest {
printf "R/R, "
for c in `seq 1 $clients`; do
if [ "$c" == "1" ]; then
printf "$c client, "
else
printf "$c clients, "
fi
declare -A avgRPR
for r in ${!rowsPerRequest[@]}; do
for c in `seq 1 $clients`; do
avgRPR[$r,$c]=0
done
done
printf "\n"
for r in ${rowsPerRequest[@]}; do
printf "$r, "
for r in ${!rowsPerRequest[@]}; do
for c in `seq 1 $clients`; do
totalRPR=0
OUTPUT_FILE=tdengineTestWrite-RPR${rowsPerRequest[$r]}-clients$c.out
for i in `seq 1 $NUM_LOOP`; do
restartTaosd
$TAOSD_DIR/taos -s "drop database db" > /dev/null 2>&1
......@@ -34,18 +33,36 @@ function runTest {
-dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \
-w -clients $c \
-rowsPerRequest $r"
RPR=`$TDTEST_DIR/tdengineTest \
-rowsPerRequest ${rowsPerRequest[$r]}"
$TDTEST_DIR/tdengineTest \
-dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \
-w -clients $c \
-rowsPerRequest $r \
| grep speed | awk '{print $(NF-1)}'`
-rowsPerRequest ${rowsPerRequest[$r]} \
| tee $OUTPUT_FILE
RPR=`cat $OUTPUT_FILE | grep speed | awk '{print $(NF-1)}'`
totalRPR=`echo "scale=4; $totalRPR + $RPR" | bc`
printTo "rows:$r, clients:$c, i:$i RPR:$RPR"
printTo "rows:${rowsPerRequest[$r]}, clients:$c, i:$i RPR:$RPR"
done
avgRPR=`echo "scale=4; $totalRPR / $NUM_LOOP" | bc`
printf "$avgRPR, "
avgRPR[$r,$c]=`echo "scale=4; $totalRPR / $NUM_LOOP" | bc`
printTo "r:${rowsPerRequest[$r]} c:$c avgRPR:${avgRPR[$r,$c]}"
done
done
printf "R/R, "
for c in `seq 1 $clients`; do
if [ "$c" == "1" ]; then
printf "$c client, "
else
printf "$c clients, "
fi
done
printf "\n"
for r in ${!rowsPerRequest[@]}; do
printf "${rowsPerRequest[$r]}, "
for c in `seq 1 $clients`; do
printf "${avgRPR[$r,$c]}, "
done
printf "\n"
done
......@@ -80,10 +97,6 @@ while : ; do
verbose=true
shift ;;
-n)
NUM_LOOP=$2
shift 2;;
master)
master=true
develop=false
......@@ -98,18 +111,22 @@ while : ; do
clients=$2
shift 2;;
-n)
NUM_LOOP=$2
shift 2;;
*)
break ;;
esac
done
if $master ; then
printTo "Test master branch.."
echo "Test master branch.."
cp /mnt/root/cfg/master/taos.cfg /etc/taos/taos.cfg
WORK_DIR=/mnt/root/TDengine.master
else
printTo "Test develop branch.."
cp /mnt/root/cfg/perftest/taos.cfg /etc/taos/taos.cfg
echo "Test develop branch.."
cp /mnt/root/cfg/develop/taos.cfg /etc/taos/taos.cfg
WORK_DIR=/mnt/root/TDengine
fi
......@@ -118,4 +135,4 @@ TDTEST_DIR=$WORK_DIR/tests/comparisonTest/tdengine
runTest
printTo "Test done!"
echo "Test done!"
......@@ -49,11 +49,7 @@ class TDTestCase:
tdSql.query("select col1 + col2 from test1")
tdSql.checkRows(10)
tdSql.checkData(0, 0, 2.0)
tdSql.query("select col1 + col2 * col3 from test1")
tdSql.checkRows(10)
tdSql.checkData(1, 0, 6.0)
tdSql.checkData(0, 0, 2.0)
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
tdSql.checkRows(10)
......
......@@ -36,7 +36,8 @@ class TDTestCase:
"insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)")
# inner join --- bug
tdSql.error("select * from tb1 a, tb2 b where a.ts = b.ts")
tdSql.query("select * from tb1 a, tb2 b where a.ts = b.ts")
tdSql.checkRows(0)
# join 3 tables -- bug exists
tdSql.error("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册