提交 5b969523 编写于 作者: S slguan

rename SCM to S

上级 aee99f11
......@@ -110,7 +110,7 @@ bool tscQueryMetricTags(SQueryInfo* pQueryInfo);
bool tscIsSelectivityWithTagQuery(SSqlCmd* pCmd);
void tscAddSpecialColumnForSelect(SQueryInfo* pQueryInfo, int32_t outputColIndex, int16_t functionId, SColumnIndex* pIndex,
SCMSchema* pColSchema, int16_t isTag);
SSchema* pColSchema, int16_t isTag);
void addRequiredTagColumn(SQueryInfo* pQueryInfo, int32_t tagColIndex, int32_t tableIndex);
......@@ -124,7 +124,7 @@ void tscGetDBInfoFromMeterId(char* meterId, char* db);
int tscAllocPayload(SSqlCmd* pCmd, int size);
void tscFieldInfoSetValFromSchema(SFieldInfo* pFieldInfo, int32_t index, SCMSchema* pSchema);
void tscFieldInfoSetValFromSchema(SFieldInfo* pFieldInfo, int32_t index, SSchema* pSchema);
void tscFieldInfoSetValFromField(SFieldInfo* pFieldInfo, int32_t index, TAOS_FIELD* pField);
void tscFieldInfoSetValue(SFieldInfo* pFieldInfo, int32_t index, int8_t type, const char* name, int16_t bytes);
void tscFieldInfoUpdateVisible(SFieldInfo* pFieldInfo, int32_t index, bool visible);
......
......@@ -40,10 +40,10 @@
*
*/
static tSQLSyntaxNode *tSQLSyntaxNodeCreate(SCMSchema *pSchema, int32_t numOfCols, SSQLToken *pToken);
static tSQLSyntaxNode *tSQLSyntaxNodeCreate(SSchema *pSchema, int32_t numOfCols, SSQLToken *pToken);
static void tSQLSyntaxNodeDestroy(tSQLSyntaxNode *pNode, void (*fp)(void *));
static tSQLSyntaxNode *createSyntaxTree(SCMSchema *pSchema, int32_t numOfCols, char *str, int32_t *i);
static tSQLSyntaxNode *createSyntaxTree(SSchema *pSchema, int32_t numOfCols, char *str, int32_t *i);
static void destroySyntaxTree(tSQLSyntaxNode *);
static uint8_t isQueryOnPrimaryKey(const char *primaryColumnName, const tSQLSyntaxNode *pLeft,
......@@ -101,7 +101,7 @@ static void reviseBinaryExprIfNecessary(tSQLSyntaxNode **pLeft, tSQLSyntaxNode *
}
}
static tSQLSyntaxNode *tSQLSyntaxNodeCreate(SCMSchema *pSchema, int32_t numOfCols, SSQLToken *pToken) {
static tSQLSyntaxNode *tSQLSyntaxNodeCreate(SSchema *pSchema, int32_t numOfCols, SSQLToken *pToken) {
/* if the token is not a value, return false */
if (pToken->type == TK_RP || (pToken->type != TK_INTEGER && pToken->type != TK_FLOAT && pToken->type != TK_ID &&
pToken->type != TK_TBNAME && pToken->type != TK_STRING && pToken->type != TK_BOOL)) {
......@@ -127,15 +127,15 @@ static tSQLSyntaxNode *tSQLSyntaxNodeCreate(SCMSchema *pSchema, int32_t numOfCol
}
}
nodeSize += sizeof(SCMSchema);
nodeSize += sizeof(SSchema);
pNode = calloc(1, nodeSize);
pNode->pSchema = (struct SCMSchema *)((char *)pNode + sizeof(tSQLSyntaxNode));
pNode->pSchema = (struct SSchema *)((char *)pNode + sizeof(tSQLSyntaxNode));
pNode->nodeType = TSQL_NODE_COL;
if (pToken->type == TK_ID) {
pNode->colId = (int16_t)pSchema[i].colId;
memcpy(pNode->pSchema, &pSchema[i], sizeof(SCMSchema));
memcpy(pNode->pSchema, &pSchema[i], sizeof(SSchema));
} else {
pNode->colId = -1;
pNode->pSchema->type = TSDB_DATA_TYPE_BINARY;
......@@ -193,7 +193,7 @@ static uint8_t getBinaryExprOptr(SSQLToken *pToken) {
}
// previous generated expr is reduced as the left child
static tSQLSyntaxNode *parseRemainStr(char *pstr, tSQLBinaryExpr *pExpr, SCMSchema *pSchema, int32_t optr,
static tSQLSyntaxNode *parseRemainStr(char *pstr, tSQLBinaryExpr *pExpr, SSchema *pSchema, int32_t optr,
int32_t numOfCols, int32_t *i) {
// set the previous generated node as the left child of new root
tSQLSyntaxNode *pLeft = malloc(sizeof(tSQLSyntaxNode));
......@@ -238,7 +238,7 @@ uint8_t isQueryOnPrimaryKey(const char *primaryColumnName, const tSQLSyntaxNode
}
}
static tSQLSyntaxNode *createSyntaxTree(SCMSchema *pSchema, int32_t numOfCols, char *str, int32_t *i) {
static tSQLSyntaxNode *createSyntaxTree(SSchema *pSchema, int32_t numOfCols, char *str, int32_t *i) {
SSQLToken t0;
t0 = tStrGetToken(str, i, false, 0, NULL);
......@@ -337,7 +337,7 @@ static tSQLSyntaxNode *createSyntaxTree(SCMSchema *pSchema, int32_t numOfCols, c
}
}
void tSQLBinaryExprFromString(tSQLBinaryExpr **pExpr, SCMSchema *pSchema, int32_t numOfCols, char *src, int32_t len) {
void tSQLBinaryExprFromString(tSQLBinaryExpr **pExpr, SSchema *pSchema, int32_t numOfCols, char *src, int32_t len) {
*pExpr = NULL;
if (len <= 0 || src == NULL || pSchema == NULL || numOfCols <= 0) {
return;
......
......@@ -2437,7 +2437,7 @@ static bool percentile_function_setup(SQLFunctionCtx *pCtx) {
}
SResultInfo *pResInfo = GET_RES_INFO(pCtx);
SCMSchema field[1] = {{pCtx->inputType, "dummyCol", 0, pCtx->inputBytes}};
SSchema field[1] = {{pCtx->inputType, "dummyCol", 0, pCtx->inputBytes}};
SColumnModel *pModel = createColumnModel(field, 1, 1000);
int32_t orderIdx = 0;
......
......@@ -85,7 +85,7 @@ static int32_t tscMaxLengthOfTagsFields(SSqlObj *pSql) {
}
char * pTagValue = tsGetTagsValue(pMeta);
SCMSchema *pTagsSchema = tsGetTagSchema(pMeta);
SSchema *pTagsSchema = tsGetTagSchema(pMeta);
int32_t len = getToStringLength(pTagValue, pTagsSchema[0].bytes, pTagsSchema[0].type);
......@@ -125,7 +125,7 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
}
tscInitResObjForLocalQuery(pSql, totalNumOfRows, rowLen);
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
for (int32_t i = 0; i < numOfRows; ++i) {
TAOS_FIELD *pField = tscFieldInfoGetField(pQueryInfo, 0);
......@@ -286,7 +286,7 @@ static int tscBuildMetricTagProjectionResult(SSqlObj *pSql) {
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, 0);
SMetricMeta *pMetricMeta = pMeterMetaInfo->pMetricMeta;
SCMSchema * pSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
SSchema * pSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
int32_t vOffset[TSDB_MAX_COLUMNS] = {0};
......
......@@ -144,7 +144,7 @@ int tsParseTime(SSQLToken *pToken, int64_t *time, char **next, char *error, int1
return TSDB_CODE_SUCCESS;
}
int32_t tsParseOneColumnData(SCMSchema *pSchema, SSQLToken *pToken, char *payload, char *msg, char **str, bool primaryKey,
int32_t tsParseOneColumnData(SSchema *pSchema, SSQLToken *pToken, char *payload, char *msg, char **str, bool primaryKey,
int16_t timePrec) {
int64_t iv;
int32_t numType;
......@@ -389,7 +389,7 @@ static int32_t tsCheckTimestamp(STableDataBlocks *pDataBlocks, const char *start
return TSDB_CODE_SUCCESS;
}
int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SCMSchema schema[], SParsedDataColInfo *spd, char *error,
int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SSchema schema[], SParsedDataColInfo *spd, char *error,
int16_t timePrec, int32_t *code, char *tmpTokenBuf) {
int32_t index = 0;
// bool isPrevOptr; //fang, never used
......@@ -402,7 +402,7 @@ int tsParseOneRowData(char **str, STableDataBlocks *pDataBlocks, SCMSchema schem
// the start position in data block buffer of current value in sql
char * start = payload + spd->elems[i].offset;
int16_t colIndex = spd->elems[i].colIndex;
SCMSchema *pSchema = schema + colIndex;
SSchema *pSchema = schema + colIndex;
rowSize += pSchema->bytes;
index = 0;
......@@ -503,7 +503,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, SMeterMeta *pMeterMe
int16_t numOfRows = 0;
SCMSchema *pSchema = tsGetSchema(pMeterMeta);
SSchema *pSchema = tsGetSchema(pMeterMeta);
int32_t precision = pMeterMeta->precision;
if (spd->hasVal[0] == false) {
......@@ -558,7 +558,7 @@ int tsParseValues(char **str, STableDataBlocks *pDataBlock, SMeterMeta *pMeterMe
}
}
static void tscSetAssignedColumnInfo(SParsedDataColInfo *spd, SCMSchema *pSchema, int32_t numOfCols) {
static void tscSetAssignedColumnInfo(SParsedDataColInfo *spd, SSchema *pSchema, int32_t numOfCols) {
spd->numOfCols = numOfCols;
spd->numOfAssignedCols = numOfCols;
......@@ -786,7 +786,7 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
return tscInvalidSQLErrMsg(pCmd->payload, "create table only from super table is allowed", sToken.z);
}
SCMSchema *pTagSchema = tsGetTagSchema(pSTableMeterMetaInfo->pMeterMeta);
SSchema *pTagSchema = tsGetTagSchema(pSTableMeterMetaInfo->pMeterMeta);
index = 0;
sToken = tStrGetToken(sql, &index, false, 0, NULL);
......@@ -1094,7 +1094,7 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
if (sToken.type == TK_VALUES) {
SParsedDataColInfo spd = {.numOfCols = pMeterMetaInfo->pMeterMeta->numOfColumns};
SCMSchema * pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema * pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
tscSetAssignedColumnInfo(&spd, pSchema, pMeterMetaInfo->pMeterMeta->numOfColumns);
......@@ -1149,7 +1149,7 @@ int doParseInsertSql(SSqlObj *pSql, char *str) {
} else if (sToken.type == TK_LP) {
/* insert into tablename(col1, col2,..., coln) values(v1, v2,... vn); */
SMeterMeta *pMeterMeta = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0)->pMeterMeta;
SCMSchema * pSchema = tsGetSchema(pMeterMeta);
SSchema * pSchema = tsGetSchema(pMeterMeta);
if (validateDataSource(pCmd, DATA_FROM_SQL_STRING, sToken.z) != TSDB_CODE_SUCCESS) {
goto _error_clean;
......@@ -1403,7 +1403,7 @@ static int tscInsertDataFromFile(SSqlObj *pSql, FILE *fp, char *tmpTokenBuf) {
int count = 0;
SParsedDataColInfo spd = {.numOfCols = pMeterMeta->numOfColumns};
SCMSchema * pSchema = tsGetSchema(pMeterMeta);
SSchema * pSchema = tsGetSchema(pMeterMeta);
tscSetAssignedColumnInfo(&spd, pSchema, pMeterMeta->numOfColumns);
......
......@@ -209,16 +209,16 @@ void tscKillStream(STscObj *pObj, uint32_t killId) {
}
char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) {
SCMQqueryList *pQList = (SCMQqueryList *)pMsg;
SQqueryList *pQList = (SQqueryList *)pMsg;
char * pMax = pMsg + TSDB_PAYLOAD_SIZE - 256;
SCMQueryDesc *pQdesc = pQList->qdesc;
SQueryDesc *pQdesc = pQList->qdesc;
pQList->numOfQueries = 0;
// We extract the lock to tscBuildHeartBeatMsg function.
/* pthread_mutex_lock (&pObj->mutex); */
pMsg += sizeof(SCMQqueryList);
pMsg += sizeof(SQqueryList);
SSqlObj *pSql = pObj->sqlList;
while (pSql) {
/*
......@@ -239,15 +239,15 @@ char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) {
pQList->numOfQueries++;
pQdesc++;
pSql = pSql->next;
pMsg += sizeof(SCMQueryDesc);
pMsg += sizeof(SQueryDesc);
if (pMsg > pMax) break;
}
SCMStreamList *pSList = (SCMStreamList *)pMsg;
SCMStreamDesc *pSdesc = pSList->sdesc;
SStreamList *pSList = (SStreamList *)pMsg;
SStreamDesc *pSdesc = pSList->sdesc;
pSList->numOfStreams = 0;
pMsg += sizeof(SCMStreamList);
pMsg += sizeof(SStreamList);
SSqlStream *pStream = pObj->streamList;
while (pStream) {
strncpy(pSdesc->sql, pStream->pSql->sqlstr, TSDB_SHOW_SQL_LEN - 1);
......@@ -265,7 +265,7 @@ char *tscBuildQueryStreamDesc(char *pMsg, STscObj *pObj) {
pSList->numOfStreams++;
pSdesc++;
pStream = pStream->next;
pMsg += sizeof(SCMStreamDesc);
pMsg += sizeof(SStreamDesc);
if (pMsg > pMax) break;
}
......
......@@ -78,7 +78,7 @@ static int32_t addProjectionExprAndResultField(SQueryInfo* pQueryInfo, tSQLExprI
static int32_t parseWhereClause(SQueryInfo* pQueryInfo, tSQLExpr** pExpr, SSqlObj* pSql);
static int32_t parseFillClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySQL);
static int32_t parseOrderbyClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql, SCMSchema* pSchema);
static int32_t parseOrderbyClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql, SSchema* pSchema);
static int32_t tsRewriteFieldNameIfNecessary(SQueryInfo* pQueryInfo);
static int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo);
......@@ -106,7 +106,7 @@ static int32_t optrToString(tSQLExpr* pExpr, char** exprString);
static int32_t getMeterIndex(SSQLToken* pTableToken, SQueryInfo* pQueryInfo, SColumnIndex* pIndex);
static int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo);
static int32_t doLocalQueryProcess(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql);
static int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate);
static int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCreateDbMsg* pCreate);
static SColumnList getColumnList(int32_t num, int16_t tableIndex, int32_t columnIndex);
......@@ -392,7 +392,7 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
char* pMsg = pCmd->payload + tsRpcHeadSize;
pMsg += sizeof(SMgmtHead);
SCMCfgDnodeMsg* pCfg = (SCMCfgDnodeMsg*)pMsg;
SCfgDnodeMsg* pCfg = (SCfgDnodeMsg*)pMsg;
strncpy(pCfg->ip, pDCL->a[0].z, pDCL->a[0].n);
strncpy(pCfg->config, pDCL->a[1].z, pDCL->a[1].n);
......@@ -905,7 +905,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
return false;
}
SCMSchema* pTagSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pTagSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
int32_t nLen = 0;
for (int32_t i = 0; i < pMeterMeta->numOfTags; ++i) {
......@@ -931,7 +931,7 @@ bool validateOneTags(SSqlCmd* pCmd, TAOS_FIELD* pTagField) {
}
// field name must be unique
SCMSchema* pSchema = tsGetSchema(pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMeta);
for (int32_t i = 0; i < pMeterMeta->numOfTags + pMeterMeta->numOfColumns; ++i) {
if (strncasecmp(pTagField->name, pSchema[i].name, TSDB_COL_NAME_LEN) == 0) {
......@@ -972,7 +972,7 @@ bool validateOneColumn(SSqlCmd* pCmd, TAOS_FIELD* pColField) {
return false;
}
SCMSchema* pSchema = tsGetSchema(pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMeta);
int32_t nLen = 0;
for (int32_t i = 0; i < pMeterMeta->numOfColumns; ++i) {
......@@ -1217,7 +1217,7 @@ SSqlExpr* doAddProjectCol(SQueryInfo* pQueryInfo, int32_t outputIndex, int32_t c
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, tableIndex);
SMeterMeta* pMeterMeta = pMeterMetaInfo->pMeterMeta;
SCMSchema* pSchema = tsGetColumnSchema(pMeterMeta, colIdx);
SSchema* pSchema = tsGetColumnSchema(pMeterMeta, colIdx);
int32_t numOfCols = pMeterMeta->numOfColumns;
int16_t functionId = (int16_t)((colIdx >= numOfCols) ? TSDB_FUNC_TAGPRJ : TSDB_FUNC_PRJ);
......@@ -1269,7 +1269,7 @@ static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumn
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, pIndex->tableIndex);
SMeterMeta* pMeterMeta = pMeterMetaInfo->pMeterMeta;
SCMSchema* pSchema = tsGetColumnSchema(pMeterMeta, pIndex->columnIndex);
SSchema* pSchema = tsGetColumnSchema(pMeterMeta, pIndex->columnIndex);
char* colName = (pItem->aliasName == NULL) ? pSchema->name : pItem->aliasName;
......@@ -1285,7 +1285,7 @@ static void addProjectQueryCol(SQueryInfo* pQueryInfo, int32_t startPos, SColumn
}
void tscAddSpecialColumnForSelect(SQueryInfo* pQueryInfo, int32_t outputColIndex, int16_t functionId,
SColumnIndex* pIndex, SCMSchema* pColSchema, int16_t flag) {
SColumnIndex* pIndex, SSchema* pColSchema, int16_t flag) {
SSqlExpr* pExpr = tscSqlExprInsert(pQueryInfo, outputColIndex, functionId, pIndex, pColSchema->type,
pColSchema->bytes, pColSchema->bytes);
......@@ -1307,7 +1307,7 @@ static int32_t doAddProjectionExprAndResultFields(SQueryInfo* pQueryInfo, SColum
int32_t numOfTotalColumns = 0;
SMeterMeta* pMeterMeta = pMeterMetaInfo->pMeterMeta;
SCMSchema* pSchema = tsGetSchema(pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMeta);
if (UTIL_METER_IS_SUPERTABLE(pMeterMetaInfo)) {
numOfTotalColumns = pMeterMeta->numOfColumns + pMeterMeta->numOfTags;
......@@ -1361,7 +1361,7 @@ int32_t addProjectionExprAndResultField(SQueryInfo* pQueryInfo, tSQLExprItem* pI
}
if (index.columnIndex == TSDB_TBNAME_COLUMN_INDEX) {
SCMSchema colSchema = {.type = TSDB_DATA_TYPE_BINARY, .bytes = TSDB_METER_NAME_LEN};
SSchema colSchema = {.type = TSDB_DATA_TYPE_BINARY, .bytes = TSDB_METER_NAME_LEN};
strcpy(colSchema.name, TSQL_TBNAME_L);
pQueryInfo->type = TSDB_QUERY_TYPE_STABLE_QUERY;
......@@ -1383,7 +1383,7 @@ int32_t addProjectionExprAndResultField(SQueryInfo* pQueryInfo, tSQLExprItem* pI
return TSDB_CODE_SUCCESS;
}
static int32_t setExprInfoForFunctions(SQueryInfo* pQueryInfo, SCMSchema* pSchema, int32_t functionID, char* aliasName,
static int32_t setExprInfoForFunctions(SQueryInfo* pQueryInfo, SSchema* pSchema, int32_t functionID, char* aliasName,
int32_t resColIdx, SColumnIndex* pColIndex) {
int16_t type = 0;
int16_t bytes = 0;
......@@ -1536,7 +1536,7 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIdx, tSQLExprIt
// 2. check if sql function can be applied on this column data type
pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, index.tableIndex);
SCMSchema* pSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, index.columnIndex);
SSchema* pSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, index.columnIndex);
int16_t colType = pSchema->type;
if (colType <= TSDB_DATA_TYPE_BOOL || colType >= TSDB_DATA_TYPE_BINARY) {
......@@ -1637,7 +1637,7 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIdx, tSQLExprIt
}
pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, index.tableIndex);
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
for (int32_t j = 0; j < pMeterMetaInfo->pMeterMeta->numOfColumns; ++j) {
index.columnIndex = j;
......@@ -1652,7 +1652,7 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIdx, tSQLExprIt
}
pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, index.tableIndex);
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
// functions can not be applied to tags
if ((index.columnIndex >= pMeterMetaInfo->pMeterMeta->numOfColumns) || (index.columnIndex < 0)) {
......@@ -1671,7 +1671,7 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIdx, tSQLExprIt
for (int32_t j = 0; j < pQueryInfo->numOfTables; ++j) {
pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, j);
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
for (int32_t i = 0; i < pMeterMetaInfo->pMeterMeta->numOfColumns; ++i) {
SColumnIndex index = {.tableIndex = j, .columnIndex = i};
......@@ -1711,7 +1711,7 @@ int32_t addExprAndResultField(SQueryInfo* pQueryInfo, int32_t colIdx, tSQLExprIt
}
pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, index.tableIndex);
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
// functions can not be applied to tags
if (index.columnIndex >= pMeterMetaInfo->pMeterMeta->numOfColumns) {
......@@ -1838,7 +1838,7 @@ static int16_t doGetColumnIndex(SQueryInfo* pQueryInfo, int32_t index, SSQLToken
SMeterMeta* pMeterMeta = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, index)->pMeterMeta;
int32_t numOfCols = pMeterMeta->numOfColumns + pMeterMeta->numOfTags;
SCMSchema* pSchema = tsGetSchema(pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMeta);
int16_t columnIndex = COLUMN_INDEX_INITIAL_VAL;
......@@ -2361,8 +2361,8 @@ int32_t parseGroupbyClause(SQueryInfo* pQueryInfo, tVariantList* pList, SSqlCmd*
}
SMeterMeta* pMeterMeta = NULL;
SCMSchema* pSchema = NULL;
SCMSchema s = tsGetTbnameColumnSchema();
SSchema* pSchema = NULL;
SSchema s = tsGetTbnameColumnSchema();
int32_t tableIndex = COLUMN_INDEX_INITIAL_VAL;
......@@ -2465,7 +2465,7 @@ static int32_t doExtractColumnFilterInfo(SQueryInfo* pQueryInfo, SColumnFilterIn
tSQLExpr* pRight = pExpr->pRight;
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, columnIndex->tableIndex);
SCMSchema* pSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, columnIndex->columnIndex);
SSchema* pSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, columnIndex->columnIndex);
int16_t colType = pSchema->type;
if (colType >= TSDB_DATA_TYPE_TINYINT && colType <= TSDB_DATA_TYPE_BIGINT) {
......@@ -2705,7 +2705,7 @@ static int32_t extractColumnFilterInfo(SQueryInfo* pQueryInfo, SColumnIndex* pIn
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, pIndex->tableIndex);
SMeterMeta* pMeterMeta = pMeterMetaInfo->pMeterMeta;
SCMSchema* pSchema = tsGetColumnSchema(pMeterMeta, pIndex->columnIndex);
SSchema* pSchema = tsGetColumnSchema(pMeterMeta, pIndex->columnIndex);
const char* msg1 = "non binary column not support like operator";
const char* msg2 = "binary column not support this operator";
......@@ -2928,7 +2928,7 @@ static int32_t validateSQLExpr(tSQLExpr* pExpr, SQueryInfo* pQueryInfo, SColumnL
// if column is timestamp, bool, binary, nchar, not support arithmetic, so return invalid sql
SMeterMeta* pMeterMeta = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, index.tableIndex)->pMeterMeta;
SCMSchema* pSchema = tsGetSchema(pMeterMeta) + index.columnIndex;
SSchema* pSchema = tsGetSchema(pMeterMeta) + index.columnIndex;
if ((pSchema->type == TSDB_DATA_TYPE_TIMESTAMP) || (pSchema->type == TSDB_DATA_TYPE_BOOL)
|| (pSchema->type == TSDB_DATA_TYPE_BINARY) || (pSchema->type == TSDB_DATA_TYPE_NCHAR)){
return TSDB_CODE_INVALID_SQL;
......@@ -3064,11 +3064,11 @@ static bool validateJoinExprNode(SQueryInfo* pQueryInfo, tSQLExpr* pExpr, SColum
// todo extract function
SMeterMetaInfo* pLeftMeterMeta = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, pLeftIndex->tableIndex);
SCMSchema* pLeftSchema = tsGetSchema(pLeftMeterMeta->pMeterMeta);
SSchema* pLeftSchema = tsGetSchema(pLeftMeterMeta->pMeterMeta);
int16_t leftType = pLeftSchema[pLeftIndex->columnIndex].type;
SMeterMetaInfo* pRightMeterMeta = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, rightIndex.tableIndex);
SCMSchema* pRightSchema = tsGetSchema(pRightMeterMeta->pMeterMeta);
SSchema* pRightSchema = tsGetSchema(pRightMeterMeta->pMeterMeta);
int16_t rightType = pRightSchema[rightIndex.columnIndex].type;
if (leftType != rightType) {
......@@ -3176,7 +3176,7 @@ static int32_t handleExprInQueryCond(SQueryInfo* pQueryInfo, tSQLExpr** pExpr, S
return TSDB_CODE_INVALID_SQL;
}
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
if ((!isTablenameToken(&pLeft->colInfo)) && pSchema[index.columnIndex].type != TSDB_DATA_TYPE_BINARY &&
pSchema[index.columnIndex].type != TSDB_DATA_TYPE_NCHAR) {
......@@ -3912,7 +3912,7 @@ static void setDefaultOrderInfo(SQueryInfo* pQueryInfo) {
}
}
int32_t parseOrderbyClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql, SCMSchema* pSchema) {
int32_t parseOrderbyClause(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql, SSchema* pSchema) {
const char* msg0 = "only support order by primary timestamp";
const char* msg1 = "invalid column name";
const char* msg2 = "only support order by primary timestamp and queried column";
......@@ -4209,7 +4209,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
return invalidSqlErrMsg(pQueryInfo->msg, msg2);
}
SCMSchema* pTagsSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, columnIndex.columnIndex);
SSchema* pTagsSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, columnIndex.columnIndex);
if (tVariantDump(&pVarList->a[1].pVar, pAlterSQL->tagData.data /*pCmd->payload*/, pTagsSchema->type) !=
TSDB_CODE_SUCCESS) {
return invalidSqlErrMsg(pQueryInfo->msg, msg1);
......@@ -4573,7 +4573,7 @@ int32_t parseLimitClause(SQueryInfo* pQueryInfo, int32_t clauseIndex, SQuerySQL*
return TSDB_CODE_SUCCESS;
}
static int32_t setKeepOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
static int32_t setKeepOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
const char* msg = "invalid number of options";
pMsg->daysToKeep = htonl(-1);
......@@ -4604,7 +4604,7 @@ static int32_t setKeepOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo*
return TSDB_CODE_SUCCESS;
}
static int32_t setTimePrecisionOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDbInfo) {
static int32_t setTimePrecisionOption(SSqlCmd* pCmd, SCreateDbMsg* pMsg, SCreateDBInfo* pCreateDbInfo) {
const char* msg = "invalid time precision";
pMsg->precision = TSDB_TIME_PRECISION_MILLI; // millisecond by default
......@@ -4628,7 +4628,7 @@ static int32_t setTimePrecisionOption(SSqlCmd* pCmd, SCMCreateDbMsg* pMsg, SCrea
return TSDB_CODE_SUCCESS;
}
static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
static void setCreateDBOption(SCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
pMsg->blocksPerMeter = htons(pCreateDb->numOfBlocksPerTable);
pMsg->compression = pCreateDb->compressionLevel;
......@@ -4643,7 +4643,7 @@ static void setCreateDBOption(SCMCreateDbMsg* pMsg, SCreateDBInfo* pCreateDb) {
}
int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDBInfo* pCreateDbSql) {
SCMCreateDbMsg* pMsg = (SCMCreateDbMsg*)(pCmd->payload + tsRpcHeadSize + sizeof(SMgmtHead));
SCreateDbMsg* pMsg = (SCreateDbMsg*)(pCmd->payload + tsRpcHeadSize + sizeof(SMgmtHead));
setCreateDBOption(pMsg, pCreateDbSql);
if (setKeepOption(pCmd, pMsg, pCreateDbSql) != TSDB_CODE_SUCCESS) {
......@@ -4694,7 +4694,7 @@ void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClau
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, tableIndex);
int16_t columnInfo = tscGetJoinTagColIndexByUid(&pQueryInfo->tagCond, pMeterMetaInfo->pMeterMeta->uid);
SColumnIndex index = {.tableIndex = 0, .columnIndex = columnInfo};
SCMSchema* pSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
int16_t type = pSchema[index.columnIndex].type;
int16_t bytes = pSchema[index.columnIndex].bytes;
......@@ -4730,7 +4730,7 @@ void doAddGroupColumnForSubquery(SQueryInfo* pQueryInfo, int32_t tagIndex) {
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, 0);
SCMSchema* pSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, index);
SSchema* pSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, index);
SColumnIndex colIndex = {.tableIndex = 0, .columnIndex = index};
SSqlExpr* pExpr = tscSqlExprInsert(pQueryInfo, pQueryInfo->fieldsInfo.numOfOutputCols, TSDB_FUNC_PRJ, &colIndex,
......@@ -4763,12 +4763,12 @@ static void doUpdateSqlFunctionForTagPrj(SQueryInfo* pQueryInfo) {
}
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, 0);
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutputCols; ++i) {
SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i);
if (pExpr->functionId != TSDB_FUNC_TAG_DUMMY && pExpr->functionId != TSDB_FUNC_TS_DUMMY) {
SCMSchema* pColSchema = &pSchema[pExpr->colInfo.colIdx];
SSchema* pColSchema = &pSchema[pExpr->colInfo.colIdx];
getResultDataInfo(pColSchema->type, pColSchema->bytes, pExpr->functionId, pExpr->param[0].i64Key, &pExpr->resType,
&pExpr->resBytes, &pExpr->interResBytes, tagLength, true);
}
......@@ -4940,7 +4940,7 @@ static int32_t doAddGroupbyColumnsOnDemand(SQueryInfo* pQueryInfo) {
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, 0);
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
int16_t bytes = 0;
int16_t type = 0;
char* name = NULL;
......@@ -5138,7 +5138,7 @@ int32_t doLocalQueryProcess(SQueryInfo* pQueryInfo, SQuerySQL* pQuerySql) {
}
// can only perform the parameters based on the macro definitation
int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCMCreateDbMsg* pCreate) {
int32_t tscCheckCreateDbParams(SSqlCmd* pCmd, SCreateDbMsg* pCreate) {
char msg[512] = {0};
if (pCreate->commitLog != -1 && (pCreate->commitLog < 0 || pCreate->commitLog > 1)) {
......@@ -5338,7 +5338,7 @@ int32_t doCheckForCreateFromStable(SSqlObj* pSql, SSqlInfo* pInfo) {
}
// too long tag values will return invalid sql, not be truncated automatically
SCMSchema* pTagSchema = tsGetTagSchema(pStableMeterMetaInfo->pMeterMeta);
SSchema* pTagSchema = tsGetTagSchema(pStableMeterMetaInfo->pMeterMeta);
char* tagVal = pCreateTable->usingInfo.tagdata.data;
for (int32_t i = 0; i < pList->nExpr; ++i) {
......
......@@ -20,7 +20,7 @@
#include "ttypes.h"
#include "tutil.h"
bool isValidSchema(struct SCMSchema* pSchema, int32_t numOfCols) {
bool isValidSchema(struct SSchema* pSchema, int32_t numOfCols) {
if (!VALIDNUMOFCOLS(numOfCols)) {
return false;
}
......@@ -64,14 +64,14 @@ bool isValidSchema(struct SCMSchema* pSchema, int32_t numOfCols) {
return (rowLen <= TSDB_MAX_BYTES_PER_ROW);
}
struct SCMSchema* tsGetSchema(SMeterMeta* pMeta) {
struct SSchema* tsGetSchema(SMeterMeta* pMeta) {
if (pMeta == NULL) {
return NULL;
}
return tsGetColumnSchema(pMeta, 0);
}
struct SCMSchema* tsGetTagSchema(SMeterMeta* pMeta) {
struct SSchema* tsGetTagSchema(SMeterMeta* pMeta) {
if (pMeta == NULL || pMeta->numOfTags == 0) {
return NULL;
}
......@@ -79,12 +79,12 @@ struct SCMSchema* tsGetTagSchema(SMeterMeta* pMeta) {
return tsGetColumnSchema(pMeta, pMeta->numOfColumns);
}
struct SCMSchema* tsGetColumnSchema(SMeterMeta* pMeta, int32_t startCol) {
return (SCMSchema*)(((char*)pMeta + sizeof(SMeterMeta)) + startCol * sizeof(SCMSchema));
struct SSchema* tsGetColumnSchema(SMeterMeta* pMeta, int32_t startCol) {
return (SSchema*)(((char*)pMeta + sizeof(SMeterMeta)) + startCol * sizeof(SSchema));
}
struct SCMSchema tsGetTbnameColumnSchema() {
struct SCMSchema s = {.colId = TSDB_TBNAME_COLUMN_INDEX, .type = TSDB_DATA_TYPE_BINARY, .bytes = TSDB_METER_NAME_LEN};
struct SSchema tsGetTbnameColumnSchema() {
struct SSchema s = {.colId = TSDB_TBNAME_COLUMN_INDEX, .type = TSDB_DATA_TYPE_BINARY, .bytes = TSDB_METER_NAME_LEN};
strcpy(s.name, TSQL_TBNAME_L);
return s;
......@@ -96,7 +96,7 @@ struct SCMSchema tsGetTbnameColumnSchema() {
* +--------------------+
* |SMeterMeta Body data| sizeof(SMeterMeta)
* +--------------------+
* |Schema data | numOfTotalColumns * sizeof(SCMSchema)
* |Schema data | numOfTotalColumns * sizeof(SSchema)
* +--------------------+
* |Tags data | tag_col_1.bytes + tag_col_2.bytes + ....
* +--------------------+
......@@ -106,7 +106,7 @@ struct SCMSchema tsGetTbnameColumnSchema() {
*/
char* tsGetTagsValue(SMeterMeta* pMeta) {
int32_t numOfTotalCols = pMeta->numOfColumns + pMeta->numOfTags;
uint32_t offset = sizeof(SMeterMeta) + numOfTotalCols * sizeof(SCMSchema);
uint32_t offset = sizeof(SMeterMeta) + numOfTotalCols * sizeof(SSchema);
return ((char*)pMeta + offset);
}
......@@ -120,10 +120,10 @@ bool tsMeterMetaIdentical(SMeterMeta* p1, SMeterMeta* p2) {
return true;
}
size_t size = sizeof(SMeterMeta) + p1->numOfColumns * sizeof(SCMSchema);
size_t size = sizeof(SMeterMeta) + p1->numOfColumns * sizeof(SSchema);
for (int32_t i = 0; i < p1->numOfTags; ++i) {
SCMSchema* pColSchema = tsGetColumnSchema(p1, i + p1->numOfColumns);
SSchema* pColSchema = tsGetColumnSchema(p1, i + p1->numOfColumns);
size += pColSchema->bytes;
}
......
......@@ -68,7 +68,7 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SSqlRes *pRes, SLocalReducer *pRedu
// input buffer hold only one point data
int16_t offset = getColumnModelOffset(pDesc->pColumnModel, i);
SCMSchema* pSchema = getColumnModelSchema(pDesc->pColumnModel, i);
SSchema* pSchema = getColumnModelSchema(pDesc->pColumnModel, i);
pCtx->aInputElemBuf = pReducer->pTempBuffer->data + offset;
......@@ -336,7 +336,7 @@ void tscCreateLocalReducer(tExtMemBuffer **pMemBuffer, int32_t numOfBuffer, tOrd
if (pQueryInfo->groupbyExpr.numOfGroupCols > 0) {
pInterpoInfo->pTags[0] = (char *)pInterpoInfo->pTags + POINTER_BYTES * pQueryInfo->groupbyExpr.numOfGroupCols;
for (int32_t i = 1; i < pQueryInfo->groupbyExpr.numOfGroupCols; ++i) {
SCMSchema* pSchema = getColumnModelSchema(pReducer->resColModel, startIndex + i - 1);
SSchema* pSchema = getColumnModelSchema(pReducer->resColModel, startIndex + i - 1);
pInterpoInfo->pTags[i] = pSchema->bytes + pInterpoInfo->pTags[i - 1];
}
} else {
......@@ -599,7 +599,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
SSqlCmd *pCmd = &pSql->cmd;
SSqlRes *pRes = &pSql->res;
SCMSchema * pSchema = NULL;
SSchema * pSchema = NULL;
SColumnModel *pModel = NULL;
*pFinalModel = NULL;
......@@ -613,7 +613,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
return pRes->code;
}
pSchema = (SCMSchema *)calloc(1, sizeof(SCMSchema) * pQueryInfo->fieldsInfo.numOfOutputCols);
pSchema = (SSchema *)calloc(1, sizeof(SSchema) * pQueryInfo->fieldsInfo.numOfOutputCols);
if (pSchema == NULL) {
tscError("%p failed to allocate memory", pSql);
pRes->code = TSDB_CODE_CLI_OUT_OF_MEMORY;
......@@ -647,7 +647,7 @@ int32_t tscLocalReducerEnvCreate(SSqlObj *pSql, tExtMemBuffer ***pMemBuffer, tOr
return pRes->code;
}
memset(pSchema, 0, sizeof(SCMSchema) * pQueryInfo->fieldsInfo.numOfOutputCols);
memset(pSchema, 0, sizeof(SSchema) * pQueryInfo->fieldsInfo.numOfOutputCols);
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutputCols; ++i) {
TAOS_FIELD *pField = tscFieldInfoGetField(pQueryInfo, i);
......@@ -985,7 +985,7 @@ static void savePreviousRow(SLocalReducer *pLocalReducer, tFilePage *tmpBuffer)
// copy to previous temp buffer
for (int32_t i = 0; i < pColumnModel->numOfCols; ++i) {
SCMSchema* pSchema = getColumnModelSchema(pColumnModel, i);
SSchema* pSchema = getColumnModelSchema(pColumnModel, i);
int16_t offset = getColumnModelOffset(pColumnModel, i);
memcpy(pLocalReducer->prevRowOfInput + offset, tmpBuffer->data + offset, pSchema->bytes);
......@@ -1208,7 +1208,7 @@ bool doGenerateFinalResults(SSqlObj *pSql, SLocalReducer *pLocalReducer, bool no
for (int32_t i = 0; i < pQueryInfo->groupbyExpr.numOfGroupCols; ++i) {
int16_t offset = getColumnModelOffset(pModel, startIndex + i);
SCMSchema* pSchema = getColumnModelSchema(pModel, startIndex + i);
SSchema* pSchema = getColumnModelSchema(pModel, startIndex + i);
memcpy(pInterpoInfo->pTags[i],
pLocalReducer->pBufForInterpo + offset * pResBuf->numOfElems, pSchema->bytes);
......
......@@ -116,7 +116,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
SSqlRes *pRes = &pSql->res;
if (code == 0) {
SCMHeartBeatRsp *pRsp = (SCMHeartBeatRsp *)pRes->pRsp;
SHeartBeatRsp *pRsp = (SHeartBeatRsp *)pRes->pRsp;
SRpcIpSet * pIpList = &pRsp->ipList;
tscSetMgmtIpList(pIpList);
......@@ -401,7 +401,7 @@ int32_t tscLaunchJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSubquerySu
// set the ts,tags that involved in join, as the output column of intermediate result
tscClearSubqueryInfo(&pNew->cmd);
SCMSchema colSchema = {.type = TSDB_DATA_TYPE_BINARY, .bytes = 1};
SSchema colSchema = {.type = TSDB_DATA_TYPE_BINARY, .bytes = 1};
SColumnIndex index = {0, PRIMARYKEY_TIMESTAMP_COL_INDEX};
tscAddSpecialColumnForSelect(pNewQueryInfo, 0, TSDB_FUNC_TS_COMP, &index, &colSchema, TSDB_COL_NORMAL);
......@@ -1459,11 +1459,11 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
// set column list ids
char * pMsg = (char *)(pQueryMsg->colList) + pQueryInfo->colList.numOfCols * sizeof(SColumnInfo);
SCMSchema *pSchema = tsGetSchema(pMeterMeta);
SSchema *pSchema = tsGetSchema(pMeterMeta);
for (int32_t i = 0; i < pQueryInfo->colList.numOfCols; ++i) {
SColumnBase *pCol = tscColumnBaseInfoGet(&pQueryInfo->colList, i);
SCMSchema * pColSchema = &pSchema[pCol->colIndex.columnIndex];
SSchema * pColSchema = &pSchema[pCol->colIndex.columnIndex];
if (pCol->colIndex.columnIndex >= pMeterMeta->numOfColumns || pColSchema->type < TSDB_DATA_TYPE_BOOL ||
pColSchema->type > TSDB_DATA_TYPE_NCHAR) {
......@@ -1571,18 +1571,18 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
// only include the required tag column schema. If a tag is not required, it won't be sent to vnode
if (pMeterMetaInfo->numOfTags > 0) {
// always transfer tag schema to vnode if exists
SCMSchema *pTagSchema = tsGetTagSchema(pMeterMeta);
SSchema *pTagSchema = tsGetTagSchema(pMeterMeta);
for (int32_t j = 0; j < pMeterMetaInfo->numOfTags; ++j) {
if (pMeterMetaInfo->tagColumnIndex[j] == TSDB_TBNAME_COLUMN_INDEX) {
SCMSchema tbSchema = {
SSchema tbSchema = {
.bytes = TSDB_METER_NAME_LEN, .colId = TSDB_TBNAME_COLUMN_INDEX, .type = TSDB_DATA_TYPE_BINARY};
memcpy(pMsg, &tbSchema, sizeof(SCMSchema));
memcpy(pMsg, &tbSchema, sizeof(SSchema));
} else {
memcpy(pMsg, &pTagSchema[pMeterMetaInfo->tagColumnIndex[j]], sizeof(SCMSchema));
memcpy(pMsg, &pTagSchema[pMeterMetaInfo->tagColumnIndex[j]], sizeof(SSchema));
}
pMsg += sizeof(SCMSchema);
pMsg += sizeof(SSchema);
}
}
......@@ -1651,19 +1651,19 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int32_t tscBuildCreateDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMCreateDbMsg *pCreateDbMsg;
SCreateDbMsg *pCreateDbMsg;
char * pMsg, *pStart;
SSqlCmd *pCmd = &pSql->cmd;
pMsg = doBuildMsgHeader(pSql, &pStart);
pCreateDbMsg = (SCMCreateDbMsg *)pMsg;
pCreateDbMsg = (SCreateDbMsg *)pMsg;
assert(pCmd->numOfClause == 1);
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0);
strncpy(pCreateDbMsg->db, pMeterMetaInfo->name, tListLen(pCreateDbMsg->db));
pMsg += sizeof(SCMCreateDbMsg);
pMsg += sizeof(SCreateDbMsg);
pCmd->payloadLen = pMsg - pStart;
pCmd->msgType = TSDB_MSG_TYPE_CREATE_DB;
......@@ -1672,7 +1672,7 @@ int32_t tscBuildCreateDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMCreateDnodeMsg *pCreate;
SCreateDnodeMsg *pCreate;
char *pMsg, *pStart;
......@@ -1680,10 +1680,10 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg = doBuildMsgHeader(pSql, &pStart);
pCreate = (SCMCreateDnodeMsg *)pMsg;
pCreate = (SCreateDnodeMsg *)pMsg;
strncpy(pCreate->ip, pInfo->pDCLInfo->a[0].z, pInfo->pDCLInfo->a[0].n);
pMsg += sizeof(SCMCreateDnodeMsg);
pMsg += sizeof(SCreateDnodeMsg);
pCmd->payloadLen = pMsg - pStart;
pCmd->msgType = TSDB_MSG_TYPE_CREATE_DNODE;
......@@ -1693,13 +1693,13 @@ int32_t tscBuildCreateDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd *pCmd = &pSql->cmd;
pCmd->payloadLen = sizeof(SCMCreateAcctMsg);
pCmd->payloadLen = sizeof(SCreateAcctMsg);
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
tscError("%p failed to malloc for query msg", pSql);
return TSDB_CODE_CLI_OUT_OF_MEMORY;
}
SCMCreateAcctMsg *pAlterMsg = (SCMCreateAcctMsg *)pCmd->payload;
SCreateAcctMsg *pAlterMsg = (SCreateAcctMsg *)pCmd->payload;
SSQLToken *pName = &pInfo->pDCLInfo->user.user;
SSQLToken *pPwd = &pInfo->pDCLInfo->user.passwd;
......@@ -1737,13 +1737,13 @@ int32_t tscBuildAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMCreateUserMsg *pAlterMsg;
SCreateUserMsg *pAlterMsg;
char * pMsg, *pStart;
SSqlCmd *pCmd = &pSql->cmd;
pMsg = doBuildMsgHeader(pSql, &pStart);
pAlterMsg = (SCMCreateUserMsg *)pMsg;
pAlterMsg = (SCreateUserMsg *)pMsg;
SUserInfo *pUser = &pInfo->pDCLInfo->user;
strncpy(pAlterMsg->user, pUser->user.z, pUser->user.n);
......@@ -1758,7 +1758,7 @@ int32_t tscBuildUserMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
strncpy(pAlterMsg->pass, pUser->passwd.z, pUser->passwd.n);
}
pMsg += sizeof(SCMCreateUserMsg);
pMsg += sizeof(SCreateUserMsg);
pCmd->payloadLen = pMsg - pStart;
if (pUser->type == TSDB_ALTER_USER_PASSWD || pUser->type == TSDB_ALTER_USER_PRIVILEGES) {
......@@ -1775,7 +1775,7 @@ int32_t tscBuildCfgDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd *pCmd = &pSql->cmd;
char *pMsg = doBuildMsgHeader(pSql, &pStart);
pMsg += sizeof(SCMCfgDnodeMsg);
pMsg += sizeof(SCfgDnodeMsg);
pCmd->payloadLen = pMsg - pStart;
pCmd->msgType = TSDB_MSG_TYPE_DNODE_CFG;
......@@ -1799,19 +1799,19 @@ char *doBuildMsgHeader(SSqlObj *pSql, char **pStart) {
}
int32_t tscBuildDropDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMDropDbMsg *pDropDbMsg;
SDropDbMsg *pDropDbMsg;
char * pMsg, *pStart;
SSqlCmd *pCmd = &pSql->cmd;
pMsg = doBuildMsgHeader(pSql, &pStart);
pDropDbMsg = (SCMDropDbMsg *)pMsg;
pDropDbMsg = (SDropDbMsg *)pMsg;
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0);
strncpy(pDropDbMsg->db, pMeterMetaInfo->name, tListLen(pDropDbMsg->db));
pDropDbMsg->ignoreNotExists = pInfo->pDCLInfo->existsCheck ? 1 : 0;
pMsg += sizeof(SCMDropDbMsg);
pMsg += sizeof(SDropDbMsg);
pCmd->payloadLen = pMsg - pStart;
pCmd->msgType = TSDB_MSG_TYPE_DROP_DB;
......@@ -1851,18 +1851,18 @@ int32_t tscBuildDropTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMDropDnodeMsg *pDrop;
SDropDnodeMsg *pDrop;
char * pMsg, *pStart;
SSqlCmd * pCmd = &pSql->cmd;
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0);
pMsg = doBuildMsgHeader(pSql, &pStart);
pDrop = (SCMDropDnodeMsg *)pMsg;
pDrop = (SDropDnodeMsg *)pMsg;
strcpy(pDrop->ip, pMeterMetaInfo->name);
pMsg += sizeof(SCMDropDnodeMsg);
pMsg += sizeof(SDropDnodeMsg);
pCmd->payloadLen = pMsg - pStart;
pCmd->msgType = TSDB_MSG_TYPE_DROP_DNODE;
......@@ -1871,18 +1871,18 @@ int32_t tscBuildDropDnodeMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMDropUserMsg *pDropMsg;
SDropUserMsg *pDropMsg;
char * pMsg, *pStart;
SSqlCmd *pCmd = &pSql->cmd;
pMsg = doBuildMsgHeader(pSql, &pStart);
pDropMsg = (SCMDropUserMsg *)pMsg;
pDropMsg = (SDropUserMsg *)pMsg;
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0);
strcpy(pDropMsg->user, pMeterMetaInfo->name);
pMsg += sizeof(SCMDropUserMsg);
pMsg += sizeof(SDropUserMsg);
pCmd->payloadLen = pMsg - pStart;
pCmd->msgType = TSDB_MSG_TYPE_DROP_USER;
......@@ -1891,18 +1891,18 @@ int32_t tscBuildDropAcctMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int32_t tscBuildUseDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMUseDbMsg *pUseDbMsg;
SUseDbMsg *pUseDbMsg;
char * pMsg, *pStart;
SSqlCmd *pCmd = &pSql->cmd;
pMsg = doBuildMsgHeader(pSql, &pStart);
pUseDbMsg = (SCMUseDbMsg *)pMsg;
pUseDbMsg = (SUseDbMsg *)pMsg;
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfo(pCmd, pCmd->clauseIndex, 0);
strcpy(pUseDbMsg->db, pMeterMetaInfo->name);
pMsg += sizeof(SCMUseDbMsg);
pMsg += sizeof(SUseDbMsg);
pCmd->payloadLen = pMsg - pStart;
pCmd->msgType = TSDB_MSG_TYPE_USE_DB;
......@@ -1918,7 +1918,7 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd *pCmd = &pSql->cmd;
STscObj *pObj = pSql->pTscObj;
int32_t size = minMsgSize() + sizeof(SMgmtHead) + sizeof(SCMShowTableMsg) + pCmd->payloadLen + TSDB_EXTRA_PAYLOAD_SIZE;
int32_t size = minMsgSize() + sizeof(SMgmtHead) + sizeof(SShowTableMsg) + pCmd->payloadLen + TSDB_EXTRA_PAYLOAD_SIZE;
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, size)) {
tscError("%p failed to malloc for show msg", pSql);
return -1;
......@@ -1951,7 +1951,7 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
strncpy(pShowMsg->payload, pPattern->z, pPattern->n);
pShowMsg->payloadLen = htons(pPattern->n);
}
pMsg += (sizeof(SCMShowTableMsg) + pPattern->n);
pMsg += (sizeof(SShowTableMsg) + pPattern->n);
} else {
SSQLToken *pIpAddr = &pShowInfo->prefix;
assert(pIpAddr->n > 0 && pIpAddr->type > 0);
......@@ -1959,7 +1959,7 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
strncpy(pShowMsg->payload, pIpAddr->z, pIpAddr->n);
pShowMsg->payloadLen = htons(pIpAddr->n);
pMsg += (sizeof(SCMShowTableMsg) + pIpAddr->n);
pMsg += (sizeof(SShowTableMsg) + pIpAddr->n);
}
pCmd->payloadLen = pMsg - pStart;
......@@ -1971,17 +1971,17 @@ int32_t tscBuildShowMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int32_t tscBuildKillMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMKillQueryMsg *pKill;
SKillQueryMsg *pKill;
char * pMsg, *pStart;
SSqlCmd *pCmd = &pSql->cmd;
pMsg = doBuildMsgHeader(pSql, &pStart);
pKill = (SCMKillQueryMsg *)pMsg;
pKill = (SKillQueryMsg *)pMsg;
strncpy(pKill->queryId, pInfo->pDCLInfo->ip.z, pInfo->pDCLInfo->ip.n);
pMsg += sizeof(SCMKillQueryMsg);
pMsg += sizeof(SKillQueryMsg);
pCmd->payloadLen = pMsg - pStart;
......@@ -2002,13 +2002,13 @@ int32_t tscBuildKillMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int tscEstimateCreateTableMsgLength(SSqlObj *pSql, SSqlInfo *pInfo) {
SSqlCmd *pCmd = &(pSql->cmd);
int32_t size = minMsgSize() + sizeof(SMgmtHead) + sizeof(SCMCreateTableMsg);
int32_t size = minMsgSize() + sizeof(SMgmtHead) + sizeof(SCreateTableMsg);
SCreateTableSQL *pCreateTableInfo = pInfo->pCreateTableInfo;
if (pCreateTableInfo->type == TSQL_CREATE_TABLE_FROM_STABLE) {
size += sizeof(STagData);
} else {
size += sizeof(SCMSchema) * (pCmd->numOfCols + pCmd->count);
size += sizeof(SSchema) * (pCmd->numOfCols + pCmd->count);
}
if (pCreateTableInfo->pSelect != NULL) {
......@@ -2019,10 +2019,10 @@ int tscEstimateCreateTableMsgLength(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMCreateTableMsg *pCreateTableMsg;
SCreateTableMsg *pCreateTableMsg;
char * pMsg, *pStart;
int msgLen = 0;
SCMSchema * pSchema;
SSchema * pSchema;
int size = 0;
SSqlCmd *pCmd = &pSql->cmd;
......@@ -2047,7 +2047,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pMsg += sizeof(SMgmtHead);
pCreateTableMsg = (SCMCreateTableMsg *)pMsg;
pCreateTableMsg = (SCreateTableMsg *)pMsg;
strcpy(pCreateTableMsg->tableId, pMeterMetaInfo->name);
SCreateTableSQL *pCreateTable = pInfo->pCreateTableInfo;
......@@ -2099,7 +2099,7 @@ int tscBuildCreateTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int tscEstimateAlterTableMsgLength(SSqlCmd *pCmd) {
SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
return minMsgSize() + sizeof(SMgmtHead) + sizeof(SAlterTableMsg) + sizeof(SCMSchema) * tscNumOfFields(pQueryInfo) +
return minMsgSize() + sizeof(SMgmtHead) + sizeof(SAlterTableMsg) + sizeof(SSchema) * tscNumOfFields(pQueryInfo) +
TSDB_EXTRA_PAYLOAD_SIZE;
}
......@@ -2136,7 +2136,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
pAlterTableMsg->numOfCols = htons(tscNumOfFields(pQueryInfo));
memcpy(pAlterTableMsg->tagVal, pAlterInfo->tagData.data, TSDB_MAX_TAGS_LEN);
SCMSchema *pSchema = pAlterTableMsg->schema;
SSchema *pSchema = pAlterTableMsg->schema;
for (int i = 0; i < tscNumOfFields(pQueryInfo); ++i) {
TAOS_FIELD *pField = tscFieldInfoGetField(pQueryInfo, i);
......@@ -2158,7 +2158,7 @@ int tscBuildAlterTableMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
}
int tscAlterDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
SCMAlterDbMsg *pAlterDbMsg;
SAlterDbMsg *pAlterDbMsg;
char * pMsg, *pStart;
int msgLen = 0;
......@@ -2173,10 +2173,10 @@ int tscAlterDbMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
strcpy(pMgmt->db, pObj->db);
pMsg += sizeof(SMgmtHead);
pAlterDbMsg = (SCMAlterDbMsg *)pMsg;
pAlterDbMsg = (SAlterDbMsg *)pMsg;
strcpy(pAlterDbMsg->db, pMeterMetaInfo->name);
pMsg += sizeof(SCMAlterDbMsg);
pMsg += sizeof(SAlterDbMsg);
msgLen = pMsg - pStart;
pCmd->payloadLen = msgLen;
......@@ -2333,14 +2333,14 @@ int tscBuildConnectMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
STscObj *pObj = pSql->pTscObj;
SSqlCmd *pCmd = &pSql->cmd;
pCmd->msgType = TSDB_MSG_TYPE_CONNECT;
pCmd->payloadLen = sizeof(SCMConnectMsg);
pCmd->payloadLen = sizeof(SConnectMsg);
if (TSDB_CODE_SUCCESS != tscAllocPayload(pCmd, pCmd->payloadLen)) {
tscError("%p failed to malloc for query msg", pSql);
return TSDB_CODE_CLI_OUT_OF_MEMORY;
}
SCMConnectMsg *pConnect = (SCMConnectMsg*)pCmd->payload;
SConnectMsg *pConnect = (SConnectMsg*)pCmd->payload;
char *db; // ugly code to move the space
db = strstr(pObj->db, TS_PATH_DELIMITER);
......@@ -2610,18 +2610,18 @@ int tscEstimateHeartBeatMsgLength(SSqlObj *pSql) {
STscObj *pObj = pSql->pTscObj;
size += tsRpcHeadSize + sizeof(SMgmtHead);
size += sizeof(SCMQqueryList);
size += sizeof(SQqueryList);
SSqlObj *tpSql = pObj->sqlList;
while (tpSql) {
size += sizeof(SCMQueryDesc);
size += sizeof(SQueryDesc);
tpSql = tpSql->next;
}
size += sizeof(SCMStreamList);
size += sizeof(SStreamList);
SSqlStream *pStream = pObj->streamList;
while (pStream) {
size += sizeof(SCMStreamDesc);
size += sizeof(SStreamDesc);
pStream = pStream->next;
}
......@@ -2664,7 +2664,7 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
int tscProcessMeterMetaRsp(SSqlObj *pSql) {
SMeterMeta *pMeta;
SCMSchema * pSchema;
SSchema * pSchema;
uint8_t ieType;
char *rsp = pSql->res.pRsp;
......@@ -2706,7 +2706,7 @@ int tscProcessMeterMetaRsp(SSqlObj *pSql) {
pMeta->rowSize = 0;
rsp += sizeof(SMeterMeta);
pSchema = (SCMSchema *)rsp;
pSchema = (SSchema *)rsp;
int32_t numOfTotalCols = pMeta->numOfColumns + pMeta->numOfTags;
for (int i = 0; i < numOfTotalCols; ++i) {
......@@ -2720,10 +2720,10 @@ int tscProcessMeterMetaRsp(SSqlObj *pSql) {
pSchema++;
}
rsp += numOfTotalCols * sizeof(SCMSchema);
rsp += numOfTotalCols * sizeof(SSchema);
int32_t tagLen = 0;
SCMSchema *pTagsSchema = tsGetTagSchema(pMeta);
SSchema *pTagsSchema = tsGetTagSchema(pMeta);
if (pMeta->tableType == TSDB_TABLE_TYPE_CHILD_TABLE) {
for (int32_t i = 0; i < pMeta->numOfTags; ++i) {
......@@ -2751,11 +2751,11 @@ int tscProcessMeterMetaRsp(SSqlObj *pSql) {
/**
* multi meter meta rsp pkg format:
* | STaosRsp | ieType | SMultiMeterInfoMsg | SMeterMeta0 | SCMSchema0 | SMeterMeta1 | SCMSchema1 | SMeterMeta2 | SCMSchema2
* | STaosRsp | ieType | SMultiMeterInfoMsg | SMeterMeta0 | SSchema0 | SMeterMeta1 | SSchema1 | SMeterMeta2 | SSchema2
* |...... 1B 1B 4B
**/
int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
SCMSchema *pSchema;
SSchema *pSchema;
uint8_t ieType;
int32_t totalNum;
int32_t i;
......@@ -2821,7 +2821,7 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
pMeta->rowSize = 0;
rsp += sizeof(SMultiMeterMeta);
pSchema = (SCMSchema *)rsp;
pSchema = (SSchema *)rsp;
int32_t numOfTotalCols = pMeta->numOfColumns + pMeta->numOfTags;
for (int j = 0; j < numOfTotalCols; ++j) {
......@@ -2835,10 +2835,10 @@ int tscProcessMultiMeterMetaRsp(SSqlObj *pSql) {
pSchema++;
}
rsp += numOfTotalCols * sizeof(SCMSchema);
rsp += numOfTotalCols * sizeof(SSchema);
int32_t tagLen = 0;
SCMSchema *pTagsSchema = tsGetTagSchema(pMeta);
SSchema *pTagsSchema = tsGetTagSchema(pMeta);
if (pMeta->tableType == TSDB_TABLE_TYPE_CHILD_TABLE) {
for (int32_t j = 0; j < pMeta->numOfTags; ++j) {
......@@ -2987,8 +2987,8 @@ _error_clean:
*/
int tscProcessShowRsp(SSqlObj *pSql) {
SMeterMeta * pMeta;
SShowRspMsg *pShow;
SCMSchema * pSchema;
SShowRsp *pShow;
SSchema * pSchema;
char key[20];
SSqlRes *pRes = &pSql->res;
......@@ -2998,7 +2998,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
SMeterMetaInfo *pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, 0);
pShow = (SShowRspMsg *)pRes->pRsp;
pShow = (SShowRsp *)pRes->pRsp;
pRes->qhandle = pShow->qhandle;
tscResetForNextRetrieve(pRes);
......@@ -3006,7 +3006,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
pMeta->numOfColumns = ntohs(pMeta->numOfColumns);
pSchema = (SCMSchema *)((char *)pMeta + sizeof(SMeterMeta));
pSchema = (SSchema *)((char *)pMeta + sizeof(SMeterMeta));
pMeta->sid = ntohs(pMeta->sid);
for (int i = 0; i < pMeta->numOfColumns; ++i) {
pSchema->bytes = htons(pSchema->bytes);
......@@ -3018,11 +3018,11 @@ int tscProcessShowRsp(SSqlObj *pSql) {
taosRemoveDataFromCache(tscCacheHandle, (void *)&(pMeterMetaInfo->pMeterMeta), false);
int32_t size = pMeta->numOfColumns * sizeof(SCMSchema) + sizeof(SMeterMeta);
int32_t size = pMeta->numOfColumns * sizeof(SSchema) + sizeof(SMeterMeta);
pMeterMetaInfo->pMeterMeta =
(SMeterMeta *)taosAddDataIntoCache(tscCacheHandle, key, (char *)pMeta, size, tsMeterMetaKeepTimer);
pCmd->numOfCols = pQueryInfo->fieldsInfo.numOfOutputCols;
SCMSchema *pMeterSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema *pMeterSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
tscColumnBaseInfoReserve(&pQueryInfo->colList, pMeta->numOfColumns);
SColumnIndex index = {0};
......@@ -3042,7 +3042,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
STscObj *pObj = pSql->pTscObj;
SSqlRes *pRes = &pSql->res;
SCMConnectRsp *pConnect = (SCMConnectRsp *)pRes->pRsp;
SConnectRsp *pConnect = (SConnectRsp *)pRes->pRsp;
strcpy(pObj->acctId, pConnect->acctId); // copy acctId from response
int32_t len = sprintf(temp, "%s%s%s", pObj->acctId, TS_PATH_DELIMITER, pObj->db);
......@@ -3050,7 +3050,7 @@ int tscProcessConnectRsp(SSqlObj *pSql) {
strncpy(pObj->db, temp, tListLen(pObj->db));
// SIpList * pIpList;
// char *rsp = pRes->pRsp + sizeof(SCMConnectRsp);
// char *rsp = pRes->pRsp + sizeof(SConnectRsp);
// pIpList = (SIpList *)rsp;
// tscSetMgmtIpList(pIpList);
......
......@@ -856,7 +856,7 @@ static void setValueImpl(TAOS_FIELD* pField, int8_t type, const char* name, int1
pField->bytes = bytes;
}
void tscFieldInfoSetValFromSchema(SFieldInfo* pFieldInfo, int32_t index, SCMSchema* pSchema) {
void tscFieldInfoSetValFromSchema(SFieldInfo* pFieldInfo, int32_t index, SSchema* pSchema) {
ensureSpace(pFieldInfo, pFieldInfo->numOfOutputCols + 1);
evic(pFieldInfo, index);
......@@ -1079,7 +1079,7 @@ SSqlExpr* tscSqlExprInsert(SQueryInfo* pQueryInfo, int32_t index, int16_t functi
if (pColIndex->columnIndex == TSDB_TBNAME_COLUMN_INDEX) {
pExpr->colInfo.colId = TSDB_TBNAME_COLUMN_INDEX;
} else {
SCMSchema* pSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, pColIndex->columnIndex);
SSchema* pSchema = tsGetColumnSchema(pMeterMetaInfo->pMeterMeta, pColIndex->columnIndex);
pExpr->colInfo.colId = pSchema->colId;
}
......@@ -1509,7 +1509,7 @@ bool tscValidateColumnId(SMeterMetaInfo* pMeterMetaInfo, int32_t colId) {
return true;
}
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
int32_t numOfTotal = pMeterMetaInfo->pMeterMeta->numOfTags + pMeterMetaInfo->pMeterMeta->numOfColumns;
for (int32_t i = 0; i < numOfTotal; ++i) {
......@@ -1555,14 +1555,14 @@ void tscTagCondRelease(STagCond* pCond) {
void tscGetSrcColumnInfo(SSrcColumnInfo* pColInfo, SQueryInfo* pQueryInfo) {
SMeterMetaInfo* pMeterMetaInfo = tscGetMeterMetaInfoFromQueryInfo(pQueryInfo, 0);
SCMSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pSchema = tsGetSchema(pMeterMetaInfo->pMeterMeta);
for (int32_t i = 0; i < pQueryInfo->exprsInfo.numOfExprs; ++i) {
SSqlExpr* pExpr = tscSqlExprGet(pQueryInfo, i);
pColInfo[i].functionId = pExpr->functionId;
if (TSDB_COL_IS_TAG(pExpr->colInfo.flag)) {
SCMSchema* pTagSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
SSchema* pTagSchema = tsGetTagSchema(pMeterMetaInfo->pMeterMeta);
int16_t actualTagIndex = pMeterMetaInfo->tagColumnIndex[pExpr->colInfo.colIdx];
pColInfo[i].type = (actualTagIndex != -1) ? pTagSchema[actualTagIndex].type : TSDB_DATA_TYPE_BINARY;
......
......@@ -176,7 +176,7 @@ int32_t dnodeProcessFreeVnodeRequest(int8_t *pCont, int32_t contLen, int8_t msgT
}
int32_t dnodeProcessDnodeCfgRequest(int8_t *pCont, int32_t contLen, int8_t msgType, void *pConn) {
SCMCfgDnodeMsg *pCfg = (SCMCfgDnodeMsg *)pCont;
SCfgDnodeMsg *pCfg = (SCfgDnodeMsg *)pCont;
int32_t code = tsCfgDynamicOptions(pCfg->config);
dnodeSendSimpleRspToMnode(pConn, msgType + 1, code);
return code;
......
......@@ -130,7 +130,7 @@ typedef struct _tab_obj {
char * pReserve1;
char * pReserve2;
char * schema;
// SCMSchema schema[];
// SSchema schema[];
} STabObj;
typedef struct {
......@@ -156,7 +156,7 @@ typedef struct SSuperTableObj {
int8_t reserved[7];
int8_t updateEnd[1];
int16_t nextColId;
SCMSchema *schema;
SSchema *schema;
} SSuperTableObj;
typedef struct {
......@@ -184,7 +184,7 @@ typedef struct {
int8_t reserved[3];
int8_t updateEnd[1];
int16_t nextColId;
SCMSchema* schema;
SSchema* schema;
} SNormalTableObj;
typedef struct {
......@@ -201,7 +201,7 @@ typedef struct {
int8_t updateEnd[1];
int16_t nextColId;
char* sql; //null-terminated string
SCMSchema* schema;
SSchema* schema;
} SStreamTableObj;
typedef struct _vg_obj {
......@@ -257,8 +257,8 @@ typedef struct _user_obj {
char updateEnd[1];
struct _user_obj *prev, *next;
struct _acctObj * pAcct;
SCMQqueryList * pQList; // query list
SCMStreamList * pSList; // stream list
SQqueryList * pQList; // query list
SStreamList * pSList; // stream list
} SUserObj;
typedef struct {
......@@ -282,7 +282,7 @@ typedef struct {
typedef struct _acctObj {
char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN];
SCMAcctCfg cfg;
SAcctCfg cfg;
int32_t acctId;
int64_t createdTime;
int8_t reserved[15];
......
......@@ -245,18 +245,12 @@ typedef struct {
SShellSubmitRspBlock *failedBlocks;
} SShellSubmitRspMsg;
typedef struct SCMSchema {
typedef struct SSchema {
uint8_t type;
char name[TSDB_COL_NAME_LEN];
short colId;
short bytes;
} SCMSchema;
typedef struct {
int8_t type;
int16_t colId;
int16_t bytes;
} SDTableColumn;
} SSchema;
typedef struct {
int32_t vnode;
......@@ -277,7 +271,7 @@ typedef struct {
typedef struct {
char db[TSDB_DB_NAME_LEN];
} SCMShowTableMsg;
} SShowTableMsg;
typedef struct {
char tableId[TSDB_TABLE_ID_LEN];
......@@ -287,8 +281,8 @@ typedef struct {
int16_t numOfColumns;
int16_t sqlLen; // the length of SQL, it starts after schema , sql is a null-terminated string
int16_t reserved[16];
SCMSchema schema[];
} SCMCreateTableMsg;
SSchema schema[];
} SCreateTableMsg;
typedef struct {
char meterId[TSDB_TABLE_ID_LEN];
......@@ -302,14 +296,14 @@ typedef struct {
int16_t type; /* operation type */
char tagVal[TSDB_MAX_BYTES_PER_ROW];
int8_t numOfCols; /* number of schema */
SCMSchema schema[];
SSchema schema[];
} SAlterTableMsg;
typedef struct {
char clientVersion[TSDB_VERSION_LEN];
char msgVersion[TSDB_VERSION_LEN];
char db[TSDB_TABLE_ID_LEN];
} SCMConnectMsg;
} SConnectMsg;
typedef struct {
char acctId[TSDB_ACCT_LEN];
......@@ -317,7 +311,7 @@ typedef struct {
int8_t writeAuth;
int8_t superAuth;
SRpcIpSet ipList;
} SCMConnectRsp;
} SConnectRsp;
typedef struct {
int32_t maxUsers;
......@@ -331,24 +325,24 @@ typedef struct {
int64_t maxInbound;
int64_t maxOutbound;
int8_t accessState; // Configured only by command
} SCMAcctCfg;
} SAcctCfg;
typedef struct {
char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN];
SCMAcctCfg cfg;
} SCMCreateAcctMsg, SCMAlterAcctMsg;
SAcctCfg cfg;
} SCreateAcctMsg, SAlterAcctMsg;
typedef struct {
char user[TSDB_USER_LEN];
} SCMDropUserMsg, SCMDropAcctMsg;
} SDropUserMsg, SDropAcctMsg;
typedef struct {
char user[TSDB_USER_LEN];
char pass[TSDB_KEY_LEN];
int8_t privilege;
int8_t flag;
} SCMCreateUserMsg, SCMAlterUserMsg;
} SCreateUserMsg, SAlterUserMsg;
typedef struct {
char db[TSDB_TABLE_ID_LEN];
......@@ -582,12 +576,12 @@ typedef struct {
int8_t loadLatest; // load into mem or not
uint8_t precision; // time resolution
int8_t reserved[16];
} SVnodeCfg, SCMCreateDbMsg, SDbCfg, SCMAlterDbMsg;
} SVnodeCfg, SCreateDbMsg, SDbCfg, SAlterDbMsg;
typedef struct {
char db[TSDB_TABLE_ID_LEN];
uint8_t ignoreNotExists;
} SCMDropDbMsg, SCMUseDbMsg;
} SDropDbMsg, SUseDbMsg;
// IMPORTANT: sizeof(SVnodeStatisticInfo) should not exceed
// TSDB_FILE_HEADER_LEN/4 - TSDB_FILE_HEADER_VERSION_SIZE
......@@ -744,19 +738,19 @@ typedef struct {
* payloadLen is the length of payload
*/
typedef struct {
char type;
int8_t type;
uint16_t payloadLen;
char payload[];
} SShowMsg;
typedef struct {
char ip[20];
} SCMCreateMnodeMsg, SCMDropMnodeMsg, SCMCreateDnodeMsg, SCMDropDnodeMsg;
typedef struct {
uint64_t qhandle;
SMeterMeta meterMeta;
} SShowRspMsg;
} SShowRsp;
typedef struct {
char ip[20];
} SCreateMnodeMsg, SDropMnodeMsg, SCreateDnodeMsg, SDropDnodeMsg;
typedef struct {
int32_t vnode;
......@@ -770,14 +764,14 @@ typedef struct {
typedef struct {
char ip[32];
char config[64];
} SCMCfgDnodeMsg;
} SCfgDnodeMsg;
typedef struct {
char sql[TSDB_SHOW_SQL_LEN];
uint32_t queryId;
int64_t useconds;
int64_t stime;
} SCMQueryDesc;
} SQueryDesc;
typedef struct {
char sql[TSDB_SHOW_SQL_LEN];
......@@ -788,33 +782,33 @@ typedef struct {
int64_t stime;
int64_t slidingTime;
int64_t interval;
} SCMStreamDesc;
} SStreamDesc;
typedef struct {
int32_t numOfQueries;
SCMQueryDesc qdesc[];
} SCMQqueryList;
SQueryDesc qdesc[];
} SQqueryList;
typedef struct {
int32_t numOfStreams;
SCMStreamDesc sdesc[];
} SCMStreamList;
SStreamDesc sdesc[];
} SStreamList;
typedef struct {
SCMQqueryList qlist;
SCMStreamList slist;
} SCMHeartBeatMsg;
SQqueryList qlist;
SStreamList slist;
} SHeartBeatMsg;
typedef struct {
uint32_t queryId;
uint32_t streamId;
int8_t killConnection;
SRpcIpSet ipList;
} SCMHeartBeatRsp;
} SHeartBeatRsp;
typedef struct {
char queryId[TSDB_KILL_MSG_LEN];
} SCMKillQueryMsg, SCMKillStreamMsg, SKillConnectionMsg;
} SKillQueryMsg, SKillStreamMsg, SKillConnectionMsg;
typedef struct {
int32_t vnode;
......
......@@ -32,7 +32,7 @@ extern void (*mgmtCleanUpAccts)();
extern SAcctObj* (*mgmtGetAcct)(char *acctName);
extern int32_t (*mgmtCheckUserLimit)(SAcctObj *pAcct);
extern int32_t (*mgmtCheckDbLimit)(SAcctObj *pAcct);
extern int32_t (*mgmtCheckTableLimit)(SAcctObj *pAcct, SCMCreateTableMsg *pCreate);
extern int32_t (*mgmtCheckTableLimit)(SAcctObj *pAcct, SCreateTableMsg *pCreate);
extern int32_t (*mgmtGetAcctMeta)(SMeterMeta *pMeta, SShowObj *pShow, void *pConn);
extern int32_t (*mgmtRetrieveAccts)(SShowObj *pShow, char *data, int32_t rows, void *pConn);
......
......@@ -28,7 +28,7 @@ extern "C" {
int32_t mgmtInitChildTables();
void mgmtCleanUpChildTables();
int32_t mgmtCreateChildTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid);
int32_t mgmtCreateChildTable(SDbObj *pDb, SCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid);
int32_t mgmtDropChildTable(SDbObj *pDb, SChildTableObj *pTable);
int32_t mgmtAlterChildTable(SDbObj *pDb, SAlterTableMsg *pAlter);
int32_t mgmtModifyChildTableTagValueByName(SChildTableObj *pTable, char *tagName, char *nContent);
......
......@@ -23,7 +23,7 @@ extern "C" {
#include "mnode.h"
void mgmtMonitorDbDrop(void *unused, void *unusedt);
int32_t mgmtAlterDb(SAcctObj *pAcct, SCMAlterDbMsg *pAlter);
int32_t mgmtAlterDb(SAcctObj *pAcct, SAlterDbMsg *pAlter);
int32_t mgmtAddVgroupIntoDb(SDbObj *pDb, SVgObj *pVgroup);
int32_t mgmtAddVgroupIntoDbTail(SDbObj *pDb, SVgObj *pVgroup);
int32_t mgmtRemoveVgroupFromDb(SDbObj *pDb, SVgObj *pVgroup);
......@@ -37,7 +37,7 @@ int32_t mgmtInitDbs();
int32_t mgmtUpdateDb(SDbObj *pDb);
SDbObj *mgmtGetDb(char *db);
SDbObj *mgmtGetDbByTableId(char *db);
int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate);
int32_t mgmtCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate);
int32_t mgmtDropDbByName(SAcctObj *pAcct, char *name, short ignoreNotExists);
int32_t mgmtDropDb(SDbObj *pDb);
bool mgmtCheckIsMonitorDB(char *db, char *monitordb);
......
......@@ -26,9 +26,9 @@ extern "C" {
int32_t mgmtInitNormalTables();
void mgmtCleanUpNormalTables();
int32_t mgmtCreateNormalTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid);
int32_t mgmtCreateNormalTable(SDbObj *pDb, SCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid);
int32_t mgmtDropNormalTable(SDbObj *pDb, SNormalTableObj *pTable);
int32_t mgmtAddNormalTableColumn(SNormalTableObj *pTable, SCMSchema schema[], int32_t ncols);
int32_t mgmtAddNormalTableColumn(SNormalTableObj *pTable, SSchema schema[], int32_t ncols);
int32_t mgmtDropNormalTableColumnByName(SNormalTableObj *pTable, char *colName);
SNormalTableObj* mgmtGetNormalTable(char *tableId);
int8_t * mgmtBuildCreateNormalTableMsg(SNormalTableObj *pTable);
......
......@@ -30,7 +30,7 @@ int32_t mgmtRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, void *pCo
int32_t mgmtRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, void *pConn);
int32_t mgmtSaveQueryStreamList(SCMHeartBeatMsg *pHBMsg);
int32_t mgmtSaveQueryStreamList(SHeartBeatMsg *pHBMsg);
int32_t mgmtKillQuery(char *qidstr, void *pConn);
......
......@@ -26,7 +26,7 @@ extern "C" {
int32_t mgmtInitStreamTables();
void mgmtCleanUpStreamTables();
int32_t mgmtCreateStreamTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid);
int32_t mgmtCreateStreamTable(SDbObj *pDb, SCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid);
int32_t mgmtDropStreamTable(SDbObj *pDb, SStreamTableObj *pTable);
int32_t mgmtAlterStreamTable(SDbObj *pDb, SAlterTableMsg *pAlter);
SStreamTableObj* mgmtGetStreamTable(char *tableId);
......
......@@ -28,14 +28,14 @@ extern "C" {
int32_t mgmtInitSuperTables();
void mgmtCleanUpSuperTables();
int32_t mgmtCreateSuperTable(SDbObj *pDb, SCMCreateTableMsg *pCreate);
int32_t mgmtCreateSuperTable(SDbObj *pDb, SCreateTableMsg *pCreate);
int32_t mgmtDropSuperTable(SDbObj *pDb, SSuperTableObj *pTable);
SSuperTableObj* mgmtGetSuperTable(char *tableId);
int32_t mgmtFindSuperTableTagIndex(SSuperTableObj *pTable, const char *tagName);
int32_t mgmtAddSuperTableTag(SSuperTableObj *pTable, SCMSchema schema[], int32_t ntags);
int32_t mgmtAddSuperTableTag(SSuperTableObj *pTable, SSchema schema[], int32_t ntags);
int32_t mgmtDropSuperTableTag(SSuperTableObj *pTable, char *tagName);
int32_t mgmtModifySuperTableTagNameByName(SSuperTableObj *pTable, char *oldTagName, char *newTagName);
int32_t mgmtAddSuperTableColumn(SSuperTableObj *pTable, SCMSchema schema[], int32_t ncols);
int32_t mgmtAddSuperTableColumn(SSuperTableObj *pTable, SSchema schema[], int32_t ncols);
int32_t mgmtDropSuperTableColumnByName(SSuperTableObj *pTable, char *colName);
int32_t mgmtGetTagsLength(SSuperTableObj* pSuperTable, int32_t col);
......
......@@ -30,7 +30,7 @@ STableInfo* mgmtGetTable(char *tableId);
STableInfo* mgmtGetTableByPos(uint32_t dnodeIp, int32_t vnode, int32_t sid);
int32_t mgmtRetrieveMetricMeta(void *pConn, char **pStart, SSuperTableMetaMsg *pInfo);
int32_t mgmtCreateTable(SDbObj *pDb, SCMCreateTableMsg *pCreate);
int32_t mgmtCreateTable(SDbObj *pDb, SCreateTableMsg *pCreate);
int32_t mgmtDropTable(SDbObj *pDb, char *meterId, int32_t ignore);
int32_t mgmtAlterTable(SDbObj *pDb, SAlterTableMsg *pAlter);
int32_t mgmtGetTableMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn);
......
......@@ -133,11 +133,11 @@ static int32_t mgmtCheckDbLimitImp(SAcctObj *pAcct) {
int32_t (*mgmtCheckDbLimit)(SAcctObj *pAcct) = mgmtCheckDbLimitImp;
static int32_t mgmtCheckTableLimitImp(SAcctObj *pAcct, SCMCreateTableMsg *pCreate) {
static int32_t mgmtCheckTableLimitImp(SAcctObj *pAcct, SCreateTableMsg *pCreate) {
return 0;
}
int32_t (*mgmtCheckTableLimit)(SAcctObj *pAcct, SCMCreateTableMsg *pCreate) = mgmtCheckTableLimitImp;
int32_t (*mgmtCheckTableLimit)(SAcctObj *pAcct, SCreateTableMsg *pCreate) = mgmtCheckTableLimitImp;
static void mgmtCleanUpAcctsImp() {
}
......
......@@ -233,7 +233,7 @@ void mgmtCleanUpChildTables() {
}
int8_t *mgmtBuildCreateChildTableMsg(SChildTableObj *pTable, SVgObj *pVgroup) {
// SCMCreateTableMsg *pCreateTable = (SCMCreateTableMsg *) pMsg;
// SCreateTableMsg *pCreateTable = (SCreateTableMsg *) pMsg;
// memcpy(pCreateTable->tableId, pTable->tableId, TSDB_TABLE_ID_LEN);
// memcpy(pCreateTable->superTableId, pTable->superTable->tableId, TSDB_TABLE_ID_LEN);
// pCreateTable->vnode = htonl(vnode);
......@@ -244,7 +244,7 @@ int8_t *mgmtBuildCreateChildTableMsg(SChildTableObj *pTable, SVgObj *pVgroup) {
// pCreateTable->numOfColumns = htons(pTable->superTable->numOfColumns);
// pCreateTable->numOfTags = htons(pTable->superTable->numOfTags);
//
// SCMSchema *pSchema = pTable->superTable->schema;
// SSchema *pSchema = pTable->superTable->schema;
// int32_t totalCols = pCreateTable->numOfColumns + pCreateTable->numOfTags;
//
// for (int32_t col = 0; col < totalCols; ++col) {
......@@ -263,7 +263,7 @@ int8_t *mgmtBuildCreateChildTableMsg(SChildTableObj *pTable, SVgObj *pVgroup) {
return NULL;
}
int32_t mgmtCreateChildTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid) {
int32_t mgmtCreateChildTable(SDbObj *pDb, SCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid) {
int32_t numOfTables = sdbGetNumOfRows(tsChildTableSdb);
if (numOfTables >= tsMaxTables) {
mError("table:%s, numOfTables:%d exceed maxTables:%d", pCreate->tableId, numOfTables, tsMaxTables);
......@@ -291,7 +291,7 @@ int32_t mgmtCreateChildTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *pV
((uint64_t) sdbGetVersion() & ((1ul << 16) - 1ul));
int32_t size = mgmtGetTagsLength(pSuperTable, INT_MAX) + (uint32_t) TSDB_TABLE_ID_LEN;
SCMSchema * schema = (SCMSchema *) calloc(1, size);
SSchema * schema = (SSchema *) calloc(1, size);
if (schema == NULL) {
free(pTable);
mError("table:%s, corresponding super table schema is null", pCreate->tableId);
......@@ -355,7 +355,7 @@ int32_t mgmtModifyChildTableTagValueByName(SChildTableObj *pTable, char *tagName
// return TSDB_CODE_SUCCESS;
// int32_t rowSize = 0;
// SCMSchema *schema = (SCMSchema *)(pSuperTable->schema + (pSuperTable->numOfColumns + col) * sizeof(SCMSchema));
// SSchema *schema = (SSchema *)(pSuperTable->schema + (pSuperTable->numOfColumns + col) * sizeof(SSchema));
//
// if (col == 0) {
// pTable->isDirty = 1;
......
......@@ -71,7 +71,7 @@ int mgmtGetConnsMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
int cols = 0;
pShow->bytes[cols] = TSDB_METER_NAME_LEN;
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
strcpy(pSchema[cols].name, "user");
......
......@@ -116,7 +116,7 @@ SDbObj *mgmtGetDbByTableId(char *meterId) {
return (SDbObj *)sdbGetRow(tsDbSdb, db);
}
int32_t mgmtCheckDBParams(SCMCreateDbMsg *pCreate) {
int32_t mgmtCheckDBParams(SCreateDbMsg *pCreate) {
if (pCreate->commitLog < 0 || pCreate->commitLog > 1) {
mError("invalid db option commitLog: %d, only 0 or 1 allowed", pCreate->commitLog);
return TSDB_CODE_INVALID_OPTION;
......@@ -189,7 +189,7 @@ int32_t mgmtCheckDBParams(SCMCreateDbMsg *pCreate) {
return TSDB_CODE_SUCCESS;
}
int32_t mgmtCheckDbParams(SCMCreateDbMsg *pCreate) {
int32_t mgmtCheckDbParams(SCreateDbMsg *pCreate) {
// assign default parameters
if (pCreate->maxSessions < 0) pCreate->maxSessions = tsSessionsPerVnode; //
if (pCreate->cacheBlockSize < 0) pCreate->cacheBlockSize = tsCacheBlockSize; //
......@@ -234,7 +234,7 @@ int32_t mgmtCheckDbParams(SCMCreateDbMsg *pCreate) {
return TSDB_CODE_SUCCESS;
}
int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate) {
int32_t mgmtCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate) {
int32_t code = mgmtCheckDbLimit(pAcct);
if (code != 0) {
return code;
......@@ -408,7 +408,7 @@ void mgmtMonitorDbDrop(void *unused, void *unusedt) {
}
}
int32_t mgmtAlterDb(SAcctObj *pAcct, SCMAlterDbMsg *pAlter) {
int32_t mgmtAlterDb(SAcctObj *pAcct, SAlterDbMsg *pAlter) {
int32_t code = TSDB_CODE_SUCCESS;
SDbObj *pDb = (SDbObj *) sdbGetRow(tsDbSdb, pAlter->db);
......@@ -530,7 +530,7 @@ void mgmtCleanUpDbs() {
int32_t mgmtGetDbMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
int32_t cols = 0;
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
SUserObj *pUser = mgmtGetUserFromConn(pConn);
if (pUser == NULL) return 0;
......
......@@ -105,7 +105,7 @@ int32_t mgmtGetDnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_NO_RIGHTS;
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
pShow->bytes[cols] = 16;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
......@@ -220,7 +220,7 @@ int32_t mgmtGetModuleMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_NO_RIGHTS;
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
pShow->bytes[cols] = 16;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
......@@ -313,7 +313,7 @@ int32_t mgmtGetConfigMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_NO_RIGHTS;
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
pShow->bytes[cols] = TSDB_CFG_OPTION_LEN;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
......@@ -399,7 +399,7 @@ int32_t mgmtGetVnodeMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
if (pUser == NULL) return 0;
if (strcmp(pUser->user, "root") != 0) return TSDB_CODE_NO_RIGHTS;
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
pShow->bytes[cols] = 4;
pSchema[cols].type = TSDB_DATA_TYPE_INT;
......
......@@ -499,7 +499,7 @@ int mgmtSendCfgDnodeMsg(char *cont) {
#endif
SDnodeObj *pDnode;
SCMCfgDnodeMsg * pCfg = (SCMCfgDnodeMsg *)cont;
SCfgDnodeMsg * pCfg = (SCfgDnodeMsg *)cont;
uint32_t ip;
ip = inet_addr(pCfg->ip);
......@@ -520,8 +520,8 @@ int mgmtSendCfgDnodeMsg(char *cont) {
if (pStart == NULL) return TSDB_CODE_NODE_OFFLINE;
pMsg = pStart;
memcpy(pMsg, cont, sizeof(SCMCfgDnodeMsg));
pMsg += sizeof(SCMCfgDnodeMsg);
memcpy(pMsg, cont, sizeof(SCfgDnodeMsg));
pMsg += sizeof(SCfgDnodeMsg);
msgLen = pMsg - pStart;
mgmtSendMsgToDnode(pDnode, pStart, msgLen);
......
......@@ -161,7 +161,7 @@ void *mgmtNormalTableActionEncode(void *row, char *str, int32_t size, int32_t *s
assert(row != NULL && str != NULL);
int32_t tsize = pTable->updateEnd - (int8_t *) pTable;
int32_t schemaSize = pTable->numOfColumns * sizeof(SCMSchema);
int32_t schemaSize = pTable->numOfColumns * sizeof(SSchema);
if (size < tsize + schemaSize + 1) {
*ssize = -1;
return NULL;
......@@ -190,8 +190,8 @@ void *mgmtNormalTableActionDecode(void *row, char *str, int32_t size, int32_t *s
}
memcpy(pTable, str, tsize);
int32_t schemaSize = pTable->numOfColumns * sizeof(SCMSchema);
pTable->schema = (SCMSchema *)malloc(schemaSize);
int32_t schemaSize = pTable->numOfColumns * sizeof(SSchema);
pTable->schema = (SSchema *)malloc(schemaSize);
if (pTable->schema == NULL) {
mgmtDestroyNormalTable(pTable);
return NULL;
......@@ -215,7 +215,7 @@ int32_t mgmtInitNormalTables() {
mgmtNormalTableActionInit();
tsNormalTableSdb = sdbOpenTable(tsMaxTables, sizeof(SNormalTableObj) + sizeof(SCMSchema) * TSDB_MAX_COLUMNS,
tsNormalTableSdb = sdbOpenTable(tsMaxTables, sizeof(SNormalTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS,
"ntables", SDB_KEYTYPE_STRING, tsMgmtDirectory, mgmtNormalTableAction);
if (tsNormalTableSdb == NULL) {
mError("failed to init normal table data");
......@@ -259,7 +259,7 @@ int8_t *mgmtBuildCreateNormalTableMsg(SNormalTableObj *pTable) {
// pCreateTable->sversion = htobe32(pTable->sversion);
// pCreateTable->numOfColumns = htobe16(pTable->numOfColumns);
//
// SCMSchema *pSchema = pTable->schema;
// SSchema *pSchema = pTable->schema;
// int32_t totalCols = pCreateTable->numOfColumns;
// for (int32_t col = 0; col < totalCols; ++col) {
......@@ -276,7 +276,7 @@ int8_t *mgmtBuildCreateNormalTableMsg(SNormalTableObj *pTable) {
return NULL;
}
int32_t mgmtCreateNormalTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid) {
int32_t mgmtCreateNormalTable(SDbObj *pDb, SCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid) {
int32_t numOfTables = sdbGetNumOfRows(tsChildTableSdb);
if (numOfTables >= TSDB_MAX_TABLES) {
mError("normal table:%s, numOfTables:%d exceed maxTables:%d", pCreate->tableId, numOfTables, TSDB_MAX_TABLES);
......@@ -297,18 +297,18 @@ int32_t mgmtCreateNormalTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *p
pTable->numOfColumns = pCreate->numOfColumns;
int32_t numOfCols = pCreate->numOfColumns + pCreate->numOfTags;
int32_t schemaSize = numOfCols * sizeof(SCMSchema);
pTable->schema = (SCMSchema *) calloc(1, schemaSize);
int32_t schemaSize = numOfCols * sizeof(SSchema);
pTable->schema = (SSchema *) calloc(1, schemaSize);
if (pTable->schema == NULL) {
free(pTable);
mError("table:%s, no schema input", pCreate->tableId);
return TSDB_CODE_INVALID_TABLE;
}
memcpy(pTable->schema, pCreate->schema, numOfCols * sizeof(SCMSchema));
memcpy(pTable->schema, pCreate->schema, numOfCols * sizeof(SSchema));
pTable->nextColId = 0;
for (int32_t col = 0; col < pCreate->numOfColumns; col++) {
SCMSchema *tschema = (SCMSchema *) pTable->schema;
SSchema *tschema = (SSchema *) pTable->schema;
tschema[col].colId = pTable->nextColId++;
}
......@@ -362,7 +362,7 @@ SNormalTableObj* mgmtGetNormalTable(char *tableId) {
}
static int32_t mgmtFindNormalTableColumnIndex(SNormalTableObj *pTable, char *colName) {
SCMSchema *schema = (SCMSchema *) pTable->schema;
SSchema *schema = (SSchema *) pTable->schema;
for (int32_t i = 0; i < pTable->numOfColumns; i++) {
if (strcasecmp(schema[i].name, colName) == 0) {
return i;
......@@ -372,7 +372,7 @@ static int32_t mgmtFindNormalTableColumnIndex(SNormalTableObj *pTable, char *col
return -1;
}
int32_t mgmtAddNormalTableColumn(SNormalTableObj *pTable, SCMSchema schema[], int32_t ncols) {
int32_t mgmtAddNormalTableColumn(SNormalTableObj *pTable, SSchema schema[], int32_t ncols) {
if (ncols <= 0) {
return TSDB_CODE_APP_ERROR;
}
......@@ -395,12 +395,12 @@ int32_t mgmtAddNormalTableColumn(SNormalTableObj *pTable, SCMSchema schema[], in
return TSDB_CODE_APP_ERROR;
}
int32_t schemaSize = pTable->numOfColumns * sizeof(SCMSchema);
pTable->schema = realloc(pTable->schema, schemaSize + sizeof(SCMSchema) * ncols);
int32_t schemaSize = pTable->numOfColumns * sizeof(SSchema);
pTable->schema = realloc(pTable->schema, schemaSize + sizeof(SSchema) * ncols);
memcpy(pTable->schema + schemaSize, schema, sizeof(SCMSchema) * ncols);
memcpy(pTable->schema + schemaSize, schema, sizeof(SSchema) * ncols);
SCMSchema *tschema = (SCMSchema *) (pTable->schema + sizeof(SCMSchema) * pTable->numOfColumns);
SSchema *tschema = (SSchema *) (pTable->schema + sizeof(SSchema) * pTable->numOfColumns);
for (int32_t i = 0; i < ncols; i++) {
tschema[i].colId = pTable->nextColId++;
}
......@@ -431,8 +431,8 @@ int32_t mgmtDropNormalTableColumnByName(SNormalTableObj *pTable, char *colName)
return TSDB_CODE_APP_ERROR;
}
memmove(pTable->schema + sizeof(SCMSchema) * col, pTable->schema + sizeof(SCMSchema) * (col + 1),
sizeof(SCMSchema) * (pTable->numOfColumns - col - 1));
memmove(pTable->schema + sizeof(SSchema) * col, pTable->schema + sizeof(SSchema) * (col + 1),
sizeof(SSchema) * (pTable->numOfColumns - col - 1));
pTable->numOfColumns--;
pTable->sversion++;
......
......@@ -32,7 +32,7 @@ typedef struct {
int32_t numOfQueries;
SCDesc * connInfo;
SCDesc **cdesc;
SCMQueryDesc qdesc[];
SQueryDesc qdesc[];
} SQueryShow;
typedef struct {
......@@ -40,10 +40,10 @@ typedef struct {
int32_t numOfStreams;
SCDesc * connInfo;
SCDesc **cdesc;
SCMStreamDesc sdesc[];
SStreamDesc sdesc[];
} SStreamShow;
int32_t mgmtSaveQueryStreamList(SCMHeartBeatMsg *pHBMsg) {
int32_t mgmtSaveQueryStreamList(SHeartBeatMsg *pHBMsg) {
// SAcctObj *pAcct = pConn->pAcct;
//
// if (contLen <= 0 || pAcct == NULL) {
......@@ -60,7 +60,7 @@ int32_t mgmtSaveQueryStreamList(SCMHeartBeatMsg *pHBMsg) {
// pConn->pQList = realloc(pConn->pQList, contLen);
// memcpy(pConn->pQList, cont, contLen);
//
// pConn->pSList = (SCMStreamList *)(((char *)pConn->pQList) + pConn->pQList->numOfQueries * sizeof(SCMQueryDesc) + sizeof(SCMQqueryList));
// pConn->pSList = (SStreamList *)(((char *)pConn->pQList) + pConn->pQList->numOfQueries * sizeof(SQueryDesc) + sizeof(SQqueryList));
//
// pAcct->acctInfo.numOfQueries += pConn->pQList->numOfQueries;
// pAcct->acctInfo.numOfStreams += pConn->pSList->numOfStreams;
......@@ -76,7 +76,7 @@ int32_t mgmtGetQueries(SShowObj *pShow, void *pConn) {
//
// pthread_mutex_lock(&pAcct->mutex);
//
// pQueryShow = malloc(sizeof(SCMQueryDesc) * pAcct->acctInfo.numOfQueries + sizeof(SQueryShow));
// pQueryShow = malloc(sizeof(SQueryDesc) * pAcct->acctInfo.numOfQueries + sizeof(SQueryShow));
// pQueryShow->numOfQueries = 0;
// pQueryShow->index = 0;
// pQueryShow->connInfo = NULL;
......@@ -87,7 +87,7 @@ int32_t mgmtGetQueries(SShowObj *pShow, void *pConn) {
// pQueryShow->cdesc = (SCDesc **)malloc(pAcct->acctInfo.numOfQueries * sizeof(SCDesc *));
//
// pConn = pAcct->pConn;
// SCMQueryDesc * pQdesc = pQueryShow->qdesc;
// SQueryDesc * pQdesc = pQueryShow->qdesc;
// SCDesc * pCDesc = pQueryShow->connInfo;
// SCDesc **ppCDesc = pQueryShow->cdesc;
//
......@@ -97,7 +97,7 @@ int32_t mgmtGetQueries(SShowObj *pShow, void *pConn) {
// pCDesc->port = pConn->port;
// strcpy(pCDesc->user, pConn->pUser->user);
//
// memcpy(pQdesc, pConn->pQList->qdesc, sizeof(SCMQueryDesc) * pConn->pQList->numOfQueries);
// memcpy(pQdesc, pConn->pQList->qdesc, sizeof(SQueryDesc) * pConn->pQList->numOfQueries);
// pQdesc += pConn->pQList->numOfQueries;
// pQueryShow->numOfQueries += pConn->pQList->numOfQueries;
// for (int32_t i = 0; i < pConn->pQList->numOfQueries; ++i, ++ppCDesc) *ppCDesc = pCDesc;
......@@ -120,7 +120,7 @@ int32_t mgmtGetQueries(SShowObj *pShow, void *pConn) {
int32_t mgmtGetQueryMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
int32_t cols = 0;
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
pShow->bytes[cols] = TSDB_USER_LEN;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
......@@ -193,7 +193,7 @@ int32_t mgmtKillQuery(char *qidstr, void *pConn) {
// while (pConn) {
// if (pConn->ip == ip && pConn->port == port && pConn->pQList) {
// int32_t i;
// SCMQueryDesc *pQDesc = pConn->pQList->qdesc;
// SQueryDesc *pQDesc = pConn->pQList->qdesc;
// for (i = 0; i < pConn->pQList->numOfQueries; ++i, ++pQDesc) {
// if (pQDesc->queryId == queryId) break;
// }
......@@ -229,7 +229,7 @@ int32_t mgmtRetrieveQueries(SShowObj *pShow, char *data, int32_t rows, void *pCo
if (rows > pQueryShow->numOfQueries - pQueryShow->index) rows = pQueryShow->numOfQueries - pQueryShow->index;
while (numOfRows < rows) {
SCMQueryDesc *pNode = pQueryShow->qdesc + pQueryShow->index;
SQueryDesc *pNode = pQueryShow->qdesc + pQueryShow->index;
SCDesc *pCDesc = pQueryShow->cdesc[pQueryShow->index];
cols = 0;
......@@ -275,7 +275,7 @@ int32_t mgmtGetStreams(SShowObj *pShow, void *pConn) {
//
// pthread_mutex_lock(&pAcct->mutex);
//
// pStreamShow = malloc(sizeof(SCMStreamDesc) * pAcct->acctInfo.numOfStreams + sizeof(SQueryShow));
// pStreamShow = malloc(sizeof(SStreamDesc) * pAcct->acctInfo.numOfStreams + sizeof(SQueryShow));
// pStreamShow->numOfStreams = 0;
// pStreamShow->index = 0;
// pStreamShow->connInfo = NULL;
......@@ -286,7 +286,7 @@ int32_t mgmtGetStreams(SShowObj *pShow, void *pConn) {
// pStreamShow->cdesc = (SCDesc **)malloc(pAcct->acctInfo.numOfStreams * sizeof(SCDesc *));
//
// pConn = pAcct->pConn;
// SCMStreamDesc * pSdesc = pStreamShow->sdesc;
// SStreamDesc * pSdesc = pStreamShow->sdesc;
// SCDesc * pCDesc = pStreamShow->connInfo;
// SCDesc **ppCDesc = pStreamShow->cdesc;
//
......@@ -296,7 +296,7 @@ int32_t mgmtGetStreams(SShowObj *pShow, void *pConn) {
// pCDesc->port = pConn->port;
// strcpy(pCDesc->user, pConn->pUser->user);
//
// memcpy(pSdesc, pConn->pSList->sdesc, sizeof(SCMStreamDesc) * pConn->pSList->numOfStreams);
// memcpy(pSdesc, pConn->pSList->sdesc, sizeof(SStreamDesc) * pConn->pSList->numOfStreams);
// pSdesc += pConn->pSList->numOfStreams;
// pStreamShow->numOfStreams += pConn->pSList->numOfStreams;
// for (int32_t i = 0; i < pConn->pSList->numOfStreams; ++i, ++ppCDesc) *ppCDesc = pCDesc;
......@@ -318,7 +318,7 @@ int32_t mgmtGetStreams(SShowObj *pShow, void *pConn) {
int32_t mgmtGetStreamMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
int32_t cols = 0;
SCMSchema *pSchema = tsGetSchema(pMeta);
SSchema *pSchema = tsGetSchema(pMeta);
pShow->bytes[cols] = TSDB_USER_LEN;
pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
......@@ -386,7 +386,7 @@ int32_t mgmtRetrieveStreams(SShowObj *pShow, char *data, int32_t rows, void *pCo
if (rows > pStreamShow->numOfStreams - pStreamShow->index) rows = pStreamShow->numOfStreams - pStreamShow->index;
while (numOfRows < rows) {
SCMStreamDesc *pNode = pStreamShow->sdesc + pStreamShow->index;
SStreamDesc *pNode = pStreamShow->sdesc + pStreamShow->index;
SCDesc *pCDesc = pStreamShow->cdesc[pStreamShow->index];
cols = 0;
......@@ -461,7 +461,7 @@ int32_t mgmtKillStream(char *qidstr, void *pConn) {
// while (pConn) {
// if (pConn->ip == ip && pConn->port == port && pConn->pSList) {
// int32_t i;
// SCMStreamDesc *pSDesc = pConn->pSList->sdesc;
// SStreamDesc *pSDesc = pConn->pSList->sdesc;
// for (i = 0; i < pConn->pSList->numOfStreams; ++i, ++pSDesc) {
// if (pSDesc->streamId == streamId) break;
// }
......
......@@ -35,7 +35,7 @@
#include "mgmtUser.h"
#include "mgmtVgroup.h"
#define MAX_LEN_OF_METER_META (sizeof(SMultiMeterMeta) + sizeof(SCMSchema) * TSDB_MAX_COLUMNS + sizeof(SCMSchema) * TSDB_MAX_TAGS + TSDB_MAX_TAGS_LEN)
#define MAX_LEN_OF_METER_META (sizeof(SMultiMeterMeta) + sizeof(SSchema) * TSDB_MAX_COLUMNS + sizeof(SSchema) * TSDB_MAX_TAGS + TSDB_MAX_TAGS_LEN)
typedef int32_t (*GetMateFp)(SMeterMeta *pMeta, SShowObj *pShow, void *pConn);
typedef int32_t (*RetrieveMetaFp)(SShowObj *pShow, char *data, int32_t rows, void *pConn);
......@@ -113,8 +113,8 @@ void mgmtCleanUpShell() {
}
}
static void mgmtSetSchemaFromMeters(SCMSchema *pSchema, STabObj *pMeterObj, uint32_t numOfCols) {
SCMSchema *pMeterSchema = (SCMSchema *)(pMeterObj->schema);
static void mgmtSetSchemaFromMeters(SSchema *pSchema, STabObj *pMeterObj, uint32_t numOfCols) {
SSchema *pMeterSchema = (SSchema *)(pMeterObj->schema);
for (int32_t i = 0; i < numOfCols; ++i) {
strcpy(pSchema->name, pMeterSchema[i].name);
pSchema->type = pMeterSchema[i].type;
......@@ -125,7 +125,7 @@ static void mgmtSetSchemaFromMeters(SCMSchema *pSchema, STabObj *pMeterObj, uint
}
static uint32_t mgmtSetMeterTagValue(char *pTags, STabObj *pMetric, STabObj *pMeterObj) {
SCMSchema *pTagSchema = (SCMSchema *)(pMetric->schema + pMetric->numOfColumns * sizeof(SCMSchema));
SSchema *pTagSchema = (SSchema *)(pMetric->schema + pMetric->numOfColumns * sizeof(SSchema));
char *tagVal = pMeterObj->pTagData + TSDB_TABLE_ID_LEN; // tag start position
......@@ -143,14 +143,14 @@ int32_t mgmtProcessMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
// STabObj * pMeterObj = NULL;
// SVgObj * pVgroup = NULL;
// SMeterMeta * pMeta = NULL;
// SCMSchema * pSchema = NULL;
// SSchema * pSchema = NULL;
// STaosRsp * pRsp = NULL;
// char * pStart = NULL;
//
// pInfo->createFlag = htons(pInfo->createFlag);
//
// int32_t size = sizeof(STaosHeader) + sizeof(STaosRsp) + sizeof(SMeterMeta) + sizeof(SCMSchema) * TSDB_MAX_COLUMNS +
// sizeof(SCMSchema) * TSDB_MAX_TAGS + TSDB_MAX_TAGS_LEN + TSDB_EXTRA_PAYLOAD_SIZE;
// int32_t size = sizeof(STaosHeader) + sizeof(STaosRsp) + sizeof(SMeterMeta) + sizeof(SSchema) * TSDB_MAX_COLUMNS +
// sizeof(SSchema) * TSDB_MAX_TAGS + TSDB_MAX_TAGS_LEN + TSDB_EXTRA_PAYLOAD_SIZE;
//
// SDbObj *pDb = NULL;
// if (pConn->pDb != NULL) pDb = mgmtGetDb(pConn->pDb->name);
......@@ -178,7 +178,7 @@ int32_t mgmtProcessMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
// return 0;
// }
//
// SCMCreateTableMsg *pCreateMsg = calloc(1, sizeof(SCMCreateTableMsg) + sizeof(STagData));
// SCreateTableMsg *pCreateMsg = calloc(1, sizeof(SCreateTableMsg) + sizeof(STagData));
// if (pCreateMsg == NULL) {
// taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_TABLE_META_RSP, TSDB_CODE_SERV_OUT_OF_MEMORY);
// return 0;
......@@ -247,7 +247,7 @@ int32_t mgmtProcessMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
// pMeta->tableType = pMeterObj->tableType;
//
// pMsg += sizeof(SMeterMeta);
// pSchema = (SCMSchema *)pMsg; // schema locates at the end of SMeterMeta struct
// pSchema = (SSchema *)pMsg; // schema locates at the end of SMeterMeta struct
//
// if (mgmtTableCreateFromSuperTable(pMeterObj)) {
// assert(pMeterObj->numOfTags == 0);
......@@ -257,7 +257,7 @@ int32_t mgmtProcessMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
//
// pMeta->numOfTags = pMetric->numOfTags; // update the numOfTags info
// mgmtSetSchemaFromMeters(pSchema, pMetric, numOfTotalCols);
// pMsg += numOfTotalCols * sizeof(SCMSchema);
// pMsg += numOfTotalCols * sizeof(SSchema);
//
// // for meters created from metric, we need the metric tag schema to parse the tag data
// int32_t tagsLen = mgmtSetMeterTagValue(pMsg, pMetric, pMeterObj);
......@@ -269,7 +269,7 @@ int32_t mgmtProcessMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
// */
// uint32_t numOfTotalCols = (uint32_t)pMeterObj->numOfTags + pMeterObj->numOfColumns;
// mgmtSetSchemaFromMeters(pSchema, pMeterObj, numOfTotalCols);
// pMsg += numOfTotalCols * sizeof(SCMSchema);
// pMsg += numOfTotalCols * sizeof(SSchema);
// }
//
// if (mgmtIsNormalTable(pMeterObj)) {
......@@ -301,10 +301,10 @@ int32_t mgmtProcessMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
/**
* multi meter meta rsp pkg format:
* | STaosRsp | ieType | SMultiMeterInfoMsg | SMeterMeta0 | SCMSchema0 | SMeterMeta1 | SCMSchema1 | SMeterMeta2 | SCMSchema2
* | STaosRsp | ieType | SMultiMeterInfoMsg | SMeterMeta0 | SSchema0 | SMeterMeta1 | SSchema1 | SMeterMeta2 | SSchema2
* 1B 1B 4B
*
* | STaosHeader | STaosRsp | ieType | SMultiMeterInfoMsg | SMeterMeta0 | SCMSchema0 | SMeterMeta1 | SCMSchema1 | ......................|
* | STaosHeader | STaosRsp | ieType | SMultiMeterInfoMsg | SMeterMeta0 | SSchema0 | SMeterMeta1 | SSchema1 | ......................|
* ^ ^ ^
* |<--------------------------------------size-----------------------------------------------|---------------------->|
* | | |
......@@ -315,7 +315,7 @@ int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle
// STabObj * pMeterObj = NULL;
// SVgObj * pVgroup = NULL;
// SMultiMeterMeta * pMeta = NULL;
// SCMSchema * pSchema = NULL;
// SSchema * pSchema = NULL;
// STaosRsp * pRsp = NULL;
// char * pStart = NULL;
//
......@@ -388,7 +388,7 @@ int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle
// pMeta->meta.tableType = pMeterObj->tableType;
//
// pCurMeter += sizeof(SMultiMeterMeta);
// pSchema = (SCMSchema *)pCurMeter; // schema locates at the end of SMeterMeta struct
// pSchema = (SSchema *)pCurMeter; // schema locates at the end of SMeterMeta struct
//
// if (mgmtTableCreateFromSuperTable(pMeterObj)) {
// assert(pMeterObj->numOfTags == 0);
......@@ -398,7 +398,7 @@ int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle
//
// pMeta->meta.numOfTags = pMetric->numOfTags; // update the numOfTags info
// mgmtSetSchemaFromMeters(pSchema, pMetric, numOfTotalCols);
// pCurMeter += numOfTotalCols * sizeof(SCMSchema);
// pCurMeter += numOfTotalCols * sizeof(SSchema);
//
// // for meters created from metric, we need the metric tag schema to parse the tag data
// int32_t tagsLen = mgmtSetMeterTagValue(pCurMeter, pMetric, pMeterObj);
......@@ -410,7 +410,7 @@ int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle
// */
// uint32_t numOfTotalCols = (uint32_t)pMeterObj->numOfTags + pMeterObj->numOfColumns;
// mgmtSetSchemaFromMeters(pSchema, pMeterObj, numOfTotalCols);
// pCurMeter += numOfTotalCols * sizeof(SCMSchema);
// pCurMeter += numOfTotalCols * sizeof(SSchema);
// }
//
// if (mgmtIsNormalTable(pMeterObj)) {
......@@ -527,7 +527,7 @@ int32_t mgmtProcessCreateDbMsg(void *pCont, int32_t contLen, void *ahandle) {
return TSDB_CODE_INVALID_USER;
}
SCMCreateDbMsg *pCreate = (SCMCreateDbMsg *) pCont;
SCreateDbMsg *pCreate = (SCreateDbMsg *) pCont;
pCreate->maxSessions = htonl(pCreate->maxSessions);
pCreate->cacheBlockSize = htonl(pCreate->cacheBlockSize);
......@@ -567,7 +567,7 @@ int32_t mgmtProcessAlterDbMsg(void *pCont, int32_t contLen, void *ahandle) {
return TSDB_CODE_INVALID_USER;
}
SCMAlterDbMsg *pAlter = (SCMAlterDbMsg *) pCont;
SAlterDbMsg *pAlter = (SAlterDbMsg *) pCont;
pAlter->daysPerFile = htonl(pAlter->daysPerFile);
pAlter->daysToKeep = htonl(pAlter->daysToKeep);
pAlter->maxSessions = htonl(pAlter->maxSessions) + 1;
......@@ -597,7 +597,7 @@ int32_t mgmtProcessKillQueryMsg(void *pCont, int32_t contLen, void *ahandle) {
return TSDB_CODE_INVALID_USER;
}
SCMKillQueryMsg *pKill = (SCMKillQueryMsg *) pCont;
SKillQueryMsg *pKill = (SKillQueryMsg *) pCont;
int32_t code;
if (!pUser->writeAuth) {
......@@ -621,7 +621,7 @@ int32_t mgmtProcessKillStreamMsg(void *pCont, int32_t contLen, void *ahandle) {
return TSDB_CODE_INVALID_USER;
}
SCMKillStreamMsg *pKill = (SCMKillStreamMsg *) pCont;
SKillStreamMsg *pKill = (SKillStreamMsg *) pCont;
int32_t code;
if (!pUser->writeAuth) {
......@@ -671,7 +671,7 @@ int32_t mgmtProcessCreateUserMsg(void *pCont, int32_t contLen, void *ahandle) {
int32_t code;
if (pUser->superAuth) {
SCMCreateUserMsg *pCreate = pCont;
SCreateUserMsg *pCreate = pCont;
code = mgmtCreateUser(pUser->pAcct, pCreate->user, pCreate->pass);
if (code == TSDB_CODE_SUCCESS) {
mLPrint("user:%s is created by %s", pCreate->user, pUser->user);
......@@ -695,7 +695,7 @@ int32_t mgmtProcessAlterUserMsg(void *pCont, int32_t contLen, void *ahandle) {
return TSDB_CODE_INVALID_USER;
}
SCMAlterUserMsg *pAlter = pCont;
SAlterUserMsg *pAlter = pCont;
SUserObj *pUser = mgmtGetUser(pAlter->user);
if (pUser == NULL) {
rpcSendResponse(ahandle, TSDB_CODE_INVALID_USER, NULL, 0);
......@@ -802,7 +802,7 @@ int32_t mgmtProcessDropUserMsg(void *pCont, int32_t contLen, void *ahandle) {
return TSDB_CODE_INVALID_USER;
}
SCMDropUserMsg *pDrop = pCont;
SDropUserMsg *pDrop = pCont;
SUserObj *pUser = mgmtGetUser(pDrop->user);
if (pUser == NULL) {
rpcSendResponse(ahandle, TSDB_CODE_INVALID_USER, NULL, 0);
......@@ -858,7 +858,7 @@ int32_t mgmtProcessDropDbMsg(void *pCont, int32_t contLen, void *ahandle) {
int32_t code;
if (pUser->superAuth) {
SCMDropDbMsg *pDrop = pCont;
SDropDbMsg *pDrop = pCont;
code = mgmtDropDbByName(pUser->pAcct, pDrop->db, pDrop->ignoreNotExists);
if (code == TSDB_CODE_SUCCESS) {
mLPrint("DB:%s is dropped by %s", pDrop->db, pUser->user);
......@@ -910,62 +910,62 @@ static void mgmtInitShowMsgFp() {
}
int32_t mgmtProcessShowMsg(void *pCont, int32_t contLen, void *ahandle) {
// SShowMsg * pShowMsg = (SShowMsg *)pMsg;
// STaosRsp * pRsp;
// char * pStart;
// int32_t code = 0;
// SShowRspMsg *pShowRsp;
// SShowObj * pShow = NULL;
//
// if (pShowMsg->type == TSDB_MGMT_TABLE_DNODE || TSDB_MGMT_TABLE_GRANTS || TSDB_MGMT_TABLE_SCORES) {
// if (mgmtCheckRedirectMsg(pConn, TSDB_MSG_TYPE_SHOW_RSP) != 0) {
// return 0;
// }
// }
//
// int32_t size = sizeof(STaosHeader) + sizeof(STaosRsp) + sizeof(SShowRspMsg) + sizeof(SCMSchema) * TSDB_MAX_COLUMNS +
// TSDB_EXTRA_PAYLOAD_SIZE;
// pStart = taosBuildRspMsgWithSize(pConn->thandle, TSDB_MSG_TYPE_SHOW_RSP, size);
// if (pStart == NULL) {
// taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_SHOW_RSP, TSDB_CODE_SERV_OUT_OF_MEMORY);
// return 0;
// }
//
// pMsg = pStart;
// pRsp = (STaosRsp *)pMsg;
// pMsg = (char *)pRsp->more;
//
// if (pShowMsg->type >= TSDB_MGMT_TABLE_MAX) {
// code = -1;
// } else {
// pShow = (SShowObj *)calloc(1, sizeof(SShowObj) + htons(pShowMsg->payloadLen));
// pShow->signature = pShow;
// pShow->type = pShowMsg->type;
// mTrace("pShow:%p is allocated", pShow);
//
// // set the table name query condition
// pShow->payloadLen = htons(pShowMsg->payloadLen);
// memcpy(pShow->payload, pShowMsg->payload, pShow->payloadLen);
//
// pShowRsp = (SShowRspMsg *)pMsg;
// pShowRsp->qhandle = (uint64_t)pShow; // qhandle;
// pConn->qhandle = pShowRsp->qhandle;
//
// code = (*mgmtGetMetaFp[(uint8_t)pShowMsg->type])(&pShowRsp->meterMeta, pShow, pConn);
// if (code == 0) {
// pMsg += sizeof(SShowRspMsg) + sizeof(SCMSchema) * pShow->numOfColumns;
// } else {
// mError("pShow:%p, type:%d %s, failed to get Meta, code:%d", pShow, pShowMsg->type, taosMsg[(uint8_t)pShowMsg->type], code);
// free(pShow);
// }
// }
//
// pRsp->code = code;
// msgLen = pMsg - pStart;
// taosSendMsgToPeer(pConn->thandle, pStart, msgLen);
//
// return msgLen;
return 0;
SShowMsg * pShowMsg = (SShowMsg *)pCont;
STaosRsp * pRsp;
char * pStart;
int32_t code = 0;
SShowRsp *pShowRsp;
SShowObj * pShow = NULL;
if (pShowMsg->type == TSDB_MGMT_TABLE_DNODE || TSDB_MGMT_TABLE_GRANTS || TSDB_MGMT_TABLE_SCORES) {
if (mgmtCheckRedirectMsg(pConn, TSDB_MSG_TYPE_SHOW_RSP) != 0) {
return 0;
}
}
int32_t size = sizeof(STaosHeader) + sizeof(STaosRsp) + sizeof(SShowRsp) + sizeof(SSchema) * TSDB_MAX_COLUMNS +
TSDB_EXTRA_PAYLOAD_SIZE;
pStart = taosBuildRspMsgWithSize(pConn->thandle, TSDB_MSG_TYPE_SHOW_RSP, size);
if (pStart == NULL) {
taosSendSimpleRsp(pConn->thandle, TSDB_MSG_TYPE_SHOW_RSP, TSDB_CODE_SERV_OUT_OF_MEMORY);
return 0;
}
pMsg = pStart;
pRsp = (STaosRsp *)pMsg;
pMsg = (char *)pRsp->more;
if (pShowMsg->type >= TSDB_MGMT_TABLE_MAX) {
code = -1;
} else {
pShow = (SShowObj *)calloc(1, sizeof(SShowObj) + htons(pShowMsg->payloadLen));
pShow->signature = pShow;
pShow->type = pShowMsg->type;
mTrace("pShow:%p is allocated", pShow);
// set the table name query condition
pShow->payloadLen = htons(pShowMsg->payloadLen);
memcpy(pShow->payload, pShowMsg->payload, pShow->payloadLen);
pShowRsp = (SShowRsp *)pMsg;
pShowRsp->qhandle = (uint64_t)pShow; // qhandle;
pConn->qhandle = pShowRsp->qhandle;
code = (*mgmtGetMetaFp[(uint8_t)pShowMsg->type])(&pShowRsp->meterMeta, pShow, pConn);
if (code == 0) {
pMsg += sizeof(SShowRsp) + sizeof(SSchema) * pShow->numOfColumns;
} else {
mError("pShow:%p, type:%d %s, failed to get Meta, code:%d", pShow, pShowMsg->type, taosMsg[(uint8_t)pShowMsg->type], code);
free(pShow);
}
}
pRsp->code = code;
msgLen = pMsg - pStart;
taosSendMsgToPeer(pConn->thandle, pStart, msgLen);
return msgLen;
}
int32_t mgmtProcessRetrieveMsg(void *pCont, int32_t contLen, void *ahandle) {
......@@ -1067,8 +1067,8 @@ int32_t mgmtProcessCreateTableMsg(void *pCont, int32_t contLen, void *ahandle) {
return TSDB_CODE_INVALID_USER;
}
SCMCreateTableMsg *pCreate = (SCMCreateTableMsg *) pCont;
SCMSchema *pSchema;
SCreateTableMsg *pCreate = (SCreateTableMsg *) pCont;
SSchema *pSchema;
int32_t code;
if (!pUser->writeAuth) {
......@@ -1195,7 +1195,7 @@ int32_t mgmtProcessCfgDnodeMsg(void *pCont, int32_t contLen, void *ahandle) {
return TSDB_CODE_INVALID_USER;
}
SCMCfgDnodeMsg *pCfg = (SCMCfgDnodeMsg *)pCont;
SCfgDnodeMsg *pCfg = (SCfgDnodeMsg *)pCont;
int32_t code;
if (strcmp(pUser->pAcct->user, "root") != 0) {
......@@ -1213,10 +1213,10 @@ int32_t mgmtProcessCfgDnodeMsg(void *pCont, int32_t contLen, void *ahandle) {
}
int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
SCMHeartBeatMsg *pHBMsg = (SCMHeartBeatMsg *) pCont;
SHeartBeatMsg *pHBMsg = (SHeartBeatMsg *) pCont;
mgmtSaveQueryStreamList(pHBMsg);
SCMHeartBeatRsp *pHBRsp = (SCMHeartBeatRsp *) rpcMallocCont(contLen);
SHeartBeatRsp *pHBRsp = (SHeartBeatRsp *) rpcMallocCont(contLen);
if (pHBRsp == NULL) {
rpcSendResponse(ahandle, TSDB_CODE_SERV_OUT_OF_MEMORY, NULL, 0);
rpcFreeCont(pCont);
......@@ -1250,7 +1250,7 @@ int32_t mgmtProcessHeartBeatMsg(void *pCont, int32_t contLen, void *ahandle) {
pHBRsp->streamId = 0;
pHBRsp->killConnection = 0;
rpcSendResponse(ahandle, TSDB_CODE_SUCCESS, pHBRsp, sizeof(SCMHeartBeatMsg));
rpcSendResponse(ahandle, TSDB_CODE_SUCCESS, pHBRsp, sizeof(SHeartBeatMsg));
return TSDB_CODE_SUCCESS;
}
......@@ -1270,7 +1270,7 @@ int32_t mgmtRetriveUserAuthInfo(char *user, char *spi, char *encrypt, char *secr
}
static int32_t mgmtProcessConnectMsg(void *pCont, int32_t contLen, void *thandle) {
SCMConnectMsg *pConnectMsg = (SCMConnectMsg *) pCont;
SConnectMsg *pConnectMsg = (SConnectMsg *) pCont;
SRpcConnInfo connInfo;
rpcGetConnInfo(thandle, &connInfo);
int32_t code;
......@@ -1307,7 +1307,7 @@ static int32_t mgmtProcessConnectMsg(void *pCont, int32_t contLen, void *thandle
}
}
SCMConnectRsp *pConnectRsp = rpcMallocCont(sizeof(SCMConnectRsp));
SConnectRsp *pConnectRsp = rpcMallocCont(sizeof(SConnectRsp));
if (pConnectRsp == NULL) {
code = TSDB_CODE_SERV_OUT_OF_MEMORY;
goto connect_over;
......@@ -1339,7 +1339,7 @@ connect_over:
rpcSendResponse(thandle, code, NULL, 0);
} else {
mLPrint("user:%s login from %s, code:%d", connInfo.user, taosIpStr(connInfo.clientIp), code);
rpcSendResponse(thandle, code, pConnectRsp, sizeof(SCMConnectRsp));
rpcSendResponse(thandle, code, pConnectRsp, sizeof(SConnectRsp));
}
return code;
......
......@@ -67,8 +67,8 @@ void *mgmtStreamTableActionReset(void *row, char *str, int32_t size, int32_t *ss
int32_t tsize = pTable->updateEnd - (int8_t *) pTable;
memcpy(pTable, str, tsize);
int32_t schemaSize = pTable->numOfColumns * sizeof(SCMSchema);
pTable->schema = (SCMSchema *) realloc(pTable->schema, schemaSize);
int32_t schemaSize = pTable->numOfColumns * sizeof(SSchema);
pTable->schema = (SSchema *) realloc(pTable->schema, schemaSize);
memcpy(pTable->schema, str + tsize, schemaSize);
pTable->sql = (char *) realloc(pTable->sql, pTable->sqlLen);
......@@ -169,7 +169,7 @@ void *mgmtStreamTableActionEncode(void *row, char *str, int32_t size, int32_t *s
assert(row != NULL && str != NULL);
int32_t tsize = pTable->updateEnd - (int8_t *) pTable;
int32_t schemaSize = pTable->numOfColumns * sizeof(SCMSchema);
int32_t schemaSize = pTable->numOfColumns * sizeof(SSchema);
if (size < tsize + schemaSize + pTable->sqlLen + 1) {
*ssize = -1;
return NULL;
......@@ -199,8 +199,8 @@ void *mgmtStreamTableActionDecode(void *row, char *str, int32_t size, int32_t *s
}
memcpy(pTable, str, tsize);
int32_t schemaSize = pTable->numOfColumns * sizeof(SCMSchema);
pTable->schema = (SCMSchema *)malloc(schemaSize);
int32_t schemaSize = pTable->numOfColumns * sizeof(SSchema);
pTable->schema = (SSchema *)malloc(schemaSize);
if (pTable->schema == NULL) {
mgmtDestroyStreamTable(pTable);
return NULL;
......@@ -230,7 +230,7 @@ int32_t mgmtInitStreamTables() {
mgmtStreamTableActionInit();
tsStreamTableSdb = sdbOpenTable(tsMaxTables, sizeof(SStreamTableObj) + sizeof(SCMSchema) * TSDB_MAX_COLUMNS + TSDB_MAX_SQL_LEN,
tsStreamTableSdb = sdbOpenTable(tsMaxTables, sizeof(SStreamTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS + TSDB_MAX_SQL_LEN,
"streams", SDB_KEYTYPE_STRING, tsMgmtDirectory, mgmtStreamTableAction);
if (tsStreamTableSdb == NULL) {
mError("failed to init stream table data");
......@@ -273,7 +273,7 @@ int8_t *mgmtBuildCreateStreamTableMsg(SStreamTableObj *pTable, SVgObj *pVgroup)
// pCreateTable->numOfColumns = htons(pTable->numOfColumns);
// //pCreateTable->sqlLen = htons(pTable->sqlLen);
//
// SCMSchema *pSchema = pTable->schema;
// SSchema *pSchema = pTable->schema;
// int32_t totalCols = pCreateTable->numOfColumns;
// for (int32_t col = 0; col < totalCols; ++col) {
......@@ -293,7 +293,7 @@ int8_t *mgmtBuildCreateStreamTableMsg(SStreamTableObj *pTable, SVgObj *pVgroup)
return NULL;
}
int32_t mgmtCreateStreamTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid) {
int32_t mgmtCreateStreamTable(SDbObj *pDb, SCreateTableMsg *pCreate, SVgObj *pVgroup, int32_t sid) {
int32_t numOfTables = sdbGetNumOfRows(tsStreamTableSdb);
if (numOfTables >= TSDB_MAX_TABLES) {
mError("stream table:%s, numOfTables:%d exceed maxTables:%d", pCreate->tableId, numOfTables, TSDB_MAX_TABLES);
......@@ -314,23 +314,23 @@ int32_t mgmtCreateStreamTable(SDbObj *pDb, SCMCreateTableMsg *pCreate, SVgObj *p
pTable->numOfColumns = pCreate->numOfColumns;
int32_t numOfCols = pCreate->numOfColumns + pCreate->numOfTags;
int32_t schemaSize = pTable->numOfColumns * sizeof(SCMSchema);
pTable->schema = (SCMSchema *) calloc(1, schemaSize);
int32_t schemaSize = pTable->numOfColumns * sizeof(SSchema);
pTable->schema = (SSchema *) calloc(1, schemaSize);
if (pTable->schema == NULL) {
free(pTable);
mError("table:%s, no schema input", pCreate->tableId);
return TSDB_CODE_INVALID_TABLE;
}
memcpy(pTable->schema, pCreate->schema, numOfCols * sizeof(SCMSchema));
memcpy(pTable->schema, pCreate->schema, numOfCols * sizeof(SSchema));
pTable->nextColId = 0;
for (int32_t col = 0; col < pCreate->numOfColumns; col++) {
SCMSchema *tschema = (SCMSchema *) pTable->schema;
SSchema *tschema = (SSchema *) pTable->schema;
tschema[col].colId = pTable->nextColId++;
}
pTable->sql = (char*)(pTable->schema + numOfCols * sizeof(SCMSchema));
memcpy(pTable->sql, (char *) (pCreate->schema) + numOfCols * sizeof(SCMSchema), pCreate->sqlLen);
pTable->sql = (char*)(pTable->schema + numOfCols * sizeof(SSchema));
memcpy(pTable->sql, (char *) (pCreate->schema) + numOfCols * sizeof(SSchema), pCreate->sqlLen);
pTable->sql[pCreate->sqlLen - 1] = 0;
mTrace("table:%s, stream sql len:%d sql:%s", pCreate->tableId, pCreate->sqlLen, pTable->sql);
......
......@@ -66,7 +66,7 @@ void *mgmtSuperTableActionReset(void *row, char *str, int32_t size, int32_t *ssi
int32_t tsize = pTable->updateEnd - (int8_t *) pTable;
memcpy(pTable, str, tsize);
int32_t schemaSize = sizeof(SCMSchema) * (pTable->numOfColumns + pTable->numOfTags);
int32_t schemaSize = sizeof(SSchema) * (pTable->numOfColumns + pTable->numOfTags);
pTable->schema = realloc(pTable->schema, schemaSize);
memcpy(pTable->schema, str + tsize, schemaSize);
......@@ -96,7 +96,7 @@ void *mgmtSuperTableActionEncode(void *row, char *str, int32_t size, int32_t *ss
assert(row != NULL && str != NULL);
int32_t tsize = pTable->updateEnd - (int8_t *) pTable;
int32_t schemaSize = sizeof(SCMSchema) * (pTable->numOfColumns + pTable->numOfTags);
int32_t schemaSize = sizeof(SSchema) * (pTable->numOfColumns + pTable->numOfTags);
if (size < tsize + schemaSize + 1) {
*ssize = -1;
......@@ -126,7 +126,7 @@ void *mgmtSuperTableActionDecode(void *row, char *str, int32_t size, int32_t *ss
}
memcpy(pTable, str, tsize);
int32_t schemaSize = sizeof(SCMSchema) * (pTable->numOfColumns + pTable->numOfTags);
int32_t schemaSize = sizeof(SSchema) * (pTable->numOfColumns + pTable->numOfTags);
pTable->schema = malloc(schemaSize);
if (pTable->schema == NULL) {
mgmtDestroySuperTable(pTable);
......@@ -151,7 +151,7 @@ int32_t mgmtInitSuperTables() {
mgmtSuperTableActionInit();
tsSuperTableSdb = sdbOpenTable(tsMaxTables, sizeof(STabObj) + sizeof(SCMSchema) * TSDB_MAX_COLUMNS,
tsSuperTableSdb = sdbOpenTable(tsMaxTables, sizeof(STabObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS,
"stables", SDB_KEYTYPE_STRING, tsMgmtDirectory, mgmtSuperTableAction);
if (tsSuperTableSdb == NULL) {
mError("failed to init super table data");
......@@ -184,7 +184,7 @@ int32_t mgmtInitSuperTables() {
void mgmtCleanUpSuperTables() {
}
int32_t mgmtCreateSuperTable(SDbObj *pDb, SCMCreateTableMsg *pCreate) {
int32_t mgmtCreateSuperTable(SDbObj *pDb, SCreateTableMsg *pCreate) {
int32_t numOfTables = sdbGetNumOfRows(tsSuperTableSdb);
if (numOfTables >= TSDB_MAX_TABLES) {
mError("super table:%s, numOfTables:%d exceed maxTables:%d", pCreate->tableId, numOfTables, TSDB_MAX_TABLES);
......@@ -207,18 +207,18 @@ int32_t mgmtCreateSuperTable(SDbObj *pDb, SCMCreateTableMsg *pCreate) {
pStable->numOfTables = 0;
int32_t numOfCols = pCreate->numOfColumns + pCreate->numOfTags;
int32_t schemaSize = numOfCols * sizeof(SCMSchema);
pStable->schema = (SCMSchema *)calloc(1, schemaSize);
int32_t schemaSize = numOfCols * sizeof(SSchema);
pStable->schema = (SSchema *)calloc(1, schemaSize);
if (pStable->schema == NULL) {
free(pStable);
mError("table:%s, no schema input", pCreate->tableId);
return TSDB_CODE_INVALID_TABLE;
}
memcpy(pStable->schema, pCreate->schema, numOfCols * sizeof(SCMSchema));
memcpy(pStable->schema, pCreate->schema, numOfCols * sizeof(SSchema));
pStable->nextColId = 0;
for (int32_t col = 0; col < pCreate->numOfColumns; col++) {
SCMSchema *tschema = (SCMSchema *)pStable->schema;
SSchema *tschema = (SSchema *)pStable->schema;
tschema[col].colId = pStable->nextColId++;
}
......@@ -241,7 +241,7 @@ SSuperTableObj* mgmtGetSuperTable(char *tableId) {
int32_t mgmtFindSuperTableTagIndex(SSuperTableObj *pStable, const char *tagName) {
for (int32_t i = 0; i < pStable->numOfTags; i++) {
SCMSchema *schema = (SCMSchema *)(pStable->schema + (pStable->numOfColumns + i) * sizeof(SCMSchema));
SSchema *schema = (SSchema *)(pStable->schema + (pStable->numOfColumns + i) * sizeof(SSchema));
if (strcasecmp(tagName, schema->name) == 0) {
return i;
}
......@@ -250,7 +250,7 @@ int32_t mgmtFindSuperTableTagIndex(SSuperTableObj *pStable, const char *tagName)
return -1;
}
int32_t mgmtAddSuperTableTag(SSuperTableObj *pStable, SCMSchema schema[], int32_t ntags) {
int32_t mgmtAddSuperTableTag(SSuperTableObj *pStable, SSchema schema[], int32_t ntags) {
if (pStable->numOfTags + ntags > TSDB_MAX_TAGS) {
return TSDB_CODE_APP_ERROR;
}
......@@ -276,14 +276,14 @@ int32_t mgmtAddSuperTableTag(SSuperTableObj *pStable, SCMSchema schema[], int32_
return TSDB_CODE_APP_ERROR;
}
int32_t schemaSize = sizeof(SCMSchema) * (pStable->numOfTags + pStable->numOfColumns);
pStable->schema = realloc(pStable->schema, schemaSize + sizeof(SCMSchema) * ntags);
int32_t schemaSize = sizeof(SSchema) * (pStable->numOfTags + pStable->numOfColumns);
pStable->schema = realloc(pStable->schema, schemaSize + sizeof(SSchema) * ntags);
memmove(pStable->schema + sizeof(SCMSchema) * (pStable->numOfColumns + ntags),
pStable->schema + sizeof(SCMSchema) * pStable->numOfColumns, sizeof(SCMSchema) * pStable->numOfTags);
memcpy(pStable->schema + sizeof(SCMSchema) * pStable->numOfColumns, schema, sizeof(SCMSchema) * ntags);
memmove(pStable->schema + sizeof(SSchema) * (pStable->numOfColumns + ntags),
pStable->schema + sizeof(SSchema) * pStable->numOfColumns, sizeof(SSchema) * pStable->numOfTags);
memcpy(pStable->schema + sizeof(SSchema) * pStable->numOfColumns, schema, sizeof(SSchema) * ntags);
SCMSchema *tschema = (SCMSchema *) (pStable->schema + sizeof(SCMSchema) * pStable->numOfColumns);
SSchema *tschema = (SSchema *) (pStable->schema + sizeof(SSchema) * pStable->numOfColumns);
for (int32_t i = 0; i < ntags; i++) {
tschema[i].colId = pStable->nextColId++;
}
......@@ -316,13 +316,13 @@ int32_t mgmtDropSuperTableTag(SSuperTableObj *pStable, char *tagName) {
return TSDB_CODE_APP_ERROR;
}
memmove(pStable->schema + sizeof(SCMSchema) * col, pStable->schema + sizeof(SCMSchema) * (col + 1),
sizeof(SCMSchema) * (pStable->numOfColumns + pStable->numOfTags - col - 1));
memmove(pStable->schema + sizeof(SSchema) * col, pStable->schema + sizeof(SSchema) * (col + 1),
sizeof(SSchema) * (pStable->numOfColumns + pStable->numOfTags - col - 1));
pStable->numOfTags--;
pStable->sversion++;
int32_t schemaSize = sizeof(SCMSchema) * (pStable->numOfTags + pStable->numOfColumns);
int32_t schemaSize = sizeof(SSchema) * (pStable->numOfTags + pStable->numOfColumns);
pStable->schema = realloc(pStable->schema, schemaSize);
sdbUpdateRow(tsSuperTableSdb, pStable, 0, 1);
......@@ -346,7 +346,7 @@ int32_t mgmtModifySuperTableTagNameByName(SSuperTableObj *pStable, char *oldTagN
}
// update
SCMSchema *schema = (SCMSchema *) (pStable->schema + (pStable->numOfColumns + col) * sizeof(SCMSchema));
SSchema *schema = (SSchema *) (pStable->schema + (pStable->numOfColumns + col) * sizeof(SSchema));
strncpy(schema->name, newTagName, TSDB_COL_NAME_LEN);
// Encode string
......@@ -370,7 +370,7 @@ int32_t mgmtModifySuperTableTagNameByName(SSuperTableObj *pStable, char *oldTagN
}
static int32_t mgmtFindSuperTableColumnIndex(SSuperTableObj *pStable, char *colName) {
SCMSchema *schema = (SCMSchema *) pStable->schema;
SSchema *schema = (SSchema *) pStable->schema;
for (int32_t i = 0; i < pStable->numOfColumns; i++) {
if (strcasecmp(schema[i].name, colName) == 0) {
return i;
......@@ -380,7 +380,7 @@ static int32_t mgmtFindSuperTableColumnIndex(SSuperTableObj *pStable, char *colN
return -1;
}
int32_t mgmtAddSuperTableColumn(SSuperTableObj *pStable, SCMSchema schema[], int32_t ncols) {
int32_t mgmtAddSuperTableColumn(SSuperTableObj *pStable, SSchema schema[], int32_t ncols) {
if (ncols <= 0) {
return TSDB_CODE_APP_ERROR;
}
......@@ -403,14 +403,14 @@ int32_t mgmtAddSuperTableColumn(SSuperTableObj *pStable, SCMSchema schema[], int
return TSDB_CODE_APP_ERROR;
}
int32_t schemaSize = sizeof(SCMSchema) * (pStable->numOfTags + pStable->numOfColumns);
pStable->schema = realloc(pStable->schema, schemaSize + sizeof(SCMSchema) * ncols);
int32_t schemaSize = sizeof(SSchema) * (pStable->numOfTags + pStable->numOfColumns);
pStable->schema = realloc(pStable->schema, schemaSize + sizeof(SSchema) * ncols);
memmove(pStable->schema + sizeof(SCMSchema) * (pStable->numOfColumns + ncols),
pStable->schema + sizeof(SCMSchema) * pStable->numOfColumns, sizeof(SCMSchema) * pStable->numOfTags);
memcpy(pStable->schema + sizeof(SCMSchema) * pStable->numOfColumns, schema, sizeof(SCMSchema) * ncols);
memmove(pStable->schema + sizeof(SSchema) * (pStable->numOfColumns + ncols),
pStable->schema + sizeof(SSchema) * pStable->numOfColumns, sizeof(SSchema) * pStable->numOfTags);
memcpy(pStable->schema + sizeof(SSchema) * pStable->numOfColumns, schema, sizeof(SSchema) * ncols);
SCMSchema *tschema = (SCMSchema *) (pStable->schema + sizeof(SCMSchema) * pStable->numOfColumns);
SSchema *tschema = (SSchema *) (pStable->schema + sizeof(SSchema) * pStable->numOfColumns);
for (int32_t i = 0; i < ncols; i++) {
tschema[i].colId = pStable->nextColId++;
}
......@@ -442,13 +442,13 @@ int32_t mgmtDropSuperTableColumnByName(SSuperTableObj *pStable, char *colName) {
return TSDB_CODE_APP_ERROR;
}
memmove(pStable->schema + sizeof(SCMSchema) * col, pStable->schema + sizeof(SCMSchema) * (col + 1),
sizeof(SCMSchema) * (pStable->numOfColumns + pStable->numOfTags - col - 1));
memmove(pStable->schema + sizeof(SSchema) * col, pStable->schema + sizeof(SSchema) * (col + 1),
sizeof(SSchema) * (pStable->numOfColumns + pStable->numOfTags - col - 1));
pStable->numOfColumns--;
pStable->sversion++;
int32_t schemaSize = sizeof(SCMSchema) * (pStable->numOfTags + pStable->numOfColumns);
int32_t schemaSize = sizeof(SSchema) * (pStable->numOfTags + pStable->numOfColumns);
pStable->schema = realloc(pStable->schema, schemaSize);
pAcct->acctInfo.numOfTimeSeries -= (pStable->numOfTables);
......@@ -465,7 +465,7 @@ int32_t mgmtGetSuperTableMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
//
// if (pDb == NULL) return TSDB_CODE_DB_NOT_SELECTED;
//
// SCMSchema *pSchema = tsGetSchema(pMeta);
// SSchema *pSchema = tsGetSchema(pMeta);
//
// pShow->bytes[cols] = TSDB_METER_NAME_LEN;
// pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
......@@ -597,7 +597,7 @@ int32_t mgmtGetTagsLength(SSuperTableObj* pSuperTable, int32_t col) { // length
int32_t tagColumnIndexOffset = pSuperTable->numOfColumns;
for (int32_t i = 0; i < pSuperTable->numOfTags && i < col; ++i) {
len += ((SCMSchema*)pSuperTable->schema)[tagColumnIndexOffset + i].bytes;
len += ((SSchema*)pSuperTable->schema)[tagColumnIndexOffset + i].bytes;
}
return len;
......
......@@ -99,7 +99,7 @@ STableInfo* mgmtGetTableByPos(uint32_t dnodeIp, int32_t vnode, int32_t sid) {
return NULL;
}
int32_t mgmtCreateTable(SDbObj *pDb, SCMCreateTableMsg *pCreate) {
int32_t mgmtCreateTable(SDbObj *pDb, SCreateTableMsg *pCreate) {
STableInfo *pTable = mgmtGetTable(pCreate->tableId);
if (pTable != NULL) {
if (pCreate->igExists) {
......@@ -241,7 +241,7 @@ int32_t mgmtGetTableMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
// return TSDB_CODE_DB_NOT_SELECTED;
// }
//
// SCMSchema *pSchema = tsGetSchema(pMeta);
// SSchema *pSchema = tsGetSchema(pMeta);
//
// pShow->bytes[cols] = TSDB_METER_NAME_LEN;
// pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
......
......@@ -160,7 +160,7 @@ void mgmtCleanUpUsers() {
int32_t mgmtGetUserMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
// int32_t cols = 0;
// SCMSchema *pSchema = tsGetSchema(pMeta);
// SSchema *pSchema = tsGetSchema(pMeta);
//
// pShow->bytes[cols] = TSDB_USER_LEN;
// pSchema[cols].type = TSDB_DATA_TYPE_BINARY;
......
......@@ -256,7 +256,7 @@ int32_t mgmtGetVgroupMeta(SMeterMeta *pMeta, SShowObj *pShow, void *pConn) {
//
// if (pDb == NULL) return TSDB_CODE_DB_NOT_SELECTED;
//
// SCMSchema *pSchema = tsGetSchema(pMeta);
// SSchema *pSchema = tsGetSchema(pMeta);
//
// pShow->bytes[cols] = 4;
// pSchema[cols].type = TSDB_DATA_TYPE_INT;
......
......@@ -28,7 +28,7 @@ extern "C" {
#include "ttypes.h"
struct tSQLBinaryExpr;
struct SCMSchema;
struct SSchema;
struct tSkipList;
struct tSkipListNode;
......@@ -49,7 +49,7 @@ typedef struct tQueryInfo {
int32_t offset; // offset value in tags
int32_t colIdx; // index of column in schema
uint8_t optr; // expression operator
SCMSchema sch; // schema of tags
SSchema sch; // schema of tags
tVariant q; // query condition value on the specific schema, filter expression
__compar_fn_t compare; // filter function
} tQueryInfo;
......@@ -65,7 +65,7 @@ typedef struct tSQLSyntaxNode {
int16_t colId; // for schema, the id of column
union {
struct tSQLBinaryExpr *pExpr;
struct SCMSchema * pSchema;
struct SSchema * pSchema;
tVariant * pVal;
};
} tSQLSyntaxNode;
......@@ -88,7 +88,7 @@ typedef struct tQueryResultset {
int64_t num;
} tQueryResultset;
void tSQLBinaryExprFromString(tSQLBinaryExpr **pExpr, SCMSchema *pSchema, int32_t numOfCols, char *src, int32_t len);
void tSQLBinaryExprFromString(tSQLBinaryExpr **pExpr, SSchema *pSchema, int32_t numOfCols, char *src, int32_t len);
void tSQLBinaryExprToString(tSQLBinaryExpr *pExpr, char *dst, int32_t *len);
......
......@@ -72,16 +72,16 @@ typedef struct tFilePagesItem {
tFilePage item;
} tFilePagesItem;
typedef struct SCMSchemaEx {
struct SCMSchema field;
typedef struct SSchemaEx {
struct SSchema field;
int16_t offset;
} SCMSchemaEx;
} SSchemaEx;
typedef struct SColumnModel {
int32_t capacity;
int32_t numOfCols;
int16_t rowSize;
SCMSchemaEx *pFields;
SSchemaEx *pFields;
} SColumnModel;
typedef struct SColumnOrderInfo {
......@@ -116,7 +116,7 @@ typedef struct tExtMemBuffer {
} tExtMemBuffer;
typedef struct tTagSchema {
struct SCMSchema *pSchema;
struct SSchema *pSchema;
int32_t numOfCols;
int32_t colOffset[];
} tTagSchema;
......@@ -198,7 +198,7 @@ bool tExtMemBufferIsAllDataInMem(tExtMemBuffer *pMemBuffer);
* @param blockCapacity
* @return
*/
SColumnModel *createColumnModel(SCMSchema *fields, int32_t numOfCols, int32_t blockCapacity);
SColumnModel *createColumnModel(SSchema *fields, int32_t numOfCols, int32_t blockCapacity);
/**
*
......@@ -219,7 +219,7 @@ void destroyColumnModel(SColumnModel *pModel);
void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxElemsCapacity);
void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxCapacity, int32_t s, int32_t e);
SCMSchema *getColumnModelSchema(SColumnModel *pColumnModel, int32_t index);
SSchema *getColumnModelSchema(SColumnModel *pColumnModel, int32_t index);
int16_t getColumnModelOffset(SColumnModel *pColumnModel, int32_t index);
......
......@@ -26,7 +26,7 @@ extern "C" {
#define VALIDNUMOFCOLS(x) ((x) >= TSDB_MIN_COLUMNS && (x) <= TSDB_MAX_COLUMNS)
struct SCMSchema;
struct SSchema;
/**
* check if the schema is valid or not, including following aspects:
......@@ -40,14 +40,14 @@ struct SCMSchema;
* @param numOfCols
* @return
*/
bool isValidSchema(struct SCMSchema *pSchema, int32_t numOfCols);
bool isValidSchema(struct SSchema *pSchema, int32_t numOfCols);
struct SCMSchema *tsGetSchema(SMeterMeta *pMeta);
struct SSchema *tsGetSchema(SMeterMeta *pMeta);
struct SCMSchema *tsGetTagSchema(SMeterMeta *pMeta);
struct SSchema *tsGetTagSchema(SMeterMeta *pMeta);
struct SCMSchema *tsGetColumnSchema(SMeterMeta *pMeta, int32_t startCol);
struct SCMSchema tsGetTbnameColumnSchema();
struct SSchema *tsGetColumnSchema(SMeterMeta *pMeta, int32_t startCol);
struct SSchema tsGetTbnameColumnSchema();
char *tsGetTagsValue(SMeterMeta *pMeta);
......
......@@ -468,7 +468,7 @@ int32_t compare_a(tOrderDescriptor *pDescriptor, int32_t numOfRows1, int32_t s1,
return ret;
}
} else {
SCMSchema *pSchema = &pDescriptor->pColumnModel->pFields[colIdx];
SSchema *pSchema = &pDescriptor->pColumnModel->pFields[colIdx];
int32_t ret = columnValueAscendingComparator(f1, f2, pSchema->type, pSchema->bytes);
if (ret == 0) {
continue;
......@@ -500,7 +500,7 @@ int32_t compare_d(tOrderDescriptor *pDescriptor, int32_t numOfRows1, int32_t s1,
return ret;
}
} else {
SCMSchema *pSchema = &pDescriptor->pColumnModel->pFields[colIdx];
SSchema *pSchema = &pDescriptor->pColumnModel->pFields[colIdx];
int32_t ret = columnValueAscendingComparator(f1, f2, pSchema->type, pSchema->bytes);
if (ret == 0) {
continue;
......@@ -527,7 +527,7 @@ static void swap(SColumnModel *pColumnModel, int32_t count, int32_t s1, char *da
void *first = COLMODEL_GET_VAL(data1, pColumnModel, count, s1, i);
void *second = COLMODEL_GET_VAL(data1, pColumnModel, count, s2, i);
SCMSchema* pSchema = &pColumnModel->pFields[i].field;
SSchema* pSchema = &pColumnModel->pFields[i].field;
tsDataSwap(first, second, pSchema->type, pSchema->bytes);
}
}
......@@ -762,16 +762,16 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
/*
* deep copy of sschema
*/
SColumnModel *createColumnModel(SCMSchema *fields, int32_t numOfCols, int32_t blockCapacity) {
SColumnModel *pColumnModel = (SColumnModel *)calloc(1, sizeof(SColumnModel) + numOfCols * sizeof(SCMSchemaEx));
SColumnModel *createColumnModel(SSchema *fields, int32_t numOfCols, int32_t blockCapacity) {
SColumnModel *pColumnModel = (SColumnModel *)calloc(1, sizeof(SColumnModel) + numOfCols * sizeof(SSchemaEx));
if (pColumnModel == NULL) {
return NULL;
}
pColumnModel->pFields = (SCMSchemaEx *)(&pColumnModel[1]);
pColumnModel->pFields = (SSchemaEx *)(&pColumnModel[1]);
for(int32_t i = 0; i < numOfCols; ++i) {
SCMSchemaEx* pSchemaEx = &pColumnModel->pFields[i];
SSchemaEx* pSchemaEx = &pColumnModel->pFields[i];
pSchemaEx->field = fields[i];
pSchemaEx->offset = pColumnModel->rowSize;
......@@ -789,15 +789,15 @@ SColumnModel *cloneColumnModel(SColumnModel *pSrc) {
return NULL;
}
SColumnModel *pColumnModel = (SColumnModel *)calloc(1, sizeof(SColumnModel) + pSrc->numOfCols * sizeof(SCMSchemaEx));
SColumnModel *pColumnModel = (SColumnModel *)calloc(1, sizeof(SColumnModel) + pSrc->numOfCols * sizeof(SSchemaEx));
if (pColumnModel == NULL) {
return NULL;
}
*pColumnModel = *pSrc;
pColumnModel->pFields = (SCMSchemaEx*) (&pColumnModel[1]);
memcpy(pColumnModel->pFields, pSrc->pFields, pSrc->numOfCols * sizeof(SCMSchemaEx));
pColumnModel->pFields = (SSchemaEx*) (&pColumnModel[1]);
memcpy(pColumnModel->pFields, pSrc->pFields, pSrc->numOfCols * sizeof(SSchemaEx));
return pColumnModel;
}
......@@ -1005,14 +1005,14 @@ void tColModelCompact(SColumnModel *pModel, tFilePage *inputBuffer, int32_t maxE
/* start from the second column */
for (int32_t i = 1; i < pModel->numOfCols; ++i) {
SCMSchemaEx* pSchemaEx = &pModel->pFields[i];
SSchemaEx* pSchemaEx = &pModel->pFields[i];
memmove(inputBuffer->data + pSchemaEx->offset * inputBuffer->numOfElems,
inputBuffer->data + pSchemaEx->offset * maxElemsCapacity,
pSchemaEx->field.bytes * inputBuffer->numOfElems);
}
}
SCMSchema* getColumnModelSchema(SColumnModel *pColumnModel, int32_t index) {
SSchema* getColumnModelSchema(SColumnModel *pColumnModel, int32_t index) {
assert(pColumnModel != NULL && index >= 0 && index < pColumnModel->numOfCols);
return &pColumnModel->pFields[index].field;
}
......@@ -1034,7 +1034,7 @@ void tColModelErase(SColumnModel *pModel, tFilePage *inputBuffer, int32_t blockC
/* start from the second column */
for (int32_t i = 0; i < pModel->numOfCols; ++i) {
int16_t offset = getColumnModelOffset(pModel, i);
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
char *startPos = inputBuffer->data + offset * blockCapacity + s * pSchema->bytes;
char *endPos = startPos + pSchema->bytes * removed;
......
......@@ -208,7 +208,7 @@ static char* getPos(char* data, int32_t bytes, int32_t order, int32_t capacity,
static void setTagsValueInInterpolation(tFilePage** data, char** pTags, SColumnModel* pModel, int32_t order, int32_t start,
int32_t capacity, int32_t num) {
for (int32_t j = 0, i = start; i < pModel->numOfCols; ++i, ++j) {
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
char* val1 = getPos(data[i]->data, pSchema->bytes, order, capacity, num);
assignVal(val1, pTags[j], pSchema->bytes, pSchema->type);
......@@ -236,7 +236,7 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
char* pInterpolationData = INTERPOL_IS_ASC_INTERPOL(pInterpoInfo) ? *prevValues : *nextValues;
if (pInterpolationData != NULL) {
for (int32_t i = 1; i < numOfValCols; ++i) {
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
int16_t offset = getColumnModelOffset(pModel, i);
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
......@@ -249,7 +249,7 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
}
} else { /* no prev value yet, set the value for null */
for (int32_t i = 1; i < numOfValCols; ++i) {
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
setNull(val1, pSchema->type, pSchema->bytes);
......@@ -261,7 +261,7 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
// TODO : linear interpolation supports NULL value
if (*prevValues != NULL && !outOfBound) {
for (int32_t i = 1; i < numOfValCols; ++i) {
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
int16_t offset = getColumnModelOffset(pModel, i);
int16_t type = pSchema->type;
......@@ -282,7 +282,7 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
} else {
for (int32_t i = 1; i < numOfValCols; ++i) {
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
setNull(val1, pSchema->type, pSchema->bytes);
......@@ -292,7 +292,7 @@ static void doInterpoResultImpl(SInterpolationInfo* pInterpoInfo, int16_t interp
}
} else { /* default value interpolation */
for (int32_t i = 1; i < numOfValCols; ++i) {
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, capacity, *num);
assignVal(val1, (char*)&defaultVal[i], pSchema->bytes, pSchema->type);
......@@ -345,7 +345,7 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
*nextValues = calloc(1, pModel->rowSize);
for (int i = 1; i < pModel->numOfCols; i++) {
int16_t offset = getColumnModelOffset(pModel, i);
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
setNull(*nextValues + offset, pSchema->type, pSchema->bytes);
}
......@@ -353,7 +353,7 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
int32_t offset = pInterpoInfo->rowIdx;
for (int32_t tlen = 0, i = 0; i < pModel->numOfCols - numOfTags; ++i) {
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
memcpy(*nextValues + tlen, srcData[i] + offset * pSchema->bytes, pSchema->bytes);
tlen += pSchema->bytes;
......@@ -379,7 +379,7 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
*prevValues = calloc(1, pModel->rowSize);
for (int i = 1; i < pModel->numOfCols; i++) {
int16_t offset = getColumnModelOffset(pModel, i);
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
setNull(*prevValues + offset, pSchema->type, pSchema->bytes);
}
......@@ -389,7 +389,7 @@ int32_t taosDoInterpoResult(SInterpolationInfo* pInterpoInfo, int16_t interpoTyp
int32_t i = 0;
for (int32_t tlen = 0; i < pModel->numOfCols - numOfTags; ++i) {
int16_t offset = getColumnModelOffset(pModel, i);
SCMSchema* pSchema = getColumnModelSchema(pModel, i);
SSchema* pSchema = getColumnModelSchema(pModel, i);
char* val1 = getPos(data[i]->data, pSchema->bytes, pInterpoInfo->order, bufSize, num);
......
......@@ -297,7 +297,7 @@ tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nE
return NULL;
}
SCMSchema* pSchema = getColumnModelSchema(pDesc->pColumnModel, 0);
SSchema* pSchema = getColumnModelSchema(pDesc->pColumnModel, 0);
if (pSchema->type != dataType) {
pError("MemBucket:%p,data type is not consistent,%d in schema, %d in param", pBucket, pSchema->type, dataType);
tfree(pBucket);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册