Compare commits

...

3 Commits

Author SHA1 Message Date
Hongze Cheng 0609bf14e6
fix: add tag data type check when create child table (#30694) 2025-04-08 17:42:06 +08:00
WANG Xu 0d7d8ffd22
Merge pull request #30676 from taosdata/fix/TD-34387
fix: improve process killing logic in remove.sh  for mac
2025-04-08 17:37:47 +08:00
chenhaoran 41ba65c43f fix: improve process killing logic in remove.sh to avoid grep false positives for mac 2025-04-07 18:01:04 +08:00
2 changed files with 40 additions and 21 deletions

View File

@ -94,7 +94,7 @@ fi
kill_service_of() {
_service=$1
pid=$(ps -C $_service | grep -w $_service | grep -v $uninstallScript | awk '{print $1}')
pid=$(ps aux | grep -w $_service | grep -v grep | grep -v $uninstallScript | awk '{print $2}')
if [ -n "$pid" ]; then
${csudo}kill -9 $pid || :
fi

View File

@ -287,33 +287,52 @@ static int32_t metaCheckCreateChildTableReq(SMeta *pMeta, int64_t version, SVCre
}
// check super table existence
if (tdbTbGet(pMeta->pNameIdx, pReq->ctb.stbName, strlen(pReq->ctb.stbName) + 1, &value, &valueSize) == 0) {
int64_t suid = *(int64_t *)value;
tdbFreeClear(value);
if (suid != pReq->ctb.suid) {
metaError("vgId:%d, %s failed at %s:%d since super table %s has uid %" PRId64 " instead of %" PRId64
", version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->ctb.stbName, suid, pReq->ctb.suid, version);
return TSDB_CODE_PAR_TABLE_NOT_EXIST;
}
} else {
metaError("vgId:%d, %s failed at %s:%d since super table %s does not eixst, version:%" PRId64,
SMetaEntry *pStbEntry = NULL;
code = metaFetchEntryByName(pMeta, pReq->ctb.stbName, &pStbEntry);
if (code) {
metaError("vgId:%d, %s failed at %s:%d since super table %s does not exist, version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->ctb.stbName, version);
return TSDB_CODE_PAR_TABLE_NOT_EXIST;
}
// check super table is a super table
if (metaGetInfo(pMeta, pReq->ctb.suid, &info, NULL) != TSDB_CODE_SUCCESS) {
metaError("vgId:%d, %s failed at %s:%d since cannot find table with uid %" PRId64
", which is an internal error, version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->ctb.suid, version);
return TSDB_CODE_INTERNAL_ERROR;
} else if (info.suid != info.uid) {
metaError("vgId:%d, %s failed at %s:%d since table with uid %" PRId64 " is not a super table, version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->ctb.suid, version);
if (pStbEntry->type != TSDB_SUPER_TABLE) {
metaError("vgId:%d, %s failed at %s:%d since table %s is not a super table, version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->ctb.stbName, version);
metaFetchEntryFree(&pStbEntry);
return TSDB_CODE_INVALID_MSG;
}
if (pStbEntry->uid != pReq->ctb.suid) {
metaError("vgId:%d, %s failed at %s:%d since super table %s uid %" PRId64 " does not match request uid %" PRId64
", version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->ctb.stbName, pStbEntry->uid, pReq->ctb.suid,
version);
metaFetchEntryFree(&pStbEntry);
return TSDB_CODE_INVALID_MSG;
}
// Check tag value
SSchemaWrapper *pTagSchema = &pStbEntry->stbEntry.schemaTag;
const STag *pTag = (const STag *)pReq->ctb.pTag;
if (pTagSchema->nCols != 1 || pTagSchema->pSchema[0].type != TSDB_DATA_TYPE_JSON) {
for (int32_t i = 0; i < pTagSchema->nCols; ++i) {
STagVal tagVal = {
.cid = pTagSchema->pSchema[i].colId,
};
if (tTagGet(pTag, &tagVal)) {
if (pTagSchema->pSchema[i].type != tagVal.type) {
metaError("vgId:%d, %s failed at %s:%d since child table %s tag type does not match the expected type, version:%" PRId64,
TD_VID(pMeta->pVnode), __func__, __FILE__, __LINE__, pReq->name, version);
metaFetchEntryFree(&pStbEntry);
return TSDB_CODE_INVALID_MSG;
}
}
}
}
metaFetchEntryFree(&pStbEntry);
// check grant
if (!metaTbInFilterCache(pMeta, pReq->ctb.stbName, 1)) {
code = grantCheck(TSDB_GRANT_TIMESERIES);