fix: restore user privilege processing if the rows generated by the user exceeds max block rows
This commit is contained in:
parent
d0b9c5172c
commit
215e358ce3
|
@ -1213,16 +1213,32 @@ static int32_t mndRetrievePrivileges(SRpcMsg *pReq, SShowObj *pShow, SSDataBlock
|
||||||
int32_t cols = 0;
|
int32_t cols = 0;
|
||||||
char *pWrite;
|
char *pWrite;
|
||||||
|
|
||||||
|
bool fetchNextUser = pShow->restore ? false : true;
|
||||||
|
pShow->restore = false;
|
||||||
|
|
||||||
while (numOfRows < rows) {
|
while (numOfRows < rows) {
|
||||||
pShow->pIter = sdbFetch(pSdb, SDB_USER, pShow->pIter, (void **)&pUser);
|
if (fetchNextUser) {
|
||||||
if (pShow->pIter == NULL) break;
|
pShow->pIter = sdbFetch(pSdb, SDB_USER, pShow->pIter, (void **)&pUser);
|
||||||
|
if (pShow->pIter == NULL) break;
|
||||||
|
} else {
|
||||||
|
fetchNextUser = true;
|
||||||
|
void *pKey = taosHashGetKey(pShow->pIter, NULL);
|
||||||
|
pUser = sdbAcquire(pSdb, SDB_USER, pKey);
|
||||||
|
if (!pUser) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int32_t numOfReadDbs = taosHashGetSize(pUser->readDbs);
|
int32_t numOfReadDbs = taosHashGetSize(pUser->readDbs);
|
||||||
int32_t numOfWriteDbs = taosHashGetSize(pUser->writeDbs);
|
int32_t numOfWriteDbs = taosHashGetSize(pUser->writeDbs);
|
||||||
int32_t numOfTopics = taosHashGetSize(pUser->topics);
|
int32_t numOfTopics = taosHashGetSize(pUser->topics);
|
||||||
int32_t numOfReadTbs = taosHashGetSize(pUser->readTbs);
|
int32_t numOfReadTbs = taosHashGetSize(pUser->readTbs);
|
||||||
int32_t numOfWriteTbs = taosHashGetSize(pUser->writeTbs);
|
int32_t numOfWriteTbs = taosHashGetSize(pUser->writeTbs);
|
||||||
if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics + numOfReadTbs + numOfWriteTbs >= rows) break;
|
if (numOfRows + numOfReadDbs + numOfWriteDbs + numOfTopics + numOfReadTbs + numOfWriteTbs >= rows) {
|
||||||
|
pShow->restore = true;
|
||||||
|
sdbRelease(pSdb, pUser);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (pUser->superUser) {
|
if (pUser->superUser) {
|
||||||
cols = 0;
|
cols = 0;
|
||||||
|
|
Loading…
Reference in New Issue