提交 d1c31282 编写于 作者: S slguan

Merge branch 'master' into develop

# Conflicts:
#	src/client/src/tscFunctionImpl.c
#	src/client/src/tscServer.c
...@@ -3889,7 +3889,7 @@ static void getStatics_d(int64_t *primaryKey, double *data, int32_t numOfRow, do ...@@ -3889,7 +3889,7 @@ static void getStatics_d(int64_t *primaryKey, double *data, int32_t numOfRow, do
dsum += dv; dsum += dv;
if (dmin > dv) { if (dmin > dv) {
dmin = dv; dmin = dv;
*minIndex = i; *minIndex = i;
} }
if (dmax < dv) { if (dmax < dv) {
......
...@@ -480,8 +480,19 @@ void *tscProcessMsgFromServer(char *msg, void *ahandle, void *thandle) { ...@@ -480,8 +480,19 @@ void *tscProcessMsgFromServer(char *msg, void *ahandle, void *thandle) {
if (code == 0) return pSql; if (code == 0) return pSql;
msg = NULL; msg = NULL;
} else if (rspCode == TSDB_CODE_NOT_ACTIVE_TABLE || rspCode == TSDB_CODE_INVALID_TABLE_ID || } else if (rspCode == TSDB_CODE_NOT_ACTIVE_TABLE || rspCode == TSDB_CODE_INVALID_TABLE_ID ||
rspCode == TSDB_CODE_NOT_ACTIVE_VNODE || rspCode == TSDB_CODE_INVALID_VNODE_ID || rspCode == TSDB_CODE_INVALID_VNODE_ID || rspCode == TSDB_CODE_NOT_ACTIVE_VNODE ||
rspCode == TSDB_CODE_TABLE_ID_MISMATCH || rspCode == TSDB_CODE_NETWORK_UNAVAIL) { rspCode == TSDB_CODE_NETWORK_UNAVAIL || rspCode == TSDB_CODE_NOT_ACTIVE_SESSION ||
rspCode == TSDB_CODE_TABLE_ID_MISMATCH) {
/*
* not_active_table: 1. the virtual node may fail to create table, since the procedure of create table is asynchronized,
* the virtual node may have not create table till now, so try again by using the new metermeta.
* 2. this requested table may have been removed by other client, so we need to renew the
* metermeta here.
*
* not_active_vnode: current vnode is move to other node due to node balance procedure or virtual node have been
* removed. So, renew metermeta and try again.
* not_active_session: db has been move to other node, the vnode does not exist on this dnode anymore.
*/
#else #else
if (rspCode == TSDB_CODE_NOT_ACTIVE_TABLE || rspCode == TSDB_CODE_INVALID_TABLE_ID || if (rspCode == TSDB_CODE_NOT_ACTIVE_TABLE || rspCode == TSDB_CODE_INVALID_TABLE_ID ||
rspCode == TSDB_CODE_NOT_ACTIVE_VNODE || rspCode == TSDB_CODE_INVALID_VNODE_ID || rspCode == TSDB_CODE_NOT_ACTIVE_VNODE || rspCode == TSDB_CODE_INVALID_VNODE_ID ||
......
...@@ -906,7 +906,10 @@ int taosProcessMsgHeader(STaosHeader *pHeader, SRpcConn **ppConn, STaosRpc *pSer ...@@ -906,7 +906,10 @@ int taosProcessMsgHeader(STaosHeader *pHeader, SRpcConn **ppConn, STaosRpc *pSer
} }
if (taosAuthenticateMsg((uint8_t *)pHeader, dataLen - TSDB_AUTH_LEN, pDigest->auth, pConn->secret) < 0) { if (taosAuthenticateMsg((uint8_t *)pHeader, dataLen - TSDB_AUTH_LEN, pDigest->auth, pConn->secret) < 0) {
tTrace("%s cid:%d sid:%d id:%s, authentication failed, msg discarded pConn:%p", pServer->label, chann, sid, char ipstr[24];
tinet_ntoa(ipstr, ip);
mLError("user:%s login from %s, authentication failed", pHeader->meterId, ipstr);
tError("%s cid:%d sid:%d id:%s, authentication failed, msg discarded pConn:%p", pServer->label, chann, sid,
pConn->meterId, pConn); pConn->meterId, pConn);
code = TSDB_CODE_AUTH_FAILURE; code = TSDB_CODE_AUTH_FAILURE;
goto _exit; goto _exit;
......
...@@ -668,6 +668,11 @@ int mgmtRetrieveDbs(SShowObj *pShow, char *data, int rows, SConnObj *pConn) { ...@@ -668,6 +668,11 @@ int mgmtRetrieveDbs(SShowObj *pShow, char *data, int rows, SConnObj *pConn) {
pDb = (SDbObj *)pShow->pNode; pDb = (SDbObj *)pShow->pNode;
if (pDb == NULL) break; if (pDb == NULL) break;
pShow->pNode = (void *)pDb->next; pShow->pNode = (void *)pDb->next;
if (mgmtCheckIsMonitorDB(pDb->name, tsMonitorDbName)) {
if (strcmp(pConn->pUser->user, "root") != 0 && strcmp(pConn->pUser->user, "_root") != 0 && strcmp(pConn->pUser->user, "monitor") != 0 ) {
continue;
}
}
cols = 0; cols = 0;
......
...@@ -1270,6 +1270,11 @@ int mgmtRetrieveMeters(SShowObj *pShow, char *data, int rows, SConnObj *pConn) { ...@@ -1270,6 +1270,11 @@ int mgmtRetrieveMeters(SShowObj *pShow, char *data, int rows, SConnObj *pConn) {
if (pConn->pDb != NULL) pDb = mgmtGetDb(pConn->pDb->name); if (pConn->pDb != NULL) pDb = mgmtGetDb(pConn->pDb->name);
if (pDb == NULL) return 0; if (pDb == NULL) return 0;
if (mgmtCheckIsMonitorDB(pDb->name, tsMonitorDbName)) {
if (strcmp(pConn->pUser->user, "root") != 0 && strcmp(pConn->pUser->user, "_root") != 0 && strcmp(pConn->pUser->user, "monitor") != 0 ) {
return 0;
}
}
strcpy(prefix, pDb->name); strcpy(prefix, pDb->name);
strcat(prefix, TS_PATH_DELIMITER); strcat(prefix, TS_PATH_DELIMITER);
...@@ -1387,6 +1392,16 @@ int mgmtRetrieveMetrics(SShowObj *pShow, char *data, int rows, SConnObj *pConn) ...@@ -1387,6 +1392,16 @@ int mgmtRetrieveMetrics(SShowObj *pShow, char *data, int rows, SConnObj *pConn)
char * pWrite; char * pWrite;
int cols = 0; int cols = 0;
SDbObj *pDb = NULL;
if (pConn->pDb != NULL) pDb = mgmtGetDb(pConn->pDb->name);
if (pDb == NULL) return 0;
if (mgmtCheckIsMonitorDB(pDb->name, tsMonitorDbName)) {
if (strcmp(pConn->pUser->user, "root") != 0 && strcmp(pConn->pUser->user, "_root") != 0 && strcmp(pConn->pUser->user, "monitor") != 0 ) {
return 0;
}
}
SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER; SPatternCompareInfo info = PATTERN_COMPARE_INFO_INITIALIZER;
char metricName[TSDB_METER_NAME_LEN] = {0}; char metricName[TSDB_METER_NAME_LEN] = {0};
......
...@@ -734,8 +734,11 @@ int mgmtProcessAlterUserMsg(char *pMsg, int msgLen, SConnObj *pConn) { ...@@ -734,8 +734,11 @@ int mgmtProcessAlterUserMsg(char *pMsg, int msgLen, SConnObj *pConn) {
if ((pAlter->flag & TSDB_ALTER_USER_PRIVILEGES) != 0) { if ((pAlter->flag & TSDB_ALTER_USER_PRIVILEGES) != 0) {
bool hasRight = false; bool hasRight = false;
if (strcmp(pUser->user, "root") == 0) { if (strcmp(pUser->user, "root") == 0) {
hasRight = false; hasRight = false;
} else if (strcmp(pUser->user, pUser->acct) == 0) {
hasRight = false;
} else if (strcmp(pOperUser->user, "root") == 0) { } else if (strcmp(pOperUser->user, "root") == 0) {
hasRight = true; hasRight = true;
} else if (strcmp(pUser->user, pOperUser->user) == 0) { } else if (strcmp(pUser->user, pOperUser->user) == 0) {
...@@ -750,21 +753,24 @@ int mgmtProcessAlterUserMsg(char *pMsg, int msgLen, SConnObj *pConn) { ...@@ -750,21 +753,24 @@ int mgmtProcessAlterUserMsg(char *pMsg, int msgLen, SConnObj *pConn) {
} }
} }
if (pAlter->privilege == 1) { // super
hasRight = false;
}
if (hasRight) { if (hasRight) {
if ((pAlter->flag & TSDB_ALTER_USER_PRIVILEGES) != 0) { //if (pAlter->privilege == 1) { // super
if (pAlter->privilege == 1) { // super // pUser->superAuth = 1;
pUser->superAuth = 1; // pUser->writeAuth = 1;
pUser->writeAuth = 1; //}
} if (pAlter->privilege == 2) { // read
if (pAlter->privilege == 2) { // read pUser->superAuth = 0;
pUser->superAuth = 0; pUser->writeAuth = 0;
pUser->writeAuth = 0;
}
if (pAlter->privilege == 3) { // write
pUser->superAuth = 0;
pUser->writeAuth = 1;
}
} }
if (pAlter->privilege == 3) { // write
pUser->superAuth = 0;
pUser->writeAuth = 1;
}
code = mgmtUpdateUser(pUser); code = mgmtUpdateUser(pUser);
mLPrint("user:%s privilege is altered by %s, code:%d", pAlter->user, pConn->pUser->user, code); mLPrint("user:%s privilege is altered by %s, code:%d", pAlter->user, pConn->pUser->user, code);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册