[TD-4394]fix core when select data after modify tag width
This commit is contained in:
parent
800a112f2a
commit
019860111d
|
@ -117,7 +117,7 @@ typedef struct {
|
||||||
|
|
||||||
void tsdbClearTableCfg(STableCfg *config);
|
void tsdbClearTableCfg(STableCfg *config);
|
||||||
|
|
||||||
void *tsdbGetTableTagVal(const void *pTable, int32_t colId, int16_t type, int16_t* bytes);
|
void *tsdbGetTableTagVal(const void *pTable, int32_t colId, int16_t type, int16_t bytes);
|
||||||
char *tsdbGetTableName(void *pTable);
|
char *tsdbGetTableName(void *pTable);
|
||||||
|
|
||||||
#define TSDB_TABLEID(_table) ((STableId*) (_table))
|
#define TSDB_TABLEID(_table) ((STableId*) (_table))
|
||||||
|
|
|
@ -1475,6 +1475,7 @@ static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg) {
|
||||||
SSchema *schema = (SSchema *) (pStable->schema + col);
|
SSchema *schema = (SSchema *) (pStable->schema + col);
|
||||||
ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR);
|
ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR);
|
||||||
schema->bytes = pAlter->schema[0].bytes;
|
schema->bytes = pAlter->schema[0].bytes;
|
||||||
|
pStable->sversion++;
|
||||||
mInfo("msg:%p, app:%p stable %s, start to modify column %s len to %d", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId,
|
mInfo("msg:%p, app:%p stable %s, start to modify column %s len to %d", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId,
|
||||||
name, schema->bytes);
|
name, schema->bytes);
|
||||||
|
|
||||||
|
@ -1504,6 +1505,7 @@ static int32_t mnodeChangeSuperTableTag(SMnodeMsg *pMsg) {
|
||||||
SSchema *schema = (SSchema *) (pStable->schema + col + pStable->numOfColumns);
|
SSchema *schema = (SSchema *) (pStable->schema + col + pStable->numOfColumns);
|
||||||
ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR);
|
ASSERT(schema->type == TSDB_DATA_TYPE_BINARY || schema->type == TSDB_DATA_TYPE_NCHAR);
|
||||||
schema->bytes = pAlter->schema[0].bytes;
|
schema->bytes = pAlter->schema[0].bytes;
|
||||||
|
pStable->tversion++;
|
||||||
mInfo("msg:%p, app:%p stable %s, start to modify tag len %s to %d", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId,
|
mInfo("msg:%p, app:%p stable %s, start to modify tag len %s to %d", pMsg, pMsg->rpcMsg.ahandle, pStable->info.tableId,
|
||||||
name, schema->bytes);
|
name, schema->bytes);
|
||||||
|
|
||||||
|
|
|
@ -2819,7 +2819,7 @@ static void doSetTagValueInParam(void* pTable, int32_t tagColId, tVariant *tag,
|
||||||
val = tsdbGetTableName(pTable);
|
val = tsdbGetTableName(pTable);
|
||||||
assert(val != NULL);
|
assert(val != NULL);
|
||||||
} else {
|
} else {
|
||||||
val = tsdbGetTableTagVal(pTable, tagColId, type, &bytes);
|
val = tsdbGetTableTagVal(pTable, tagColId, type, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (val == NULL || isNull(val, type)) {
|
if (val == NULL || isNull(val, type)) {
|
||||||
|
@ -6011,7 +6011,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
|
||||||
if (pExprInfo->base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
|
if (pExprInfo->base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
|
||||||
data = tsdbGetTableName(item->pTable);
|
data = tsdbGetTableName(item->pTable);
|
||||||
} else {
|
} else {
|
||||||
data = tsdbGetTableTagVal(item->pTable, pExprInfo->base.colInfo.colId, type, &bytes);
|
data = tsdbGetTableTagVal(item->pTable, pExprInfo->base.colInfo.colId, type, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
doSetTagValueToResultBuf(output, data, type, bytes);
|
doSetTagValueToResultBuf(output, data, type, bytes);
|
||||||
|
@ -6050,7 +6050,7 @@ static SSDataBlock* doTagScan(void* param, bool* newgroup) {
|
||||||
if (pExprInfo[j].base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
|
if (pExprInfo[j].base.colInfo.colId == TSDB_TBNAME_COLUMN_INDEX) {
|
||||||
data = tsdbGetTableName(item->pTable);
|
data = tsdbGetTableName(item->pTable);
|
||||||
} else {
|
} else {
|
||||||
data = tsdbGetTableTagVal(item->pTable, pExprInfo[j].base.colInfo.colId, type, &bytes);
|
data = tsdbGetTableTagVal(item->pTable, pExprInfo[j].base.colInfo.colId, type, bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
dst = pColInfo->pData + count * pExprInfo[j].base.resBytes;
|
dst = pColInfo->pData + count * pExprInfo[j].base.resBytes;
|
||||||
|
|
|
@ -148,7 +148,7 @@ int tsdbCreateTable(STsdbRepo *repo, STableCfg *pCfg) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_err:
|
_err:
|
||||||
tsdbFreeTable(super);
|
//tsdbFreeTable(super);
|
||||||
tsdbFreeTable(table);
|
tsdbFreeTable(table);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +201,7 @@ _err:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_t* bytes) {
|
void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_t bytes) {
|
||||||
// TODO: this function should be changed also
|
// TODO: this function should be changed also
|
||||||
|
|
||||||
STSchema *pSchema = tsdbGetTableTagSchema((STable*) pTable);
|
STSchema *pSchema = tsdbGetTableTagSchema((STable*) pTable);
|
||||||
|
@ -211,16 +211,8 @@ void *tsdbGetTableTagVal(const void* pTable, int32_t colId, int16_t type, int16_
|
||||||
}
|
}
|
||||||
|
|
||||||
char *val = tdGetKVRowValOfCol(((STable*)pTable)->tagVal, colId);
|
char *val = tdGetKVRowValOfCol(((STable*)pTable)->tagVal, colId);
|
||||||
assert(type == pCol->type &&
|
assert(type == pCol->type && bytes == pCol->bytes);
|
||||||
// if var data type,bytes may >= col bytes,in case of tag width has beed modified
|
|
||||||
((IS_VAR_DATA_TYPE(type) && *bytes >= pCol->bytes) ||
|
|
||||||
// otherwise, bytes must be equal to colomn bytes
|
|
||||||
(!IS_VAR_DATA_TYPE(type) && *bytes == pCol->bytes)));
|
|
||||||
|
|
||||||
// in case tag width has been modified bigger but vnode has not been notified
|
|
||||||
if (val != NULL && IS_VAR_DATA_TYPE(type) && *bytes > pCol->bytes) {
|
|
||||||
*bytes = pCol->bytes;
|
|
||||||
}
|
|
||||||
// if (val != NULL && IS_VAR_DATA_TYPE(type)) {
|
// if (val != NULL && IS_VAR_DATA_TYPE(type)) {
|
||||||
// assert(varDataLen(val) < pCol->bytes);
|
// assert(varDataLen(val) < pCol->bytes);
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -85,7 +85,7 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint16_t keyLen, _
|
||||||
}
|
}
|
||||||
|
|
||||||
void tSkipListDestroy(SSkipList *pSkipList) {
|
void tSkipListDestroy(SSkipList *pSkipList) {
|
||||||
if (pSkipList == NULL) return;
|
if (pSkipList == NULL || pSkipList->pHead == NULL) return;
|
||||||
|
|
||||||
tSkipListWLock(pSkipList);
|
tSkipListWLock(pSkipList);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue