提交 f38b2182 编写于 作者: S Shengliang Guan

TD-2046

上级 60146985
...@@ -47,7 +47,7 @@ typedef enum { ...@@ -47,7 +47,7 @@ typedef enum {
SDB_OPER_LOCAL SDB_OPER_LOCAL
} ESdbOper; } ESdbOper;
typedef struct SSdbOper { typedef struct SSWriteMsg {
ESdbOper type; ESdbOper type;
int32_t rowSize; int32_t rowSize;
int32_t retCode; // for callback in sdb queue int32_t retCode; // for callback in sdb queue
...@@ -58,7 +58,7 @@ typedef struct SSdbOper { ...@@ -58,7 +58,7 @@ typedef struct SSdbOper {
void * pObj; void * pObj;
void * rowData; void * rowData;
struct SMnodeMsg *pMsg; struct SMnodeMsg *pMsg;
} SSdbOper; } SSWriteMsg;
typedef struct { typedef struct {
char *tableName; char *tableName;
...@@ -67,13 +67,13 @@ typedef struct { ...@@ -67,13 +67,13 @@ typedef struct {
int32_t refCountPos; int32_t refCountPos;
ESdbTable tableId; ESdbTable tableId;
ESdbKey keyType; ESdbKey keyType;
int32_t (*insertFp)(SSdbOper *pOper); int32_t (*fpInsert)(SSWriteMsg *pWrite);
int32_t (*deleteFp)(SSdbOper *pOper); int32_t (*fpDelete)(SSWriteMsg *pWrite);
int32_t (*updateFp)(SSdbOper *pOper); int32_t (*fpUpdate)(SSWriteMsg *pWrite);
int32_t (*encodeFp)(SSdbOper *pOper); int32_t (*fpEncode)(SSWriteMsg *pWrite);
int32_t (*decodeFp)(SSdbOper *pDesc); int32_t (*fpDecode)(SSWriteMsg *pWrite);
int32_t (*destroyFp)(SSdbOper *pDesc); int32_t (*fpDestroy)(SSWriteMsg *pWrite);
int32_t (*restoredFp)(); int32_t (*fpDestored)();
} SSdbTableDesc; } SSdbTableDesc;
int32_t sdbInit(); int32_t sdbInit();
...@@ -84,10 +84,10 @@ bool sdbIsMaster(); ...@@ -84,10 +84,10 @@ bool sdbIsMaster();
bool sdbIsServing(); bool sdbIsServing();
void sdbUpdateMnodeRoles(); void sdbUpdateMnodeRoles();
int32_t sdbInsertRow(SSdbOper *pOper); int32_t sdbInsertRow(SSWriteMsg *pWrite);
int32_t sdbDeleteRow(SSdbOper *pOper); int32_t sdbDeleteRow(SSWriteMsg *pWrite);
int32_t sdbUpdateRow(SSdbOper *pOper); int32_t sdbUpdateRow(SSWriteMsg *pWrite);
int32_t sdbInsertRowImp(SSdbOper *pOper); int32_t sdbInsertRowImp(SSWriteMsg *pWrite);
void *sdbGetRow(void *handle, void *key); void *sdbGetRow(void *handle, void *key);
void *sdbFetchRow(void *handle, void *pIter, void **ppRow); void *sdbFetchRow(void *handle, void *pIter, void **ppRow);
......
...@@ -31,14 +31,14 @@ void * tsAcctSdb = NULL; ...@@ -31,14 +31,14 @@ void * tsAcctSdb = NULL;
static int32_t tsAcctUpdateSize; static int32_t tsAcctUpdateSize;
static int32_t mnodeCreateRootAcct(); static int32_t mnodeCreateRootAcct();
static int32_t mnodeAcctActionDestroy(SSdbOper *pOper) { static int32_t mnodeAcctActionDestroy(SSWriteMsg *pOper) {
SAcctObj *pAcct = pOper->pObj; SAcctObj *pAcct = pOper->pObj;
pthread_mutex_destroy(&pAcct->mutex); pthread_mutex_destroy(&pAcct->mutex);
tfree(pOper->pObj); tfree(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeAcctActionInsert(SSdbOper *pOper) { static int32_t mnodeAcctActionInsert(SSWriteMsg *pOper) {
SAcctObj *pAcct = pOper->pObj; SAcctObj *pAcct = pOper->pObj;
memset(&pAcct->acctInfo, 0, sizeof(SAcctInfo)); memset(&pAcct->acctInfo, 0, sizeof(SAcctInfo));
pAcct->acctInfo.accessState = TSDB_VN_ALL_ACCCESS; pAcct->acctInfo.accessState = TSDB_VN_ALL_ACCCESS;
...@@ -46,14 +46,14 @@ static int32_t mnodeAcctActionInsert(SSdbOper *pOper) { ...@@ -46,14 +46,14 @@ static int32_t mnodeAcctActionInsert(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeAcctActionDelete(SSdbOper *pOper) { static int32_t mnodeAcctActionDelete(SSWriteMsg *pOper) {
SAcctObj *pAcct = pOper->pObj; SAcctObj *pAcct = pOper->pObj;
mnodeDropAllUsers(pAcct); mnodeDropAllUsers(pAcct);
mnodeDropAllDbs(pAcct); mnodeDropAllDbs(pAcct);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeAcctActionUpdate(SSdbOper *pOper) { static int32_t mnodeAcctActionUpdate(SSWriteMsg *pOper) {
SAcctObj *pAcct = pOper->pObj; SAcctObj *pAcct = pOper->pObj;
SAcctObj *pSaved = mnodeGetAcct(pAcct->user); SAcctObj *pSaved = mnodeGetAcct(pAcct->user);
if (pAcct != pSaved) { if (pAcct != pSaved) {
...@@ -64,14 +64,14 @@ static int32_t mnodeAcctActionUpdate(SSdbOper *pOper) { ...@@ -64,14 +64,14 @@ static int32_t mnodeAcctActionUpdate(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeAcctActionEncode(SSdbOper *pOper) { static int32_t mnodeAcctActionEncode(SSWriteMsg *pOper) {
SAcctObj *pAcct = pOper->pObj; SAcctObj *pAcct = pOper->pObj;
memcpy(pOper->rowData, pAcct, tsAcctUpdateSize); memcpy(pOper->rowData, pAcct, tsAcctUpdateSize);
pOper->rowSize = tsAcctUpdateSize; pOper->rowSize = tsAcctUpdateSize;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeAcctActionDecode(SSdbOper *pOper) { static int32_t mnodeAcctActionDecode(SSWriteMsg *pOper) {
SAcctObj *pAcct = (SAcctObj *) calloc(1, sizeof(SAcctObj)); SAcctObj *pAcct = (SAcctObj *) calloc(1, sizeof(SAcctObj));
if (pAcct == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pAcct == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -106,13 +106,13 @@ int32_t mnodeInitAccts() { ...@@ -106,13 +106,13 @@ int32_t mnodeInitAccts() {
.maxRowSize = tsAcctUpdateSize, .maxRowSize = tsAcctUpdateSize,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_STRING, .keyType = SDB_KEY_STRING,
.insertFp = mnodeAcctActionInsert, .fpInsert = mnodeAcctActionInsert,
.deleteFp = mnodeAcctActionDelete, .fpDelete = mnodeAcctActionDelete,
.updateFp = mnodeAcctActionUpdate, .fpUpdate = mnodeAcctActionUpdate,
.encodeFp = mnodeAcctActionEncode, .fpEncode = mnodeAcctActionEncode,
.decodeFp = mnodeAcctActionDecode, .fpDecode = mnodeAcctActionDecode,
.destroyFp = mnodeAcctActionDestroy, .fpDestroy = mnodeAcctActionDestroy,
.restoredFp = mnodeAcctActionRestored .fpDestored = mnodeAcctActionRestored
}; };
tsAcctSdb = sdbOpenTable(&tableDesc); tsAcctSdb = sdbOpenTable(&tableDesc);
...@@ -226,7 +226,7 @@ static int32_t mnodeCreateRootAcct() { ...@@ -226,7 +226,7 @@ static int32_t mnodeCreateRootAcct() {
pAcct->acctId = sdbGetId(tsAcctSdb); pAcct->acctId = sdbGetId(tsAcctSdb);
pAcct->createdTime = taosGetTimestampMs(); pAcct->createdTime = taosGetTimestampMs();
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsAcctSdb, .table = tsAcctSdb,
.pObj = pAcct, .pObj = pAcct,
......
...@@ -32,31 +32,31 @@ static int32_t mnodeCreateCluster(); ...@@ -32,31 +32,31 @@ static int32_t mnodeCreateCluster();
static int32_t mnodeGetClusterMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn); static int32_t mnodeGetClusterMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
static int32_t mnodeRetrieveClusters(SShowObj *pShow, char *data, int32_t rows, void *pConn); static int32_t mnodeRetrieveClusters(SShowObj *pShow, char *data, int32_t rows, void *pConn);
static int32_t mnodeClusterActionDestroy(SSdbOper *pOper) { static int32_t mnodeClusterActionDestroy(SSWriteMsg *pOper) {
tfree(pOper->pObj); tfree(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeClusterActionInsert(SSdbOper *pOper) { static int32_t mnodeClusterActionInsert(SSWriteMsg *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeClusterActionDelete(SSdbOper *pOper) { static int32_t mnodeClusterActionDelete(SSWriteMsg *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeClusterActionUpdate(SSdbOper *pOper) { static int32_t mnodeClusterActionUpdate(SSWriteMsg *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeClusterActionEncode(SSdbOper *pOper) { static int32_t mnodeClusterActionEncode(SSWriteMsg *pOper) {
SClusterObj *pCluster = pOper->pObj; SClusterObj *pCluster = pOper->pObj;
memcpy(pOper->rowData, pCluster, tsClusterUpdateSize); memcpy(pOper->rowData, pCluster, tsClusterUpdateSize);
pOper->rowSize = tsClusterUpdateSize; pOper->rowSize = tsClusterUpdateSize;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeClusterActionDecode(SSdbOper *pOper) { static int32_t mnodeClusterActionDecode(SSWriteMsg *pOper) {
SClusterObj *pCluster = (SClusterObj *) calloc(1, sizeof(SClusterObj)); SClusterObj *pCluster = (SClusterObj *) calloc(1, sizeof(SClusterObj));
if (pCluster == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pCluster == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -91,13 +91,13 @@ int32_t mnodeInitCluster() { ...@@ -91,13 +91,13 @@ int32_t mnodeInitCluster() {
.maxRowSize = tsClusterUpdateSize, .maxRowSize = tsClusterUpdateSize,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_STRING, .keyType = SDB_KEY_STRING,
.insertFp = mnodeClusterActionInsert, .fpInsert = mnodeClusterActionInsert,
.deleteFp = mnodeClusterActionDelete, .fpDelete = mnodeClusterActionDelete,
.updateFp = mnodeClusterActionUpdate, .fpUpdate = mnodeClusterActionUpdate,
.encodeFp = mnodeClusterActionEncode, .fpEncode = mnodeClusterActionEncode,
.decodeFp = mnodeClusterActionDecode, .fpDecode = mnodeClusterActionDecode,
.destroyFp = mnodeClusterActionDestroy, .fpDestroy = mnodeClusterActionDestroy,
.restoredFp = mnodeClusterActionRestored .fpDestored = mnodeClusterActionRestored
}; };
tsClusterSdb = sdbOpenTable(&tableDesc); tsClusterSdb = sdbOpenTable(&tableDesc);
...@@ -145,7 +145,7 @@ static int32_t mnodeCreateCluster() { ...@@ -145,7 +145,7 @@ static int32_t mnodeCreateCluster() {
mDebug("uid is %s", pCluster->uid); mDebug("uid is %s", pCluster->uid);
} }
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsClusterSdb, .table = tsClusterSdb,
.pObj = pCluster, .pObj = pCluster,
......
...@@ -56,7 +56,7 @@ static void mnodeDestroyDb(SDbObj *pDb) { ...@@ -56,7 +56,7 @@ static void mnodeDestroyDb(SDbObj *pDb) {
tfree(pDb); tfree(pDb);
} }
static int32_t mnodeDbActionDestroy(SSdbOper *pOper) { static int32_t mnodeDbActionDestroy(SSWriteMsg *pOper) {
mnodeDestroyDb(pOper->pObj); mnodeDestroyDb(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
...@@ -65,7 +65,7 @@ int64_t mnodeGetDbNum() { ...@@ -65,7 +65,7 @@ int64_t mnodeGetDbNum() {
return sdbGetNumOfRows(tsDbSdb); return sdbGetNumOfRows(tsDbSdb);
} }
static int32_t mnodeDbActionInsert(SSdbOper *pOper) { static int32_t mnodeDbActionInsert(SSWriteMsg *pOper) {
SDbObj *pDb = pOper->pObj; SDbObj *pDb = pOper->pObj;
SAcctObj *pAcct = mnodeGetAcct(pDb->acct); SAcctObj *pAcct = mnodeGetAcct(pDb->acct);
...@@ -91,7 +91,7 @@ static int32_t mnodeDbActionInsert(SSdbOper *pOper) { ...@@ -91,7 +91,7 @@ static int32_t mnodeDbActionInsert(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDbActionDelete(SSdbOper *pOper) { static int32_t mnodeDbActionDelete(SSWriteMsg *pOper) {
SDbObj *pDb = pOper->pObj; SDbObj *pDb = pOper->pObj;
SAcctObj *pAcct = mnodeGetAcct(pDb->acct); SAcctObj *pAcct = mnodeGetAcct(pDb->acct);
...@@ -107,7 +107,7 @@ static int32_t mnodeDbActionDelete(SSdbOper *pOper) { ...@@ -107,7 +107,7 @@ static int32_t mnodeDbActionDelete(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDbActionUpdate(SSdbOper *pOper) { static int32_t mnodeDbActionUpdate(SSWriteMsg *pOper) {
SDbObj *pNew = pOper->pObj; SDbObj *pNew = pOper->pObj;
SDbObj *pDb = mnodeGetDb(pNew->name); SDbObj *pDb = mnodeGetDb(pNew->name);
if (pDb != NULL && pNew != pDb) { if (pDb != NULL && pNew != pDb) {
...@@ -120,14 +120,14 @@ static int32_t mnodeDbActionUpdate(SSdbOper *pOper) { ...@@ -120,14 +120,14 @@ static int32_t mnodeDbActionUpdate(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDbActionEncode(SSdbOper *pOper) { static int32_t mnodeDbActionEncode(SSWriteMsg *pOper) {
SDbObj *pDb = pOper->pObj; SDbObj *pDb = pOper->pObj;
memcpy(pOper->rowData, pDb, tsDbUpdateSize); memcpy(pOper->rowData, pDb, tsDbUpdateSize);
pOper->rowSize = tsDbUpdateSize; pOper->rowSize = tsDbUpdateSize;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDbActionDecode(SSdbOper *pOper) { static int32_t mnodeDbActionDecode(SSWriteMsg *pOper) {
SDbObj *pDb = (SDbObj *) calloc(1, sizeof(SDbObj)); SDbObj *pDb = (SDbObj *) calloc(1, sizeof(SDbObj));
if (pDb == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pDb == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -151,13 +151,13 @@ int32_t mnodeInitDbs() { ...@@ -151,13 +151,13 @@ int32_t mnodeInitDbs() {
.maxRowSize = tsDbUpdateSize, .maxRowSize = tsDbUpdateSize,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_STRING, .keyType = SDB_KEY_STRING,
.insertFp = mnodeDbActionInsert, .fpInsert = mnodeDbActionInsert,
.deleteFp = mnodeDbActionDelete, .fpDelete = mnodeDbActionDelete,
.updateFp = mnodeDbActionUpdate, .fpUpdate = mnodeDbActionUpdate,
.encodeFp = mnodeDbActionEncode, .fpEncode = mnodeDbActionEncode,
.decodeFp = mnodeDbActionDecode, .fpDecode = mnodeDbActionDecode,
.destroyFp = mnodeDbActionDestroy, .fpDestroy = mnodeDbActionDestroy,
.restoredFp = mnodeDbActionRestored .fpDestored = mnodeDbActionRestored
}; };
tsDbSdb = sdbOpenTable(&tableDesc); tsDbSdb = sdbOpenTable(&tableDesc);
...@@ -412,7 +412,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate, SMnodeMsg * ...@@ -412,7 +412,7 @@ static int32_t mnodeCreateDb(SAcctObj *pAcct, SCreateDbMsg *pCreate, SMnodeMsg *
pMsg->pDb = pDb; pMsg->pDb = pDb;
mnodeIncDbRef(pDb); mnodeIncDbRef(pDb);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsDbSdb, .table = tsDbSdb,
.pObj = pDb, .pObj = pDb,
...@@ -807,7 +807,7 @@ static int32_t mnodeSetDbDropping(SDbObj *pDb) { ...@@ -807,7 +807,7 @@ static int32_t mnodeSetDbDropping(SDbObj *pDb) {
if (pDb->status) return TSDB_CODE_SUCCESS; if (pDb->status) return TSDB_CODE_SUCCESS;
pDb->status = true; pDb->status = true;
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsDbSdb, .table = tsDbSdb,
.pObj = pDb .pObj = pDb
...@@ -1019,7 +1019,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) { ...@@ -1019,7 +1019,7 @@ static int32_t mnodeAlterDb(SDbObj *pDb, SAlterDbMsg *pAlter, void *pMsg) {
if (memcmp(&newCfg, &pDb->cfg, sizeof(SDbCfg)) != 0) { if (memcmp(&newCfg, &pDb->cfg, sizeof(SDbCfg)) != 0) {
pDb->cfg = newCfg; pDb->cfg = newCfg;
pDb->cfgVersion++; pDb->cfgVersion++;
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsDbSdb, .table = tsDbSdb,
.pObj = pDb, .pObj = pDb,
...@@ -1071,7 +1071,7 @@ static int32_t mnodeDropDb(SMnodeMsg *pMsg) { ...@@ -1071,7 +1071,7 @@ static int32_t mnodeDropDb(SMnodeMsg *pMsg) {
SDbObj *pDb = pMsg->pDb; SDbObj *pDb = pMsg->pDb;
mInfo("db:%s, drop db from sdb", pDb->name); mInfo("db:%s, drop db from sdb", pDb->name);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsDbSdb, .table = tsDbSdb,
.pObj = pDb, .pObj = pDb,
...@@ -1134,7 +1134,7 @@ void mnodeDropAllDbs(SAcctObj *pAcct) { ...@@ -1134,7 +1134,7 @@ void mnodeDropAllDbs(SAcctObj *pAcct) {
if (pDb->pAcct == pAcct) { if (pDb->pAcct == pAcct) {
mInfo("db:%s, drop db from sdb for acct:%s is dropped", pDb->name, pAcct->user); mInfo("db:%s, drop db from sdb for acct:%s is dropped", pDb->name, pAcct->user);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_LOCAL, .type = SDB_OPER_LOCAL,
.table = tsDbSdb, .table = tsDbSdb,
.pObj = pDb .pObj = pDb
......
...@@ -87,12 +87,12 @@ static char* offlineReason[] = { ...@@ -87,12 +87,12 @@ static char* offlineReason[] = {
"unknown", "unknown",
}; };
static int32_t mnodeDnodeActionDestroy(SSdbOper *pOper) { static int32_t mnodeDnodeActionDestroy(SSWriteMsg *pOper) {
tfree(pOper->pObj); tfree(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDnodeActionInsert(SSdbOper *pOper) { static int32_t mnodeDnodeActionInsert(SSWriteMsg *pOper) {
SDnodeObj *pDnode = pOper->pObj; SDnodeObj *pDnode = pOper->pObj;
if (pDnode->status != TAOS_DN_STATUS_DROPPING) { if (pDnode->status != TAOS_DN_STATUS_DROPPING) {
pDnode->status = TAOS_DN_STATUS_OFFLINE; pDnode->status = TAOS_DN_STATUS_OFFLINE;
...@@ -107,7 +107,7 @@ static int32_t mnodeDnodeActionInsert(SSdbOper *pOper) { ...@@ -107,7 +107,7 @@ static int32_t mnodeDnodeActionInsert(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDnodeActionDelete(SSdbOper *pOper) { static int32_t mnodeDnodeActionDelete(SSWriteMsg *pOper) {
SDnodeObj *pDnode = pOper->pObj; SDnodeObj *pDnode = pOper->pObj;
#ifndef _SYNC #ifndef _SYNC
...@@ -121,7 +121,7 @@ static int32_t mnodeDnodeActionDelete(SSdbOper *pOper) { ...@@ -121,7 +121,7 @@ static int32_t mnodeDnodeActionDelete(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDnodeActionUpdate(SSdbOper *pOper) { static int32_t mnodeDnodeActionUpdate(SSWriteMsg *pOper) {
SDnodeObj *pNew = pOper->pObj; SDnodeObj *pNew = pOper->pObj;
SDnodeObj *pDnode = mnodeGetDnode(pNew->dnodeId); SDnodeObj *pDnode = mnodeGetDnode(pNew->dnodeId);
if (pDnode != NULL && pNew != pDnode) { if (pDnode != NULL && pNew != pDnode) {
...@@ -134,14 +134,14 @@ static int32_t mnodeDnodeActionUpdate(SSdbOper *pOper) { ...@@ -134,14 +134,14 @@ static int32_t mnodeDnodeActionUpdate(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDnodeActionEncode(SSdbOper *pOper) { static int32_t mnodeDnodeActionEncode(SSWriteMsg *pOper) {
SDnodeObj *pDnode = pOper->pObj; SDnodeObj *pDnode = pOper->pObj;
memcpy(pOper->rowData, pDnode, tsDnodeUpdateSize); memcpy(pOper->rowData, pDnode, tsDnodeUpdateSize);
pOper->rowSize = tsDnodeUpdateSize; pOper->rowSize = tsDnodeUpdateSize;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeDnodeActionDecode(SSdbOper *pOper) { static int32_t mnodeDnodeActionDecode(SSWriteMsg *pOper) {
SDnodeObj *pDnode = (SDnodeObj *) calloc(1, sizeof(SDnodeObj)); SDnodeObj *pDnode = (SDnodeObj *) calloc(1, sizeof(SDnodeObj));
if (pDnode == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pDnode == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -178,13 +178,13 @@ int32_t mnodeInitDnodes() { ...@@ -178,13 +178,13 @@ int32_t mnodeInitDnodes() {
.maxRowSize = tsDnodeUpdateSize, .maxRowSize = tsDnodeUpdateSize,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_AUTO, .keyType = SDB_KEY_AUTO,
.insertFp = mnodeDnodeActionInsert, .fpInsert = mnodeDnodeActionInsert,
.deleteFp = mnodeDnodeActionDelete, .fpDelete = mnodeDnodeActionDelete,
.updateFp = mnodeDnodeActionUpdate, .fpUpdate = mnodeDnodeActionUpdate,
.encodeFp = mnodeDnodeActionEncode, .fpEncode = mnodeDnodeActionEncode,
.decodeFp = mnodeDnodeActionDecode, .fpDecode = mnodeDnodeActionDecode,
.destroyFp = mnodeDnodeActionDestroy, .fpDestroy = mnodeDnodeActionDestroy,
.restoredFp = mnodeDnodeActionRestored .fpDestored = mnodeDnodeActionRestored
}; };
tsDnodeSdb = sdbOpenTable(&tableDesc); tsDnodeSdb = sdbOpenTable(&tableDesc);
...@@ -296,7 +296,7 @@ void mnodeDecDnodeRef(SDnodeObj *pDnode) { ...@@ -296,7 +296,7 @@ void mnodeDecDnodeRef(SDnodeObj *pDnode) {
} }
void mnodeUpdateDnode(SDnodeObj *pDnode) { void mnodeUpdateDnode(SDnodeObj *pDnode) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsDnodeSdb, .table = tsDnodeSdb,
.pObj = pDnode .pObj = pDnode
...@@ -644,7 +644,7 @@ static int32_t mnodeCreateDnode(char *ep, SMnodeMsg *pMsg) { ...@@ -644,7 +644,7 @@ static int32_t mnodeCreateDnode(char *ep, SMnodeMsg *pMsg) {
tstrncpy(pDnode->dnodeEp, ep, TSDB_EP_LEN); tstrncpy(pDnode->dnodeEp, ep, TSDB_EP_LEN);
taosGetFqdnPortFromEp(ep, pDnode->dnodeFqdn, &pDnode->dnodePort); taosGetFqdnPortFromEp(ep, pDnode->dnodeFqdn, &pDnode->dnodePort);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsDnodeSdb, .table = tsDnodeSdb,
.pObj = pDnode, .pObj = pDnode,
...@@ -665,7 +665,7 @@ static int32_t mnodeCreateDnode(char *ep, SMnodeMsg *pMsg) { ...@@ -665,7 +665,7 @@ static int32_t mnodeCreateDnode(char *ep, SMnodeMsg *pMsg) {
} }
int32_t mnodeDropDnode(SDnodeObj *pDnode, void *pMsg) { int32_t mnodeDropDnode(SDnodeObj *pDnode, void *pMsg) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsDnodeSdb, .table = tsDnodeSdb,
.pObj = pDnode, .pObj = pDnode,
......
...@@ -58,12 +58,12 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo ...@@ -58,12 +58,12 @@ static int32_t mnodeRetrieveMnodes(SShowObj *pShow, char *data, int32_t rows, vo
#define mnodeMnodeDestroyLock() pthread_mutex_destroy(&tsMnodeLock) #define mnodeMnodeDestroyLock() pthread_mutex_destroy(&tsMnodeLock)
#endif #endif
static int32_t mnodeMnodeActionDestroy(SSdbOper *pOper) { static int32_t mnodeMnodeActionDestroy(SSWriteMsg *pOper) {
tfree(pOper->pObj); tfree(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeMnodeActionInsert(SSdbOper *pOper) { static int32_t mnodeMnodeActionInsert(SSWriteMsg *pOper) {
SMnodeObj *pMnode = pOper->pObj; SMnodeObj *pMnode = pOper->pObj;
SDnodeObj *pDnode = mnodeGetDnode(pMnode->mnodeId); SDnodeObj *pDnode = mnodeGetDnode(pMnode->mnodeId);
if (pDnode == NULL) return TSDB_CODE_MND_DNODE_NOT_EXIST; if (pDnode == NULL) return TSDB_CODE_MND_DNODE_NOT_EXIST;
...@@ -76,7 +76,7 @@ static int32_t mnodeMnodeActionInsert(SSdbOper *pOper) { ...@@ -76,7 +76,7 @@ static int32_t mnodeMnodeActionInsert(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeMnodeActionDelete(SSdbOper *pOper) { static int32_t mnodeMnodeActionDelete(SSWriteMsg *pOper) {
SMnodeObj *pMnode = pOper->pObj; SMnodeObj *pMnode = pOper->pObj;
SDnodeObj *pDnode = mnodeGetDnode(pMnode->mnodeId); SDnodeObj *pDnode = mnodeGetDnode(pMnode->mnodeId);
...@@ -88,7 +88,7 @@ static int32_t mnodeMnodeActionDelete(SSdbOper *pOper) { ...@@ -88,7 +88,7 @@ static int32_t mnodeMnodeActionDelete(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeMnodeActionUpdate(SSdbOper *pOper) { static int32_t mnodeMnodeActionUpdate(SSWriteMsg *pOper) {
SMnodeObj *pMnode = pOper->pObj; SMnodeObj *pMnode = pOper->pObj;
SMnodeObj *pSaved = mnodeGetMnode(pMnode->mnodeId); SMnodeObj *pSaved = mnodeGetMnode(pMnode->mnodeId);
if (pMnode != pSaved) { if (pMnode != pSaved) {
...@@ -99,14 +99,14 @@ static int32_t mnodeMnodeActionUpdate(SSdbOper *pOper) { ...@@ -99,14 +99,14 @@ static int32_t mnodeMnodeActionUpdate(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeMnodeActionEncode(SSdbOper *pOper) { static int32_t mnodeMnodeActionEncode(SSWriteMsg *pOper) {
SMnodeObj *pMnode = pOper->pObj; SMnodeObj *pMnode = pOper->pObj;
memcpy(pOper->rowData, pMnode, tsMnodeUpdateSize); memcpy(pOper->rowData, pMnode, tsMnodeUpdateSize);
pOper->rowSize = tsMnodeUpdateSize; pOper->rowSize = tsMnodeUpdateSize;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeMnodeActionDecode(SSdbOper *pOper) { static int32_t mnodeMnodeActionDecode(SSWriteMsg *pOper) {
SMnodeObj *pMnode = calloc(1, sizeof(SMnodeObj)); SMnodeObj *pMnode = calloc(1, sizeof(SMnodeObj));
if (pMnode == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pMnode == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -144,13 +144,13 @@ int32_t mnodeInitMnodes() { ...@@ -144,13 +144,13 @@ int32_t mnodeInitMnodes() {
.maxRowSize = tsMnodeUpdateSize, .maxRowSize = tsMnodeUpdateSize,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_INT, .keyType = SDB_KEY_INT,
.insertFp = mnodeMnodeActionInsert, .fpInsert = mnodeMnodeActionInsert,
.deleteFp = mnodeMnodeActionDelete, .fpDelete = mnodeMnodeActionDelete,
.updateFp = mnodeMnodeActionUpdate, .fpUpdate = mnodeMnodeActionUpdate,
.encodeFp = mnodeMnodeActionEncode, .fpEncode = mnodeMnodeActionEncode,
.decodeFp = mnodeMnodeActionDecode, .fpDecode = mnodeMnodeActionDecode,
.destroyFp = mnodeMnodeActionDestroy, .fpDestroy = mnodeMnodeActionDestroy,
.restoredFp = mnodeMnodeActionRestored .fpDestored = mnodeMnodeActionRestored
}; };
tsMnodeSdb = sdbOpenTable(&tableDesc); tsMnodeSdb = sdbOpenTable(&tableDesc);
...@@ -329,7 +329,7 @@ void mnodeCreateMnode(int32_t dnodeId, char *dnodeEp, bool needConfirm) { ...@@ -329,7 +329,7 @@ void mnodeCreateMnode(int32_t dnodeId, char *dnodeEp, bool needConfirm) {
pMnode->mnodeId = dnodeId; pMnode->mnodeId = dnodeId;
pMnode->createdTime = taosGetTimestampMs(); pMnode->createdTime = taosGetTimestampMs();
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsMnodeSdb, .table = tsMnodeSdb,
.pObj = pMnode, .pObj = pMnode,
...@@ -356,7 +356,7 @@ void mnodeCreateMnode(int32_t dnodeId, char *dnodeEp, bool needConfirm) { ...@@ -356,7 +356,7 @@ void mnodeCreateMnode(int32_t dnodeId, char *dnodeEp, bool needConfirm) {
void mnodeDropMnodeLocal(int32_t dnodeId) { void mnodeDropMnodeLocal(int32_t dnodeId) {
SMnodeObj *pMnode = mnodeGetMnode(dnodeId); SMnodeObj *pMnode = mnodeGetMnode(dnodeId);
if (pMnode != NULL) { if (pMnode != NULL) {
SSdbOper oper = {.type = SDB_OPER_LOCAL, .table = tsMnodeSdb, .pObj = pMnode}; SSWriteMsg oper = {.type = SDB_OPER_LOCAL, .table = tsMnodeSdb, .pObj = pMnode};
sdbDeleteRow(&oper); sdbDeleteRow(&oper);
mnodeDecMnodeRef(pMnode); mnodeDecMnodeRef(pMnode);
} }
...@@ -371,7 +371,7 @@ int32_t mnodeDropMnode(int32_t dnodeId) { ...@@ -371,7 +371,7 @@ int32_t mnodeDropMnode(int32_t dnodeId) {
return TSDB_CODE_MND_DNODE_NOT_EXIST; return TSDB_CODE_MND_DNODE_NOT_EXIST;
} }
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsMnodeSdb, .table = tsMnodeSdb,
.pObj = pMnode .pObj = pMnode
......
此差异已折叠。
...@@ -99,12 +99,12 @@ static void mnodeDestroyChildTable(SCTableObj *pTable) { ...@@ -99,12 +99,12 @@ static void mnodeDestroyChildTable(SCTableObj *pTable) {
tfree(pTable); tfree(pTable);
} }
static int32_t mnodeChildTableActionDestroy(SSdbOper *pOper) { static int32_t mnodeChildTableActionDestroy(SSWriteMsg *pOper) {
mnodeDestroyChildTable(pOper->pObj); mnodeDestroyChildTable(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeChildTableActionInsert(SSdbOper *pOper) { static int32_t mnodeChildTableActionInsert(SSWriteMsg *pOper) {
SCTableObj *pTable = pOper->pObj; SCTableObj *pTable = pOper->pObj;
SVgObj *pVgroup = mnodeGetVgroup(pTable->vgId); SVgObj *pVgroup = mnodeGetVgroup(pTable->vgId);
...@@ -153,7 +153,7 @@ static int32_t mnodeChildTableActionInsert(SSdbOper *pOper) { ...@@ -153,7 +153,7 @@ static int32_t mnodeChildTableActionInsert(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeChildTableActionDelete(SSdbOper *pOper) { static int32_t mnodeChildTableActionDelete(SSWriteMsg *pOper) {
SCTableObj *pTable = pOper->pObj; SCTableObj *pTable = pOper->pObj;
if (pTable->vgId == 0) { if (pTable->vgId == 0) {
return TSDB_CODE_MND_VGROUP_NOT_EXIST; return TSDB_CODE_MND_VGROUP_NOT_EXIST;
...@@ -189,7 +189,7 @@ static int32_t mnodeChildTableActionDelete(SSdbOper *pOper) { ...@@ -189,7 +189,7 @@ static int32_t mnodeChildTableActionDelete(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeChildTableActionUpdate(SSdbOper *pOper) { static int32_t mnodeChildTableActionUpdate(SSWriteMsg *pOper) {
SCTableObj *pNew = pOper->pObj; SCTableObj *pNew = pOper->pObj;
SCTableObj *pTable = mnodeGetChildTable(pNew->info.tableId); SCTableObj *pTable = mnodeGetChildTable(pNew->info.tableId);
if (pTable != pNew) { if (pTable != pNew) {
...@@ -216,7 +216,7 @@ static int32_t mnodeChildTableActionUpdate(SSdbOper *pOper) { ...@@ -216,7 +216,7 @@ static int32_t mnodeChildTableActionUpdate(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeChildTableActionEncode(SSdbOper *pOper) { static int32_t mnodeChildTableActionEncode(SSWriteMsg *pOper) {
SCTableObj *pTable = pOper->pObj; SCTableObj *pTable = pOper->pObj;
assert(pTable != NULL && pOper->rowData != NULL); assert(pTable != NULL && pOper->rowData != NULL);
...@@ -246,7 +246,7 @@ static int32_t mnodeChildTableActionEncode(SSdbOper *pOper) { ...@@ -246,7 +246,7 @@ static int32_t mnodeChildTableActionEncode(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeChildTableActionDecode(SSdbOper *pOper) { static int32_t mnodeChildTableActionDecode(SSWriteMsg *pOper) {
assert(pOper->rowData != NULL); assert(pOper->rowData != NULL);
SCTableObj *pTable = calloc(1, sizeof(SCTableObj)); SCTableObj *pTable = calloc(1, sizeof(SCTableObj));
if (pTable == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pTable == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -297,7 +297,7 @@ static int32_t mnodeChildTableActionRestored() { ...@@ -297,7 +297,7 @@ static int32_t mnodeChildTableActionRestored() {
SDbObj *pDb = mnodeGetDbByTableId(pTable->info.tableId); SDbObj *pDb = mnodeGetDbByTableId(pTable->info.tableId);
if (pDb == NULL || pDb->status != TSDB_DB_STATUS_READY) { if (pDb == NULL || pDb->status != TSDB_DB_STATUS_READY) {
mError("ctable:%s, failed to get db or db in dropping, discard it", pTable->info.tableId); mError("ctable:%s, failed to get db or db in dropping, discard it", pTable->info.tableId);
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSWriteMsg desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mnodeDecTableRef(pTable); mnodeDecTableRef(pTable);
mnodeDecDbRef(pDb); mnodeDecDbRef(pDb);
...@@ -309,7 +309,7 @@ static int32_t mnodeChildTableActionRestored() { ...@@ -309,7 +309,7 @@ static int32_t mnodeChildTableActionRestored() {
if (pVgroup == NULL) { if (pVgroup == NULL) {
mError("ctable:%s, failed to get vgId:%d tid:%d, discard it", pTable->info.tableId, pTable->vgId, pTable->tid); mError("ctable:%s, failed to get vgId:%d tid:%d, discard it", pTable->info.tableId, pTable->vgId, pTable->tid);
pTable->vgId = 0; pTable->vgId = 0;
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSWriteMsg desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mnodeDecTableRef(pTable); mnodeDecTableRef(pTable);
continue; continue;
...@@ -320,7 +320,7 @@ static int32_t mnodeChildTableActionRestored() { ...@@ -320,7 +320,7 @@ static int32_t mnodeChildTableActionRestored() {
mError("ctable:%s, db:%s not match with vgId:%d db:%s sid:%d, discard it", mError("ctable:%s, db:%s not match with vgId:%d db:%s sid:%d, discard it",
pTable->info.tableId, pDb->name, pTable->vgId, pVgroup->dbName, pTable->tid); pTable->info.tableId, pDb->name, pTable->vgId, pVgroup->dbName, pTable->tid);
pTable->vgId = 0; pTable->vgId = 0;
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSWriteMsg desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mnodeDecTableRef(pTable); mnodeDecTableRef(pTable);
continue; continue;
...@@ -331,7 +331,7 @@ static int32_t mnodeChildTableActionRestored() { ...@@ -331,7 +331,7 @@ static int32_t mnodeChildTableActionRestored() {
if (pSuperTable == NULL) { if (pSuperTable == NULL) {
mError("ctable:%s, stable:%" PRIu64 " not exist", pTable->info.tableId, pTable->suid); mError("ctable:%s, stable:%" PRIu64 " not exist", pTable->info.tableId, pTable->suid);
pTable->vgId = 0; pTable->vgId = 0;
SSdbOper desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb}; SSWriteMsg desc = {.type = SDB_OPER_LOCAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
mnodeDecTableRef(pTable); mnodeDecTableRef(pTable);
continue; continue;
...@@ -358,13 +358,13 @@ static int32_t mnodeInitChildTables() { ...@@ -358,13 +358,13 @@ static int32_t mnodeInitChildTables() {
.maxRowSize = sizeof(SCTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16) + TSDB_TABLE_FNAME_LEN + TSDB_CQ_SQL_SIZE, .maxRowSize = sizeof(SCTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16) + TSDB_TABLE_FNAME_LEN + TSDB_CQ_SQL_SIZE,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_VAR_STRING, .keyType = SDB_KEY_VAR_STRING,
.insertFp = mnodeChildTableActionInsert, .fpInsert = mnodeChildTableActionInsert,
.deleteFp = mnodeChildTableActionDelete, .fpDelete = mnodeChildTableActionDelete,
.updateFp = mnodeChildTableActionUpdate, .fpUpdate = mnodeChildTableActionUpdate,
.encodeFp = mnodeChildTableActionEncode, .fpEncode = mnodeChildTableActionEncode,
.decodeFp = mnodeChildTableActionDecode, .fpDecode = mnodeChildTableActionDecode,
.destroyFp = mnodeChildTableActionDestroy, .fpDestroy = mnodeChildTableActionDestroy,
.restoredFp = mnodeChildTableActionRestored .fpDestored = mnodeChildTableActionRestored
}; };
tsChildTableSdb = sdbOpenTable(&tableDesc); tsChildTableSdb = sdbOpenTable(&tableDesc);
...@@ -430,12 +430,12 @@ static void mnodeDestroySuperTable(SSTableObj *pStable) { ...@@ -430,12 +430,12 @@ static void mnodeDestroySuperTable(SSTableObj *pStable) {
tfree(pStable); tfree(pStable);
} }
static int32_t mnodeSuperTableActionDestroy(SSdbOper *pOper) { static int32_t mnodeSuperTableActionDestroy(SSWriteMsg *pOper) {
mnodeDestroySuperTable(pOper->pObj); mnodeDestroySuperTable(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeSuperTableActionInsert(SSdbOper *pOper) { static int32_t mnodeSuperTableActionInsert(SSWriteMsg *pOper) {
SSTableObj *pStable = pOper->pObj; SSTableObj *pStable = pOper->pObj;
SDbObj *pDb = mnodeGetDbByTableId(pStable->info.tableId); SDbObj *pDb = mnodeGetDbByTableId(pStable->info.tableId);
if (pDb != NULL && pDb->status == TSDB_DB_STATUS_READY) { if (pDb != NULL && pDb->status == TSDB_DB_STATUS_READY) {
...@@ -446,7 +446,7 @@ static int32_t mnodeSuperTableActionInsert(SSdbOper *pOper) { ...@@ -446,7 +446,7 @@ static int32_t mnodeSuperTableActionInsert(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeSuperTableActionDelete(SSdbOper *pOper) { static int32_t mnodeSuperTableActionDelete(SSWriteMsg *pOper) {
SSTableObj *pStable = pOper->pObj; SSTableObj *pStable = pOper->pObj;
SDbObj *pDb = mnodeGetDbByTableId(pStable->info.tableId); SDbObj *pDb = mnodeGetDbByTableId(pStable->info.tableId);
if (pDb != NULL) { if (pDb != NULL) {
...@@ -458,7 +458,7 @@ static int32_t mnodeSuperTableActionDelete(SSdbOper *pOper) { ...@@ -458,7 +458,7 @@ static int32_t mnodeSuperTableActionDelete(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeSuperTableActionUpdate(SSdbOper *pOper) { static int32_t mnodeSuperTableActionUpdate(SSWriteMsg *pOper) {
SSTableObj *pNew = pOper->pObj; SSTableObj *pNew = pOper->pObj;
SSTableObj *pTable = mnodeGetSuperTable(pNew->info.tableId); SSTableObj *pTable = mnodeGetSuperTable(pNew->info.tableId);
if (pTable != NULL && pTable != pNew) { if (pTable != NULL && pTable != pNew) {
...@@ -483,7 +483,7 @@ static int32_t mnodeSuperTableActionUpdate(SSdbOper *pOper) { ...@@ -483,7 +483,7 @@ static int32_t mnodeSuperTableActionUpdate(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeSuperTableActionEncode(SSdbOper *pOper) { static int32_t mnodeSuperTableActionEncode(SSWriteMsg *pOper) {
SSTableObj *pStable = pOper->pObj; SSTableObj *pStable = pOper->pObj;
assert(pOper->pObj != NULL && pOper->rowData != NULL); assert(pOper->pObj != NULL && pOper->rowData != NULL);
...@@ -506,7 +506,7 @@ static int32_t mnodeSuperTableActionEncode(SSdbOper *pOper) { ...@@ -506,7 +506,7 @@ static int32_t mnodeSuperTableActionEncode(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeSuperTableActionDecode(SSdbOper *pOper) { static int32_t mnodeSuperTableActionDecode(SSWriteMsg *pOper) {
assert(pOper->rowData != NULL); assert(pOper->rowData != NULL);
SSTableObj *pStable = (SSTableObj *) calloc(1, sizeof(SSTableObj)); SSTableObj *pStable = (SSTableObj *) calloc(1, sizeof(SSTableObj));
if (pStable == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pStable == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -551,13 +551,13 @@ static int32_t mnodeInitSuperTables() { ...@@ -551,13 +551,13 @@ static int32_t mnodeInitSuperTables() {
.maxRowSize = sizeof(SSTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16) + TSDB_TABLE_FNAME_LEN, .maxRowSize = sizeof(SSTableObj) + sizeof(SSchema) * (TSDB_MAX_TAGS + TSDB_MAX_COLUMNS + 16) + TSDB_TABLE_FNAME_LEN,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_VAR_STRING, .keyType = SDB_KEY_VAR_STRING,
.insertFp = mnodeSuperTableActionInsert, .fpInsert = mnodeSuperTableActionInsert,
.deleteFp = mnodeSuperTableActionDelete, .fpDelete = mnodeSuperTableActionDelete,
.updateFp = mnodeSuperTableActionUpdate, .fpUpdate = mnodeSuperTableActionUpdate,
.encodeFp = mnodeSuperTableActionEncode, .fpEncode = mnodeSuperTableActionEncode,
.decodeFp = mnodeSuperTableActionDecode, .fpDecode = mnodeSuperTableActionDecode,
.destroyFp = mnodeSuperTableActionDestroy, .fpDestroy = mnodeSuperTableActionDestroy,
.restoredFp = mnodeSuperTableActionRestored .fpDestored = mnodeSuperTableActionRestored
}; };
tsSuperTableSdb = sdbOpenTable(&tableDesc); tsSuperTableSdb = sdbOpenTable(&tableDesc);
...@@ -828,7 +828,7 @@ static int32_t mnodeCreateSuperTableCb(SMnodeMsg *pMsg, int32_t code) { ...@@ -828,7 +828,7 @@ static int32_t mnodeCreateSuperTableCb(SMnodeMsg *pMsg, int32_t code) {
} else { } else {
mError("app:%p:%p, stable:%s, failed to create in sdb, reason:%s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId, mError("app:%p:%p, stable:%s, failed to create in sdb, reason:%s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId,
tstrerror(code)); tstrerror(code));
SSdbOper desc = {.type = SDB_OPER_GLOBAL, .pObj = pTable, .table = tsSuperTableSdb}; SSWriteMsg desc = {.type = SDB_OPER_GLOBAL, .pObj = pTable, .table = tsSuperTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
} }
...@@ -878,7 +878,7 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) { ...@@ -878,7 +878,7 @@ static int32_t mnodeProcessCreateSuperTableMsg(SMnodeMsg *pMsg) {
pMsg->pTable = (STableObj *)pStable; pMsg->pTable = (STableObj *)pStable;
mnodeIncTableRef(pMsg->pTable); mnodeIncTableRef(pMsg->pTable);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pStable, .pObj = pStable,
...@@ -937,7 +937,7 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) { ...@@ -937,7 +937,7 @@ static int32_t mnodeProcessDropSuperTableMsg(SMnodeMsg *pMsg) {
mnodeDropAllChildTablesInStable(pStable); mnodeDropAllChildTablesInStable(pStable);
} }
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pStable, .pObj = pStable,
...@@ -1010,7 +1010,7 @@ static int32_t mnodeAddSuperTableTag(SMnodeMsg *pMsg, SSchema schema[], int32_t ...@@ -1010,7 +1010,7 @@ static int32_t mnodeAddSuperTableTag(SMnodeMsg *pMsg, SSchema schema[], int32_t
mInfo("app:%p:%p, stable %s, start to add tag %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId, mInfo("app:%p:%p, stable %s, start to add tag %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
schema[0].name); schema[0].name);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pStable, .pObj = pStable,
...@@ -1044,7 +1044,7 @@ static int32_t mnodeDropSuperTableTag(SMnodeMsg *pMsg, char *tagName) { ...@@ -1044,7 +1044,7 @@ static int32_t mnodeDropSuperTableTag(SMnodeMsg *pMsg, char *tagName) {
mInfo("app:%p:%p, stable %s, start to drop tag %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId, tagName); mInfo("app:%p:%p, stable %s, start to drop tag %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId, tagName);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pStable, .pObj = pStable,
...@@ -1088,7 +1088,7 @@ static int32_t mnodeModifySuperTableTagName(SMnodeMsg *pMsg, char *oldTagName, c ...@@ -1088,7 +1088,7 @@ static int32_t mnodeModifySuperTableTagName(SMnodeMsg *pMsg, char *oldTagName, c
mInfo("app:%p:%p, stable %s, start to modify tag %s to %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId, mInfo("app:%p:%p, stable %s, start to modify tag %s to %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
oldTagName, newTagName); oldTagName, newTagName);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pStable, .pObj = pStable,
...@@ -1162,7 +1162,7 @@ static int32_t mnodeAddSuperTableColumn(SMnodeMsg *pMsg, SSchema schema[], int32 ...@@ -1162,7 +1162,7 @@ static int32_t mnodeAddSuperTableColumn(SMnodeMsg *pMsg, SSchema schema[], int32
mInfo("app:%p:%p, stable %s, start to add column", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId); mInfo("app:%p:%p, stable %s, start to add column", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pStable, .pObj = pStable,
...@@ -1207,7 +1207,7 @@ static int32_t mnodeDropSuperTableColumn(SMnodeMsg *pMsg, char *colName) { ...@@ -1207,7 +1207,7 @@ static int32_t mnodeDropSuperTableColumn(SMnodeMsg *pMsg, char *colName) {
mInfo("app:%p:%p, stable %s, start to delete column", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId); mInfo("app:%p:%p, stable %s, start to delete column", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pStable, .pObj = pStable,
...@@ -1251,7 +1251,7 @@ static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg, char *oldName, char ...@@ -1251,7 +1251,7 @@ static int32_t mnodeChangeSuperTableColumn(SMnodeMsg *pMsg, char *oldName, char
mInfo("app:%p:%p, stable %s, start to modify column %s to %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId, mInfo("app:%p:%p, stable %s, start to modify column %s to %s", pMsg->rpcMsg.ahandle, pMsg, pStable->info.tableId,
oldName, newName); oldName, newName);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pStable, .pObj = pStable,
...@@ -1417,7 +1417,7 @@ void mnodeDropAllSuperTables(SDbObj *pDropDb) { ...@@ -1417,7 +1417,7 @@ void mnodeDropAllSuperTables(SDbObj *pDropDb) {
if (pTable == NULL) break; if (pTable == NULL) break;
if (strncmp(prefix, pTable->info.tableId, prefixLen) == 0) { if (strncmp(prefix, pTable->info.tableId, prefixLen) == 0) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_LOCAL, .type = SDB_OPER_LOCAL,
.table = tsSuperTableSdb, .table = tsSuperTableSdb,
.pObj = pTable, .pObj = pTable,
...@@ -1694,7 +1694,7 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) { ...@@ -1694,7 +1694,7 @@ static int32_t mnodeDoCreateChildTableCb(SMnodeMsg *pMsg, int32_t code) {
} else { } else {
mError("app:%p:%p, table:%s, failed to create table sid:%d, uid:%" PRIu64 ", reason:%s", pMsg->rpcMsg.ahandle, pMsg, mError("app:%p:%p, table:%s, failed to create table sid:%d, uid:%" PRIu64 ", reason:%s", pMsg->rpcMsg.ahandle, pMsg,
pTable->info.tableId, pTable->tid, pTable->uid, tstrerror(code)); pTable->info.tableId, pTable->tid, pTable->uid, tstrerror(code));
SSdbOper desc = {.type = SDB_OPER_GLOBAL, .pObj = pTable, .table = tsChildTableSdb}; SSWriteMsg desc = {.type = SDB_OPER_GLOBAL, .pObj = pTable, .table = tsChildTableSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
return code; return code;
} }
...@@ -1780,7 +1780,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) { ...@@ -1780,7 +1780,7 @@ static int32_t mnodeDoCreateChildTable(SMnodeMsg *pMsg, int32_t tid) {
pMsg->pTable = (STableObj *)pTable; pMsg->pTable = (STableObj *)pTable;
mnodeIncTableRef(pMsg->pTable); mnodeIncTableRef(pMsg->pTable);
SSdbOper desc = { SSWriteMsg desc = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.pObj = pTable, .pObj = pTable,
.table = tsChildTableSdb, .table = tsChildTableSdb,
...@@ -1901,7 +1901,7 @@ static int32_t mnodeProcessDropChildTableMsg(SMnodeMsg *pMsg) { ...@@ -1901,7 +1901,7 @@ static int32_t mnodeProcessDropChildTableMsg(SMnodeMsg *pMsg) {
return TSDB_CODE_MND_APP_ERROR; return TSDB_CODE_MND_APP_ERROR;
} }
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsChildTableSdb, .table = tsChildTableSdb,
.pObj = pTable, .pObj = pTable,
...@@ -2005,7 +2005,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3 ...@@ -2005,7 +2005,7 @@ static int32_t mnodeAddNormalTableColumn(SMnodeMsg *pMsg, SSchema schema[], int3
mInfo("app:%p:%p, ctable %s, start to add column", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId); mInfo("app:%p:%p, ctable %s, start to add column", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsChildTableSdb, .table = tsChildTableSdb,
.pObj = pTable, .pObj = pTable,
...@@ -2038,7 +2038,7 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) { ...@@ -2038,7 +2038,7 @@ static int32_t mnodeDropNormalTableColumn(SMnodeMsg *pMsg, char *colName) {
mInfo("app:%p:%p, ctable %s, start to drop column %s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId, colName); mInfo("app:%p:%p, ctable %s, start to drop column %s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId, colName);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsChildTableSdb, .table = tsChildTableSdb,
.pObj = pTable, .pObj = pTable,
...@@ -2075,7 +2075,7 @@ static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg, char *oldName, char ...@@ -2075,7 +2075,7 @@ static int32_t mnodeChangeNormalTableColumn(SMnodeMsg *pMsg, char *oldName, char
mInfo("app:%p:%p, ctable %s, start to modify column %s to %s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId, mInfo("app:%p:%p, ctable %s, start to modify column %s to %s", pMsg->rpcMsg.ahandle, pMsg, pTable->info.tableId,
oldName, newName); oldName, newName);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsChildTableSdb, .table = tsChildTableSdb,
.pObj = pTable, .pObj = pTable,
...@@ -2218,7 +2218,7 @@ void mnodeDropAllChildTablesInVgroups(SVgObj *pVgroup) { ...@@ -2218,7 +2218,7 @@ void mnodeDropAllChildTablesInVgroups(SVgObj *pVgroup) {
if (pTable == NULL) break; if (pTable == NULL) break;
if (pTable->vgId == pVgroup->vgId) { if (pTable->vgId == pVgroup->vgId) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_LOCAL, .type = SDB_OPER_LOCAL,
.table = tsChildTableSdb, .table = tsChildTableSdb,
.pObj = pTable, .pObj = pTable,
...@@ -2251,7 +2251,7 @@ void mnodeDropAllChildTables(SDbObj *pDropDb) { ...@@ -2251,7 +2251,7 @@ void mnodeDropAllChildTables(SDbObj *pDropDb) {
if (pTable == NULL) break; if (pTable == NULL) break;
if (strncmp(prefix, pTable->info.tableId, prefixLen) == 0) { if (strncmp(prefix, pTable->info.tableId, prefixLen) == 0) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_LOCAL, .type = SDB_OPER_LOCAL,
.table = tsChildTableSdb, .table = tsChildTableSdb,
.pObj = pTable, .pObj = pTable,
...@@ -2280,7 +2280,7 @@ static void mnodeDropAllChildTablesInStable(SSTableObj *pStable) { ...@@ -2280,7 +2280,7 @@ static void mnodeDropAllChildTablesInStable(SSTableObj *pStable) {
if (pTable == NULL) break; if (pTable == NULL) break;
if (pTable->superTable == pStable) { if (pTable->superTable == pStable) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_LOCAL, .type = SDB_OPER_LOCAL,
.table = tsChildTableSdb, .table = tsChildTableSdb,
.pObj = pTable, .pObj = pTable,
...@@ -2410,7 +2410,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) { ...@@ -2410,7 +2410,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
} }
if (rpcMsg->code == TSDB_CODE_SUCCESS || rpcMsg->code == TSDB_CODE_TDB_TABLE_ALREADY_EXIST) { if (rpcMsg->code == TSDB_CODE_SUCCESS || rpcMsg->code == TSDB_CODE_TDB_TABLE_ALREADY_EXIST) {
SSdbOper desc = { SSWriteMsg desc = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.pObj = pTable, .pObj = pTable,
.table = tsChildTableSdb, .table = tsChildTableSdb,
...@@ -2440,7 +2440,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) { ...@@ -2440,7 +2440,7 @@ static void mnodeProcessCreateChildTableRsp(SRpcMsg *rpcMsg) {
mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid, mnodeMsg->rpcMsg.ahandle, mnodeMsg, pTable->info.tableId, pTable->vgId, pTable->tid, pTable->uid,
tstrerror(rpcMsg->code), mnodeMsg->rpcMsg.handle, mnodeMsg->incomingTs, sec, mnodeMsg->retry); tstrerror(rpcMsg->code), mnodeMsg->rpcMsg.handle, mnodeMsg->incomingTs, sec, mnodeMsg->retry);
SSdbOper oper = {.type = SDB_OPER_GLOBAL, .table = tsChildTableSdb, .pObj = pTable}; SSWriteMsg oper = {.type = SDB_OPER_GLOBAL, .table = tsChildTableSdb, .pObj = pTable};
sdbDeleteRow(&oper); sdbDeleteRow(&oper);
if (rpcMsg->code == TSDB_CODE_APP_NOT_READY) { if (rpcMsg->code == TSDB_CODE_APP_NOT_READY) {
......
...@@ -42,12 +42,12 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg); ...@@ -42,12 +42,12 @@ static int32_t mnodeProcessAlterUserMsg(SMnodeMsg *pMsg);
static int32_t mnodeProcessDropUserMsg(SMnodeMsg *pMsg); static int32_t mnodeProcessDropUserMsg(SMnodeMsg *pMsg);
static int32_t mnodeProcessAuthMsg(SMnodeMsg *pMsg); static int32_t mnodeProcessAuthMsg(SMnodeMsg *pMsg);
static int32_t mnodeUserActionDestroy(SSdbOper *pOper) { static int32_t mnodeUserActionDestroy(SSWriteMsg *pOper) {
tfree(pOper->pObj); tfree(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeUserActionInsert(SSdbOper *pOper) { static int32_t mnodeUserActionInsert(SSWriteMsg *pOper) {
SUserObj *pUser = pOper->pObj; SUserObj *pUser = pOper->pObj;
SAcctObj *pAcct = mnodeGetAcct(pUser->acct); SAcctObj *pAcct = mnodeGetAcct(pUser->acct);
...@@ -62,7 +62,7 @@ static int32_t mnodeUserActionInsert(SSdbOper *pOper) { ...@@ -62,7 +62,7 @@ static int32_t mnodeUserActionInsert(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeUserActionDelete(SSdbOper *pOper) { static int32_t mnodeUserActionDelete(SSWriteMsg *pOper) {
SUserObj *pUser = pOper->pObj; SUserObj *pUser = pOper->pObj;
SAcctObj *pAcct = mnodeGetAcct(pUser->acct); SAcctObj *pAcct = mnodeGetAcct(pUser->acct);
...@@ -74,7 +74,7 @@ static int32_t mnodeUserActionDelete(SSdbOper *pOper) { ...@@ -74,7 +74,7 @@ static int32_t mnodeUserActionDelete(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeUserActionUpdate(SSdbOper *pOper) { static int32_t mnodeUserActionUpdate(SSWriteMsg *pOper) {
SUserObj *pUser = pOper->pObj; SUserObj *pUser = pOper->pObj;
SUserObj *pSaved = mnodeGetUser(pUser->user); SUserObj *pSaved = mnodeGetUser(pUser->user);
if (pUser != pSaved) { if (pUser != pSaved) {
...@@ -85,14 +85,14 @@ static int32_t mnodeUserActionUpdate(SSdbOper *pOper) { ...@@ -85,14 +85,14 @@ static int32_t mnodeUserActionUpdate(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeUserActionEncode(SSdbOper *pOper) { static int32_t mnodeUserActionEncode(SSWriteMsg *pOper) {
SUserObj *pUser = pOper->pObj; SUserObj *pUser = pOper->pObj;
memcpy(pOper->rowData, pUser, tsUserUpdateSize); memcpy(pOper->rowData, pUser, tsUserUpdateSize);
pOper->rowSize = tsUserUpdateSize; pOper->rowSize = tsUserUpdateSize;
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeUserActionDecode(SSdbOper *pOper) { static int32_t mnodeUserActionDecode(SSWriteMsg *pOper) {
SUserObj *pUser = (SUserObj *)calloc(1, sizeof(SUserObj)); SUserObj *pUser = (SUserObj *)calloc(1, sizeof(SUserObj));
if (pUser == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pUser == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -157,13 +157,13 @@ int32_t mnodeInitUsers() { ...@@ -157,13 +157,13 @@ int32_t mnodeInitUsers() {
.maxRowSize = tsUserUpdateSize, .maxRowSize = tsUserUpdateSize,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_STRING, .keyType = SDB_KEY_STRING,
.insertFp = mnodeUserActionInsert, .fpInsert = mnodeUserActionInsert,
.deleteFp = mnodeUserActionDelete, .fpDelete = mnodeUserActionDelete,
.updateFp = mnodeUserActionUpdate, .fpUpdate = mnodeUserActionUpdate,
.encodeFp = mnodeUserActionEncode, .fpEncode = mnodeUserActionEncode,
.decodeFp = mnodeUserActionDecode, .fpDecode = mnodeUserActionDecode,
.destroyFp = mnodeUserActionDestroy, .fpDestroy = mnodeUserActionDestroy,
.restoredFp = mnodeUserActionRestored .fpDestored = mnodeUserActionRestored
}; };
tsUserSdb = sdbOpenTable(&tableDesc); tsUserSdb = sdbOpenTable(&tableDesc);
...@@ -205,7 +205,7 @@ void mnodeDecUserRef(SUserObj *pUser) { ...@@ -205,7 +205,7 @@ void mnodeDecUserRef(SUserObj *pUser) {
} }
static int32_t mnodeUpdateUser(SUserObj *pUser, void *pMsg) { static int32_t mnodeUpdateUser(SUserObj *pUser, void *pMsg) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsUserSdb, .table = tsUserSdb,
.pObj = pUser, .pObj = pUser,
...@@ -259,7 +259,7 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) { ...@@ -259,7 +259,7 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) {
pUser->superAuth = 1; pUser->superAuth = 1;
} }
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsUserSdb, .table = tsUserSdb,
.pObj = pUser, .pObj = pUser,
...@@ -279,7 +279,7 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) { ...@@ -279,7 +279,7 @@ int32_t mnodeCreateUser(SAcctObj *pAcct, char *name, char *pass, void *pMsg) {
} }
static int32_t mnodeDropUser(SUserObj *pUser, void *pMsg) { static int32_t mnodeDropUser(SUserObj *pUser, void *pMsg) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsUserSdb, .table = tsUserSdb,
.pObj = pUser, .pObj = pUser,
...@@ -562,7 +562,7 @@ void mnodeDropAllUsers(SAcctObj *pAcct) { ...@@ -562,7 +562,7 @@ void mnodeDropAllUsers(SAcctObj *pAcct) {
if (pUser == NULL) break; if (pUser == NULL) break;
if (strncmp(pUser->acct, pAcct->user, acctNameLen) == 0) { if (strncmp(pUser->acct, pAcct->user, acctNameLen) == 0) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_LOCAL, .type = SDB_OPER_LOCAL,
.table = tsUserSdb, .table = tsUserSdb,
.pObj = pUser, .pObj = pUser,
......
...@@ -72,12 +72,12 @@ static void mnodeDestroyVgroup(SVgObj *pVgroup) { ...@@ -72,12 +72,12 @@ static void mnodeDestroyVgroup(SVgObj *pVgroup) {
tfree(pVgroup); tfree(pVgroup);
} }
static int32_t mnodeVgroupActionDestroy(SSdbOper *pOper) { static int32_t mnodeVgroupActionDestroy(SSWriteMsg *pOper) {
mnodeDestroyVgroup(pOper->pObj); mnodeDestroyVgroup(pOper->pObj);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeVgroupActionInsert(SSdbOper *pOper) { static int32_t mnodeVgroupActionInsert(SSWriteMsg *pOper) {
SVgObj *pVgroup = pOper->pObj; SVgObj *pVgroup = pOper->pObj;
// refer to db // refer to db
...@@ -115,7 +115,7 @@ static int32_t mnodeVgroupActionInsert(SSdbOper *pOper) { ...@@ -115,7 +115,7 @@ static int32_t mnodeVgroupActionInsert(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeVgroupActionDelete(SSdbOper *pOper) { static int32_t mnodeVgroupActionDelete(SSWriteMsg *pOper) {
SVgObj *pVgroup = pOper->pObj; SVgObj *pVgroup = pOper->pObj;
if (pVgroup->pDb == NULL) { if (pVgroup->pDb == NULL) {
...@@ -137,7 +137,7 @@ static int32_t mnodeVgroupActionDelete(SSdbOper *pOper) { ...@@ -137,7 +137,7 @@ static int32_t mnodeVgroupActionDelete(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeVgroupActionUpdate(SSdbOper *pOper) { static int32_t mnodeVgroupActionUpdate(SSWriteMsg *pOper) {
SVgObj *pNew = pOper->pObj; SVgObj *pNew = pOper->pObj;
SVgObj *pVgroup = mnodeGetVgroup(pNew->vgId); SVgObj *pVgroup = mnodeGetVgroup(pNew->vgId);
...@@ -176,7 +176,7 @@ static int32_t mnodeVgroupActionUpdate(SSdbOper *pOper) { ...@@ -176,7 +176,7 @@ static int32_t mnodeVgroupActionUpdate(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeVgroupActionEncode(SSdbOper *pOper) { static int32_t mnodeVgroupActionEncode(SSWriteMsg *pOper) {
SVgObj *pVgroup = pOper->pObj; SVgObj *pVgroup = pOper->pObj;
memcpy(pOper->rowData, pVgroup, tsVgUpdateSize); memcpy(pOper->rowData, pVgroup, tsVgUpdateSize);
SVgObj *pTmpVgroup = pOper->rowData; SVgObj *pTmpVgroup = pOper->rowData;
...@@ -189,7 +189,7 @@ static int32_t mnodeVgroupActionEncode(SSdbOper *pOper) { ...@@ -189,7 +189,7 @@ static int32_t mnodeVgroupActionEncode(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static int32_t mnodeVgroupActionDecode(SSdbOper *pOper) { static int32_t mnodeVgroupActionDecode(SSWriteMsg *pOper) {
SVgObj *pVgroup = (SVgObj *) calloc(1, sizeof(SVgObj)); SVgObj *pVgroup = (SVgObj *) calloc(1, sizeof(SVgObj));
if (pVgroup == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY; if (pVgroup == NULL) return TSDB_CODE_MND_OUT_OF_MEMORY;
...@@ -213,13 +213,13 @@ int32_t mnodeInitVgroups() { ...@@ -213,13 +213,13 @@ int32_t mnodeInitVgroups() {
.maxRowSize = tsVgUpdateSize, .maxRowSize = tsVgUpdateSize,
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj, .refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
.keyType = SDB_KEY_AUTO, .keyType = SDB_KEY_AUTO,
.insertFp = mnodeVgroupActionInsert, .fpInsert = mnodeVgroupActionInsert,
.deleteFp = mnodeVgroupActionDelete, .fpDelete = mnodeVgroupActionDelete,
.updateFp = mnodeVgroupActionUpdate, .fpUpdate = mnodeVgroupActionUpdate,
.encodeFp = mnodeVgroupActionEncode, .fpEncode = mnodeVgroupActionEncode,
.decodeFp = mnodeVgroupActionDecode, .fpDecode = mnodeVgroupActionDecode,
.destroyFp = mnodeVgroupActionDestroy, .fpDestroy = mnodeVgroupActionDestroy,
.restoredFp = mnodeVgroupActionRestored, .fpDestored = mnodeVgroupActionRestored,
}; };
tsVgroupSdb = sdbOpenTable(&tableDesc); tsVgroupSdb = sdbOpenTable(&tableDesc);
...@@ -253,7 +253,7 @@ SVgObj *mnodeGetVgroup(int32_t vgId) { ...@@ -253,7 +253,7 @@ SVgObj *mnodeGetVgroup(int32_t vgId) {
} }
void mnodeUpdateVgroup(SVgObj *pVgroup) { void mnodeUpdateVgroup(SVgObj *pVgroup) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsVgroupSdb, .table = tsVgroupSdb,
.pObj = pVgroup .pObj = pVgroup
...@@ -519,14 +519,14 @@ static int32_t mnodeCreateVgroupCb(SMnodeMsg *pMsg, int32_t code) { ...@@ -519,14 +519,14 @@ static int32_t mnodeCreateVgroupCb(SMnodeMsg *pMsg, int32_t code) {
if (code != TSDB_CODE_SUCCESS) { if (code != TSDB_CODE_SUCCESS) {
mError("app:%p:%p, vgId:%d, failed to create in sdb, reason:%s", pMsg->rpcMsg.ahandle, pMsg, pVgroup->vgId, mError("app:%p:%p, vgId:%d, failed to create in sdb, reason:%s", pMsg->rpcMsg.ahandle, pMsg, pVgroup->vgId,
tstrerror(code)); tstrerror(code));
SSdbOper desc = {.type = SDB_OPER_GLOBAL, .pObj = pVgroup, .table = tsVgroupSdb}; SSWriteMsg desc = {.type = SDB_OPER_GLOBAL, .pObj = pVgroup, .table = tsVgroupSdb};
sdbDeleteRow(&desc); sdbDeleteRow(&desc);
return code; return code;
} else { } else {
mInfo("app:%p:%p, vgId:%d, is created in sdb, db:%s replica:%d", pMsg->rpcMsg.ahandle, pMsg, pVgroup->vgId, mInfo("app:%p:%p, vgId:%d, is created in sdb, db:%s replica:%d", pMsg->rpcMsg.ahandle, pMsg, pVgroup->vgId,
pDb->name, pVgroup->numOfVnodes); pDb->name, pVgroup->numOfVnodes);
pVgroup->status = TAOS_VG_STATUS_READY; pVgroup->status = TAOS_VG_STATUS_READY;
SSdbOper desc = {.type = SDB_OPER_GLOBAL, .pObj = pVgroup, .table = tsVgroupSdb}; SSWriteMsg desc = {.type = SDB_OPER_GLOBAL, .pObj = pVgroup, .table = tsVgroupSdb};
(void)sdbUpdateRow(&desc); (void)sdbUpdateRow(&desc);
dnodeReprocessMWriteMsg(pMsg); dnodeReprocessMWriteMsg(pMsg);
...@@ -535,7 +535,7 @@ static int32_t mnodeCreateVgroupCb(SMnodeMsg *pMsg, int32_t code) { ...@@ -535,7 +535,7 @@ static int32_t mnodeCreateVgroupCb(SMnodeMsg *pMsg, int32_t code) {
// mInfo("app:%p:%p, vgId:%d, is created in sdb, db:%s replica:%d", pMsg->rpcMsg.ahandle, pMsg, pVgroup->vgId, // mInfo("app:%p:%p, vgId:%d, is created in sdb, db:%s replica:%d", pMsg->rpcMsg.ahandle, pMsg, pVgroup->vgId,
// pDb->name, pVgroup->numOfVnodes); // pDb->name, pVgroup->numOfVnodes);
// pVgroup->status = TAOS_VG_STATUS_READY; // pVgroup->status = TAOS_VG_STATUS_READY;
// SSdbOper desc = {.type = SDB_OPER_GLOBAL, .pObj = pVgroup, .table = tsVgroupSdb}; // SSWriteMsg desc = {.type = SDB_OPER_GLOBAL, .pObj = pVgroup, .table = tsVgroupSdb};
// (void)sdbUpdateRow(&desc); // (void)sdbUpdateRow(&desc);
// dnodeReprocessMWriteMsg(pMsg); // dnodeReprocessMWriteMsg(pMsg);
// return TSDB_CODE_MND_ACTION_IN_PROGRESS; // return TSDB_CODE_MND_ACTION_IN_PROGRESS;
...@@ -571,7 +571,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg) { ...@@ -571,7 +571,7 @@ int32_t mnodeCreateVgroup(SMnodeMsg *pMsg) {
pMsg->pVgroup = pVgroup; pMsg->pVgroup = pVgroup;
mnodeIncVgroupRef(pVgroup); mnodeIncVgroupRef(pVgroup);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsVgroupSdb, .table = tsVgroupSdb,
.pObj = pVgroup, .pObj = pVgroup,
...@@ -595,7 +595,7 @@ void mnodeDropVgroup(SVgObj *pVgroup, void *ahandle) { ...@@ -595,7 +595,7 @@ void mnodeDropVgroup(SVgObj *pVgroup, void *ahandle) {
} else { } else {
mDebug("vgId:%d, replica:%d is deleting from sdb", pVgroup->vgId, pVgroup->numOfVnodes); mDebug("vgId:%d, replica:%d is deleting from sdb", pVgroup->vgId, pVgroup->numOfVnodes);
mnodeSendDropVgroupMsg(pVgroup, NULL); mnodeSendDropVgroupMsg(pVgroup, NULL);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsVgroupSdb, .table = tsVgroupSdb,
.pObj = pVgroup .pObj = pVgroup
...@@ -957,7 +957,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) { ...@@ -957,7 +957,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
if (mnodeMsg->received != mnodeMsg->expected) return; if (mnodeMsg->received != mnodeMsg->expected) return;
if (mnodeMsg->received == mnodeMsg->successed) { if (mnodeMsg->received == mnodeMsg->successed) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsVgroupSdb, .table = tsVgroupSdb,
.pObj = pVgroup, .pObj = pVgroup,
...@@ -973,7 +973,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) { ...@@ -973,7 +973,7 @@ static void mnodeProcessCreateVnodeRsp(SRpcMsg *rpcMsg) {
dnodeSendRpcMWriteRsp(mnodeMsg, code); dnodeSendRpcMWriteRsp(mnodeMsg, code);
} }
} else { } else {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsVgroupSdb, .table = tsVgroupSdb,
.pObj = pVgroup .pObj = pVgroup
...@@ -1031,7 +1031,7 @@ static void mnodeProcessDropVnodeRsp(SRpcMsg *rpcMsg) { ...@@ -1031,7 +1031,7 @@ static void mnodeProcessDropVnodeRsp(SRpcMsg *rpcMsg) {
if (mnodeMsg->received != mnodeMsg->expected) return; if (mnodeMsg->received != mnodeMsg->expected) return;
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_GLOBAL, .type = SDB_OPER_GLOBAL,
.table = tsVgroupSdb, .table = tsVgroupSdb,
.pObj = pVgroup .pObj = pVgroup
...@@ -1084,7 +1084,7 @@ void mnodeDropAllDnodeVgroups(SDnodeObj *pDropDnode) { ...@@ -1084,7 +1084,7 @@ void mnodeDropAllDnodeVgroups(SDnodeObj *pDropDnode) {
if (pVgroup->vnodeGid[0].dnodeId == pDropDnode->dnodeId) { if (pVgroup->vnodeGid[0].dnodeId == pDropDnode->dnodeId) {
mnodeDropAllChildTablesInVgroups(pVgroup); mnodeDropAllChildTablesInVgroups(pVgroup);
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_LOCAL, .type = SDB_OPER_LOCAL,
.table = tsVgroupSdb, .table = tsVgroupSdb,
.pObj = pVgroup, .pObj = pVgroup,
...@@ -1135,7 +1135,7 @@ void mnodeDropAllDbVgroups(SDbObj *pDropDb) { ...@@ -1135,7 +1135,7 @@ void mnodeDropAllDbVgroups(SDbObj *pDropDb) {
if (pVgroup == NULL) break; if (pVgroup == NULL) break;
if (pVgroup->pDb == pDropDb) { if (pVgroup->pDb == pDropDb) {
SSdbOper oper = { SSWriteMsg oper = {
.type = SDB_OPER_LOCAL, .type = SDB_OPER_LOCAL,
.table = tsVgroupSdb, .table = tsVgroupSdb,
.pObj = pVgroup, .pObj = pVgroup,
......
...@@ -118,7 +118,7 @@ typedef struct { ...@@ -118,7 +118,7 @@ typedef struct {
typedef struct { typedef struct {
char *module; char *module;
bool (*decodeFp)(struct HttpContext *pContext); bool (*fpDecode)(struct HttpContext *pContext);
} HttpDecodeMethod; } HttpDecodeMethod;
typedef struct { typedef struct {
......
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
#include "httpHandle.h" #include "httpHandle.h"
bool httpDecodeRequest(HttpContext* pContext) { bool httpDecodeRequest(HttpContext* pContext) {
if (pContext->decodeMethod->decodeFp == NULL) { if (pContext->decodeMethod->fpDecode == NULL) {
return false; return false;
} }
return (*pContext->decodeMethod->decodeFp)(pContext); return (*pContext->decodeMethod->fpDecode)(pContext);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册