fix ctb cursor issue

This commit is contained in:
Hongze Cheng 2022-01-18 11:44:03 +00:00
parent 6d9ae1af99
commit 3f4551fa01
1 changed files with 15 additions and 10 deletions

View File

@ -374,22 +374,27 @@ static int metaCtbIdxCb(DB *pIdx, const DBT *pKey, const DBT *pValue, DBT *pSKey
DBT * pDbt;
if (pTbCfg->type == META_CHILD_TABLE) {
pDbt = calloc(2, sizeof(DBT));
// pDbt = calloc(2, sizeof(DBT));
// First key is suid
pDbt[0].data = &(pTbCfg->ctbCfg.suid);
pDbt[0].size = sizeof(pTbCfg->ctbCfg.suid);
// // First key is suid
// pDbt[0].data = &(pTbCfg->ctbCfg.suid);
// pDbt[0].size = sizeof(pTbCfg->ctbCfg.suid);
// Second key is the first tag
void *pTagVal = tdGetKVRowValOfCol(pTbCfg->ctbCfg.pTag, (kvRowColIdx(pTbCfg->ctbCfg.pTag))[0].colId);
pDbt[1].data = pTagVal;
pDbt[1].size = sizeof(int32_t);
// // Second key is the first tag
// void *pTagVal = tdGetKVRowValOfCol(pTbCfg->ctbCfg.pTag, (kvRowColIdx(pTbCfg->ctbCfg.pTag))[0].colId);
// pDbt[1].data = pTagVal;
// pDbt[1].size = sizeof(int32_t);
// Set index key
memset(pSKey, 0, sizeof(*pSKey));
#if 0
pSKey->flags = DB_DBT_MULTIPLE | DB_DBT_APPMALLOC;
pSKey->data = pDbt;
pSKey->size = 2;
#else
pSKey->data = &(pTbCfg->ctbCfg.suid);
pSKey->size = sizeof(pTbCfg->ctbCfg.suid);
#endif
return 0;
} else {