Merge remote-tracking branch 'origin/feature/query' into feature/query
This commit is contained in:
commit
6634c97552
|
@ -648,8 +648,12 @@ static int32_t mnodeRetrieveDbs(SShowObj *pShow, char *data, int32_t rows, void
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = mnodeGetNextDb(pShow->pIter, &pDb);
|
pShow->pIter = mnodeGetNextDb(pShow->pIter, &pDb);
|
||||||
|
|
||||||
if (pDb == NULL) break;
|
if (pDb == NULL) break;
|
||||||
if (pDb->pAcct != pUser->pAcct) continue;
|
if (pDb->pAcct != pUser->pAcct) {
|
||||||
|
mnodeDecDbRef(pDb);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,8 @@ static int32_t mnodeChildTableActionInsert(SSdbOper *pOper) {
|
||||||
mnodeAddTableIntoStable(pTable->superTable, pTable);
|
mnodeAddTableIntoStable(pTable->superTable, pTable);
|
||||||
grantAdd(TSDB_GRANT_TIMESERIES, pTable->superTable->numOfColumns - 1);
|
grantAdd(TSDB_GRANT_TIMESERIES, pTable->superTable->numOfColumns - 1);
|
||||||
if (pAcct) pAcct->acctInfo.numOfTimeSeries += (pTable->superTable->numOfColumns - 1);
|
if (pAcct) pAcct->acctInfo.numOfTimeSeries += (pTable->superTable->numOfColumns - 1);
|
||||||
|
} else {
|
||||||
|
mError("table:%s:%p, correspond stable not found suid:%" PRIu64, pTable->info.tableId, pTable, pTable->suid);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
grantAdd(TSDB_GRANT_TIMESERIES, pTable->numOfColumns - 1);
|
grantAdd(TSDB_GRANT_TIMESERIES, pTable->numOfColumns - 1);
|
||||||
|
@ -460,12 +462,14 @@ static int32_t mnodeSuperTableActionUpdate(SSdbOper *pOper) {
|
||||||
void *oldSchema = pTable->schema;
|
void *oldSchema = pTable->schema;
|
||||||
void *oldVgHash = pTable->vgHash;
|
void *oldVgHash = pTable->vgHash;
|
||||||
int32_t oldRefCount = pTable->refCount;
|
int32_t oldRefCount = pTable->refCount;
|
||||||
|
int32_t oldNumOfTables = pTable->numOfTables;
|
||||||
|
|
||||||
memcpy(pTable, pNew, sizeof(SSuperTableObj));
|
memcpy(pTable, pNew, sizeof(SSuperTableObj));
|
||||||
|
|
||||||
pTable->vgHash = oldVgHash;
|
pTable->vgHash = oldVgHash;
|
||||||
pTable->refCount = oldRefCount;
|
pTable->refCount = oldRefCount;
|
||||||
pTable->schema = pNew->schema;
|
pTable->schema = pNew->schema;
|
||||||
|
pTable->numOfTables = oldNumOfTables;
|
||||||
free(pNew);
|
free(pNew);
|
||||||
free(oldTableId);
|
free(oldTableId);
|
||||||
free(oldSchema);
|
free(oldSchema);
|
||||||
|
@ -837,10 +841,11 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
|
||||||
return TSDB_CODE_MND_OUT_OF_MEMORY;
|
return TSDB_CODE_MND_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t us = taosGetTimestampUs();
|
||||||
pStable->info.tableId = strdup(pCreate->tableId);
|
pStable->info.tableId = strdup(pCreate->tableId);
|
||||||
pStable->info.type = TSDB_SUPER_TABLE;
|
pStable->info.type = TSDB_SUPER_TABLE;
|
||||||
pStable->createdTime = taosGetTimestampMs();
|
pStable->createdTime = taosGetTimestampMs();
|
||||||
pStable->uid = (((uint64_t) pStable->createdTime) << 16) + (sdbGetVersion() & ((1ul << 16) - 1ul));
|
pStable->uid = (us << 24) + ((sdbGetVersion() & ((1ul << 16) - 1ul)) << 8) + (taosRand() & ((1ul << 8) - 1ul));
|
||||||
pStable->sversion = 0;
|
pStable->sversion = 0;
|
||||||
pStable->tversion = 0;
|
pStable->tversion = 0;
|
||||||
pStable->numOfColumns = htons(pCreate->numOfColumns);
|
pStable->numOfColumns = htons(pCreate->numOfColumns);
|
||||||
|
@ -1494,7 +1499,7 @@ static int32_t mnodeProcessSuperTableVgroupMsg(SMnodeMsg *pMsg) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (pTable->vgHash == NULL) {
|
if (pTable->vgHash == NULL) {
|
||||||
mError("app:%p:%p, stable:%s, no vgroup exist while get stable vgroup info", pMsg->rpcMsg.ahandle, pMsg,
|
mDebug("app:%p:%p, stable:%s, no vgroup exist while get stable vgroup info", pMsg->rpcMsg.ahandle, pMsg,
|
||||||
stableName);
|
stableName);
|
||||||
mnodeDecTableRef(pTable);
|
mnodeDecTableRef(pTable);
|
||||||
|
|
||||||
|
@ -1703,9 +1708,9 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
|
||||||
pTable->createdTime = taosGetTimestampMs();
|
pTable->createdTime = taosGetTimestampMs();
|
||||||
pTable->sid = tid;
|
pTable->sid = tid;
|
||||||
pTable->vgId = pVgroup->vgId;
|
pTable->vgId = pVgroup->vgId;
|
||||||
|
|
||||||
if (pTable->info.type == TSDB_CHILD_TABLE) {
|
if (pTable->info.type == TSDB_CHILD_TABLE) {
|
||||||
STagData *pTagData = (STagData *) pCreate->schema; // it is a tag key
|
STagData *pTagData = (STagData *)pCreate->schema; // it is a tag key
|
||||||
if (pMsg->pSTable == NULL) pMsg->pSTable = mnodeGetSuperTable(pTagData->name);
|
if (pMsg->pSTable == NULL) pMsg->pSTable = mnodeGetSuperTable(pTagData->name);
|
||||||
if (pMsg->pSTable == NULL) {
|
if (pMsg->pSTable == NULL) {
|
||||||
mError("app:%p:%p, table:%s, corresponding super table:%s does not exist", pMsg->rpcMsg.ahandle, pMsg,
|
mError("app:%p:%p, table:%s, corresponding super table:%s does not exist", pMsg->rpcMsg.ahandle, pMsg,
|
||||||
|
@ -2250,7 +2255,8 @@ static void mnodeDropAllChildTablesInStable(SSuperTableObj *pStable) {
|
||||||
int32_t numOfTables = 0;
|
int32_t numOfTables = 0;
|
||||||
SChildTableObj *pTable = NULL;
|
SChildTableObj *pTable = NULL;
|
||||||
|
|
||||||
mInfo("stable:%s, all child tables:%d will dropped from sdb", pStable->info.tableId, pStable->numOfTables);
|
mInfo("stable:%s uid:%" PRIu64 ", all child tables:%d will be dropped from sdb", pStable->info.tableId, pStable->uid,
|
||||||
|
pStable->numOfTables);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
pIter = mnodeGetNextChildTable(pIter, &pTable);
|
pIter = mnodeGetNextChildTable(pIter, &pTable);
|
||||||
|
|
|
@ -723,8 +723,16 @@ static int32_t mnodeRetrieveVgroups(SShowObj *pShow, char *data, int32_t rows, v
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = mnodeGetNextVgroup(pShow->pIter, &pVgroup);
|
pShow->pIter = mnodeGetNextVgroup(pShow->pIter, &pVgroup);
|
||||||
if (pVgroup == NULL) break;
|
if (pVgroup == NULL) break;
|
||||||
if (pVgroup->pDb != pDb) continue;
|
|
||||||
if (!mnodeFilterVgroups(pVgroup, pTable)) continue;
|
if (pVgroup->pDb != pDb) {
|
||||||
|
mnodeDecVgroupRef(pVgroup);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mnodeFilterVgroups(pVgroup, pTable)) {
|
||||||
|
mnodeDecVgroupRef(pVgroup);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue