diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 055d44ff1ede33a0a8f78900a1189a3289b37a6e..667a3dbe5a5995f2d779c65a8722ac8de162df56 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -5259,26 +5259,6 @@ int32_t parseCreateDBOptions(SSqlCmd* pCmd, SCreateDBInfo* pCreateDbSql) { return TSDB_CODE_SUCCESS; } -//void tscAddTimestampColumn(SQueryInfo* pQueryInfo, int16_t functionId, int16_t tableIndex) { -// // the first column not timestamp column, add it -// SSqlExpr* pExpr = NULL; -// if (tscSqlExprNumOfExprs(pQueryInfo) > 0) { -// pExpr = tscSqlExprGet(pQueryInfo, 0); -// } -// -// if (pExpr == NULL || pExpr->colInfo.colId != PRIMARYKEY_TIMESTAMP_COL_INDEX || pExpr->functionId != functionId) { -// SColumnIndex index = {tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX}; -// -// pExpr = tscSqlExprInsert(pQueryInfo, 0, functionId, &index, TSDB_DATA_TYPE_TIMESTAMP, TSDB_KEYSIZE, TSDB_KEYSIZE, false); -// pExpr->colInfo.flag = TSDB_COL_NORMAL; -// -// // NOTE: tag column does not add to source column list -// SColumnList ids = getColumnList(1, tableIndex, PRIMARYKEY_TIMESTAMP_COL_INDEX); -// -// insertResultField(pQueryInfo, 0, &ids, TSDB_KEYSIZE, TSDB_DATA_TYPE_TIMESTAMP, "ts", pExpr); -// } -//} - void addGroupInfoForSubquery(SSqlObj* pParentObj, SSqlObj* pSql, int32_t subClauseIndex, int32_t tableIndex) { SQueryInfo* pParentQueryInfo = tscGetQueryInfoDetail(&pParentObj->cmd, subClauseIndex); diff --git a/src/client/src/tscSchemaUtil.c b/src/client/src/tscSchemaUtil.c index fb9130b6c5a0f731377dfb911335f162a4d807e0..dfd707344c5ab3ec42b49859937f604fa477fe10 100644 --- a/src/client/src/tscSchemaUtil.c +++ b/src/client/src/tscSchemaUtil.c @@ -163,7 +163,7 @@ STableMeta* tscCreateTableMetaFromMsg(STableMetaMsg* pTableMetaMsg, size_t* size .numOfColumns = pTableMetaMsg->numOfColumns, }; - pTableMeta->id.tid = pTableMetaMsg->sid; + pTableMeta->id.tid = pTableMetaMsg->tid; pTableMeta->id.uid = pTableMetaMsg->uid; SCMVgroupInfo* pVgroupInfo = &pTableMeta->vgroupInfo; diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index ff798a9f9966ea5b1ca5697abe589624749deaed..8d63eb97755caa9bfb252dd91f99e7c324124474 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1650,7 +1650,7 @@ int tscBuildHeartBeatMsg(SSqlObj *pSql, SSqlInfo *pInfo) { int tscProcessTableMetaRsp(SSqlObj *pSql) { STableMetaMsg *pMetaMsg = (STableMetaMsg *)pSql->res.pRsp; - pMetaMsg->sid = htonl(pMetaMsg->sid); + pMetaMsg->tid = htonl(pMetaMsg->tid); pMetaMsg->sversion = htons(pMetaMsg->sversion); pMetaMsg->tversion = htons(pMetaMsg->tversion); pMetaMsg->vgroup.vgId = htonl(pMetaMsg->vgroup.vgId); @@ -1660,9 +1660,9 @@ int tscProcessTableMetaRsp(SSqlObj *pSql) { pMetaMsg->numOfColumns = htons(pMetaMsg->numOfColumns); if ((pMetaMsg->tableType != TSDB_SUPER_TABLE) && - (pMetaMsg->sid <= 0 || pMetaMsg->vgroup.vgId < 2 || pMetaMsg->vgroup.numOfEps <= 0)) { + (pMetaMsg->tid <= 0 || pMetaMsg->vgroup.vgId < 2 || pMetaMsg->vgroup.numOfEps <= 0)) { tscError("invalid value in table numOfEps:%d, vgId:%d tid:%d, name:%s", pMetaMsg->vgroup.numOfEps, pMetaMsg->vgroup.vgId, - pMetaMsg->sid, pMetaMsg->tableId); + pMetaMsg->tid, pMetaMsg->tableId); return TSDB_CODE_TSC_INVALID_VALUE; } @@ -1845,8 +1845,10 @@ int tscProcessSTableVgroupRsp(SSqlObj *pSql) { SVgroupsMsg * pVgroupMsg = (SVgroupsMsg *) pMsg; pVgroupMsg->numOfVgroups = htonl(pVgroupMsg->numOfVgroups); - size_t size = sizeof(SCMVgroupInfo) * pVgroupMsg->numOfVgroups + sizeof(SVgroupsInfo); - pInfo->vgroupList = calloc(1, size); + size_t size = sizeof(SCMVgroupMsg) * pVgroupMsg->numOfVgroups + sizeof(SVgroupsMsg); + + size_t vgroupsz = sizeof(SCMVgroupInfo) * pVgroupMsg->numOfVgroups + sizeof(SVgroupsInfo); + pInfo->vgroupList = calloc(1, vgroupsz); assert(pInfo->vgroupList != NULL); pInfo->vgroupList->numOfVgroups = pVgroupMsg->numOfVgroups; @@ -1898,7 +1900,7 @@ int tscProcessShowRsp(SSqlObj *pSql) { pMetaMsg->numOfColumns = ntohs(pMetaMsg->numOfColumns); pSchema = pMetaMsg->schema; - pMetaMsg->sid = ntohs(pMetaMsg->sid); + pMetaMsg->tid = ntohs(pMetaMsg->tid); for (int i = 0; i < pMetaMsg->numOfColumns; ++i) { pSchema->bytes = htons(pSchema->bytes); pSchema++; diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index 7a2a242df588d0046a18036a230ed0288a293923..4184d05ddc7d3254df58e6be1988e4b5a7494e1e 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -1142,7 +1142,6 @@ static void tscRetrieveDataRes(void *param, TAOS_RES *tres, int code); static SSqlObj *tscCreateSTableSubquery(SSqlObj *pSql, SRetrieveSupport *trsupport, SSqlObj *prevSqlObj); -// TODO int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter *pSupporter) { SSqlCmd * pCmd = &pSql->cmd; SQueryInfo *pQueryInfo = tscGetQueryInfoDetail(pCmd, pCmd->clauseIndex); @@ -1298,14 +1297,6 @@ void tscHandleMasterJoinQuery(SSqlObj* pSql) { assert((pQueryInfo->type & TSDB_QUERY_TYPE_SUBQUERY) == 0); int32_t code = TSDB_CODE_SUCCESS; - - // todo add test -// SSubqueryState *pState = calloc(1, sizeof(SSubqueryState)); -// if (pState == NULL) { -// code = TSDB_CODE_TSC_OUT_OF_MEMORY; -// goto _error; -// } - pSql->subState.numOfSub = pQueryInfo->numOfTables; bool hasEmptySub = false; diff --git a/src/dnode/src/dnodeShell.c b/src/dnode/src/dnodeShell.c index a5c5d4759bbabf054de4b933c475b1cd2fd26e90..4c6c2100e048e9aaf23f4155d3c54604104a8f9b 100644 --- a/src/dnode/src/dnodeShell.c +++ b/src/dnode/src/dnodeShell.c @@ -173,15 +173,15 @@ static int dnodeRetrieveUserAuthInfo(char *user, char *spi, char *encrypt, char return rpcRsp.code; } -void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) { - dDebug("vgId:%d, sid:%d send config table msg to mnode", vgId, sid); +void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t tid) { + dDebug("vgId:%d, tid:%d send config table msg to mnode", vgId, tid); int32_t contLen = sizeof(SDMConfigTableMsg); SDMConfigTableMsg *pMsg = rpcMallocCont(contLen); pMsg->dnodeId = htonl(dnodeGetDnodeId()); pMsg->vgId = htonl(vgId); - pMsg->sid = htonl(sid); + pMsg->tid = htonl(tid); SRpcMsg rpcMsg = {0}; rpcMsg.pCont = pMsg; @@ -194,18 +194,18 @@ void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid) { if (rpcRsp.code != 0) { rpcFreeCont(rpcRsp.pCont); - dError("vgId:%d, sid:%d failed to config table from mnode", vgId, sid); + dError("vgId:%d, tid:%d failed to config table from mnode", vgId, tid); return NULL; } else { - dInfo("vgId:%d, sid:%d config table msg is received", vgId, sid); + dInfo("vgId:%d, tid:%d config table msg is received", vgId, tid); // delete this after debug finished SMDCreateTableMsg *pTable = rpcRsp.pCont; int16_t numOfColumns = htons(pTable->numOfColumns); int16_t numOfTags = htons(pTable->numOfTags); - int32_t sid = htonl(pTable->sid); + int32_t tableId = htonl(pTable->tid); uint64_t uid = htobe64(pTable->uid); - dInfo("table:%s, numOfColumns:%d numOfTags:%d sid:%d uid:%" PRIu64, pTable->tableId, numOfColumns, numOfTags, sid, uid); + dInfo("table:%s, numOfColumns:%d numOfTags:%d tid:%d uid:%" PRIu64, pTable->tableId, numOfColumns, numOfTags, tableId, uid); return rpcRsp.pCont; } diff --git a/src/inc/dnode.h b/src/inc/dnode.h index 83d2a4ad9c58a77510aacf076296213779327326..e84545be1753f3fedb4ee78acf397c91d824ad8b 100644 --- a/src/inc/dnode.h +++ b/src/inc/dnode.h @@ -49,7 +49,7 @@ void dnodeAddClientRspHandle(uint8_t msgType, void (*fp)(SRpcMsg *rpcMsg)); void dnodeSendMsgToDnode(SRpcEpSet *epSet, SRpcMsg *rpcMsg); void dnodeSendMsgToMnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp); void dnodeSendMsgToDnodeRecv(SRpcMsg *rpcMsg, SRpcMsg *rpcRsp, SRpcEpSet *epSet); -void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t sid); +void *dnodeSendCfgTableToRecv(int32_t vgId, int32_t tid); void *dnodeAllocateVnodeWqueue(void *pVnode); void dnodeFreeVnodeWqueue(void *queue); diff --git a/src/inc/taosmsg.h b/src/inc/taosmsg.h index 635e2aba800e77aaaf428f101a1fa56bfbd45c35..2c2d686099c3ac3d31082709e6bb4fccfa92ec33 100644 --- a/src/inc/taosmsg.h +++ b/src/inc/taosmsg.h @@ -251,7 +251,7 @@ typedef struct { int8_t tableType; int16_t numOfColumns; int16_t numOfTags; - int32_t sid; + int32_t tid; int32_t sversion; int32_t tversion; int32_t tagDataLen; @@ -360,7 +360,7 @@ typedef struct { typedef struct { int32_t contLen; int32_t vgId; - int32_t sid; + int32_t tid; uint64_t uid; char tableId[TSDB_TABLE_FNAME_LEN]; } SMDDropTableMsg; @@ -699,7 +699,7 @@ typedef struct STableMetaMsg { int16_t numOfColumns; int16_t sversion; int16_t tversion; - int32_t sid; + int32_t tid; uint64_t uid; SCMVgroupMsg vgroup; SSchema schema[]; @@ -747,7 +747,7 @@ typedef struct { typedef struct { int32_t dnodeId; int32_t vgId; - int32_t sid; + int32_t tid; } SDMConfigTableMsg; typedef struct { diff --git a/src/mnode/inc/mnodeDef.h b/src/mnode/inc/mnodeDef.h index 8a2947dd180218dfd2ddc91d52b2825ccb011eae..4bc840f026d41dc4fe4e8d61c84d53140501bff6 100644 --- a/src/mnode/inc/mnodeDef.h +++ b/src/mnode/inc/mnodeDef.h @@ -115,7 +115,7 @@ typedef struct { uint64_t suid; int64_t createdTime; int32_t numOfColumns; //used by normal table - int32_t sid; + int32_t tid; int32_t vgId; int32_t sqlLen; int8_t updateEnd[4]; diff --git a/src/mnode/src/mnodeTable.c b/src/mnode/src/mnodeTable.c index b72addaa9707eac1a1ed56c63b6a2052c49df748..0a81b47c9b1e35e255d40fe7f3e0b167fc619399 100644 --- a/src/mnode/src/mnodeTable.c +++ b/src/mnode/src/mnodeTable.c @@ -303,7 +303,7 @@ static int32_t mnodeChildTableActionRestored() { SVgObj *pVgroup = mnodeGetVgroup(pTable->vgId); if (pVgroup == NULL) { - mError("ctable:%s, failed to get vgId:%d sid:%d, discard it", pTable->info.tableId, pTable->vgId, pTable->sid); + mError("ctable:%s, failed to get vgId:%d tid:%d, discard it", pTable->info.tableId, pTable->vgId, pTable->tid); pTable->vgId = 0; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); @@ -314,7 +314,7 @@ static int32_t mnodeChildTableActionRestored() { if (strcmp(pVgroup->dbName, pDb->name) != 0) { mError("ctable:%s, db:%s not match with vgId:%d db:%s sid:%d, discard it", - pTable->info.tableId, pDb->name, pTable->vgId, pVgroup->dbName, pTable->sid); + pTable->info.tableId, pDb->name, pTable->vgId, pVgroup->dbName, pTable->tid); pTable->vgId = 0; SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); @@ -771,8 +771,8 @@ static int32_t mnodeProcessDropTableMsg(SMnodeMsg *pMsg) { return mnodeProcessDropSuperTableMsg(pMsg); } else { SChildTableObj *pCTable = (SChildTableObj *)pMsg->pTable; - mInfo("app:%p:%p, table:%s, start to drop ctable, vgId:%d sid:%d uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, - pDrop->tableId, pCTable->vgId, pCTable->sid, pCTable->uid); + mInfo("app:%p:%p, table:%s, start to drop ctable, vgId:%d tid:%d uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, + pDrop->tableId, pCTable->vgId, pCTable->tid, pCTable->uid); return mnodeProcessDropChildTableMsg(pMsg); } } @@ -1479,6 +1479,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) { if (pTable != NULL && pTable->vgHash != NULL) { contLen += (taosHashGetSize(pTable->vgHash) * sizeof(SCMVgroupMsg) + sizeof(SVgroupsMsg)); } + mnodeDecTableRef(pTable); } @@ -1593,7 +1594,7 @@ static void *mnodeBuildCreateChildTableMsg(SCMCreateTableMsg *pMsg, SChildTableO pCreate->vgId = htonl(pTable->vgId); pCreate->tableType = pTable->info.type; pCreate->createdTime = htobe64(pTable->createdTime); - pCreate->sid = htonl(pTable->sid); + pCreate->tid = htonl(pTable->tid); pCreate->sqlDataLen = htonl(pTable->sqlLen); pCreate->uid = htobe64(pTable->uid); @@ -1642,7 +1643,7 @@ static int32_t mnodeDoCreateChildTableFp(SMnodeMsg *pMsg) { assert(pTable); mDebug("app:%p:%p, table:%s, created in mnode, vgId:%d sid:%d, uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, - pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid); + pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid); SCMCreateTableMsg *pCreate = pMsg->rpcMsg.pCont; SMDCreateTableMsg *pMDCreate = mnodeBuildCreateChildTableMsg(pCreate, pTable); @@ -1684,7 +1685,7 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) { return TSDB_CODE_MND_ACTION_IN_PROGRESS; } else { mError("app:%p:%p, table:%s, failed to create table sid:%d, uid:%" PRIu64 ", reason:%s", pMsg->rpcMsg.ahandle, pMsg, - pTable->info.tableId, pTable->sid, pTable->uid, tstrerror(code)); + pTable->info.tableId, pTable->tid, pTable->uid, tstrerror(code)); SSdbOper desc = {.type = SDB_OPER_GLOBAL, .pObj = pTable, .table = tsChildTableSdb}; sdbDeleteRow(&desc); return code; @@ -1708,7 +1709,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { pTable->info.tableId = strdup(pCreate->tableId); pTable->createdTime = taosGetTimestampMs(); - pTable->sid = tid; + pTable->tid = tid; pTable->vgId = pVgroup->vgId; if (pTable->info.type == TSDB_CHILD_TABLE) { @@ -1722,7 +1723,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { } pTable->suid = pMsg->pSTable->uid; - pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->sid) & ((1ul << 24) - 1ul)) << 24) + + pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->tid) & ((1ul << 24) - 1ul)) << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); pTable->superTable = pMsg->pSTable; } else { @@ -1730,7 +1731,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { int64_t us = taosGetTimestampUs(); pTable->uid = (us << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); } else { - pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->sid) & ((1ul << 24) - 1ul)) << 24) + + pTable->uid = (((uint64_t)pTable->vgId) << 48) + ((((uint64_t)pTable->tid) & ((1ul << 24) - 1ul)) << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul)); } @@ -1787,7 +1788,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { tstrerror(code)); } else { mDebug("app:%p:%p, table:%s, allocated in vgroup, vgId:%d sid:%d uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, - pTable->info.tableId, pVgroup->vgId, pTable->sid, pTable->uid); + pTable->info.tableId, pVgroup->vgId, pTable->tid, pTable->uid); } return code; @@ -1805,8 +1806,8 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) { if (pMsg->retry == 0) { if (pMsg->pTable == NULL) { SVgObj *pVgroup = NULL; - int32_t sid = 0; - code = mnodeGetAvailableVgroup(pMsg, &pVgroup, &sid); + int32_t tid = 0; + code = mnodeGetAvailableVgroup(pMsg, &pVgroup, &tid); if (code != TSDB_CODE_SUCCESS) { mDebug("app:%p:%p, table:%s, failed to get available vgroup, reason:%s", pMsg->rpcMsg.ahandle, pMsg, pCreate->tableId, tstrerror(code)); @@ -1820,7 +1821,7 @@ static int32_t mnodeProcessCreateChildTableMsg(SMnodeMsg *pMsg) { pMsg->pVgroup = pVgroup; mnodeIncVgroupRef(pVgroup); - return mnodeDoCreateChildTable(pMsg, sid); + return mnodeDoCreateChildTable(pMsg, tid); } } else { if (pMsg->pTable == NULL) pMsg->pTable = mnodeGetTable(pCreate->tableId); @@ -1850,13 +1851,13 @@ static int32_t mnodeSendDropChildTableMsg(SMnodeMsg *pMsg, bool needReturn) { tstrncpy(pDrop->tableId, pTable->info.tableId, TSDB_TABLE_FNAME_LEN); pDrop->vgId = htonl(pTable->vgId); pDrop->contLen = htonl(sizeof(SMDDropTableMsg)); - pDrop->sid = htonl(pTable->sid); + pDrop->tid = htonl(pTable->tid); pDrop->uid = htobe64(pTable->uid); SRpcEpSet epSet = mnodeGetEpSetFromVgroup(pMsg->pVgroup); mInfo("app:%p:%p, ctable:%s, send drop ctable msg, vgId:%d sid:%d uid:%" PRIu64, pMsg->rpcMsg.ahandle, pMsg, - pDrop->tableId, pTable->vgId, pTable->sid, pTable->uid); + pDrop->tableId, pTable->vgId, pTable->tid, pTable->uid); SRpcMsg rpcMsg = { .ahandle = pMsg, @@ -2095,7 +2096,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) { SChildTableObj *pTable = (SChildTableObj *)pMsg->pTable; pMeta->uid = htobe64(pTable->uid); - pMeta->sid = htonl(pTable->sid); + pMeta->tid = htonl(pTable->tid); pMeta->precision = pDb->cfg.precision; pMeta->tableType = pTable->info.type; tstrncpy(pMeta->tableId, pTable->info.tableId, TSDB_TABLE_FNAME_LEN); @@ -2135,7 +2136,7 @@ static int32_t mnodeDoGetChildTableMeta(SMnodeMsg *pMsg, STableMetaMsg *pMeta) { pMeta->vgroup.vgId = htonl(pMsg->pVgroup->vgId); mDebug("app:%p:%p, table:%s, uid:%" PRIu64 " table meta is retrieved, vgId:%d sid:%d", pMsg->rpcMsg.ahandle, pMsg, - pTable->info.tableId, pTable->uid, pTable->vgId, pTable->sid); + pTable->info.tableId, pTable->uid, pTable->vgId, pTable->tid); return TSDB_CODE_SUCCESS; } @@ -2283,11 +2284,11 @@ static void mnodeDropAllChildTablesInStable(SSuperTableObj *pStable) { } #if 0 -static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t sid) { +static SChildTableObj* mnodeGetTableByPos(int32_t vnode, int32_t tid) { SVgObj *pVgroup = mnodeGetVgroup(vnode); if (pVgroup == NULL) return NULL; - SChildTableObj *pTable = pVgroup->tableList[sid - 1]; + SChildTableObj *pTable = pVgroup->tableList[tid - 1]; mnodeIncTableRef((STableObj *)pTable); mnodeDecVgroupRef(pVgroup); @@ -2335,12 +2336,12 @@ static void mnodeProcessDropChildTableRsp(SRpcMsg *rpcMsg) { assert(pTable); mInfo("app:%p:%p, table:%s, drop table rsp received, vgId:%d sid:%d uid:%" PRIu64 ", thandle:%p result:%s", - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid, + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, mnodeMsg->rpcMsg.handle, tstrerror(rpcMsg->code)); if (rpcMsg->code != TSDB_CODE_SUCCESS) { mError("app:%p:%p, table:%s, failed to drop in dnode, vgId:%d sid:%d uid:%" PRIu64 ", reason:%s", - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid, + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, tstrerror(rpcMsg->code)); dnodeSendRpcMnodeWriteRsp(mnodeMsg, rpcMsg->code); return; @@ -2378,7 +2379,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) { // If the table is deleted by another thread during creation, stop creating and send drop msg to vnode if (sdbCheckRowDeleted(tsChildTableSdb, pTable)) { mDebug("app:%p:%p, table:%s, create table rsp received, but a deleting opertion incoming, vgId:%d sid:%d uid:%" PRIu64, - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid); + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid); // if the vgroup is already dropped from hash, it can't be accquired by pTable->vgId // so the refCount of vgroup can not be decreased @@ -2413,13 +2414,13 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) { if (mnodeMsg->retry++ < 10) { mDebug("app:%p:%p, table:%s, create table rsp received, need retry, times:%d vgId:%d sid:%d uid:%" PRIu64 " result:%s thandle:%p", - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, mnodeMsg->retry, pTable->vgId, pTable->sid, + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, mnodeMsg->retry, pTable->vgId, pTable->tid, pTable->uid, tstrerror(rpcMsg->code), mnodeMsg->rpcMsg.handle); dnodeDelayReprocessMnodeWriteMsg(mnodeMsg); } else { mError("app:%p:%p, table:%s, failed to create in dnode, vgId:%d sid:%d uid:%" PRIu64 ", result:%s thandle:%p", - mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->sid, pTable->uid, + mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, tstrerror(rpcMsg->code), mnodeMsg->rpcMsg.handle); SSdbOper oper = {.type = SDB_OPER_GLOBAL, .table = tsChildTableSdb, .pObj = pTable}; @@ -2674,7 +2675,7 @@ static int32_t mnodeRetrieveShowTables(SShowObj *pShow, char *data, int32_t rows // tid pWrite = data + pShow->offset[cols] * rows + pShow->bytes[cols] * numOfRows; - *(int32_t*) pWrite = pTable->sid; + *(int32_t*) pWrite = pTable->tid; cols++; //vgid diff --git a/src/mnode/src/mnodeVgroup.c b/src/mnode/src/mnodeVgroup.c index 28e4d179202e2d54bef669bbc80cadcfe85d3d17..5084f1276ae883289939bd74c50a0502f6b3c71d 100644 --- a/src/mnode/src/mnodeVgroup.c +++ b/src/mnode/src/mnodeVgroup.c @@ -793,12 +793,12 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v void mnodeAddTableIntoVgroup(SVgObj *pVgroup, SChildTableObj *pTable) { int32_t idPoolSize = taosIdPoolMaxSize(pVgroup->idPool); - if (pTable->sid > idPoolSize) { + if (pTable->tid > idPoolSize) { mnodeAllocVgroupIdPool(pVgroup); } - if (pTable->sid >= 1) { - taosIdPoolMarkStatus(pVgroup->idPool, pTable->sid); + if (pTable->tid >= 1) { + taosIdPoolMarkStatus(pVgroup->idPool, pTable->tid); pVgroup->numOfTables++; // The create vgroup message may be received later than the create table message // and the writing order in sdb is therefore uncertain @@ -808,8 +808,8 @@ void mnodeAddTableIntoVgroup(SVgObj *pVgroup, SChildTableObj *pTable) { } void mnodeRemoveTableFromVgroup(SVgObj *pVgroup, SChildTableObj *pTable) { - if (pTable->sid >= 1) { - taosFreeId(pVgroup->idPool, pTable->sid); + if (pTable->tid >= 1) { + taosFreeId(pVgroup->idPool, pTable->tid); pVgroup->numOfTables--; // The create vgroup message may be received later than the create table message // and the writing order in sdb is therefore uncertain diff --git a/src/tsdb/src/tsdbMeta.c b/src/tsdb/src/tsdbMeta.c index 564d7f5db51c80929391283e4b6fa1128275ea14..f3bd91f038cf209827b1c252160019a6b0aac27f 100644 --- a/src/tsdb/src/tsdbMeta.c +++ b/src/tsdb/src/tsdbMeta.c @@ -239,7 +239,7 @@ STableCfg *tsdbCreateTableCfgFromMsg(SMDCreateTableMsg *pMsg) { return NULL; } - if (tsdbInitTableCfg(pCfg, pMsg->tableType, htobe64(pMsg->uid), htonl(pMsg->sid)) < 0) goto _err; + if (tsdbInitTableCfg(pCfg, pMsg->tableType, htobe64(pMsg->uid), htonl(pMsg->tid)) < 0) goto _err; if (tdInitTSchemaBuilder(&schemaBuilder, htonl(pMsg->sversion)) < 0) { terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; goto _err; diff --git a/src/vnode/src/vnodeWrite.c b/src/vnode/src/vnodeWrite.c index 70b08b9669d0a66f3f06596305d10091e7c1d36a..084e72a73413e4a06a8c2ef22d28e13599cefc89 100644 --- a/src/vnode/src/vnodeWrite.c +++ b/src/vnode/src/vnodeWrite.c @@ -149,7 +149,7 @@ static int32_t vnodeProcessDropTableMsg(SVnodeObj *pVnode, void *pCont, SRspRet int32_t code = TSDB_CODE_SUCCESS; vDebug("vgId:%d, table:%s, start to drop", pVnode->vgId, pTable->tableId); - STableId tableId = {.uid = htobe64(pTable->uid), .tid = htonl(pTable->sid)}; + STableId tableId = {.uid = htobe64(pTable->uid), .tid = htonl(pTable->tid)}; if (tsdbDropTable(pVnode->tsdb, tableId) < 0) code = terrno;