diff --git a/source/dnode/vnode/src/vnd/vnodeQuery.c b/source/dnode/vnode/src/vnd/vnodeQuery.c index 2b07de916c..c7b1a816cd 100644 --- a/source/dnode/vnode/src/vnd/vnodeQuery.c +++ b/source/dnode/vnode/src/vnd/vnodeQuery.c @@ -49,6 +49,35 @@ int32_t fillTableColCmpr(SMetaReader *reader, SSchemaExt *pExt, int32_t numOfCol return 0; } +void vnodePrintTableMeta(STableMetaRsp* pMeta) { + if (!(qDebugFlag & DEBUG_DEBUG)) { + return; + } + + qDebug("tbName:%s", pMeta->tbName); + qDebug("stbName:%s", pMeta->stbName); + qDebug("dbFName:%s", pMeta->dbFName); + qDebug("dbId:%" PRId64, pMeta->dbId); + qDebug("numOfTags:%d", pMeta->numOfTags); + qDebug("numOfColumns:%d", pMeta->numOfColumns); + qDebug("precision:%d", pMeta->precision); + qDebug("tableType:%d", pMeta->tableType); + qDebug("sversion:%d", pMeta->sversion); + qDebug("tversion:%d", pMeta->tversion); + qDebug("suid:%" PRIu64, pMeta->suid); + qDebug("tuid:%" PRIu64, pMeta->tuid); + qDebug("vgId:%d", pMeta->vgId); + qDebug("sysInfo:%d", pMeta->sysInfo); + if (pMeta->pSchemas) { + for (int32_t i = 0; i < (pMeta->numOfColumns + pMeta->numOfTags); ++i) { + SSchema* pSchema = pMeta->pSchemas + i; + qDebug("%d col/tag: type:%d, flags:%d, colId:%d, bytes:%d, name:%s", i, pSchema->type, pSchema->flags, pSchema->colId, pSchema->bytes, pSchema->name); + } + } + +} + + int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { STableInfoReq infoReq = {0}; STableMetaRsp metaRsp = {0}; @@ -155,6 +184,8 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) { goto _exit; } + vnodePrintTableMeta(&metaRsp); + // encode and send response rspLen = tSerializeSTableMetaRsp(NULL, 0, &metaRsp); if (rspLen < 0) { diff --git a/source/libs/qcom/src/queryUtil.c b/source/libs/qcom/src/queryUtil.c index 6d637bee98..85b1c543c0 100644 --- a/source/libs/qcom/src/queryUtil.c +++ b/source/libs/qcom/src/queryUtil.c @@ -67,24 +67,29 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen for (int32_t i = 0; i < numOfCols; ++i) { // 1. valid types if (!isValidDataType(pSchema[i].type)) { + qError("The %d col/tag data type error, type:%d", i, pSchema[i].type); return false; } // 2. valid length for each type if (pSchema[i].type == TSDB_DATA_TYPE_BINARY || pSchema[i].type == TSDB_DATA_TYPE_VARBINARY) { if (pSchema[i].bytes > TSDB_MAX_BINARY_LEN) { + qError("The %d col/tag var data len error, type:%d, len:%d", i, pSchema[i].type, pSchema[i].bytes); return false; } } else if (pSchema[i].type == TSDB_DATA_TYPE_NCHAR) { if (pSchema[i].bytes > TSDB_MAX_NCHAR_LEN) { + qError("The %d col/tag nchar data len error, len:%d", i, pSchema[i].bytes); return false; } } else if (pSchema[i].type == TSDB_DATA_TYPE_GEOMETRY) { if (pSchema[i].bytes > TSDB_MAX_GEOMETRY_LEN) { + qError("The %d col/tag geometry data len error, len:%d", i, pSchema[i].bytes); return false; } } else { if (pSchema[i].bytes != tDataTypes[pSchema[i].type].bytes) { + qError("The %d col/tag data len error, type:%d, len:%d", i, pSchema[i].type, pSchema[i].bytes); return false; } } @@ -92,6 +97,7 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen // 3. valid column names for (int32_t j = i + 1; j < numOfCols; ++j) { if (strncmp(pSchema[i].name, pSchema[j].name, sizeof(pSchema[i].name) - 1) == 0) { + qError("The %d col/tag name %s is same with %d col/tag name %s", i, pSchema[i].name, j, pSchema[j].name); return false; } } @@ -104,23 +110,28 @@ static bool doValidateSchema(SSchema* pSchema, int32_t numOfCols, int32_t maxLen bool tIsValidSchema(struct SSchema* pSchema, int32_t numOfCols, int32_t numOfTags) { if (!pSchema || !VALIDNUMOFCOLS(numOfCols)) { + qError("invalid numOfCols: %d", numOfCols); return false; } if (!VALIDNUMOFTAGS(numOfTags)) { + qError("invalid numOfTags: %d", numOfTags); return false; } /* first column must be the timestamp, which is a primary key */ if (pSchema[0].type != TSDB_DATA_TYPE_TIMESTAMP) { + qError("invalid first column type: %d", pSchema[0].type); return false; } if (!doValidateSchema(pSchema, numOfCols, TSDB_MAX_BYTES_PER_ROW)) { + qError("validate schema columns failed"); return false; } if (!doValidateSchema(&pSchema[numOfCols], numOfTags, TSDB_MAX_TAGS_LEN)) { + qError("validate schema tags failed"); return false; }