super table config
This commit is contained in:
parent
7cedf4afd6
commit
81975c11b7
|
@ -616,7 +616,6 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
char tableId[TSDB_TABLE_ID_LEN];
|
||||
char db[TSDB_DB_NAME_LEN];
|
||||
int16_t createFlag;
|
||||
char tags[];
|
||||
} STableInfoMsg;
|
||||
|
@ -626,6 +625,15 @@ typedef struct {
|
|||
char tableIds[];
|
||||
} SMultiTableInfoMsg;
|
||||
|
||||
typedef struct {
|
||||
char tableId[TSDB_TABLE_ID_LEN];
|
||||
} SSuperTableInfoMsg;
|
||||
|
||||
typedef struct {
|
||||
int32_t numOfDnodes;
|
||||
uint32_t dnodeIps[];
|
||||
} SSuperTableInfoRsp;
|
||||
|
||||
typedef struct {
|
||||
int16_t elemLen;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ int32_t mgmtAddSuperTableColumn(SSuperTableObj *pTable, SSchema schema[], int32_
|
|||
int32_t mgmtDropSuperTableColumnByName(SSuperTableObj *pTable, char *colName);
|
||||
|
||||
int32_t mgmtGetSuperTableMeta(SDbObj *pDb, SSuperTableObj *pTable, STableMeta *pMeta, bool usePublicIp);
|
||||
void * mgmtGetSuperTableVgroup(SSuperTableObj *pStable);
|
||||
|
||||
int32_t mgmtFindSuperTableTagIndex(SSuperTableObj *pTable, const char *tagName);
|
||||
int32_t mgmtSetSchemaFromSuperTable(SSchema *pSchema, SSuperTableObj *pTable);
|
||||
|
|
|
@ -132,7 +132,7 @@ int32_t mgmtProcessTableMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
|
|||
STableInfoMsg *pInfo = pCont;
|
||||
pInfo->createFlag = htons(pInfo->createFlag);
|
||||
|
||||
SDbObj *pDb = mgmtGetDb(pInfo->db);
|
||||
SDbObj* pDb = mgmtGetDbByTableId(pInfo->tableId);
|
||||
if (pDb == NULL || pDb->dropStatus != TSDB_DB_STATUS_READY) {
|
||||
rpcSendResponse(ahandle, TSDB_CODE_INVALID_DB, NULL, 0);
|
||||
return TSDB_CODE_INVALID_DB;
|
||||
|
@ -191,7 +191,7 @@ int32_t mgmtProcessTableMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||
int32_t mgmtProcessMultiTableMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||
SRpcConnInfo connInfo;
|
||||
rpcGetConnInfo(ahandle, &connInfo);
|
||||
|
||||
|
@ -249,6 +249,30 @@ int32_t mgmtProcessMultiMeterMetaMsg(void *pCont, int32_t contLen, void *ahandle
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t mgmtProcessSuperTableMetaMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||
SRpcConnInfo connInfo;
|
||||
rpcGetConnInfo(ahandle, &connInfo);
|
||||
|
||||
bool usePublicIp = (connInfo.serverIp == tsPublicIpInt);
|
||||
|
||||
SSuperTableInfoMsg *pInfo = pCont;
|
||||
STableInfo *pTable = mgmtGetSuperTable(pInfo->tableId);
|
||||
if (pTable == NULL) {
|
||||
rpcSendResponse(ahandle, TSDB_CODE_INVALID_TABLE, NULL, 0);
|
||||
return TSDB_CODE_INVALID_TABLE;
|
||||
}
|
||||
|
||||
SSuperTableInfoRsp *pRsp = mgmtGetSuperTableVgroup((SSuperTableObj *) pTable);
|
||||
if (pRsp != NULL) {
|
||||
int32_t msgLen = sizeof(SSuperTableObj) + htonl(pRsp->numOfDnodes) * sizeof(int32_t);
|
||||
rpcSendResponse(ahandle, TSDB_CODE_SUCCESS, pRsp, msgLen);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
} else {
|
||||
rpcSendResponse(ahandle, TSDB_CODE_SUCCESS, NULL, 0);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t mgmtProcessCreateDbMsg(void *pCont, int32_t contLen, void *ahandle) {
|
||||
if (mgmtCheckRedirectMsg(ahandle) != 0) {
|
||||
return TSDB_CODE_REDIRECT;
|
||||
|
@ -1115,8 +1139,8 @@ void mgmtInitProcessShellMsg() {
|
|||
mgmtProcessShellMsg[TSDB_MSG_TYPE_SHOW] = mgmtProcessShowMsg;
|
||||
mgmtProcessShellMsg[TSDB_MSG_TYPE_RETRIEVE] = mgmtProcessRetrieveMsg;
|
||||
mgmtProcessShellMsg[TSDB_MSG_TYPE_TABLE_META] = mgmtProcessTableMetaMsg;
|
||||
mgmtProcessShellMsg[TSDB_MSG_TYPE_MULTI_TABLE_META] = mgmtProcessMultiMeterMetaMsg;
|
||||
mgmtProcessShellMsg[TSDB_MSG_TYPE_STABLE_META] = mgmtProcessUnSupportMsg;
|
||||
mgmtProcessShellMsg[TSDB_MSG_TYPE_MULTI_TABLE_META] = mgmtProcessMultiTableMetaMsg;
|
||||
mgmtProcessShellMsg[TSDB_MSG_TYPE_STABLE_META] = mgmtProcessSuperTableMetaMsg;
|
||||
}
|
||||
|
||||
static int32_t mgmtCheckRedirectMsgImp(void *pConn) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "mgmtAcct.h"
|
||||
#include "mgmtChildTable.h"
|
||||
#include "mgmtDb.h"
|
||||
#include "mgmtDnode.h"
|
||||
#include "mgmtDnodeInt.h"
|
||||
#include "mgmtGrant.h"
|
||||
#include "mgmtSuperTable.h"
|
||||
|
@ -239,6 +240,13 @@ void* mgmtGetSuperTable(char *tableId) {
|
|||
return sdbGetRow(tsSuperTableSdb, tableId);
|
||||
}
|
||||
|
||||
void *mgmtGetSuperTableVgroup(SSuperTableObj *pStable) {
|
||||
SSuperTableInfoRsp *rsp = rpcMallocCont(sizeof(SSuperTableInfoRsp) + sizeof(uint32_t) * mgmtGetDnodesNum());
|
||||
rsp->numOfDnodes = 1;
|
||||
rsp->dnodeIps[0] = 0;
|
||||
return rsp;
|
||||
}
|
||||
|
||||
int32_t mgmtFindSuperTableTagIndex(SSuperTableObj *pStable, const char *tagName) {
|
||||
for (int32_t i = 0; i < pStable->numOfTags; i++) {
|
||||
SSchema *schema = (SSchema *)(pStable->schema + (pStable->numOfColumns + i) * sizeof(SSchema));
|
||||
|
|
Loading…
Reference in New Issue