[TD-93] add ref to sdb
This commit is contained in:
parent
2a41cd2136
commit
64f57318d2
|
@ -59,7 +59,6 @@ typedef struct {
|
|||
char mnodeName[TSDB_DNODE_NAME_LEN + 1];
|
||||
int8_t reserved[15];
|
||||
int8_t updateEnd[1];
|
||||
int32_t refCount;
|
||||
int syncFd;
|
||||
void *hbTimer;
|
||||
void *pSync;
|
||||
|
@ -85,7 +84,6 @@ typedef struct {
|
|||
char dnodeName[TSDB_DNODE_NAME_LEN + 1];
|
||||
int8_t reserved[15];
|
||||
int8_t updateEnd[1];
|
||||
int32_t refCount;
|
||||
SVnodeLoad vload[TSDB_MAX_VNODES];
|
||||
int32_t status;
|
||||
uint32_t lastReboot; // time stamp for last reboot
|
||||
|
@ -153,7 +151,6 @@ typedef struct _vg_obj {
|
|||
int8_t lbStatus;
|
||||
int8_t reserved[14];
|
||||
int8_t updateEnd[1];
|
||||
int32_t refCount;
|
||||
struct _vg_obj *prev, *next;
|
||||
struct _db_obj *pDb;
|
||||
int32_t numOfTables;
|
||||
|
@ -219,7 +216,6 @@ typedef struct _acctObj {
|
|||
int8_t dirty;
|
||||
int8_t reserved[14];
|
||||
int8_t updateEnd[1];
|
||||
int32_t refCount;
|
||||
SAcctInfo acctInfo;
|
||||
pthread_mutex_t mutex;
|
||||
} SAcctObj;
|
||||
|
|
|
@ -30,8 +30,6 @@ typedef enum {
|
|||
int32_t acctInit();
|
||||
void acctCleanUp();
|
||||
SAcctObj *acctGetAcct(char *acctName);
|
||||
void acctIncRef(SAcctObj *pAcct);
|
||||
void acctDecRef(SAcctObj *pAcct);
|
||||
int32_t acctCheck(SAcctObj *pAcct, EAcctGrantType type);
|
||||
|
||||
void acctAddDb(SAcctObj *pAcct, SDbObj *pDb);
|
||||
|
|
|
@ -32,31 +32,25 @@ int32_t acctInit() {
|
|||
|
||||
void acctCleanUp() {}
|
||||
SAcctObj *acctGetAcct(char *acctName) { return &tsAcctObj; }
|
||||
void acctIncRef(SAcctObj *pAcct) {}
|
||||
void acctDecRef(SAcctObj *pAcct) {}
|
||||
int32_t acctCheck(SAcctObj *pAcct, EAcctGrantType type) { return TSDB_CODE_SUCCESS; }
|
||||
#endif
|
||||
|
||||
void acctAddDb(SAcctObj *pAcct, SDbObj *pDb) {
|
||||
atomic_add_fetch_32(&pAcct->acctInfo.numOfDbs, 1);
|
||||
pDb->pAcct = pAcct;
|
||||
acctIncRef(pAcct);
|
||||
}
|
||||
|
||||
void acctRemoveDb(SAcctObj *pAcct, SDbObj *pDb) {
|
||||
atomic_sub_fetch_32(&pAcct->acctInfo.numOfDbs, 1);
|
||||
pDb->pAcct = NULL;
|
||||
acctDecRef(pAcct);
|
||||
}
|
||||
|
||||
void acctAddUser(SAcctObj *pAcct, SUserObj *pUser) {
|
||||
atomic_add_fetch_32(&pAcct->acctInfo.numOfUsers, 1);
|
||||
pUser->pAcct = pAcct;
|
||||
acctIncRef(pAcct);
|
||||
}
|
||||
|
||||
void acctRemoveUser(SAcctObj *pAcct, SUserObj *pUser) {
|
||||
atomic_sub_fetch_32(&pAcct->acctInfo.numOfUsers, 1);
|
||||
pUser->pAcct = NULL;
|
||||
acctDecRef(pAcct);
|
||||
}
|
|
@ -33,7 +33,7 @@
|
|||
#include "mgmtUser.h"
|
||||
#include "mgmtVgroup.h"
|
||||
|
||||
static void * tsDbSdb = NULL;
|
||||
void * tsDbSdb = NULL;
|
||||
static int32_t tsDbUpdateSize;
|
||||
|
||||
static int32_t mgmtCreateDb(SAcctObj *pAcct, SCMCreateDbMsg *pCreate);
|
||||
|
@ -116,7 +116,7 @@ int32_t mgmtInitDbs() {
|
|||
.tableName = "dbs",
|
||||
.hashSessions = TSDB_MAX_DBS,
|
||||
.maxRowSize = tsDbUpdateSize,
|
||||
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
|
||||
.refCountPos = 0,//(int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
|
||||
.keyType = SDB_KEY_TYPE_STRING,
|
||||
.insertFp = mgmtDbActionInsert,
|
||||
.deleteFp = mgmtDbActionDelete,
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
#include "mgmtUser.h"
|
||||
#include "mgmtVgroup.h"
|
||||
|
||||
static void * tsChildTableSdb;
|
||||
static void * tsSuperTableSdb;
|
||||
void * tsChildTableSdb;
|
||||
void * tsSuperTableSdb;
|
||||
static int32_t tsChildTableUpdateSize;
|
||||
static int32_t tsSuperTableUpdateSize;
|
||||
|
||||
|
@ -239,7 +239,7 @@ static int32_t mgmtInitChildTables() {
|
|||
.tableName = "ctables",
|
||||
.hashSessions = tsMaxTables,
|
||||
.maxRowSize = sizeof(SChildTableObj) + sizeof(SSchema) * TSDB_MAX_COLUMNS,
|
||||
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
|
||||
.refCountPos = 0, //(int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
|
||||
.keyType = SDB_KEY_TYPE_STRING,
|
||||
.insertFp = mgmtChildTableActionInsert,
|
||||
.deleteFp = mgmtChildTableActionDelete,
|
||||
|
@ -415,7 +415,7 @@ static int32_t mgmtInitSuperTables() {
|
|||
.tableName = "stables",
|
||||
.hashSessions = TSDB_MAX_SUPER_TABLES,
|
||||
.maxRowSize = tsSuperTableUpdateSize + sizeof(SSchema) * TSDB_MAX_COLUMNS,
|
||||
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
|
||||
.refCountPos = 0, //(int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
|
||||
.keyType = SDB_KEY_TYPE_STRING,
|
||||
.insertFp = mgmtSuperTableActionInsert,
|
||||
.deleteFp = mgmtSuperTableActionDelete,
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "mgmtShell.h"
|
||||
#include "mgmtUser.h"
|
||||
|
||||
static void * tsUserSdb = NULL;
|
||||
void * tsUserSdb = NULL;
|
||||
static int32_t tsUserUpdateSize = 0;
|
||||
static int32_t mgmtGetUserMeta(STableMetaMsg *pMeta, SShowObj *pShow, void *pConn);
|
||||
static int32_t mgmtRetrieveUsers(SShowObj *pShow, char *data, int32_t rows, void *pConn);
|
||||
|
@ -97,7 +97,7 @@ int32_t mgmtInitUsers() {
|
|||
.tableName = "users",
|
||||
.hashSessions = TSDB_MAX_USERS,
|
||||
.maxRowSize = tsUserUpdateSize,
|
||||
.refCountPos = (int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
|
||||
.refCountPos = 0, //(int8_t *)(&tObj.refCount) - (int8_t *)&tObj,
|
||||
.keyType = SDB_KEY_TYPE_STRING,
|
||||
.insertFp = mgmtUserActionInsert,
|
||||
.deleteFp = mgmtUserActionDelete,
|
||||
|
@ -117,7 +117,6 @@ int32_t mgmtInitUsers() {
|
|||
mgmtCreateUser(pAcct, "root", "taosdata");
|
||||
mgmtCreateUser(pAcct, "monitor", tsInternalPass);
|
||||
mgmtCreateUser(pAcct, "_root", tsInternalPass);
|
||||
acctDecRef(pAcct);
|
||||
|
||||
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_CREATE_USER, mgmtProcessCreateUserMsg);
|
||||
mgmtAddShellMsgHandle(TSDB_MSG_TYPE_CM_ALTER_USER, mgmtProcessAlterUserMsg);
|
||||
|
|
Loading…
Reference in New Issue