From 28d731646266dec9071d24e154d1e98b2f5a88b3 Mon Sep 17 00:00:00 2001 From: kailixu Date: Tue, 18 Jul 2023 07:53:05 +0800 Subject: [PATCH] chore: add enable is tsc obj --- include/common/tmsg.h | 1 + source/client/inc/clientInt.h | 1 + source/client/src/clientHb.c | 6 ++++++ source/common/src/tmsg.c | 9 ++++++++- source/dnode/mnode/impl/src/mndProfile.c | 1 + 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/common/tmsg.h b/include/common/tmsg.h index b9365172d5..6c85fc9d7f 100644 --- a/include/common/tmsg.h +++ b/include/common/tmsg.h @@ -632,6 +632,7 @@ typedef struct { int8_t superUser; int8_t sysInfo; int8_t connType; + int8_t enable; SEpSet epSet; int32_t svrTimestamp; int32_t passVer; diff --git a/source/client/inc/clientInt.h b/source/client/inc/clientInt.h index 736582dff2..b234a99678 100644 --- a/source/client/inc/clientInt.h +++ b/source/client/inc/clientInt.h @@ -141,6 +141,7 @@ typedef struct STscObj { char sVer[TSDB_VERSION_LEN]; char sDetailVer[128]; int8_t sysInfo; + int8_t enable; int8_t connType; int32_t acctId; uint32_t connId; diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index 54e3a6ee48..e9c09bdc6e 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -104,6 +104,12 @@ static int32_t hbUpdateUserAuthInfo(SAppHbMgr *pAppHbMgr, SUserAuthBatchRsp *bat pTscObj->sysInfo = pRsp->sysInfo; } + if (pTscObj->enable != pRsp->enable) { + tscDebug("update enable of user %s from %" PRIi8 " to %" PRIi8 ", tscRid:%" PRIi64, pRsp->user, pTscObj->enable, + pRsp->enable, pTscObj->id); + pTscObj->enable = pRsp->enable; + } + if (pTscObj->passInfo.fp) { SPassInfo *passInfo = &pTscObj->passInfo; int32_t oldVer = atomic_load_32(&passInfo->ver); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index a25ee04a1b..2370381df5 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -4117,7 +4117,8 @@ int32_t tSerializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { if (tEncodeCStr(&encoder, pRsp->sVer) < 0) return -1; if (tEncodeCStr(&encoder, pRsp->sDetailVer) < 0) return -1; if (tEncodeI32(&encoder, pRsp->passVer) < 0) return -1; - if (tEncodeI32(&encoder, pRsp->authVer) < 0) return -1; + if (tEncodeI32(&encoder, pRsp->authVer) < 0) return -1; // since 3.0.7.0 + if (tEncodeI8(&encoder, pRsp->enable) < 0) return -1; // since 3.1.0.0 tEndEncode(&encoder); int32_t tlen = encoder.pos; @@ -4153,6 +4154,12 @@ int32_t tDeserializeSConnectRsp(void *buf, int32_t bufLen, SConnectRsp *pRsp) { } else { pRsp->authVer = 0; } + // since 3.1.0.0 + if (!tDecodeIsEnd(&decoder)) { + if (tDecodeI8(&decoder, &pRsp->enable) < 0) return -1; + } else { + pRsp->enable = 0; + } tEndDecode(&decoder); diff --git a/source/dnode/mnode/impl/src/mndProfile.c b/source/dnode/mnode/impl/src/mndProfile.c index 524ea1a06b..d2160cb7c7 100644 --- a/source/dnode/mnode/impl/src/mndProfile.c +++ b/source/dnode/mnode/impl/src/mndProfile.c @@ -282,6 +282,7 @@ _CONNECT: connectRsp.acctId = pUser->acctId; connectRsp.superUser = pUser->superUser; connectRsp.sysInfo = pUser->sysInfo; + connectRsp.enable = pUser->enable; connectRsp.clusterId = pMnode->clusterId; connectRsp.connId = pConn->id; connectRsp.connType = connReq.connType; -- GitLab