[TD-17] make cluster can be compiled
This commit is contained in:
parent
ecae31bbbf
commit
10485e3396
|
@ -14,11 +14,11 @@
|
|||
*/
|
||||
|
||||
#define _DEFAULT_SOURCE
|
||||
#ifndef _ACCOUNT
|
||||
#include "os.h"
|
||||
#include "taoserror.h"
|
||||
#include "mnode.h"
|
||||
#include "mgmtAcct.h"
|
||||
#ifndef _ACCOUNT
|
||||
|
||||
static SAcctObj tsAcctObj = {0};
|
||||
|
||||
|
@ -31,10 +31,78 @@ int32_t acctInit() {
|
|||
void acctCleanUp() {}
|
||||
SAcctObj *acctGetAcct(char *acctName) { return &tsAcctObj; }
|
||||
int32_t acctCheck(SAcctObj *pAcct, EAcctGrantType type) { return TSDB_CODE_SUCCESS; }
|
||||
#endif
|
||||
|
||||
int32_t acctAddDb(SAcctObj *pAcct, SDbObj *pDb) { return TSDB_CODE_SUCCESS; }
|
||||
int32_t acctRemoveDb(SAcctObj *pAcct, SDbObj *pDb) { return TSDB_CODE_SUCCESS; }
|
||||
int32_t acctAddUser(SAcctObj *pAcct, SUserObj *pUser) { return TSDB_CODE_SUCCESS; }
|
||||
int32_t acctRemoveUser(SAcctObj *pAcct, SUserObj *pUser) { return TSDB_CODE_SUCCESS; }
|
||||
int32_t acctAddDb(SAcctObj *pAcct, SDbObj *pDb) {
|
||||
pthread_mutex_lock(&pAcct->mutex);
|
||||
pDb->next = pAcct->pHead;
|
||||
pDb->prev = NULL;
|
||||
pDb->pAcct = pAcct;
|
||||
|
||||
#endif
|
||||
if (pAcct->pHead) {
|
||||
pAcct->pHead->prev = pDb;
|
||||
}
|
||||
|
||||
pAcct->pHead = pDb;
|
||||
pAcct->acctInfo.numOfDbs++;
|
||||
pthread_mutex_unlock(&pAcct->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t acctRemoveDb(SAcctObj *pAcct, SDbObj *pDb) {
|
||||
pthread_mutex_lock(&pAcct->mutex);
|
||||
if (pDb->prev) {
|
||||
pDb->prev->next = pDb->next;
|
||||
}
|
||||
|
||||
if (pDb->next) {
|
||||
pDb->next->prev = pDb->prev;
|
||||
}
|
||||
|
||||
if (pDb->prev == NULL) {
|
||||
pAcct->pHead = pDb->next;
|
||||
}
|
||||
|
||||
pAcct->acctInfo.numOfDbs--;
|
||||
pthread_mutex_unlock(&pAcct->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t acctAddUser(SAcctObj *pAcct, SUserObj *pUser) {
|
||||
pthread_mutex_lock(&pAcct->mutex);
|
||||
pUser->next = pAcct->pUser;
|
||||
pUser->prev = NULL;
|
||||
|
||||
if (pAcct->pUser) {
|
||||
pAcct->pUser->prev = pUser;
|
||||
}
|
||||
|
||||
pAcct->pUser = pUser;
|
||||
pAcct->acctInfo.numOfUsers++;
|
||||
pUser->pAcct = pAcct;
|
||||
pthread_mutex_unlock(&pAcct->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t acctRemoveUser(SAcctObj *pAcct, SUserObj *pUser) {
|
||||
pthread_mutex_lock(&pAcct->mutex);
|
||||
if (pUser->prev) {
|
||||
pUser->prev->next = pUser->next;
|
||||
}
|
||||
|
||||
if (pUser->next) {
|
||||
pUser->next->prev = pUser->prev;
|
||||
}
|
||||
|
||||
if (pUser->prev == NULL) {
|
||||
pAcct->pUser = pUser->next;
|
||||
}
|
||||
|
||||
pAcct->acctInfo.numOfUsers--;
|
||||
pthread_mutex_unlock(&pAcct->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -23,7 +23,7 @@
|
|||
int32_t grantInit() { return TSDB_CODE_SUCCESS; }
|
||||
void grantCleanUp() {}
|
||||
void grantParseParameter() { mError("can't parsed parameter k"); }
|
||||
int32_t grantCheck(EGrantType grant) { return true; }
|
||||
int32_t grantCheck(EGrantType grant) { return TSDB_CODE_SUCCESS; }
|
||||
void grantReset(EGrantType grant, uint64_t value) {}
|
||||
void grantAdd(EGrantType grant, uint64_t value) {}
|
||||
void grantRestore(EGrantType grant, uint64_t value) {}
|
||||
|
|
|
@ -81,7 +81,7 @@ float tsRatioOfQueryThreads = 0.5;
|
|||
char tsPublicIp[TSDB_IPv4ADDR_LEN] = {0};
|
||||
char tsPrivateIp[TSDB_IPv4ADDR_LEN] = {0};
|
||||
short tsNumOfVnodesPerCore = 8;
|
||||
short tsNumOfTotalVnodes = 0;
|
||||
short tsNumOfTotalVnodes = TSDB_INVALID_VNODE_NUM;
|
||||
short tsCheckHeaderFile = 0;
|
||||
|
||||
#ifdef _TD_ARM_32_
|
||||
|
@ -960,7 +960,7 @@ bool tsReadGlobalConfig() {
|
|||
tsNumOfCores = 1;
|
||||
}
|
||||
|
||||
if (tsNumOfTotalVnodes == -1) {
|
||||
if (tsNumOfTotalVnodes == TSDB_INVALID_VNODE_NUM) {
|
||||
tsNumOfTotalVnodes = tsNumOfCores * tsNumOfVnodesPerCore;
|
||||
tsNumOfTotalVnodes = tsNumOfTotalVnodes > TSDB_MAX_VNODES ? TSDB_MAX_VNODES : tsNumOfTotalVnodes;
|
||||
tsNumOfTotalVnodes = tsNumOfTotalVnodes < TSDB_MIN_VNODES ? TSDB_MIN_VNODES : tsNumOfTotalVnodes;
|
||||
|
|
Loading…
Reference in New Issue