Merge branch 'master' into hotfix/TD-4099
This commit is contained in:
commit
bf3fffb170
|
@ -218,7 +218,7 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_VND_NOT_SYNCED TAOS_DEF_ERROR_CODE(0, 0x0511) //"Database suspended")
|
#define TSDB_CODE_VND_NOT_SYNCED TAOS_DEF_ERROR_CODE(0, 0x0511) //"Database suspended")
|
||||||
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512) //"Database write operation denied")
|
#define TSDB_CODE_VND_NO_WRITE_AUTH TAOS_DEF_ERROR_CODE(0, 0x0512) //"Database write operation denied")
|
||||||
#define TSDB_CODE_VND_IS_SYNCING TAOS_DEF_ERROR_CODE(0, 0x0513) //"Database is syncing")
|
#define TSDB_CODE_VND_IS_SYNCING TAOS_DEF_ERROR_CODE(0, 0x0513) //"Database is syncing")
|
||||||
#define TSDB_CODE_VND_INVALID_TSDB_STATE TAOS_DEF_ERROR_CODE(0, 0x0513) //"Invalid tsdb state")
|
#define TSDB_CODE_VND_INVALID_TSDB_STATE TAOS_DEF_ERROR_CODE(0, 0x0514) //"Invalid tsdb state")
|
||||||
|
|
||||||
// tsdb
|
// tsdb
|
||||||
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600) //"Invalid table ID")
|
#define TSDB_CODE_TDB_INVALID_TABLE_ID TAOS_DEF_ERROR_CODE(0, 0x0600) //"Invalid table ID")
|
||||||
|
|
|
@ -771,48 +771,49 @@ static void parse_args(int argc, char *argv[], SArguments *arguments) {
|
||||||
}
|
}
|
||||||
arguments->sqlFile = argv[++i];
|
arguments->sqlFile = argv[++i];
|
||||||
} else if (strcmp(argv[i], "-q") == 0) {
|
} else if (strcmp(argv[i], "-q") == 0) {
|
||||||
if ((argc == i+1) ||
|
if ((argc == i+1)
|
||||||
(!isStringNumber(argv[i+1]))) {
|
|| (!isStringNumber(argv[i+1]))) {
|
||||||
printHelp();
|
printHelp();
|
||||||
errorPrint("%s", "\n\t-q need a number following!\nQuery mode -- 0: SYNC, 1: ASYNC. Default is SYNC.\n");
|
errorPrint("%s", "\n\t-q need a number following!\nQuery mode -- 0: SYNC, 1: ASYNC. Default is SYNC.\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
arguments->query_mode = atoi(argv[++i]);
|
arguments->query_mode = atoi(argv[++i]);
|
||||||
} else if (strcmp(argv[i], "-T") == 0) {
|
} else if (strcmp(argv[i], "-T") == 0) {
|
||||||
if ((argc == i+1) ||
|
if ((argc == i+1)
|
||||||
(!isStringNumber(argv[i+1]))) {
|
|| (!isStringNumber(argv[i+1]))) {
|
||||||
printHelp();
|
printHelp();
|
||||||
errorPrint("%s", "\n\t-T need a number following!\n");
|
errorPrint("%s", "\n\t-T need a number following!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
arguments->num_of_threads = atoi(argv[++i]);
|
arguments->num_of_threads = atoi(argv[++i]);
|
||||||
} else if (strcmp(argv[i], "-i") == 0) {
|
} else if (strcmp(argv[i], "-i") == 0) {
|
||||||
if ((argc == i+1) ||
|
if ((argc == i+1)
|
||||||
(!isStringNumber(argv[i+1]))) {
|
|| (!isStringNumber(argv[i+1]))) {
|
||||||
printHelp();
|
printHelp();
|
||||||
errorPrint("%s", "\n\t-i need a number following!\n");
|
errorPrint("%s", "\n\t-i need a number following!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
arguments->insert_interval = atoi(argv[++i]);
|
arguments->insert_interval = atoi(argv[++i]);
|
||||||
} else if (strcmp(argv[i], "-qt") == 0) {
|
} else if (strcmp(argv[i], "-qt") == 0) {
|
||||||
if ((argc == i+1) ||
|
if ((argc == i+1)
|
||||||
(!isStringNumber(argv[i+1]))) {
|
|| (!isStringNumber(argv[i+1]))
|
||||||
|
|| (atoi(argv[i+1]) <= 0)) {
|
||||||
printHelp();
|
printHelp();
|
||||||
errorPrint("%s", "\n\t-qt need a number following!\n");
|
errorPrint("%s", "\n\t-qt need a valid (>0) number following!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
arguments->query_times = atoi(argv[++i]);
|
arguments->query_times = atoi(argv[++i]);
|
||||||
} else if (strcmp(argv[i], "-B") == 0) {
|
} else if (strcmp(argv[i], "-B") == 0) {
|
||||||
if ((argc == i+1) ||
|
if ((argc == i+1)
|
||||||
(!isStringNumber(argv[i+1]))) {
|
|| (!isStringNumber(argv[i+1]))) {
|
||||||
printHelp();
|
printHelp();
|
||||||
errorPrint("%s", "\n\t-B need a number following!\n");
|
errorPrint("%s", "\n\t-B need a number following!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
arguments->interlace_rows = atoi(argv[++i]);
|
arguments->interlace_rows = atoi(argv[++i]);
|
||||||
} else if (strcmp(argv[i], "-r") == 0) {
|
} else if (strcmp(argv[i], "-r") == 0) {
|
||||||
if ((argc == i+1) ||
|
if ((argc == i+1)
|
||||||
(!isStringNumber(argv[i+1]))) {
|
|| (!isStringNumber(argv[i+1]))) {
|
||||||
printHelp();
|
printHelp();
|
||||||
errorPrint("%s", "\n\t-r need a number following!\n");
|
errorPrint("%s", "\n\t-r need a number following!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
@ -1072,7 +1073,7 @@ static int queryDbExec(TAOS *taos, char *command, QUERY_TYPE type, bool quiet) {
|
||||||
if (code != 0) {
|
if (code != 0) {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
debugPrint("%s() LN%d - command: %s\n", __func__, __LINE__, command);
|
debugPrint("%s() LN%d - command: %s\n", __func__, __LINE__, command);
|
||||||
errorPrint("Failed to run %s, reason: %s\n", command, taos_errstr(res));
|
errorPrint("Failed to execute %s, reason: %s\n", command, taos_errstr(res));
|
||||||
}
|
}
|
||||||
taos_free_result(res);
|
taos_free_result(res);
|
||||||
//taos_close(taos);
|
//taos_close(taos);
|
||||||
|
@ -4040,9 +4041,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
|
|
||||||
cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times");
|
cJSON* gQueryTimes = cJSON_GetObjectItem(root, "query_times");
|
||||||
if (gQueryTimes && gQueryTimes->type == cJSON_Number) {
|
if (gQueryTimes && gQueryTimes->type == cJSON_Number) {
|
||||||
if (gQueryTimes->valueint < 0) {
|
if (gQueryTimes->valueint <= 0) {
|
||||||
errorPrint("%s() LN%d, failed to read json, query_times input mistake\n",
|
errorPrint("%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n",
|
||||||
__func__, __LINE__);
|
__func__, __LINE__, gQueryTimes->valueint);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
g_args.query_times = gQueryTimes->valueint;
|
g_args.query_times = gQueryTimes->valueint;
|
||||||
|
@ -4091,9 +4092,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
cJSON* specifiedQueryTimes = cJSON_GetObjectItem(specifiedQuery,
|
cJSON* specifiedQueryTimes = cJSON_GetObjectItem(specifiedQuery,
|
||||||
"query_times");
|
"query_times");
|
||||||
if (specifiedQueryTimes && specifiedQueryTimes->type == cJSON_Number) {
|
if (specifiedQueryTimes && specifiedQueryTimes->type == cJSON_Number) {
|
||||||
if (specifiedQueryTimes->valueint < 0) {
|
if (specifiedQueryTimes->valueint <= 0) {
|
||||||
errorPrint("%s() LN%d, failed to read json, query_times input mistake\n",
|
errorPrint("%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n",
|
||||||
__func__, __LINE__);
|
__func__, __LINE__, specifiedQueryTimes->valueint);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4235,9 +4236,9 @@ static bool getMetaFromQueryJsonFile(cJSON* root) {
|
||||||
|
|
||||||
cJSON* superQueryTimes = cJSON_GetObjectItem(superQuery, "query_times");
|
cJSON* superQueryTimes = cJSON_GetObjectItem(superQuery, "query_times");
|
||||||
if (superQueryTimes && superQueryTimes->type == cJSON_Number) {
|
if (superQueryTimes && superQueryTimes->type == cJSON_Number) {
|
||||||
if (superQueryTimes->valueint < 0) {
|
if (superQueryTimes->valueint <= 0) {
|
||||||
errorPrint("%s() LN%d, failed to read json, query_times input mistake\n",
|
errorPrint("%s() LN%d, failed to read json, query_times: %"PRId64", need be a valid (>0) number\n",
|
||||||
__func__, __LINE__);
|
__func__, __LINE__, superQueryTimes->valueint);
|
||||||
goto PARSE_OVER;
|
goto PARSE_OVER;
|
||||||
}
|
}
|
||||||
g_queryInfo.superQueryInfo.queryTimes = superQueryTimes->valueint;
|
g_queryInfo.superQueryInfo.queryTimes = superQueryTimes->valueint;
|
||||||
|
@ -5200,6 +5201,13 @@ static void* syncWriteInterlace(threadInfo *pThreadInfo) {
|
||||||
|
|
||||||
startTs = taosGetTimestampMs();
|
startTs = taosGetTimestampMs();
|
||||||
|
|
||||||
|
if (recOfBatch == 0) {
|
||||||
|
errorPrint("[%d] %s() LN%d try inserting records of batch is %"PRIu64"\n",
|
||||||
|
pThreadInfo->threadID, __func__, __LINE__,
|
||||||
|
recOfBatch);
|
||||||
|
errorPrint("%s\n", "\tPlease check if the batch or the buffer length is proper value!\n");
|
||||||
|
goto free_of_interlace;
|
||||||
|
}
|
||||||
int64_t affectedRows = execInsert(pThreadInfo, buffer, recOfBatch);
|
int64_t affectedRows = execInsert(pThreadInfo, buffer, recOfBatch);
|
||||||
|
|
||||||
endTs = taosGetTimestampMs();
|
endTs = taosGetTimestampMs();
|
||||||
|
|
|
@ -119,7 +119,6 @@ void vnodeConfirmForard(int32_t vgId, void *wparam, int32_t code) {
|
||||||
void *pVnode = vnodeAcquire(vgId);
|
void *pVnode = vnodeAcquire(vgId);
|
||||||
if (pVnode == NULL) {
|
if (pVnode == NULL) {
|
||||||
vError("vgId:%d, vnode not found while confirm forward", vgId);
|
vError("vgId:%d, vnode not found while confirm forward", vgId);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dnodeSendRpcVWriteRsp(pVnode, wparam, code);
|
dnodeSendRpcVWriteRsp(pVnode, wparam, code);
|
||||||
|
|
|
@ -317,12 +317,13 @@ int32_t vnodeWriteToWQueue(void *vparam, void *wparam, int32_t qtype, void *rpar
|
||||||
|
|
||||||
void vnodeFreeFromWQueue(void *vparam, SVWriteMsg *pWrite) {
|
void vnodeFreeFromWQueue(void *vparam, SVWriteMsg *pWrite) {
|
||||||
SVnodeObj *pVnode = vparam;
|
SVnodeObj *pVnode = vparam;
|
||||||
|
if (pVnode) {
|
||||||
|
int32_t queued = atomic_sub_fetch_32(&pVnode->queuedWMsg, 1);
|
||||||
|
int64_t queuedSize = atomic_sub_fetch_64(&pVnode->queuedWMsgSize, pWrite->pHead.len);
|
||||||
|
|
||||||
int32_t queued = atomic_sub_fetch_32(&pVnode->queuedWMsg, 1);
|
vTrace("vgId:%d, msg:%p, app:%p, free from vwqueue, queued:%d size:%" PRId64, pVnode->vgId, pWrite,
|
||||||
int64_t queuedSize = atomic_sub_fetch_64(&pVnode->queuedWMsgSize, pWrite->pHead.len);
|
pWrite->rpcMsg.ahandle, queued, queuedSize);
|
||||||
|
}
|
||||||
vTrace("vgId:%d, msg:%p, app:%p, free from vwqueue, queued:%d size:%" PRId64, pVnode->vgId, pWrite,
|
|
||||||
pWrite->rpcMsg.ahandle, queued, queuedSize);
|
|
||||||
|
|
||||||
taosFreeQitem(pWrite);
|
taosFreeQitem(pWrite);
|
||||||
vnodeRelease(pVnode);
|
vnodeRelease(pVnode);
|
||||||
|
@ -371,8 +372,8 @@ static int32_t vnodePerformFlowCtrl(SVWriteMsg *pWrite) {
|
||||||
taosMsleep(ms);
|
taosMsleep(ms);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
void *unUsed = NULL;
|
void *unUsedTimerId = NULL;
|
||||||
taosTmrReset(vnodeFlowCtrlMsgToWQueue, 100, pWrite, tsDnodeTmr, &unUsed);
|
taosTmrReset(vnodeFlowCtrlMsgToWQueue, 100, pWrite, tsDnodeTmr, &unUsedTimerId);
|
||||||
|
|
||||||
vTrace("vgId:%d, msg:%p, app:%p, perform flowctrl, retry:%d", pVnode->vgId, pWrite, pWrite->rpcMsg.ahandle,
|
vTrace("vgId:%d, msg:%p, app:%p, perform flowctrl, retry:%d", pVnode->vgId, pWrite, pWrite->rpcMsg.ahandle,
|
||||||
pWrite->processedCount);
|
pWrite->processedCount);
|
||||||
|
|
|
@ -226,6 +226,7 @@ python3 ./test.py -f query/querySecondtscolumnTowherenow.py
|
||||||
python3 ./test.py -f query/queryFilterTswithDateUnit.py
|
python3 ./test.py -f query/queryFilterTswithDateUnit.py
|
||||||
python3 ./test.py -f query/queryTscomputWithNow.py
|
python3 ./test.py -f query/queryTscomputWithNow.py
|
||||||
python3 ./test.py -f query/computeErrorinWhere.py
|
python3 ./test.py -f query/computeErrorinWhere.py
|
||||||
|
python3 ./test.py -f query/queryTsisNull.py
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
###################################################################
|
||||||
|
# Copyright (c) 2016 by TAOS Technologies, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This file is proprietary and confidential to TAOS Technologies.
|
||||||
|
# No part of this file may be reproduced, stored, transmitted,
|
||||||
|
# disclosed or used in any form or by any means other than as
|
||||||
|
# expressly provided by the written permission from Jianhui Tao
|
||||||
|
#
|
||||||
|
###################################################################
|
||||||
|
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.dnodes import *
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
def init(self, conn, logSql):
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor(), logSql)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
tdSql.prepare()
|
||||||
|
tdSql.execute("drop database if exists db")
|
||||||
|
tdSql.execute("create database if not exists db keep 3650")
|
||||||
|
tdSql.execute("use db")
|
||||||
|
|
||||||
|
tdLog.printNoPrefix("==========step1:create table and insert data")
|
||||||
|
tdSql.execute(
|
||||||
|
"create table stb1 (ts timestamp, c1 timestamp , c2 int) TAGS(t1 int )"
|
||||||
|
)
|
||||||
|
|
||||||
|
tdLog.printNoPrefix("==========step2:query data where timestamp data is null")
|
||||||
|
tdSql.execute(
|
||||||
|
"insert into t1 using stb1(t1) tags(1) (ts, c1, c2) values (now-1m, null, 1)"
|
||||||
|
)
|
||||||
|
tdSql.execute(
|
||||||
|
"insert into t1 using stb1(t1) tags(1) (ts, c2) values (now-2m, 2)"
|
||||||
|
)
|
||||||
|
tdSql.query("select * from t1 where c1 is NULL")
|
||||||
|
tdSql.checkRows(2)
|
||||||
|
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
|
@ -74,6 +74,16 @@ class TDTestCase:
|
||||||
|
|
||||||
tdSql.error("select 'dc' as options from stb where type = 1 limit 1 union all select 'ad' as city from stb where type = 2 limit 1")
|
tdSql.error("select 'dc' as options from stb where type = 1 limit 1 union all select 'ad' as city from stb where type = 2 limit 1")
|
||||||
|
|
||||||
|
# for defect https://jira.taosdata.com:18080/browse/TD-4017
|
||||||
|
tdSql.execute("alter table stb add column col int")
|
||||||
|
tdSql.execute("insert into tb1 values(%d, 'option1', 'beijing', 10)" % (self.ts + 1000))
|
||||||
|
|
||||||
|
tdSql.query("select 'dc' as options from stb where col > 10 limit 1")
|
||||||
|
tdSql.checkRows(0)
|
||||||
|
|
||||||
|
tdSql.query("select 'dcs' as options from stb where col > 200 limit 1 union all select 'aaa' as options from stb limit 10")
|
||||||
|
tdSql.checkData(0, 0, 'aaa')
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
tdSql.close()
|
tdSql.close()
|
||||||
tdLog.success("%s successfully executed" % __file__)
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
Loading…
Reference in New Issue