enh: drop table with uid

This commit is contained in:
kailixu 2024-09-16 12:59:21 +08:00
parent 1b6694af20
commit a6c76329fc
2 changed files with 6 additions and 6 deletions

View File

@ -125,7 +125,7 @@ int32_t metaGetTableTags(void *pVnode, uint64_t suid, SArray *uidList);
int32_t metaGetTableTagsByUids(void *pVnode, int64_t suid, SArray *uidList); int32_t metaGetTableTagsByUids(void *pVnode, int64_t suid, SArray *uidList);
int32_t metaReadNext(SMetaReader *pReader); int32_t metaReadNext(SMetaReader *pReader);
const void *metaGetTableTagVal(const void *tag, int16_t type, STagVal *tagVal); const void *metaGetTableTagVal(const void *tag, int16_t type, STagVal *tagVal);
int metaGetTableNameByUid(void *meta, uint64_t uid, char *tbName); int32_t metaGetTableNameByUid(void *pVnode, uint64_t uid, char *tbName);
int metaGetTableSzNameByUid(void *meta, uint64_t uid, char *tbName); int metaGetTableSzNameByUid(void *meta, uint64_t uid, char *tbName);
int metaGetTableUidByName(void *pVnode, char *tbName, uint64_t *uid); int metaGetTableUidByName(void *pVnode, char *tbName, uint64_t *uid);

View File

@ -55,7 +55,7 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
SMetaReader mer1 = {0}; SMetaReader mer1 = {0};
SMetaReader mer2 = {0}; SMetaReader mer2 = {0};
char tableFName[TSDB_TABLE_FNAME_LEN]; char tableFName[TSDB_TABLE_FNAME_LEN];
bool tbUidReq = false; bool reqFromUid = false;
SRpcMsg rpcMsg = {0}; SRpcMsg rpcMsg = {0};
int32_t code = 0; int32_t code = 0;
int32_t rspLen = 0; int32_t rspLen = 0;
@ -69,12 +69,12 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
goto _exit4; goto _exit4;
} }
if (infoReq.option == 0x01) tbUidReq = true; if (infoReq.option == 0x01) reqFromUid = true;
metaRsp.dbId = pVnode->config.dbId; metaRsp.dbId = pVnode->config.dbId;
(void)strcpy(metaRsp.tbName, infoReq.tbName); (void)strcpy(metaRsp.tbName, infoReq.tbName);
(void)memcpy(metaRsp.dbFName, infoReq.dbFName, sizeof(metaRsp.dbFName)); (void)memcpy(metaRsp.dbFName, infoReq.dbFName, sizeof(metaRsp.dbFName));
if (!tbUidReq) { if (!reqFromUid) {
(void)sprintf(tableFName, "%s.%s", infoReq.dbFName, infoReq.tbName); (void)sprintf(tableFName, "%s.%s", infoReq.dbFName, infoReq.tbName);
code = vnodeValidateTableHash(pVnode, tableFName); code = vnodeValidateTableHash(pVnode, tableFName);
if (code) { if (code) {
@ -85,14 +85,14 @@ int32_t vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg, bool direct) {
// query meta // query meta
metaReaderDoInit(&mer1, pVnode->pMeta, META_READER_LOCK); metaReaderDoInit(&mer1, pVnode->pMeta, META_READER_LOCK);
if (tbUidReq) { if (reqFromUid) {
uint64_t tbUid = taosStr2UInt64(infoReq.tbName, NULL, 10); uint64_t tbUid = taosStr2UInt64(infoReq.tbName, NULL, 10);
if (errno == ERANGE || tbUid == 0) { if (errno == ERANGE || tbUid == 0) {
code = TSDB_CODE_PAR_TABLE_NOT_EXIST; code = TSDB_CODE_PAR_TABLE_NOT_EXIST;
goto _exit3; goto _exit3;
} }
char tbName[TSDB_TABLE_NAME_LEN] = {0}; char tbName[TSDB_TABLE_NAME_LEN] = {0};
if (metaGetTableNameByUid(&mer1, tbUid, tbName) < 0) { if (metaGetTableNameByUid(pVnode, tbUid, tbName) < 0) {
code = terrno; code = terrno;
goto _exit3; goto _exit3;
} }