minor changes
This commit is contained in:
parent
3b5828c0d4
commit
ff77967299
|
@ -845,11 +845,11 @@ static int32_t mndProcessStbMetaReq(SMnodeMsg *pReq) {
|
|||
}
|
||||
|
||||
int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num, void **rsp, int32_t *rspLen) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t bufSize = num * (sizeof(STableMetaRsp) + 4 * sizeof(SSchema));
|
||||
void *buf = malloc(bufSize);
|
||||
int32_t len = 0;
|
||||
int32_t contLen = 0;
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
int32_t bufSize = num * (sizeof(STableMetaRsp) + 4 * sizeof(SSchema));
|
||||
void *buf = malloc(bufSize);
|
||||
int32_t len = 0;
|
||||
int32_t contLen = 0;
|
||||
STableMetaRsp *pRsp = NULL;
|
||||
|
||||
for (int32_t i = 0; i < num; ++i) {
|
||||
|
@ -859,7 +859,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
|
|||
stb->tversion = ntohs(stb->tversion);
|
||||
|
||||
if ((contLen + sizeof(STableMetaRsp)) > bufSize) {
|
||||
bufSize = contLen + (num -i) * (sizeof(STableMetaRsp) + 4 * sizeof(SSchema));
|
||||
bufSize = contLen + (num - i) * (sizeof(STableMetaRsp) + 4 * sizeof(SSchema));
|
||||
buf = realloc(buf, bufSize);
|
||||
}
|
||||
|
||||
|
@ -908,7 +908,7 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
|
|||
contLen += sizeof(STableMetaRsp) + len;
|
||||
|
||||
if (contLen > bufSize) {
|
||||
bufSize = contLen + (num -i - 1) * (sizeof(STableMetaRsp) + 4 * sizeof(SSchema));
|
||||
bufSize = contLen + (num - i - 1) * (sizeof(STableMetaRsp) + 4 * sizeof(SSchema));
|
||||
buf = realloc(buf, bufSize);
|
||||
}
|
||||
|
||||
|
@ -921,14 +921,24 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
|
|||
pRsp->suid = htobe64(pStb->uid);
|
||||
pRsp->tuid = htobe64(pStb->uid);
|
||||
|
||||
for (int32_t i = 0; i < totalCols; ++i) {
|
||||
for (int32_t i = 0; i < pStb->numOfColumns; ++i) {
|
||||
SSchema *pSchema = &pRsp->pSchema[i];
|
||||
SSchema *pSrcSchema = &pStb->pSchema[i];
|
||||
SSchema *pSrcSchema = &pStb->pColumns[i];
|
||||
memcpy(pSchema->name, pSrcSchema->name, TSDB_COL_NAME_LEN);
|
||||
pSchema->type = pSrcSchema->type;
|
||||
pSchema->colId = htonl(pSrcSchema->colId);
|
||||
pSchema->bytes = htonl(pSrcSchema->bytes);
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < pStb->numOfTags; ++i) {
|
||||
SSchema *pSchema = &pRsp->pSchema[i + pStb->numOfColumns];
|
||||
SSchema *pSrcSchema = &pStb->pTags[i];
|
||||
memcpy(pSchema->name, pSrcSchema->name, TSDB_COL_NAME_LEN);
|
||||
pSchema->type = pSrcSchema->type;
|
||||
pSchema->colId = htonl(pSrcSchema->colId);
|
||||
pSchema->bytes = htonl(pSrcSchema->bytes);
|
||||
}
|
||||
|
||||
taosRUnLockLatch(&pStb->lock);
|
||||
mndReleaseDb(pMnode, pDb);
|
||||
mndReleaseStb(pMnode, pStb);
|
||||
|
@ -946,7 +956,6 @@ int32_t mndValidateStbInfo(SMnode *pMnode, SSTableMetaVersion *stbs, int32_t num
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int32_t mndGetNumOfStbs(SMnode *pMnode, char *dbName, int32_t *pNumOfStbs) {
|
||||
SSdb *pSdb = pMnode->pSdb;
|
||||
|
||||
|
|
Loading…
Reference in New Issue