Merge branch '3.0' of https://github.com/taosdata/TDengine into fix/TD-27041
This commit is contained in:
commit
e6fffe58a5
|
@ -11,7 +11,7 @@ ExternalProject_Add(curl2
|
|||
BUILD_IN_SOURCE TRUE
|
||||
BUILD_ALWAYS 1
|
||||
UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.2 --with-ssl=$ENV{HOME}/.cos-local.2 --enable-shared=no --disable-ldap --disable-ldaps --without-brotli --without-zstd --without-libidn2 #--enable-debug
|
||||
CONFIGURE_COMMAND ./configure --prefix=$ENV{HOME}/.cos-local.2 --with-ssl=$ENV{HOME}/.cos-local.2 --enable-shared=no --disable-ldap --disable-ldaps --without-brotli --without-zstd --without-libidn2 --without-nghttp2 #--enable-debug
|
||||
BUILD_COMMAND make -j
|
||||
INSTALL_COMMAND make install
|
||||
TEST_COMMAND ""
|
||||
|
|
|
@ -8,7 +8,7 @@ ExternalProject_Add(openssl
|
|||
BUILD_IN_SOURCE TRUE
|
||||
#BUILD_ALWAYS 1
|
||||
#UPDATE_COMMAND ""
|
||||
CONFIGURE_COMMAND ./Configure --prefix=$ENV{HOME}/.cos-local.2 -static #--no-shared
|
||||
CONFIGURE_COMMAND ./Configure --prefix=$ENV{HOME}/.cos-local.2 no-shared
|
||||
BUILD_COMMAND make -j
|
||||
INSTALL_COMMAND make install_sw -j
|
||||
TEST_COMMAND ""
|
||||
|
|
|
@ -175,8 +175,8 @@ if(${BUILD_WITH_S3})
|
|||
find_library(S3_LIBRARY s3)
|
||||
find_library(CURL_LIBRARY curl $ENV{HOME}/.cos-local.2/lib NO_DEFAULT_PATH)
|
||||
find_library(XML2_LIBRARY xml2)
|
||||
find_library(SSL_LIBRARY ssl $ENV{HOME}/.cos-local.2/lib64 NO_DEFAULT_PATH)
|
||||
find_library(CRYPTO_LIBRARY crypto $ENV{HOME}/.cos-local.2/lib64 NO_DEFAULT_PATH)
|
||||
find_library(SSL_LIBRARY ssl $ENV{HOME}/.cos-local.2/lib $ENV{HOME}/.cos-local.2/lib64 NO_DEFAULT_PATH)
|
||||
find_library(CRYPTO_LIBRARY crypto $ENV{HOME}/.cos-local.2/lib $ENV{HOME}/.cos-local.2/lib64 NO_DEFAULT_PATH)
|
||||
target_link_libraries(
|
||||
vnode
|
||||
|
||||
|
|
|
@ -373,8 +373,11 @@ void clearGroupResInfo(SGroupResInfo* pGroupResInfo) {
|
|||
if (pGroupResInfo->freeItem) {
|
||||
int32_t size = taosArrayGetSize(pGroupResInfo->pRows);
|
||||
for (int32_t i = pGroupResInfo->index; i < size; i++) {
|
||||
void* pVal = taosArrayGetP(pGroupResInfo->pRows, i);
|
||||
taosMemoryFree(pVal);
|
||||
SRowBuffPos* pPos = taosArrayGetP(pGroupResInfo->pRows, i);
|
||||
if (!pPos->needFree && !pPos->pRowBuff) {
|
||||
taosMemoryFreeClear(pPos->pKey);
|
||||
taosMemoryFree(pPos);
|
||||
}
|
||||
}
|
||||
pGroupResInfo->freeItem = false;
|
||||
}
|
||||
|
|
|
@ -166,6 +166,7 @@ static int32_t ignoreUsingClause(SInsertParseContext* pCxt, const char** pSql) {
|
|||
}
|
||||
|
||||
static int32_t parseDuplicateUsingClause(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, bool* pDuplicate) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
*pDuplicate = false;
|
||||
|
||||
char tbFName[TSDB_TABLE_FNAME_LEN];
|
||||
|
@ -173,13 +174,13 @@ static int32_t parseDuplicateUsingClause(SInsertParseContext* pCxt, SVnodeModify
|
|||
STableMeta** pMeta = taosHashGet(pStmt->pSubTableHashObj, tbFName, strlen(tbFName));
|
||||
if (NULL != pMeta) {
|
||||
*pDuplicate = true;
|
||||
int32_t code = ignoreUsingClause(pCxt, &pStmt->pSql);
|
||||
code = ignoreUsingClause(pCxt, &pStmt->pSql);
|
||||
if (TSDB_CODE_SUCCESS == code) {
|
||||
return cloneTableMeta(*pMeta, &pStmt->pTableMeta);
|
||||
}
|
||||
}
|
||||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
return code;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
|
@ -1594,11 +1595,9 @@ static int32_t parseTbnameToken(SInsertParseContext* pCxt, SStbRowsDataContext*
|
|||
|
||||
if (pToken->n > 0) {
|
||||
if (pToken->n <= TSDB_TABLE_NAME_LEN - 1) {
|
||||
memcpy(ctbName, pToken->z, pToken->n);
|
||||
ctbName[pToken->n] = '\0';
|
||||
memcpy(pStbRowsCxt->ctbName.tname, pToken->z, pToken->n);
|
||||
pStbRowsCxt->ctbName.tname[pToken->n] = '\0';
|
||||
*pFoundCtbName = true;
|
||||
tNameSetDbName(&pStbRowsCxt->ctbName, pStbRowsCxt->stbName.acctId, pStbRowsCxt->stbName.dbname, strlen(pStbRowsCxt->stbName.dbname));
|
||||
tNameAddTbName(&pStbRowsCxt->ctbName, ctbName, pToken->n);
|
||||
} else {
|
||||
return buildInvalidOperationMsg(&pCxt->msg, "tbname is too long");
|
||||
}
|
||||
|
@ -1644,10 +1643,13 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
SArray* pTagNames = pStbRowsCxt->aTagNames;
|
||||
SArray* pTagVals = pStbRowsCxt->aTagVals;
|
||||
bool canParseTagsAfter = !pStbRowsCxt->pTagCond && !pStbRowsCxt->hasTimestampTag;
|
||||
int32_t numOfCols = getNumOfColumns(pStbRowsCxt->pStbMeta);
|
||||
int32_t tbnameIdx = getTbnameSchemaIndex(pStbRowsCxt->pStbMeta);
|
||||
for (int i = 0; i < pCols->numOfBound && (code) == TSDB_CODE_SUCCESS; ++i) {
|
||||
const char* pTmpSql = *ppSql;
|
||||
bool ignoreComma = false;
|
||||
NEXT_TOKEN_WITH_PREV_EXT(*ppSql, *pToken, &ignoreComma);
|
||||
|
||||
if (ignoreComma) {
|
||||
code = buildSyntaxErrMsg(&pCxt->msg, "invalid data or symbol", pTmpSql);
|
||||
break;
|
||||
|
@ -1657,12 +1659,11 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
code = generateSyntaxErrMsg(&pCxt->msg, TSDB_CODE_PAR_INVALID_COLUMNS_NUM);
|
||||
break;
|
||||
}
|
||||
|
||||
if (pCols->pColIndex[i] < getNumOfColumns(pStbRowsCxt->pStbMeta)) {
|
||||
if (pCols->pColIndex[i] < numOfCols) {
|
||||
const SSchema* pSchema = &pSchemas[pCols->pColIndex[i]];
|
||||
SColVal* pVal = taosArrayGet(pStbRowsCxt->aColVals, pCols->pColIndex[i]);
|
||||
code = parseValueToken(pCxt, ppSql, pToken, (SSchema*)pSchema, getTableInfo(pStbRowsCxt->pStbMeta).precision, pVal);
|
||||
} else if (pCols->pColIndex[i] < getTbnameSchemaIndex(pStbRowsCxt->pStbMeta)) {
|
||||
} else if (pCols->pColIndex[i] < tbnameIdx) {
|
||||
const SSchema* pTagSchema = &pSchemas[pCols->pColIndex[i]];
|
||||
if (canParseTagsAfter) {
|
||||
tagTokens[(*pNumOfTagTokens)] = *pToken;
|
||||
|
@ -1675,7 +1676,7 @@ static int32_t doGetStbRowValues(SInsertParseContext* pCxt, SVnodeModifyOpStmt*
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (pCols->pColIndex[i] == getTbnameSchemaIndex(pStbRowsCxt->pStbMeta)) {
|
||||
else if (pCols->pColIndex[i] == tbnameIdx) {
|
||||
char ctbName[TSDB_TABLE_NAME_LEN];
|
||||
code = parseTbnameToken(pCxt, pStbRowsCxt, pToken, ctbName, bFoundTbName);
|
||||
}
|
||||
|
@ -1756,7 +1757,7 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod
|
|||
.requestId = pCxt->pComCxt->requestId,
|
||||
.requestObjRefId = pCxt->pComCxt->requestRid,
|
||||
.mgmtEps = pCxt->pComCxt->mgmtEpSet};
|
||||
code = catalogGetTableHashVgroup(pCxt->pComCxt->pCatalog, &conn, &pStmt->targetTableName, &vg);
|
||||
code = catalogGetTableHashVgroup(pCxt->pComCxt->pCatalog, &conn, &pStbRowsCxt->ctbName, &vg);
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
taosHashPut(pStmt->pVgroupsHashObj, (const char*)(&vg.vgId), sizeof(vg.vgId), &vg, sizeof(vg));
|
||||
pStbRowsCxt->pCtbMeta->uid = taosHashGetSize(pStmt->pSubTableHashObj) + 1;
|
||||
|
@ -1771,12 +1772,6 @@ static int32_t processCtbAutoCreationAndCtbMeta(SInsertParseContext* pCxt, SVnod
|
|||
return code;
|
||||
}
|
||||
|
||||
static void resetStbRowsDataContextPreStbRow(SStbRowsDataContext* pStbRowsCxt) {
|
||||
pStbRowsCxt->pCtbMeta->tableType = TSDB_CHILD_TABLE;
|
||||
pStbRowsCxt->pCtbMeta->suid = pStbRowsCxt->pStbMeta->uid;
|
||||
|
||||
insInitColValues(pStbRowsCxt->pStbMeta, pStbRowsCxt->aColVals);
|
||||
}
|
||||
|
||||
static void clearStbRowsDataContext(SStbRowsDataContext* pStbRowsCxt) {
|
||||
if (pStbRowsCxt == NULL) return;
|
||||
|
@ -1791,19 +1786,15 @@ static void clearStbRowsDataContext(SStbRowsDataContext* pStbRowsCxt) {
|
|||
taosArrayClear(pStbRowsCxt->aTagVals);
|
||||
|
||||
clearColValArray(pStbRowsCxt->aColVals);
|
||||
taosArrayClear(pStbRowsCxt->aColVals);
|
||||
|
||||
tTagFree(pStbRowsCxt->pTag);
|
||||
pStbRowsCxt->pTag = NULL;
|
||||
pStbRowsCxt->pCtbMeta->uid = 0;
|
||||
pStbRowsCxt->pCtbMeta->vgId = 0;
|
||||
tdDestroySVCreateTbReq(pStbRowsCxt->pCreateCtbReq);
|
||||
taosMemoryFreeClear(pStbRowsCxt->pCreateCtbReq);
|
||||
}
|
||||
|
||||
static int32_t parseOneStbRow(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pStmt, const char** ppSql,
|
||||
SStbRowsDataContext* pStbRowsCxt, bool* pGotRow, SToken* pToken) {
|
||||
resetStbRowsDataContextPreStbRow(pStbRowsCxt);
|
||||
bool bFirstTable = false;
|
||||
int32_t code = getStbRowValues(pCxt, pStmt, ppSql, pStbRowsCxt, pGotRow, pToken, &bFirstTable);
|
||||
if (code != TSDB_CODE_SUCCESS || !*pGotRow) {
|
||||
|
@ -1825,6 +1816,7 @@ static int32_t parseOneStbRow(SInsertParseContext* pCxt, SVnodeModifyOpStmt* pSt
|
|||
insCheckTableDataOrder(pTableDataCxt, TD_ROW_KEY(*pRow));
|
||||
}
|
||||
}
|
||||
|
||||
if (code == TSDB_CODE_SUCCESS) {
|
||||
*pGotRow = true;
|
||||
}
|
||||
|
@ -2100,6 +2092,10 @@ static int32_t constructStbRowsDataContext(SVnodeModifyOpStmt* pStmt, SStbRowsDa
|
|||
collectUseTable(&pStbRowsCxt->stbName, pStmt->pTableNameHashObj);
|
||||
collectUseDatabase(&pStbRowsCxt->stbName, pStmt->pDbFNameHashObj);
|
||||
|
||||
pStbRowsCxt->ctbName.type = TSDB_TABLE_NAME_T;
|
||||
pStbRowsCxt->ctbName.acctId = pStbRowsCxt->stbName.acctId;
|
||||
memcpy(pStbRowsCxt->ctbName.dbname, pStbRowsCxt->stbName.dbname, sizeof(pStbRowsCxt->stbName.dbname));
|
||||
|
||||
pStbRowsCxt->pTagCond = pStmt->pTagCond;
|
||||
pStbRowsCxt->pStbMeta = pStmt->pTableMeta;
|
||||
|
||||
|
|
|
@ -81,10 +81,10 @@ pip3 list|grep taospy
|
|||
pip3 uninstall taospy -y
|
||||
pip3 install --default-timeout=120 taospy==2.7.12
|
||||
|
||||
#define taos-ws-py 0.2.8
|
||||
#define taos-ws-py 0.3.1
|
||||
pip3 list|grep taos-ws-py
|
||||
pip3 uninstall taos-ws-py -y
|
||||
pip3 install --default-timeout=120 taos-ws-py==0.2.8
|
||||
pip3 install --default-timeout=120 taos-ws-py==0.3.1
|
||||
|
||||
$TIMEOUT_CMD $cmd
|
||||
RET=$?
|
||||
|
|
|
@ -21,9 +21,16 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "taos.h" // TAOS header file
|
||||
|
||||
static int64_t currTimeInUs() {
|
||||
struct timeval start_time;
|
||||
gettimeofday(&start_time, NULL);
|
||||
return (start_time.tv_sec) * 1000000 + (start_time.tv_usec);
|
||||
}
|
||||
|
||||
static void executeSql(TAOS *taos, char *command) {
|
||||
int i;
|
||||
TAOS_RES *pSql = NULL;
|
||||
|
@ -52,7 +59,7 @@ static void executeSql(TAOS *taos, char *command) {
|
|||
taos_free_result(pSql);
|
||||
}
|
||||
|
||||
void testInsert(TAOS *taos, char *qstr) {
|
||||
void testInsert(TAOS *taos, char *qstr, double* pElapsedTime) {
|
||||
executeSql(taos, "drop database if exists demo2");
|
||||
executeSql(taos, "create database demo2");
|
||||
executeSql(taos, "use demo2");
|
||||
|
@ -60,8 +67,7 @@ void testInsert(TAOS *taos, char *qstr) {
|
|||
executeSql(taos, "create table st (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10)) tags(t1 int, t2 float, t3 binary(10))");
|
||||
printf("success to create table\n");
|
||||
|
||||
struct timeval start_time;
|
||||
gettimeofday(&start_time, NULL);
|
||||
int64_t ts1 = currTimeInUs();
|
||||
|
||||
for (int tblIdx = 0; tblIdx < 10; ++tblIdx) {
|
||||
int len = 0;
|
||||
|
@ -84,15 +90,16 @@ void testInsert(TAOS *taos, char *qstr) {
|
|||
taos_free_result(result1);
|
||||
}
|
||||
}
|
||||
struct timeval end_time;
|
||||
gettimeofday(&end_time, NULL);
|
||||
double elapsed_time = (double)(end_time.tv_sec - start_time.tv_sec) +
|
||||
(double)(end_time.tv_usec - start_time.tv_usec) / 1000000.0;
|
||||
printf("elapsed time: %.3f\n", elapsed_time);
|
||||
|
||||
int64_t ts2 = currTimeInUs();
|
||||
double elapsedTime = (double)(ts2-ts1) / 1000000.0;
|
||||
*pElapsedTime = elapsedTime;
|
||||
|
||||
printf("elapsed time: %.3f\n", elapsedTime);
|
||||
executeSql(taos, "drop database if exists demo2");
|
||||
}
|
||||
|
||||
void testInsertStb(TAOS *taos, char *qstr) {
|
||||
void testInsertStb(TAOS *taos, char *qstr, double *pElapsedTime) {
|
||||
executeSql(taos, "drop database if exists demo");
|
||||
executeSql(taos, "create database demo");
|
||||
executeSql(taos, "use demo");
|
||||
|
@ -100,8 +107,7 @@ void testInsertStb(TAOS *taos, char *qstr) {
|
|||
executeSql(taos, "create table st (ts timestamp, ti tinyint, si smallint, i int, bi bigint, f float, d double, b binary(10)) tags(t1 int, t2 float, t3 binary(10))");
|
||||
printf("success to create table\n");
|
||||
|
||||
struct timeval start_time;
|
||||
gettimeofday(&start_time, NULL);
|
||||
int64_t ts1 = currTimeInUs();
|
||||
|
||||
for (int tblIdx = 0; tblIdx < 10; ++tblIdx) {
|
||||
int len = 0;
|
||||
|
@ -125,12 +131,11 @@ void testInsertStb(TAOS *taos, char *qstr) {
|
|||
taos_free_result(result1);
|
||||
}
|
||||
}
|
||||
struct timeval end_time;
|
||||
gettimeofday(&end_time, NULL);
|
||||
double elapsed_time = (double)(end_time.tv_sec - start_time.tv_sec) +
|
||||
(double)(end_time.tv_usec - start_time.tv_usec) / 1000000.0;
|
||||
|
||||
printf("elapsed time: %.3f\n", elapsed_time);
|
||||
int64_t ts2 = currTimeInUs();
|
||||
double elapsedTime = (double)(ts2 - ts1) / 1000000.0;
|
||||
*pElapsedTime = elapsedTime;
|
||||
printf("elapsed time: %.3f\n", elapsedTime);
|
||||
executeSql(taos, "drop database if exists demo");
|
||||
}
|
||||
|
||||
|
@ -149,13 +154,26 @@ int main(int argc, char *argv[]) {
|
|||
exit(1);
|
||||
}
|
||||
char* qstr = malloc(1024*1024);
|
||||
{
|
||||
printf("test insert into tb using stb\n\n");
|
||||
double sum = 0;
|
||||
for (int i =0; i < 5; ++i) {
|
||||
testInsert(taos, qstr);
|
||||
double elapsed = 0;
|
||||
testInsert(taos, qstr, &elapsed);
|
||||
sum += elapsed;
|
||||
}
|
||||
printf("average insert tb using stb time : %.3f\n", sum/5);
|
||||
}
|
||||
printf("test insert into stb tbname\n\n");
|
||||
{
|
||||
printf("test insert into stb\n\n");
|
||||
double sum = 0;
|
||||
for (int i =0; i < 5; ++i) {
|
||||
testInsertStb(taos, qstr);
|
||||
double elapsed = 0;
|
||||
testInsertStb(taos, qstr, &elapsed);
|
||||
sum += elapsed;
|
||||
}
|
||||
printf("average insert into stb time : %.3f\n", sum/5);
|
||||
}
|
||||
free(qstr);
|
||||
taos_close(taos);
|
||||
|
|
|
@ -319,4 +319,7 @@ if $data45 != 30.000000000 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql_error insert into ct1 using stb tags('a', 'b') values ('2022-06-26 13:00:00', 1) ct11 using sta tags('c', 'b#) values ('2022-06-26 13:00:01', 2);
|
||||
|
||||
|
||||
system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
||||
|
|
|
@ -51,6 +51,21 @@ print $rows
|
|||
if $rows != 5 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql create database dgxy;
|
||||
sql use dgxy;
|
||||
sql create table st(ts timestamp, f int) tags(t int);
|
||||
sql insert into ct1 using st tags(1) values(now, 1);
|
||||
sql insert into st(tbname, ts, f) values('ct1', now, 2);
|
||||
sql select * from ct1;
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
sql show tables like 'ct1';
|
||||
if $rows != 1 then
|
||||
return -1
|
||||
endi
|
||||
|
||||
sql_error insert into d2.st values(now, 1, 1)
|
||||
sql_error insert into d2.st(ts, f) values(now, 1);
|
||||
sql_error insert into d2.st(ts, f, tbname) values(now, 1);
|
||||
|
|
|
@ -176,7 +176,7 @@ class TDTestCase:
|
|||
tdSql.checkData(3, 2, 10)
|
||||
tdSql.checkData(4, 0, datetime.datetime(2021, 4, 19, 8, 0, 13))
|
||||
tdSql.checkData(4, 1, 1)
|
||||
tdSql.checkData(4, 2, None)
|
||||
tdSql.checkData(4, 2, 1)
|
||||
|
||||
def run_insert_stb(self):
|
||||
print("running {}".format('insert_stb'))
|
||||
|
|
Loading…
Reference in New Issue