Merge pull request #28531 from taosdata/fix/TS-5248
fix(s3/s3_chunksize): rename to s3_chunkpages & default to 128k pages
This commit is contained in:
commit
800bc944e3
|
@ -122,7 +122,7 @@
|
||||||
#define TK_STT_TRIGGER 104
|
#define TK_STT_TRIGGER 104
|
||||||
#define TK_TABLE_PREFIX 105
|
#define TK_TABLE_PREFIX 105
|
||||||
#define TK_TABLE_SUFFIX 106
|
#define TK_TABLE_SUFFIX 106
|
||||||
#define TK_S3_CHUNKSIZE 107
|
#define TK_S3_CHUNKPAGES 107
|
||||||
#define TK_S3_KEEPLOCAL 108
|
#define TK_S3_KEEPLOCAL 108
|
||||||
#define TK_S3_COMPACT 109
|
#define TK_S3_COMPACT 109
|
||||||
#define TK_KEEP_TIME_OFFSET 110
|
#define TK_KEEP_TIME_OFFSET 110
|
||||||
|
|
|
@ -450,7 +450,7 @@ typedef enum ELogicConditionType {
|
||||||
|
|
||||||
#define TSDB_MIN_S3_CHUNK_SIZE (128 * 1024)
|
#define TSDB_MIN_S3_CHUNK_SIZE (128 * 1024)
|
||||||
#define TSDB_MAX_S3_CHUNK_SIZE (1024 * 1024)
|
#define TSDB_MAX_S3_CHUNK_SIZE (1024 * 1024)
|
||||||
#define TSDB_DEFAULT_S3_CHUNK_SIZE (256 * 1024)
|
#define TSDB_DEFAULT_S3_CHUNK_SIZE (128 * 1024)
|
||||||
#define TSDB_MIN_S3_KEEP_LOCAL (1 * 1440) // unit minute
|
#define TSDB_MIN_S3_KEEP_LOCAL (1 * 1440) // unit minute
|
||||||
#define TSDB_MAX_S3_KEEP_LOCAL (365000 * 1440)
|
#define TSDB_MAX_S3_KEEP_LOCAL (365000 * 1440)
|
||||||
#define TSDB_DEFAULT_S3_KEEP_LOCAL (365 * 1440)
|
#define TSDB_DEFAULT_S3_KEEP_LOCAL (365 * 1440)
|
||||||
|
|
|
@ -118,7 +118,7 @@ static const SSysDbTableSchema userDBSchema[] = {
|
||||||
{.name = "table_suffix", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
|
{.name = "table_suffix", .bytes = 2, .type = TSDB_DATA_TYPE_SMALLINT, .sysInfo = true},
|
||||||
{.name = "tsdb_pagesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
|
{.name = "tsdb_pagesize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
|
||||||
{.name = "keep_time_offset", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
|
{.name = "keep_time_offset", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = false},
|
||||||
{.name = "s3_chunksize", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
|
{.name = "s3_chunkpages", .bytes = 4, .type = TSDB_DATA_TYPE_INT, .sysInfo = true},
|
||||||
{.name = "s3_keeplocal", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
{.name = "s3_keeplocal", .bytes = 10 + VARSTR_HEADER_SIZE, .type = TSDB_DATA_TYPE_VARCHAR, .sysInfo = true},
|
||||||
{.name = "s3_compact", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
{.name = "s3_compact", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
||||||
{.name = "with_arbitrator", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
{.name = "with_arbitrator", .bytes = 1, .type = TSDB_DATA_TYPE_TINYINT, .sysInfo = true},
|
||||||
|
|
|
@ -50,7 +50,7 @@ static int32_t buildRetrieveTableRsp(SSDataBlock* pBlock, int32_t numOfCols, SRe
|
||||||
(*pRsp)->numOfCols = htonl(numOfCols);
|
(*pRsp)->numOfCols = htonl(numOfCols);
|
||||||
|
|
||||||
int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, numOfCols);
|
int32_t len = blockEncode(pBlock, (*pRsp)->data + PAYLOAD_PREFIX_LEN, numOfCols);
|
||||||
if(len < 0) {
|
if (len < 0) {
|
||||||
taosMemoryFree(*pRsp);
|
taosMemoryFree(*pRsp);
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -410,27 +410,27 @@ static int32_t setCreateDBResultIntoDataBlock(SSDataBlock* pBlock, char* dbName,
|
||||||
int32_t lenKeep2 = formatDurationOrKeep(keep2Str, sizeof(keep2Str), pCfg->daysToKeep2);
|
int32_t lenKeep2 = formatDurationOrKeep(keep2Str, sizeof(keep2Str), pCfg->daysToKeep2);
|
||||||
|
|
||||||
if (IS_SYS_DBNAME(dbName)) {
|
if (IS_SYS_DBNAME(dbName)) {
|
||||||
len += tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, "CREATE DATABASE `%s`", dbName);
|
|
||||||
} else {
|
|
||||||
len += tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE,
|
len += tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE,
|
||||||
|
"CREATE DATABASE `%s`", dbName);
|
||||||
|
} else {
|
||||||
|
len +=
|
||||||
|
tsnprintf(buf2 + VARSTR_HEADER_SIZE, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE,
|
||||||
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %s "
|
"CREATE DATABASE `%s` BUFFER %d CACHESIZE %d CACHEMODEL '%s' COMP %d DURATION %s "
|
||||||
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %s,%s,%s PAGES %d PAGESIZE %d "
|
"WAL_FSYNC_PERIOD %d MAXROWS %d MINROWS %d STT_TRIGGER %d KEEP %s,%s,%s PAGES %d PAGESIZE %d "
|
||||||
"PRECISION '%s' REPLICA %d "
|
"PRECISION '%s' REPLICA %d "
|
||||||
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d "
|
"WAL_LEVEL %d VGROUPS %d SINGLE_STABLE %d TABLE_PREFIX %d TABLE_SUFFIX %d TSDB_PAGESIZE %d "
|
||||||
"WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64
|
"WAL_RETENTION_PERIOD %d WAL_RETENTION_SIZE %" PRId64
|
||||||
" KEEP_TIME_OFFSET %d ENCRYPT_ALGORITHM '%s' S3_CHUNKSIZE %d S3_KEEPLOCAL %dm S3_COMPACT %d",
|
" KEEP_TIME_OFFSET %d ENCRYPT_ALGORITHM '%s' S3_CHUNKPAGES %d S3_KEEPLOCAL %dm S3_COMPACT %d",
|
||||||
dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression,
|
dbName, pCfg->buffer, pCfg->cacheSize, cacheModelStr(pCfg->cacheLast), pCfg->compression, durationStr,
|
||||||
durationStr,
|
pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger, keep0Str, keep1Str, keep2Str,
|
||||||
pCfg->walFsyncPeriod, pCfg->maxRows, pCfg->minRows, pCfg->sstTrigger,
|
pCfg->pages, pCfg->pageSize, prec, pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups,
|
||||||
keep0Str, keep1Str, keep2Str,
|
1 == pCfg->numOfStables, hashPrefix, pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod,
|
||||||
pCfg->pages, pCfg->pageSize, prec,
|
pCfg->walRetentionSize, pCfg->keepTimeOffset, encryptAlgorithmStr(pCfg->encryptAlgorithm),
|
||||||
pCfg->replications, pCfg->walLevel, pCfg->numOfVgroups, 1 == pCfg->numOfStables, hashPrefix,
|
pCfg->s3ChunkSize, pCfg->s3KeepLocal, pCfg->s3Compact);
|
||||||
pCfg->hashSuffix, pCfg->tsdbPageSize, pCfg->walRetentionPeriod, pCfg->walRetentionSize,
|
|
||||||
pCfg->keepTimeOffset, encryptAlgorithmStr(pCfg->encryptAlgorithm), pCfg->s3ChunkSize,
|
|
||||||
pCfg->s3KeepLocal, pCfg->s3Compact);
|
|
||||||
|
|
||||||
if (pRetentions) {
|
if (pRetentions) {
|
||||||
len += tsnprintf(buf2 + VARSTR_HEADER_SIZE + len, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE, " RETENTIONS %s", pRetentions);
|
len += tsnprintf(buf2 + VARSTR_HEADER_SIZE + len, SHOW_CREATE_DB_RESULT_FIELD2_LEN - VARSTR_HEADER_SIZE,
|
||||||
|
" RETENTIONS %s", pRetentions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,12 +528,12 @@ void appendColumnFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
columnLevelStr(COMPRESS_L2_TYPE_LEVEL_U32(pCfg->pSchemaExt[i].compress)));
|
columnLevelStr(COMPRESS_L2_TYPE_LEVEL_U32(pCfg->pSchemaExt[i].compress)));
|
||||||
}
|
}
|
||||||
if (!(pSchema->flags & COL_IS_KEY)) {
|
if (!(pSchema->flags & COL_IS_KEY)) {
|
||||||
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), "%s`%s` %s",
|
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len),
|
||||||
((i > 0) ? ", " : ""), pSchema->name, type);
|
"%s`%s` %s", ((i > 0) ? ", " : ""), pSchema->name, type);
|
||||||
} else {
|
} else {
|
||||||
char* pk = "PRIMARY KEY";
|
char* pk = "PRIMARY KEY";
|
||||||
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), "%s`%s` %s %s",
|
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len),
|
||||||
((i > 0) ? ", " : ""), pSchema->name, type, pk);
|
"%s`%s` %s %s", ((i > 0) ? ", " : ""), pSchema->name, type, pk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -545,14 +545,15 @@ void appendTagFields(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
snprintf(type, sizeof(type), "%s", tDataTypes[pSchema->type].name);
|
snprintf(type, sizeof(type), "%s", tDataTypes[pSchema->type].name);
|
||||||
if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_VARBINARY == pSchema->type ||
|
if (TSDB_DATA_TYPE_VARCHAR == pSchema->type || TSDB_DATA_TYPE_VARBINARY == pSchema->type ||
|
||||||
TSDB_DATA_TYPE_GEOMETRY == pSchema->type) {
|
TSDB_DATA_TYPE_GEOMETRY == pSchema->type) {
|
||||||
snprintf(type + strlen(type), sizeof(type) - strlen(type), "(%d)", (int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE));
|
snprintf(type + strlen(type), sizeof(type) - strlen(type), "(%d)",
|
||||||
|
(int32_t)(pSchema->bytes - VARSTR_HEADER_SIZE));
|
||||||
} else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) {
|
} else if (TSDB_DATA_TYPE_NCHAR == pSchema->type) {
|
||||||
snprintf(type + strlen(type), sizeof(type) - strlen(type), "(%d)",
|
snprintf(type + strlen(type), sizeof(type) - strlen(type), "(%d)",
|
||||||
(int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
|
(int32_t)((pSchema->bytes - VARSTR_HEADER_SIZE) / TSDB_NCHAR_SIZE));
|
||||||
}
|
}
|
||||||
|
|
||||||
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len), "%s`%s` %s",
|
*len += tsnprintf(buf + VARSTR_HEADER_SIZE + *len, SHOW_CREATE_TB_RESULT_FIELD2_LEN - (VARSTR_HEADER_SIZE + *len),
|
||||||
((i > 0) ? ", " : ""), pSchema->name, type);
|
"%s`%s` %s", ((i > 0) ? ", " : ""), pSchema->name, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,7 +625,8 @@ int32_t appendTagValues(char* buf, int32_t* len, STableCfg* pCfg) {
|
||||||
code = dataConverToStr(buf + VARSTR_HEADER_SIZE + *len, leftSize, type, pTagVal->pData, pTagVal->nData, &tlen);
|
code = dataConverToStr(buf + VARSTR_HEADER_SIZE + *len, leftSize, type, pTagVal->pData, pTagVal->nData, &tlen);
|
||||||
TAOS_CHECK_ERRNO(code);
|
TAOS_CHECK_ERRNO(code);
|
||||||
} else {
|
} else {
|
||||||
code = dataConverToStr(buf + VARSTR_HEADER_SIZE + *len, leftSize, type, &pTagVal->i64, tDataTypes[type].bytes, &tlen);
|
code = dataConverToStr(buf + VARSTR_HEADER_SIZE + *len, leftSize, type, &pTagVal->i64, tDataTypes[type].bytes,
|
||||||
|
&tlen);
|
||||||
TAOS_CHECK_ERRNO(code);
|
TAOS_CHECK_ERRNO(code);
|
||||||
}
|
}
|
||||||
*len += tlen;
|
*len += tlen;
|
||||||
|
@ -793,7 +795,7 @@ static int32_t setCreateViewResultIntoDataBlock(SSDataBlock* pBlock, SShowCreate
|
||||||
}
|
}
|
||||||
|
|
||||||
SViewMeta* pMeta = pStmt->pViewMeta;
|
SViewMeta* pMeta = pStmt->pViewMeta;
|
||||||
if(NULL == pMeta) {
|
if (NULL == pMeta) {
|
||||||
qError("exception: view meta is null");
|
qError("exception: view meta is null");
|
||||||
return TSDB_CODE_APP_ERROR;
|
return TSDB_CODE_APP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ typedef enum EDatabaseOptionType {
|
||||||
DB_OPTION_STT_TRIGGER,
|
DB_OPTION_STT_TRIGGER,
|
||||||
DB_OPTION_TABLE_PREFIX,
|
DB_OPTION_TABLE_PREFIX,
|
||||||
DB_OPTION_TABLE_SUFFIX,
|
DB_OPTION_TABLE_SUFFIX,
|
||||||
DB_OPTION_S3_CHUNKSIZE,
|
DB_OPTION_S3_CHUNKPAGES,
|
||||||
DB_OPTION_S3_KEEPLOCAL,
|
DB_OPTION_S3_KEEPLOCAL,
|
||||||
DB_OPTION_S3_COMPACT,
|
DB_OPTION_S3_COMPACT,
|
||||||
DB_OPTION_KEEP_TIME_OFFSET,
|
DB_OPTION_KEEP_TIME_OFFSET,
|
||||||
|
|
|
@ -280,7 +280,7 @@ db_options(A) ::= db_options(B) WAL_SEGMENT_SIZE NK_INTEGER(C).
|
||||||
db_options(A) ::= db_options(B) STT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STT_TRIGGER, &C); }
|
db_options(A) ::= db_options(B) STT_TRIGGER NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_STT_TRIGGER, &C); }
|
||||||
db_options(A) ::= db_options(B) TABLE_PREFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_PREFIX, C); }
|
db_options(A) ::= db_options(B) TABLE_PREFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_PREFIX, C); }
|
||||||
db_options(A) ::= db_options(B) TABLE_SUFFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_SUFFIX, C); }
|
db_options(A) ::= db_options(B) TABLE_SUFFIX signed(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_TABLE_SUFFIX, C); }
|
||||||
db_options(A) ::= db_options(B) S3_CHUNKSIZE NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_CHUNKSIZE, &C); }
|
db_options(A) ::= db_options(B) S3_CHUNKPAGES NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_CHUNKPAGES, &C); }
|
||||||
db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); }
|
db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); }
|
||||||
db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); }
|
db_options(A) ::= db_options(B) S3_KEEPLOCAL NK_VARIABLE(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_KEEPLOCAL, &C); }
|
||||||
db_options(A) ::= db_options(B) S3_COMPACT NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_COMPACT, &C); }
|
db_options(A) ::= db_options(B) S3_COMPACT NK_INTEGER(C). { A = setDatabaseOption(pCxt, B, DB_OPTION_S3_COMPACT, &C); }
|
||||||
|
|
|
@ -333,7 +333,7 @@ SNode* releaseRawExprNode(SAstCreateContext* pCxt, SNode* pNode) {
|
||||||
// Len of pRawExpr->p could be larger than len of aliasName[TSDB_COL_NAME_LEN].
|
// Len of pRawExpr->p could be larger than len of aliasName[TSDB_COL_NAME_LEN].
|
||||||
// If aliasName is truncated, hash value of aliasName could be the same.
|
// If aliasName is truncated, hash value of aliasName could be the same.
|
||||||
uint64_t hashVal = MurmurHash3_64(pRawExpr->p, pRawExpr->n);
|
uint64_t hashVal = MurmurHash3_64(pRawExpr->p, pRawExpr->n);
|
||||||
sprintf(pExpr->aliasName, "%"PRIu64, hashVal);
|
sprintf(pExpr->aliasName, "%" PRIu64, hashVal);
|
||||||
strncpy(pExpr->userAlias, pRawExpr->p, len);
|
strncpy(pExpr->userAlias, pRawExpr->p, len);
|
||||||
pExpr->userAlias[len] = '\0';
|
pExpr->userAlias[len] = '\0';
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ SNode* createValueNode(SAstCreateContext* pCxt, int32_t dataType, const SToken*
|
||||||
pCxt->errCode = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&val);
|
pCxt->errCode = nodesMakeNode(QUERY_NODE_VALUE, (SNode**)&val);
|
||||||
CHECK_MAKE_NODE(val);
|
CHECK_MAKE_NODE(val);
|
||||||
val->literal = taosStrndup(pLiteral->z, pLiteral->n);
|
val->literal = taosStrndup(pLiteral->z, pLiteral->n);
|
||||||
if(!val->literal) {
|
if (!val->literal) {
|
||||||
pCxt->errCode = terrno;
|
pCxt->errCode = terrno;
|
||||||
nodesDestroyNode((SNode*)val);
|
nodesDestroyNode((SNode*)val);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -971,7 +971,7 @@ _err:
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight) {
|
SNode* createBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight) {
|
||||||
SNode* pNew = NULL, *pGE = NULL, *pLE = NULL;
|
SNode *pNew = NULL, *pGE = NULL, *pLE = NULL;
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
pCxt->errCode = nodesCloneNode(pExpr, &pNew);
|
pCxt->errCode = nodesCloneNode(pExpr, &pNew);
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
|
@ -993,7 +993,7 @@ _err:
|
||||||
}
|
}
|
||||||
|
|
||||||
SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight) {
|
SNode* createNotBetweenAnd(SAstCreateContext* pCxt, SNode* pExpr, SNode* pLeft, SNode* pRight) {
|
||||||
SNode* pNew = NULL, *pLT = NULL, *pGT = NULL;
|
SNode *pNew = NULL, *pLT = NULL, *pGT = NULL;
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
pCxt->errCode = nodesCloneNode(pExpr, &pNew);
|
pCxt->errCode = nodesCloneNode(pExpr, &pNew);
|
||||||
CHECK_PARSER_STATUS(pCxt);
|
CHECK_PARSER_STATUS(pCxt);
|
||||||
|
@ -1959,7 +1959,7 @@ static SNode* setDatabaseOptionImpl(SAstCreateContext* pCxt, SNode* pOptions, ED
|
||||||
nodesDestroyNode((SNode*)pNode);
|
nodesDestroyNode((SNode*)pNode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DB_OPTION_S3_CHUNKSIZE:
|
case DB_OPTION_S3_CHUNKPAGES:
|
||||||
pDbOptions->s3ChunkSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
pDbOptions->s3ChunkSize = taosStr2Int32(((SToken*)pVal)->z, NULL, 10);
|
||||||
break;
|
break;
|
||||||
case DB_OPTION_S3_KEEPLOCAL: {
|
case DB_OPTION_S3_KEEPLOCAL: {
|
||||||
|
|
|
@ -340,7 +340,7 @@ static SKeyword keywordTable[] = {
|
||||||
{"_FROWTS", TK_FROWTS},
|
{"_FROWTS", TK_FROWTS},
|
||||||
{"ALIVE", TK_ALIVE},
|
{"ALIVE", TK_ALIVE},
|
||||||
{"VARBINARY", TK_VARBINARY},
|
{"VARBINARY", TK_VARBINARY},
|
||||||
{"S3_CHUNKSIZE", TK_S3_CHUNKSIZE},
|
{"S3_CHUNKPAGES", TK_S3_CHUNKPAGES},
|
||||||
{"S3_KEEPLOCAL", TK_S3_KEEPLOCAL},
|
{"S3_KEEPLOCAL", TK_S3_KEEPLOCAL},
|
||||||
{"S3_COMPACT", TK_S3_COMPACT},
|
{"S3_COMPACT", TK_S3_COMPACT},
|
||||||
{"S3MIGRATE", TK_S3MIGRATE},
|
{"S3MIGRATE", TK_S3MIGRATE},
|
||||||
|
@ -713,10 +713,10 @@ uint32_t tGetToken(const char* z, uint32_t* tokenId) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
bool hasNonAsciiChars = false;
|
bool hasNonAsciiChars = false;
|
||||||
for (i = 1; ; i++) {
|
for (i = 1;; i++) {
|
||||||
if ((z[i] & 0x80) != 0) {
|
if ((z[i] & 0x80) != 0) {
|
||||||
hasNonAsciiChars = true;
|
hasNonAsciiChars = true;
|
||||||
} else if (isIdChar[(uint8_t)z[i]]){
|
} else if (isIdChar[(uint8_t)z[i]]) {
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -834,9 +834,7 @@ SToken tStrGetToken(const char* str, int32_t* i, bool isPrevOptr, bool* pIgnoreC
|
||||||
|
|
||||||
bool taosIsKeyWordToken(const char* z, int32_t len) { return (tKeywordCode((char*)z, len) != TK_NK_ID); }
|
bool taosIsKeyWordToken(const char* z, int32_t len) { return (tKeywordCode((char*)z, len) != TK_NK_ID); }
|
||||||
|
|
||||||
int32_t taosInitKeywordsTable() {
|
int32_t taosInitKeywordsTable() { return doInitKeywordsTable(); }
|
||||||
return doInitKeywordsTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void taosCleanupKeywordsTable() {
|
void taosCleanupKeywordsTable() {
|
||||||
void* m = keywordHashTable;
|
void* m = keywordHashTable;
|
||||||
|
|
|
@ -725,7 +725,7 @@ static int32_t getTableHashVgroupImpl(STranslateContext* pCxt, const SName* pNam
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (pParCxt->async) {
|
if (pParCxt->async) {
|
||||||
if(pCxt->withOpt) {
|
if (pCxt->withOpt) {
|
||||||
code = getDbTableVgroupFromCache(pCxt->pMetaCache, pName, pInfo);
|
code = getDbTableVgroupFromCache(pCxt->pMetaCache, pName, pInfo);
|
||||||
} else {
|
} else {
|
||||||
code = getTableVgroupFromCache(pCxt->pMetaCache, pName, pInfo);
|
code = getTableVgroupFromCache(pCxt->pMetaCache, pName, pInfo);
|
||||||
|
@ -1019,8 +1019,7 @@ static uint8_t getPrecisionFromCurrStmt(SNode* pCurrStmt, uint8_t defaultVal) {
|
||||||
if (isDeleteStmt(pCurrStmt)) {
|
if (isDeleteStmt(pCurrStmt)) {
|
||||||
return ((SDeleteStmt*)pCurrStmt)->precision;
|
return ((SDeleteStmt*)pCurrStmt)->precision;
|
||||||
}
|
}
|
||||||
if (pCurrStmt && nodeType(pCurrStmt) == QUERY_NODE_CREATE_TSMA_STMT)
|
if (pCurrStmt && nodeType(pCurrStmt) == QUERY_NODE_CREATE_TSMA_STMT) return ((SCreateTSMAStmt*)pCurrStmt)->precision;
|
||||||
return ((SCreateTSMAStmt*)pCurrStmt)->precision;
|
|
||||||
return defaultVal;
|
return defaultVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,7 +1167,7 @@ static bool isBlockTimeLineAlignedQuery(SNode* pStmt) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum, SNodeList**ppOut) {
|
int32_t buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum, SNodeList** ppOut) {
|
||||||
*ppOut = NULL;
|
*ppOut = NULL;
|
||||||
SNodeList* pPartitionList = NULL;
|
SNodeList* pPartitionList = NULL;
|
||||||
SNode* pNode = NULL;
|
SNode* pNode = NULL;
|
||||||
|
@ -1194,8 +1193,7 @@ int32_t buildPartitionListFromOrderList(SNodeList* pOrderList, int32_t nodesNum,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) *ppOut = pPartitionList;
|
||||||
*ppOut = pPartitionList;
|
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -1229,7 +1227,8 @@ static int32_t isTimeLineAlignedQuery(SNode* pStmt, bool* pRes) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
|
if (TSDB_CODE_SUCCESS == code &&
|
||||||
|
QUERY_NODE_SET_OPERATOR == nodeType(((STempTableNode*)pSelect->pFromTable)->pSubquery)) {
|
||||||
SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery;
|
SSetOperator* pSub = (SSetOperator*)((STempTableNode*)pSelect->pFromTable)->pSubquery;
|
||||||
if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) {
|
if (pSelect->pPartitionByList && pSub->timeLineFromOrderBy && pSub->pOrderByList->length > 1) {
|
||||||
SNodeList* pPartitionList = NULL;
|
SNodeList* pPartitionList = NULL;
|
||||||
|
@ -1397,12 +1396,16 @@ static void setColumnPrimTs(STranslateContext* pCxt, SColumnNode* pCol, const ST
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* pTable, bool igTags, SNodeList* pList, bool skipProjRef) {
|
static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* pTable, bool igTags, SNodeList* pList,
|
||||||
|
bool skipProjRef) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
if (QUERY_NODE_REAL_TABLE == nodeType(pTable)) {
|
if (QUERY_NODE_REAL_TABLE == nodeType(pTable)) {
|
||||||
const STableMeta* pMeta = ((SRealTableNode*)pTable)->pMeta;
|
const STableMeta* pMeta = ((SRealTableNode*)pTable)->pMeta;
|
||||||
int32_t nums = pMeta->tableInfo.numOfColumns +
|
int32_t nums = pMeta->tableInfo.numOfColumns +
|
||||||
(igTags ? 0 : ((TSDB_SUPER_TABLE == pMeta->tableType || ((SRealTableNode*)pTable)->stbRewrite) ? pMeta->tableInfo.numOfTags : 0));
|
(igTags ? 0
|
||||||
|
: ((TSDB_SUPER_TABLE == pMeta->tableType || ((SRealTableNode*)pTable)->stbRewrite)
|
||||||
|
? pMeta->tableInfo.numOfTags
|
||||||
|
: 0));
|
||||||
for (int32_t i = 0; i < nums; ++i) {
|
for (int32_t i = 0; i < nums; ++i) {
|
||||||
if (invisibleColumn(pCxt->pParseCxt->enableSysInfo, pMeta->tableType, pMeta->schema[i].flags)) {
|
if (invisibleColumn(pCxt->pParseCxt->enableSysInfo, pMeta->tableType, pMeta->schema[i].flags)) {
|
||||||
pCxt->pParseCxt->hasInvisibleCol = true;
|
pCxt->pParseCxt->hasInvisibleCol = true;
|
||||||
|
@ -1433,7 +1436,8 @@ static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* p
|
||||||
code = setColumnInfoByExpr(pTempTable, (SExprNode*)pNode, (SColumnNode**)&pCell->pNode);
|
code = setColumnInfoByExpr(pTempTable, (SExprNode*)pNode, (SColumnNode**)&pCell->pNode);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
if (!skipProjRef) pCol->projRefIdx = ((SExprNode*)pNode)->projIdx; // only set proj ref when select * from (select ...)
|
if (!skipProjRef)
|
||||||
|
pCol->projRefIdx = ((SExprNode*)pNode)->projIdx; // only set proj ref when select * from (select ...)
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1603,7 +1607,8 @@ static EDealRes translateColumnUseAlias(STranslateContext* pCxt, SColumnNode** p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*pFound) {
|
if (*pFound) {
|
||||||
if (QUERY_NODE_FUNCTION == nodeType(pFoundNode) && (SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause)) {
|
if (QUERY_NODE_FUNCTION == nodeType(pFoundNode) &&
|
||||||
|
(SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause)) {
|
||||||
pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode);
|
pCxt->errCode = getFuncInfo(pCxt, (SFunctionNode*)pFoundNode);
|
||||||
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
||||||
if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) {
|
if (fmIsVectorFunc(((SFunctionNode*)pFoundNode)->funcId)) {
|
||||||
|
@ -1744,8 +1749,7 @@ static int32_t biRewriteSelectFuncParamStar(STranslateContext* pCxt, SSelectStmt
|
||||||
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
SNode* pTbnameNode = NULL;
|
SNode* pTbnameNode = NULL;
|
||||||
code = biMakeTbnameProjectAstNode(pFunc->functionName, NULL, &pTbnameNode);
|
code = biMakeTbnameProjectAstNode(pFunc->functionName, NULL, &pTbnameNode);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
||||||
code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
||||||
|
@ -1761,8 +1765,7 @@ static int32_t biRewriteSelectFuncParamStar(STranslateContext* pCxt, SSelectStmt
|
||||||
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
SNode* pTbnameNode = NULL;
|
SNode* pTbnameNode = NULL;
|
||||||
code = biMakeTbnameProjectAstNode(pFunc->functionName, pTableAlias, &pTbnameNode);
|
code = biMakeTbnameProjectAstNode(pFunc->functionName, pTableAlias, &pTbnameNode);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
||||||
code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
||||||
nodesListInsertListAfterPos(pSelect->pProjectionList, pSelectListCell, pTbnameNodeList);
|
nodesListInsertListAfterPos(pSelect->pProjectionList, pSelectListCell, pTbnameNodeList);
|
||||||
|
@ -1794,8 +1797,7 @@ int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
SNode* pTbnameNode = NULL;
|
SNode* pTbnameNode = NULL;
|
||||||
code = biMakeTbnameProjectAstNode(NULL, NULL, &pTbnameNode);
|
code = biMakeTbnameProjectAstNode(NULL, NULL, &pTbnameNode);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
||||||
code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
||||||
|
@ -1810,8 +1812,7 @@ int32_t biRewriteSelectStar(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
((SRealTableNode*)pTable)->pMeta != NULL && ((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
((SRealTableNode*)pTable)->pMeta != NULL && ((SRealTableNode*)pTable)->pMeta->tableType == TSDB_SUPER_TABLE) {
|
||||||
SNode* pTbnameNode = NULL;
|
SNode* pTbnameNode = NULL;
|
||||||
code = biMakeTbnameProjectAstNode(NULL, pTableAlias, &pTbnameNode);
|
code = biMakeTbnameProjectAstNode(NULL, pTableAlias, &pTbnameNode);
|
||||||
if (TSDB_CODE_SUCCESS ==code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
||||||
code = nodesListStrictAppend(pTbnameNodeList, pTbnameNode);
|
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
if (TSDB_CODE_SUCCESS == code && LIST_LENGTH(pTbnameNodeList) > 0) {
|
||||||
nodesListInsertListAfterPos(pSelect->pProjectionList, cell, pTbnameNodeList);
|
nodesListInsertListAfterPos(pSelect->pProjectionList, cell, pTbnameNodeList);
|
||||||
|
@ -1877,9 +1878,7 @@ int32_t biCheckCreateTableTbnameCol(STranslateContext* pCxt, SCreateTableStmt* p
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool clauseSupportAlias(ESqlClause clause) {
|
static bool clauseSupportAlias(ESqlClause clause) {
|
||||||
return SQL_CLAUSE_GROUP_BY == clause ||
|
return SQL_CLAUSE_GROUP_BY == clause || SQL_CLAUSE_PARTITION_BY == clause || SQL_CLAUSE_ORDER_BY == clause;
|
||||||
SQL_CLAUSE_PARTITION_BY == clause ||
|
|
||||||
SQL_CLAUSE_ORDER_BY == clause;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
||||||
|
@ -1908,8 +1907,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
||||||
res = translateColumnWithPrefix(pCxt, pCol);
|
res = translateColumnWithPrefix(pCxt, pCol);
|
||||||
} else {
|
} else {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if ((pCxt->currClause == SQL_CLAUSE_ORDER_BY) &&
|
if ((pCxt->currClause == SQL_CLAUSE_ORDER_BY) && !(*pCol)->node.asParam) {
|
||||||
!(*pCol)->node.asParam) {
|
|
||||||
res = translateColumnUseAlias(pCxt, pCol, &found);
|
res = translateColumnUseAlias(pCxt, pCol, &found);
|
||||||
}
|
}
|
||||||
if (DEAL_RES_ERROR != res && !found) {
|
if (DEAL_RES_ERROR != res && !found) {
|
||||||
|
@ -1919,9 +1917,7 @@ static EDealRes translateColumn(STranslateContext* pCxt, SColumnNode** pCol) {
|
||||||
res = translateColumnWithoutPrefix(pCxt, pCol);
|
res = translateColumnWithoutPrefix(pCxt, pCol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (clauseSupportAlias(pCxt->currClause) &&
|
if (clauseSupportAlias(pCxt->currClause) && !(*pCol)->node.asParam && res != DEAL_RES_CONTINUE &&
|
||||||
!(*pCol)->node.asParam &&
|
|
||||||
res != DEAL_RES_CONTINUE &&
|
|
||||||
res != DEAL_RES_END) {
|
res != DEAL_RES_END) {
|
||||||
res = translateColumnUseAlias(pCxt, pCol, &found);
|
res = translateColumnUseAlias(pCxt, pCol, &found);
|
||||||
}
|
}
|
||||||
|
@ -2750,7 +2746,8 @@ static int32_t translateRepeatScanFunc(STranslateContext* pCxt, SFunctionNode* p
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL != pSelect->pWindow) {
|
if (NULL != pSelect->pWindow) {
|
||||||
if (QUERY_NODE_EVENT_WINDOW == nodeType(pSelect->pWindow) || QUERY_NODE_COUNT_WINDOW == nodeType(pSelect->pWindow)) {
|
if (QUERY_NODE_EVENT_WINDOW == nodeType(pSelect->pWindow) ||
|
||||||
|
QUERY_NODE_COUNT_WINDOW == nodeType(pSelect->pWindow)) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_ALLOWED_FUNC,
|
||||||
"%s function is not supported in count/event window", pFunc->functionName);
|
"%s function is not supported in count/event window", pFunc->functionName);
|
||||||
}
|
}
|
||||||
|
@ -3222,8 +3219,7 @@ static EDealRes translateFunction(STranslateContext* pCxt, SFunctionNode** pFunc
|
||||||
|
|
||||||
pCxt->errCode = getFuncInfo(pCxt, *pFunc);
|
pCxt->errCode = getFuncInfo(pCxt, *pFunc);
|
||||||
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
|
||||||
if ((SQL_CLAUSE_GROUP_BY == pCxt->currClause ||
|
if ((SQL_CLAUSE_GROUP_BY == pCxt->currClause || SQL_CLAUSE_PARTITION_BY == pCxt->currClause) &&
|
||||||
SQL_CLAUSE_PARTITION_BY == pCxt->currClause) &&
|
|
||||||
fmIsVectorFunc((*pFunc)->funcId)) {
|
fmIsVectorFunc((*pFunc)->funcId)) {
|
||||||
pCxt->errCode = TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION;
|
pCxt->errCode = TSDB_CODE_PAR_ILLEGAL_USE_AGG_FUNCTION;
|
||||||
}
|
}
|
||||||
|
@ -3314,20 +3310,19 @@ static int32_t selectCommonType(SDataType* commonType, const SDataType* newType)
|
||||||
commonType->bytes = TMAX(commonType->bytes, newType->bytes);
|
commonType->bytes = TMAX(commonType->bytes, newType->bytes);
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
if (resultType == commonType->type){
|
if (resultType == commonType->type) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
if(resultType == newType->type) {
|
if (resultType == newType->type) {
|
||||||
*commonType = *newType;
|
*commonType = *newType;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]);
|
commonType->bytes = TMAX(TMAX(commonType->bytes, newType->bytes), TYPE_BYTES[resultType]);
|
||||||
if(resultType == TSDB_DATA_TYPE_VARCHAR && (IS_FLOAT_TYPE(commonType->type) || IS_FLOAT_TYPE(newType->type))) {
|
if (resultType == TSDB_DATA_TYPE_VARCHAR && (IS_FLOAT_TYPE(commonType->type) || IS_FLOAT_TYPE(newType->type))) {
|
||||||
commonType->bytes += TYPE_BYTES[TSDB_DATA_TYPE_DOUBLE];
|
commonType->bytes += TYPE_BYTES[TSDB_DATA_TYPE_DOUBLE];
|
||||||
}
|
}
|
||||||
commonType->type = resultType;
|
commonType->type = resultType;
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseWhen) {
|
static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseWhen) {
|
||||||
|
@ -3350,7 +3345,7 @@ static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseW
|
||||||
}
|
}
|
||||||
allNullThen = false;
|
allNullThen = false;
|
||||||
pCxt->errCode = selectCommonType(&pCaseWhen->node.resType, &pThenExpr->resType);
|
pCxt->errCode = selectCommonType(&pCaseWhen->node.resType, &pThenExpr->resType);
|
||||||
if(TSDB_CODE_SUCCESS != pCxt->errCode){
|
if (TSDB_CODE_SUCCESS != pCxt->errCode) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3358,7 +3353,7 @@ static EDealRes translateCaseWhen(STranslateContext* pCxt, SCaseWhenNode* pCaseW
|
||||||
SExprNode* pElseExpr = (SExprNode*)pCaseWhen->pElse;
|
SExprNode* pElseExpr = (SExprNode*)pCaseWhen->pElse;
|
||||||
if (NULL != pElseExpr) {
|
if (NULL != pElseExpr) {
|
||||||
pCxt->errCode = selectCommonType(&pCaseWhen->node.resType, &pElseExpr->resType);
|
pCxt->errCode = selectCommonType(&pCaseWhen->node.resType, &pElseExpr->resType);
|
||||||
if(TSDB_CODE_SUCCESS != pCxt->errCode) {
|
if (TSDB_CODE_SUCCESS != pCxt->errCode) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4278,8 +4273,8 @@ static int32_t setTableTsmas(STranslateContext* pCxt, SName* pName, SRealTableNo
|
||||||
SVgroupInfo vgInfo = {0};
|
SVgroupInfo vgInfo = {0};
|
||||||
bool exists = false;
|
bool exists = false;
|
||||||
toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName);
|
toName(pCxt->pParseCxt->acctId, pRealTable->table.dbName, "", &tsmaTargetTbName);
|
||||||
int32_t len = tsnprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName, pTsma->name,
|
int32_t len = tsnprintf(buf, TSDB_TABLE_FNAME_LEN + TSDB_TABLE_NAME_LEN, "%s.%s_%s", pTsma->dbFName,
|
||||||
pRealTable->table.tableName);
|
pTsma->name, pRealTable->table.tableName);
|
||||||
len = taosCreateMD5Hash(buf, len);
|
len = taosCreateMD5Hash(buf, len);
|
||||||
strncpy(tsmaTargetTbName.tname, buf, MD5_OUTPUT_LEN);
|
strncpy(tsmaTargetTbName.tname, buf, MD5_OUTPUT_LEN);
|
||||||
code = collectUseTable(&tsmaTargetTbName, pCxt->pTargetTables);
|
code = collectUseTable(&tsmaTargetTbName, pCxt->pTargetTables);
|
||||||
|
@ -4957,8 +4952,7 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare
|
||||||
}
|
}
|
||||||
code = translateAudit(pCxt, pRealTable, &name);
|
code = translateAudit(pCxt, pRealTable, &name);
|
||||||
#endif
|
#endif
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = setTableVgroupList(pCxt, &name, pRealTable);
|
||||||
code = setTableVgroupList(pCxt, &name, pRealTable);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = setTableIndex(pCxt, &name, pRealTable);
|
code = setTableIndex(pCxt, &name, pRealTable);
|
||||||
}
|
}
|
||||||
|
@ -5350,8 +5344,8 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static EDealRes needFillImpl(SNode* pNode, void* pContext) {
|
static EDealRes needFillImpl(SNode* pNode, void* pContext) {
|
||||||
if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType
|
if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType &&
|
||||||
&& FUNCTION_TYPE_GROUP_CONST_VALUE != ((SFunctionNode*)pNode)->funcType) {
|
FUNCTION_TYPE_GROUP_CONST_VALUE != ((SFunctionNode*)pNode)->funcType) {
|
||||||
*(bool*)pContext = true;
|
*(bool*)pContext = true;
|
||||||
return DEAL_RES_END;
|
return DEAL_RES_END;
|
||||||
}
|
}
|
||||||
|
@ -5460,9 +5454,7 @@ static int32_t translateProjectionList(STranslateContext* pCxt, SSelectStmt* pSe
|
||||||
} else {
|
} else {
|
||||||
SNode* pNode;
|
SNode* pNode;
|
||||||
int32_t projIdx = 1;
|
int32_t projIdx = 1;
|
||||||
FOREACH(pNode, pSelect->pProjectionList) {
|
FOREACH(pNode, pSelect->pProjectionList) { ((SExprNode*)pNode)->projIdx = projIdx++; }
|
||||||
((SExprNode*)pNode)->projIdx = projIdx++;
|
|
||||||
}
|
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5478,7 +5470,7 @@ static EDealRes replaceGroupByAliasImpl(SNode** pNode, void* pContext) {
|
||||||
SNode* pProject = NULL;
|
SNode* pProject = NULL;
|
||||||
if (QUERY_NODE_VALUE == nodeType(*pNode)) {
|
if (QUERY_NODE_VALUE == nodeType(*pNode)) {
|
||||||
STranslateContext* pTransCxt = pCxt->pTranslateCxt;
|
STranslateContext* pTransCxt = pCxt->pTranslateCxt;
|
||||||
SValueNode* pVal = (SValueNode*) *pNode;
|
SValueNode* pVal = (SValueNode*)*pNode;
|
||||||
if (DEAL_RES_ERROR == translateValue(pTransCxt, pVal)) {
|
if (DEAL_RES_ERROR == translateValue(pTransCxt, pVal)) {
|
||||||
return DEAL_RES_CONTINUE;
|
return DEAL_RES_CONTINUE;
|
||||||
}
|
}
|
||||||
|
@ -5511,8 +5503,7 @@ static int32_t replaceGroupByAlias(STranslateContext* pCxt, SSelectStmt* pSelect
|
||||||
if (NULL == pSelect->pGroupByList) {
|
if (NULL == pSelect->pGroupByList) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
SReplaceGroupByAliasCxt cxt = {
|
SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
||||||
.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
|
||||||
nodesRewriteExprsPostOrder(pSelect->pGroupByList, replaceGroupByAliasImpl, &cxt);
|
nodesRewriteExprsPostOrder(pSelect->pGroupByList, replaceGroupByAliasImpl, &cxt);
|
||||||
|
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
|
@ -5522,8 +5513,7 @@ static int32_t replacePartitionByAlias(STranslateContext* pCxt, SSelectStmt* pSe
|
||||||
if (NULL == pSelect->pPartitionByList) {
|
if (NULL == pSelect->pPartitionByList) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
SReplaceGroupByAliasCxt cxt = {
|
SReplaceGroupByAliasCxt cxt = {.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
||||||
.pTranslateCxt = pCxt, .pProjectionList = pSelect->pProjectionList};
|
|
||||||
nodesRewriteExprsPostOrder(pSelect->pPartitionByList, replaceGroupByAliasImpl, &cxt);
|
nodesRewriteExprsPostOrder(pSelect->pPartitionByList, replaceGroupByAliasImpl, &cxt);
|
||||||
|
|
||||||
return pCxt->errCode;
|
return pCxt->errCode;
|
||||||
|
@ -6400,7 +6390,8 @@ static int32_t isOperatorTbnameInCond(STranslateContext* pCxt, SOperatorNode* pO
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pWhere, SEqCondTbNameTableInfo* pInfo, bool* pRet) {
|
static int32_t findEqCondTbNameInOperatorNode(STranslateContext* pCxt, SNode* pWhere, SEqCondTbNameTableInfo* pInfo,
|
||||||
|
bool* pRet) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
char* pTableAlias = NULL;
|
char* pTableAlias = NULL;
|
||||||
bool eqTbnameCond = false, tbnameInCond = false;
|
bool eqTbnameCond = false, tbnameInCond = false;
|
||||||
|
@ -6714,7 +6705,8 @@ static int32_t setEqualTbnameTableVgroups(STranslateContext* pCxt, SSelectStmt*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug("before ctbname optimize, code:%d, aTableNum:%d, nTbls:%d, stableQuery:%d", code, aTableNum, nTbls, stableQuery);
|
qDebug("before ctbname optimize, code:%d, aTableNum:%d, nTbls:%d, stableQuery:%d", code, aTableNum, nTbls,
|
||||||
|
stableQuery);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code && 1 == aTableNum && 1 == nTbls && stableQuery && NULL == pInfo->pRealTable->pTsmas) {
|
if (TSDB_CODE_SUCCESS == code && 1 == aTableNum && 1 == nTbls && stableQuery && NULL == pInfo->pRealTable->pTsmas) {
|
||||||
code = replaceToChildTableQuery(pCxt, pInfo);
|
code = replaceToChildTableQuery(pCxt, pInfo);
|
||||||
|
@ -6808,8 +6800,8 @@ static EDealRes collectTableAlias(SNode* pNode, void* pContext) {
|
||||||
*(SSHashObj**)pContext = pHash;
|
*(SSHashObj**)pContext = pHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != tSimpleHashPut(*(SSHashObj**)pContext, pCol->tableAlias, strlen(pCol->tableAlias), pCol->tableAlias,
|
if (TSDB_CODE_SUCCESS != tSimpleHashPut(*(SSHashObj**)pContext, pCol->tableAlias, strlen(pCol->tableAlias),
|
||||||
sizeof(pCol->tableAlias))) {
|
pCol->tableAlias, sizeof(pCol->tableAlias))) {
|
||||||
return DEAL_RES_ERROR;
|
return DEAL_RES_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7075,8 +7067,7 @@ static int32_t translateSelectFrom(STranslateContext* pCxt, SSelectStmt* pSelect
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = resetSelectFuncNumWithoutDup(pSelect);
|
code = resetSelectFuncNumWithoutDup(pSelect);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = checkAggColCoexist(pCxt, pSelect);
|
||||||
code = checkAggColCoexist(pCxt, pSelect);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -8005,8 +7996,8 @@ static int32_t checkDatabaseOptions(STranslateContext* pCxt, const char* pDbName
|
||||||
code = checkOptionsDependency(pCxt, pDbName, pOptions);
|
code = checkOptionsDependency(pCxt, pDbName, pOptions);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code =
|
code = checkDbRangeOption(pCxt, "s3_chunkpages", pOptions->s3ChunkSize, TSDB_MIN_S3_CHUNK_SIZE,
|
||||||
checkDbRangeOption(pCxt, "s3_chunksize", pOptions->s3ChunkSize, TSDB_MIN_S3_CHUNK_SIZE, TSDB_MAX_S3_CHUNK_SIZE);
|
TSDB_MAX_S3_CHUNK_SIZE);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = checkDbRangeOption(pCxt, "s3_compact", pOptions->s3Compact, TSDB_MIN_S3_COMPACT, TSDB_MAX_S3_COMPACT);
|
code = checkDbRangeOption(pCxt, "s3_compact", pOptions->s3Compact, TSDB_MIN_S3_COMPACT, TSDB_MAX_S3_COMPACT);
|
||||||
|
@ -9024,7 +9015,8 @@ static int32_t createRollupFuncs(SCreateTableStmt* pStmt, SNodeList** ppList) {
|
||||||
}
|
}
|
||||||
*ppList = pFuncs;
|
*ppList = pFuncs;
|
||||||
|
|
||||||
return code;;
|
return code;
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t createRollupTableMeta(SCreateTableStmt* pStmt, int8_t precision, STableMeta** ppTbMeta) {
|
static int32_t createRollupTableMeta(SCreateTableStmt* pStmt, int8_t precision, STableMeta** ppTbMeta) {
|
||||||
|
@ -9153,8 +9145,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
|
||||||
// columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
// columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
||||||
// columnDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
// columnDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
||||||
code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
code = columnDefNodeToField(pStmt->pCols, &pReq->pColumns, true);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
||||||
code = tagDefNodeToField(pStmt->pTags, &pReq->pTags, true);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pReq->numOfColumns = LIST_LENGTH(pStmt->pCols);
|
pReq->numOfColumns = LIST_LENGTH(pStmt->pCols);
|
||||||
pReq->numOfTags = LIST_LENGTH(pStmt->pTags);
|
pReq->numOfTags = LIST_LENGTH(pStmt->pTags);
|
||||||
|
@ -9174,8 +9165,7 @@ static int32_t buildCreateStbReq(STranslateContext* pCxt, SCreateTableStmt* pStm
|
||||||
toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName);
|
toName(pCxt->pParseCxt->acctId, pStmt->dbName, pStmt->tableName, &tableName);
|
||||||
code = tNameExtractFullName(&tableName, pReq->name);
|
code = tNameExtractFullName(&tableName, pReq->name);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = collectUseTable(&tableName, pCxt->pTables);
|
||||||
code = collectUseTable(&tableName, pCxt->pTables);
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = collectUseTable(&tableName, pCxt->pTargetTables);
|
code = collectUseTable(&tableName, pCxt->pTargetTables);
|
||||||
}
|
}
|
||||||
|
@ -9532,7 +9522,8 @@ static int32_t translateUseDatabase(STranslateContext* pCxt, SUseDatabaseStmt* p
|
||||||
code = tNameExtractFullName(&name, usedbReq.db);
|
code = tNameExtractFullName(&name, usedbReq.db);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code)
|
||||||
code = getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable, &usedbReq.stateTs);
|
code =
|
||||||
|
getDBVgVersion(pCxt, usedbReq.db, &usedbReq.vgVersion, &usedbReq.dbId, &usedbReq.numOfTable, &usedbReq.stateTs);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
code = buildCmdMsg(pCxt, TDMT_MND_USE_DB, (FSerializeFunc)tSerializeSUseDbReq, &usedbReq);
|
code = buildCmdMsg(pCxt, TDMT_MND_USE_DB, (FSerializeFunc)tSerializeSUseDbReq, &usedbReq);
|
||||||
}
|
}
|
||||||
|
@ -10112,8 +10103,7 @@ static int32_t buildCreateTopicReq(STranslateContext* pCxt, SCreateTopicStmt* pS
|
||||||
} else if ('\0' != pStmt->subDbName[0]) {
|
} else if ('\0' != pStmt->subDbName[0]) {
|
||||||
pReq->subType = TOPIC_SUB_TYPE__DB;
|
pReq->subType = TOPIC_SUB_TYPE__DB;
|
||||||
code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->subDbName, strlen(pStmt->subDbName));
|
code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->subDbName, strlen(pStmt->subDbName));
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) (void)tNameGetFullDbName(&name, pReq->subDbName);
|
||||||
(void)tNameGetFullDbName(&name, pReq->subDbName);
|
|
||||||
} else {
|
} else {
|
||||||
pReq->subType = TOPIC_SUB_TYPE__COLUMN;
|
pReq->subType = TOPIC_SUB_TYPE__COLUMN;
|
||||||
char* dbName = ((SRealTableNode*)(((SSelectStmt*)pStmt->pQuery)->pFromTable))->table.dbName;
|
char* dbName = ((SRealTableNode*)(((SSelectStmt*)pStmt->pQuery)->pFromTable))->table.dbName;
|
||||||
|
@ -10518,7 +10508,7 @@ static int32_t setColumnDefNodePrimaryKey(SColumnDefNode* pNode, bool isPk) {
|
||||||
if (!pNode->pOptions) {
|
if (!pNode->pOptions) {
|
||||||
code = nodesMakeNode(QUERY_NODE_COLUMN_OPTIONS, &pNode->pOptions);
|
code = nodesMakeNode(QUERY_NODE_COLUMN_OPTIONS, &pNode->pOptions);
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS ==code) ((SColumnOptions*)pNode->pOptions)->bPrimaryKey = isPk;
|
if (TSDB_CODE_SUCCESS == code) ((SColumnOptions*)pNode->pOptions)->bPrimaryKey = isPk;
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10625,8 +10615,7 @@ static int32_t addNullTagsForExistTable(STranslateContext* pCxt, STableMeta* pMe
|
||||||
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < numOfTags; ++i) {
|
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < numOfTags; ++i) {
|
||||||
SNode* pNull = NULL;
|
SNode* pNull = NULL;
|
||||||
code = createNullValue(&pNull);
|
code = createNullValue(&pNull);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&pSelect->pTags, pNull);
|
||||||
code = nodesListMakeStrictAppend(&pSelect->pTags, pNull);
|
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -10686,8 +10675,7 @@ static int32_t addNullTagsForCreateTable(STranslateContext* pCxt, SCreateStreamS
|
||||||
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < LIST_LENGTH(pStmt->pTags); ++i) {
|
for (int32_t i = 0; TSDB_CODE_SUCCESS == code && i < LIST_LENGTH(pStmt->pTags); ++i) {
|
||||||
SNode* pNull = NULL;
|
SNode* pNull = NULL;
|
||||||
code = createNullValue(&pNull);
|
code = createNullValue(&pNull);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&((SSelectStmt*)pStmt->pQuery)->pTags, pNull);
|
||||||
code = nodesListMakeStrictAppend(&((SSelectStmt*)pStmt->pQuery)->pTags, pNull);
|
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -10874,7 +10862,8 @@ static int32_t checkStreamQuery(STranslateContext* pCxt, SCreateStreamStmt* pStm
|
||||||
SValueNode* pVal = (SValueNode*)pStmt->pOptions->pDelay;
|
SValueNode* pVal = (SValueNode*)pStmt->pOptions->pDelay;
|
||||||
int64_t minDelay = 0;
|
int64_t minDelay = 0;
|
||||||
char* str = "5s";
|
char* str = "5s";
|
||||||
if (DEAL_RES_ERROR != translateValue(pCxt, pVal) && TSDB_CODE_SUCCESS ==
|
if (DEAL_RES_ERROR != translateValue(pCxt, pVal) &&
|
||||||
|
TSDB_CODE_SUCCESS ==
|
||||||
parseNatualDuration(str, strlen(str), &minDelay, &pVal->unit, pVal->node.resType.precision, false)) {
|
parseNatualDuration(str, strlen(str), &minDelay, &pVal->unit, pVal->node.resType.precision, false)) {
|
||||||
if (pVal->datum.i < minDelay) {
|
if (pVal->datum.i < minDelay) {
|
||||||
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_INVALID_STREAM_QUERY,
|
||||||
|
@ -11170,8 +11159,7 @@ static int32_t adjustOrderOfTags(STranslateContext* pCxt, SNodeList* pTags, cons
|
||||||
}
|
}
|
||||||
SNode* pNull = NULL;
|
SNode* pNull = NULL;
|
||||||
code = createNullValue(&pNull);
|
code = createNullValue(&pNull);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListStrictAppend(pNewTagExprs, pNull);
|
||||||
code = nodesListStrictAppend(pNewTagExprs, pNull);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11623,7 +11611,7 @@ static int32_t createStreamReqVersionInfo(SSDataBlock* pBlock, SArray** pArray,
|
||||||
|
|
||||||
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
|
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
|
||||||
SVgroupVer v = {.vgId = *(int32_t*)colDataGetData(pCol1, i), .ver = *(int64_t*)colDataGetData(pCol2, i)};
|
SVgroupVer v = {.vgId = *(int32_t*)colDataGetData(pCol1, i), .ver = *(int64_t*)colDataGetData(pCol2, i)};
|
||||||
if((taosArrayPush(*pArray, &v)) == NULL) {
|
if ((taosArrayPush(*pArray, &v)) == NULL) {
|
||||||
taosArrayDestroy(*pArray);
|
taosArrayDestroy(*pArray);
|
||||||
return terrno;
|
return terrno;
|
||||||
}
|
}
|
||||||
|
@ -12077,8 +12065,7 @@ static int32_t translateShowCreateDatabase(STranslateContext* pCxt, SShowCreateD
|
||||||
SName name;
|
SName name;
|
||||||
int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
int32_t code = tNameSetDbName(&name, pCxt->pParseCxt->acctId, pStmt->dbName, strlen(pStmt->dbName));
|
||||||
(void)tNameGetFullDbName(&name, pStmt->dbFName);
|
(void)tNameGetFullDbName(&name, pStmt->dbFName);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg);
|
||||||
return getDBCfg(pCxt, pStmt->dbName, (SDbCfgInfo*)pStmt->pCfg);
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12218,8 +12205,7 @@ static int32_t buildTSMAAst(STranslateContext* pCxt, SCreateTSMAStmt* pStmt, SMC
|
||||||
info.pDbName = pStmt->dbName;
|
info.pDbName = pStmt->dbName;
|
||||||
info.pTableName = tbName;
|
info.pTableName = tbName;
|
||||||
code = nodesCloneList(pStmt->pOptions->pFuncs, &info.pFuncs);
|
code = nodesCloneList(pStmt->pOptions->pFuncs, &info.pFuncs);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesCloneNode(pStmt->pOptions->pInterval, &info.pInterval);
|
||||||
code = nodesCloneNode(pStmt->pOptions->pInterval, &info.pInterval);
|
|
||||||
|
|
||||||
SFunctionNode* pTbnameFunc = NULL;
|
SFunctionNode* pTbnameFunc = NULL;
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -12244,10 +12230,9 @@ static int32_t buildTSMAAst(STranslateContext* pCxt, SCreateTSMAStmt* pStmt, SMC
|
||||||
}
|
}
|
||||||
code = nodesListAppend(info.pPartitionByList, pTagCol);
|
code = nodesListAppend(info.pPartitionByList, pTagCol);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
SNode*pNew = NULL;
|
SNode* pNew = NULL;
|
||||||
code = nodesCloneNode(pTagCol, &pNew);
|
code = nodesCloneNode(pTagCol, &pNew);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&info.pTags, pNew);
|
||||||
code = nodesListMakeStrictAppend(&info.pTags, pNew);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12405,8 +12390,7 @@ static int32_t buildCreateTSMAReq(STranslateContext* pCxt, SCreateTSMAStmt* pStm
|
||||||
} else {
|
} else {
|
||||||
if (pReq->intervalUnit == TIME_UNIT_MONTH && (pReq->interval < 1 || pReq->interval > 12))
|
if (pReq->intervalUnit == TIME_UNIT_MONTH && (pReq->interval < 1 || pReq->interval > 12))
|
||||||
return TSDB_CODE_TSMA_INVALID_INTERVAL;
|
return TSDB_CODE_TSMA_INVALID_INTERVAL;
|
||||||
if (pReq->intervalUnit == TIME_UNIT_YEAR && (pReq->interval != 1))
|
if (pReq->intervalUnit == TIME_UNIT_YEAR && (pReq->interval != 1)) return TSDB_CODE_TSMA_INVALID_INTERVAL;
|
||||||
return TSDB_CODE_TSMA_INVALID_INTERVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STableMeta* pTableMeta = NULL;
|
STableMeta* pTableMeta = NULL;
|
||||||
|
@ -13323,7 +13307,7 @@ static int32_t addShowUserDatabasesCond(SSelectStmt* pSelect) {
|
||||||
SNode* pNameCond1 = NULL;
|
SNode* pNameCond1 = NULL;
|
||||||
SNode* pNameCond2 = NULL;
|
SNode* pNameCond2 = NULL;
|
||||||
SNode* pNameCond = NULL;
|
SNode* pNameCond = NULL;
|
||||||
SValueNode* pValNode1 = NULL, *pValNode2 = NULL;
|
SValueNode *pValNode1 = NULL, *pValNode2 = NULL;
|
||||||
code = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB, &pValNode1);
|
code = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB, &pValNode1);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -13337,11 +13321,9 @@ static int32_t addShowUserDatabasesCond(SSelectStmt* pSelect) {
|
||||||
}
|
}
|
||||||
nodesDestroyNode((SNode*)pValNode2);
|
nodesDestroyNode((SNode*)pValNode2);
|
||||||
nodesDestroyNode((SNode*)pValNode1);
|
nodesDestroyNode((SNode*)pValNode1);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_AND);
|
||||||
code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_AND);
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = insertCondIntoSelectStmt(pSelect, &pNameCond);
|
||||||
code = insertCondIntoSelectStmt(pSelect, &pNameCond);
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
nodesDestroyNode(pNameCond1);
|
nodesDestroyNode(pNameCond1);
|
||||||
|
@ -13355,7 +13337,7 @@ static int32_t addShowSystemDatabasesCond(SSelectStmt* pSelect) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
SNode* pNameCond1 = NULL;
|
SNode* pNameCond1 = NULL;
|
||||||
SNode* pNameCond2 = NULL;
|
SNode* pNameCond2 = NULL;
|
||||||
SValueNode* pValNode1 = NULL, * pValNode2 = NULL;
|
SValueNode *pValNode1 = NULL, *pValNode2 = NULL;
|
||||||
SNode* pNameCond = NULL;
|
SNode* pNameCond = NULL;
|
||||||
code = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB, &pValNode1);
|
code = nodesMakeValueNodeFromString(TSDB_INFORMATION_SCHEMA_DB, &pValNode1);
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
|
@ -13373,8 +13355,7 @@ static int32_t addShowSystemDatabasesCond(SSelectStmt* pSelect) {
|
||||||
code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_OR);
|
code = createLogicCondNode(&pNameCond1, &pNameCond2, &pNameCond, LOGIC_COND_TYPE_OR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = insertCondIntoSelectStmt(pSelect, &pNameCond);
|
||||||
code = insertCondIntoSelectStmt(pSelect, &pNameCond);
|
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
nodesDestroyNode(pNameCond1);
|
nodesDestroyNode(pNameCond1);
|
||||||
|
@ -13390,8 +13371,7 @@ static int32_t addShowNormalTablesCond(SSelectStmt* pSelect) {
|
||||||
SValueNode* pValNode1 = NULL;
|
SValueNode* pValNode1 = NULL;
|
||||||
code = nodesMakeValueNodeFromString("NORMAL_TABLE", &pValNode1);
|
code = nodesMakeValueNodeFromString("NORMAL_TABLE", &pValNode1);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
|
||||||
|
|
||||||
nodesDestroyNode((SNode*)pValNode1);
|
nodesDestroyNode((SNode*)pValNode1);
|
||||||
|
|
||||||
|
@ -13406,8 +13386,7 @@ static int32_t addShowChildTablesCond(SSelectStmt* pSelect) {
|
||||||
SValueNode* pValNode1 = NULL;
|
SValueNode* pValNode1 = NULL;
|
||||||
code = nodesMakeValueNodeFromString("CHILD_TABLE", &pValNode1);
|
code = nodesMakeValueNodeFromString("CHILD_TABLE", &pValNode1);
|
||||||
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "type", (SNode*)pValNode1, &pTypeCond);
|
|
||||||
|
|
||||||
nodesDestroyNode((SNode*)pValNode1);
|
nodesDestroyNode((SNode*)pValNode1);
|
||||||
|
|
||||||
|
@ -13506,7 +13485,8 @@ static int32_t checkShowTags(STranslateContext* pCxt, const SShowStmt* pShow) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
SName name = {0};
|
SName name = {0};
|
||||||
STableMeta* pTableMeta = NULL;
|
STableMeta* pTableMeta = NULL;
|
||||||
toName(pCxt->pParseCxt->acctId, ((SValueNode*)pShow->pDbName)->literal, ((SValueNode*)pShow->pTbName)->literal, &name);
|
toName(pCxt->pParseCxt->acctId, ((SValueNode*)pShow->pDbName)->literal, ((SValueNode*)pShow->pTbName)->literal,
|
||||||
|
&name);
|
||||||
code = getTargetMeta(pCxt, &name, &pTableMeta, true);
|
code = getTargetMeta(pCxt, &name, &pTableMeta, true);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
|
code = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_GET_META_ERROR, tstrerror(code));
|
||||||
|
@ -13670,8 +13650,7 @@ static int32_t rewriteShowTableDist(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
NODES_DESTORY_LIST(pStmt->pProjectionList);
|
NODES_DESTORY_LIST(pStmt->pProjectionList);
|
||||||
SFunctionNode* pFuncNew = NULL;
|
SFunctionNode* pFuncNew = NULL;
|
||||||
code = createBlockDistFunc(&pFuncNew);
|
code = createBlockDistFunc(&pFuncNew);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = nodesListMakeStrictAppend(&pStmt->pProjectionList, (SNode*)pFuncNew);
|
||||||
code = nodesListMakeStrictAppend(&pStmt->pProjectionList, (SNode*)pFuncNew);
|
|
||||||
}
|
}
|
||||||
if (TSDB_CODE_SUCCESS == code) {
|
if (TSDB_CODE_SUCCESS == code) {
|
||||||
pCxt->showRewrite = true;
|
pCxt->showRewrite = true;
|
||||||
|
@ -15623,12 +15602,9 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
SNode* pCond3 = NULL;
|
SNode* pCond3 = NULL;
|
||||||
SNode* pCond4 = NULL;
|
SNode* pCond4 = NULL;
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "v1_status", (SNode*)pValNode, &pCond1);
|
code = createOperatorNode(OP_TYPE_EQUAL, "v1_status", (SNode*)pValNode, &pCond1);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v2_status", (SNode*)pValNode, &pCond2);
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "v2_status", (SNode*)pValNode, &pCond2);
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v3_status", (SNode*)pValNode, &pCond3);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createOperatorNode(OP_TYPE_EQUAL, "v4_status", (SNode*)pValNode, &pCond4);
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "v3_status", (SNode*)pValNode, &pCond3);
|
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
|
||||||
code = createOperatorNode(OP_TYPE_EQUAL, "v4_status", (SNode*)pValNode, &pCond4);
|
|
||||||
nodesDestroyNode((SNode*)pValNode);
|
nodesDestroyNode((SNode*)pValNode);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
nodesDestroyNode(pCond1);
|
nodesDestroyNode(pCond1);
|
||||||
|
@ -15643,10 +15619,8 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
SNode* pTemp2 = NULL;
|
SNode* pTemp2 = NULL;
|
||||||
SNode* pFullCond = NULL;
|
SNode* pFullCond = NULL;
|
||||||
code = createLogicCondNode(&pCond1, &pCond2, &pTemp1, LOGIC_COND_TYPE_OR);
|
code = createLogicCondNode(&pCond1, &pCond2, &pTemp1, LOGIC_COND_TYPE_OR);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pTemp1, &pCond3, &pTemp2, LOGIC_COND_TYPE_OR);
|
||||||
code = createLogicCondNode(&pTemp1, &pCond3, &pTemp2, LOGIC_COND_TYPE_OR);
|
if (TSDB_CODE_SUCCESS == code) code = createLogicCondNode(&pTemp2, &pCond4, &pFullCond, LOGIC_COND_TYPE_OR);
|
||||||
if (TSDB_CODE_SUCCESS == code)
|
|
||||||
code = createLogicCondNode(&pTemp2, &pCond4, &pFullCond, LOGIC_COND_TYPE_OR);
|
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
nodesDestroyNode(pCond1);
|
nodesDestroyNode(pCond1);
|
||||||
nodesDestroyNode(pCond2);
|
nodesDestroyNode(pCond2);
|
||||||
|
@ -15969,8 +15943,8 @@ static int32_t rewriteShowAliveStmt(STranslateContext* pCxt, SQuery* pQuery) {
|
||||||
}
|
}
|
||||||
// pSubSelect, pWhenThenlist need to free
|
// pSubSelect, pWhenThenlist need to free
|
||||||
|
|
||||||
// case when leader_col = count_col and leader_col > 0 then 1 when leader_col < count_col and leader_col > 0 then 2 else
|
// case when leader_col = count_col and leader_col > 0 then 1 when leader_col < count_col and leader_col > 0 then 2
|
||||||
// 0 end as status
|
// else 0 end as status
|
||||||
pElse = NULL;
|
pElse = NULL;
|
||||||
code = nodesMakeValueNodeFromInt32(0, &pElse);
|
code = nodesMakeValueNodeFromInt32(0, &pElse);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -20,7 +20,7 @@
|
||||||
"replica": 1,
|
"replica": 1,
|
||||||
"duration":"10d",
|
"duration":"10d",
|
||||||
"s3_keeplocal":"30d",
|
"s3_keeplocal":"30d",
|
||||||
"s3_chunksize":"131072",
|
"s3_chunkpages":"131072",
|
||||||
"tsdb_pagesize":"1",
|
"tsdb_pagesize":"1",
|
||||||
"s3_compact":"1",
|
"s3_compact":"1",
|
||||||
"wal_retention_size":"1",
|
"wal_retention_size":"1",
|
||||||
|
|
|
@ -168,13 +168,13 @@ class TDTestCase(TBase):
|
||||||
if keepLocal is not None:
|
if keepLocal is not None:
|
||||||
kw1 = f"s3_keeplocal {keepLocal}"
|
kw1 = f"s3_keeplocal {keepLocal}"
|
||||||
if chunkSize is not None:
|
if chunkSize is not None:
|
||||||
kw2 = f"s3_chunksize {chunkSize}"
|
kw2 = f"s3_chunkpages {chunkSize}"
|
||||||
if compact is not None:
|
if compact is not None:
|
||||||
kw3 = f"s3_compact {compact}"
|
kw3 = f"s3_compact {compact}"
|
||||||
|
|
||||||
sql = f" create database db1 vgroups 1 duration 1h {kw1} {kw2} {kw3}"
|
sql = f" create database db1 vgroups 1 duration 1h {kw1} {kw2} {kw3}"
|
||||||
tdSql.execute(sql, show=True)
|
tdSql.execute(sql, show=True)
|
||||||
#sql = f"select name,s3_keeplocal,s3_chunksize,s3_compact from information_schema.ins_databases where name='db1';"
|
#sql = f"select name,s3_keeplocal,s3_chunkpages,s3_compact from information_schema.ins_databases where name='db1';"
|
||||||
sql = f"select * from information_schema.ins_databases where name='db1';"
|
sql = f"select * from information_schema.ins_databases where name='db1';"
|
||||||
tdSql.query(sql)
|
tdSql.query(sql)
|
||||||
# 29 30 31 -> chunksize keeplocal compact
|
# 29 30 31 -> chunksize keeplocal compact
|
||||||
|
@ -194,9 +194,9 @@ class TDTestCase(TBase):
|
||||||
f"create database db2 s3_keeplocal -1",
|
f"create database db2 s3_keeplocal -1",
|
||||||
f"create database db2 s3_keeplocal 0",
|
f"create database db2 s3_keeplocal 0",
|
||||||
f"create database db2 s3_keeplocal 365001",
|
f"create database db2 s3_keeplocal 365001",
|
||||||
f"create database db2 s3_chunksize -1",
|
f"create database db2 s3_chunkpages -1",
|
||||||
f"create database db2 s3_chunksize 0",
|
f"create database db2 s3_chunkpages 0",
|
||||||
f"create database db2 s3_chunksize 900000000",
|
f"create database db2 s3_chunkpages 900000000",
|
||||||
f"create database db2 s3_compact -1",
|
f"create database db2 s3_compact -1",
|
||||||
f"create database db2 s3_compact 100",
|
f"create database db2 s3_compact 100",
|
||||||
f"create database db2 duration 1d s3_keeplocal 1d"
|
f"create database db2 duration 1d s3_keeplocal 1d"
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
"replica": 1,
|
"replica": 1,
|
||||||
"duration":"10d",
|
"duration":"10d",
|
||||||
"s3_keeplocal":"30d",
|
"s3_keeplocal":"30d",
|
||||||
"s3_chunksize":"131072",
|
"s3_chunkpages":"131072",
|
||||||
"tsdb_pagesize":"1",
|
"tsdb_pagesize":"1",
|
||||||
"s3_compact":"1",
|
"s3_compact":"1",
|
||||||
"wal_retention_size":"1",
|
"wal_retention_size":"1",
|
||||||
|
|
|
@ -202,13 +202,13 @@ class TDTestCase(TBase):
|
||||||
if keepLocal is not None:
|
if keepLocal is not None:
|
||||||
kw1 = f"s3_keeplocal {keepLocal}"
|
kw1 = f"s3_keeplocal {keepLocal}"
|
||||||
if chunkSize is not None:
|
if chunkSize is not None:
|
||||||
kw2 = f"s3_chunksize {chunkSize}"
|
kw2 = f"s3_chunkpages {chunkSize}"
|
||||||
if compact is not None:
|
if compact is not None:
|
||||||
kw3 = f"s3_compact {compact}"
|
kw3 = f"s3_compact {compact}"
|
||||||
|
|
||||||
sql = f" create database db1 vgroups 1 duration 1h {kw1} {kw2} {kw3}"
|
sql = f" create database db1 vgroups 1 duration 1h {kw1} {kw2} {kw3}"
|
||||||
tdSql.execute(sql, show=True)
|
tdSql.execute(sql, show=True)
|
||||||
# sql = f"select name,s3_keeplocal,s3_chunksize,s3_compact from information_schema.ins_databases where name='db1';"
|
# sql = f"select name,s3_keeplocal,s3_chunkpages,s3_compact from information_schema.ins_databases where name='db1';"
|
||||||
sql = f"select * from information_schema.ins_databases where name='db1';"
|
sql = f"select * from information_schema.ins_databases where name='db1';"
|
||||||
tdSql.query(sql)
|
tdSql.query(sql)
|
||||||
# 29 30 31 -> chunksize keeplocal compact
|
# 29 30 31 -> chunksize keeplocal compact
|
||||||
|
@ -228,9 +228,9 @@ class TDTestCase(TBase):
|
||||||
f"create database db2 s3_keeplocal -1",
|
f"create database db2 s3_keeplocal -1",
|
||||||
f"create database db2 s3_keeplocal 0",
|
f"create database db2 s3_keeplocal 0",
|
||||||
f"create database db2 s3_keeplocal 365001",
|
f"create database db2 s3_keeplocal 365001",
|
||||||
f"create database db2 s3_chunksize -1",
|
f"create database db2 s3_chunkpages -1",
|
||||||
f"create database db2 s3_chunksize 0",
|
f"create database db2 s3_chunkpages 0",
|
||||||
f"create database db2 s3_chunksize 900000000",
|
f"create database db2 s3_chunkpages 900000000",
|
||||||
f"create database db2 s3_compact -1",
|
f"create database db2 s3_compact -1",
|
||||||
f"create database db2 s3_compact 100",
|
f"create database db2 s3_compact 100",
|
||||||
f"create database db2 duration 1d s3_keeplocal 1d"
|
f"create database db2 duration 1d s3_keeplocal 1d"
|
||||||
|
|
|
@ -42,17 +42,17 @@ class TDTestCase:
|
||||||
tdSql.query('show create database scd;')
|
tdSql.query('show create database scd;')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd')
|
tdSql.checkData(0, 0, 'scd')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
||||||
|
|
||||||
tdSql.query('show create database scd2;')
|
tdSql.query('show create database scd2;')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd2')
|
tdSql.checkData(0, 0, 'scd2')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
||||||
|
|
||||||
tdSql.query('show create database scd4')
|
tdSql.query('show create database scd4')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd4')
|
tdSql.checkData(0, 0, 'scd4')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
||||||
|
|
||||||
|
|
||||||
self.restartTaosd(1, dbname='scd')
|
self.restartTaosd(1, dbname='scd')
|
||||||
|
@ -60,16 +60,16 @@ class TDTestCase:
|
||||||
tdSql.query('show create database scd;')
|
tdSql.query('show create database scd;')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd')
|
tdSql.checkData(0, 0, 'scd')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 2 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
||||||
|
|
||||||
tdSql.query('show create database scd2;')
|
tdSql.query('show create database scd2;')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd2')
|
tdSql.checkData(0, 0, 'scd2')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd2` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 3 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
||||||
tdSql.query('show create database scd4')
|
tdSql.query('show create database scd4')
|
||||||
tdSql.checkRows(1)
|
tdSql.checkRows(1)
|
||||||
tdSql.checkData(0, 0, 'scd4')
|
tdSql.checkData(0, 0, 'scd4')
|
||||||
tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKSIZE 262144 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
tdSql.checkData(0, 1, "CREATE DATABASE `scd4` BUFFER 256 CACHESIZE 1 CACHEMODEL 'none' COMP 2 DURATION 10d WAL_FSYNC_PERIOD 3000 MAXROWS 4096 MINROWS 100 STT_TRIGGER 13 KEEP 3650d,3650d,3650d PAGES 256 PAGESIZE 4 PRECISION 'ms' REPLICA 1 WAL_LEVEL 1 VGROUPS 2 SINGLE_STABLE 0 TABLE_PREFIX 0 TABLE_SUFFIX 0 TSDB_PAGESIZE 4 WAL_RETENTION_PERIOD 3600 WAL_RETENTION_SIZE 0 KEEP_TIME_OFFSET 0 ENCRYPT_ALGORITHM 'none' S3_CHUNKPAGES 131072 S3_KEEPLOCAL 525600m S3_COMPACT 1")
|
||||||
|
|
||||||
|
|
||||||
tdSql.execute('drop database scd')
|
tdSql.execute('drop database scd')
|
||||||
|
|
Loading…
Reference in New Issue