feat: support uniq grant
This commit is contained in:
parent
3f061a8460
commit
3e7884a4f7
|
@ -146,7 +146,7 @@ typedef struct SSTableVersion {
|
|||
} SSTableVersion;
|
||||
|
||||
typedef struct SGrantVersion {
|
||||
int32_t grantId;
|
||||
int64_t grantId;
|
||||
int32_t version;
|
||||
} SGrantVersion;
|
||||
|
||||
|
|
|
@ -568,6 +568,7 @@ typedef struct SCtgUpdateGrantInfoMsg {
|
|||
|
||||
typedef struct SCtgDropGrantInfoMsg {
|
||||
SCatalog* pCtg;
|
||||
int64_t grantId;
|
||||
} SCtgDropGrantInfoMsg;
|
||||
|
||||
typedef struct SCtgCacheOperation {
|
||||
|
@ -1040,10 +1041,12 @@ void ctgResetTbMetaTask(SCtgTask* pTask);
|
|||
void ctgFreeDbCache(SCtgDBCache* dbCache);
|
||||
int32_t ctgStbVersionSortCompare(const void* key1, const void* key2);
|
||||
int32_t ctgViewVersionSortCompare(const void* key1, const void* key2);
|
||||
int32_t ctgGrantVersionSortCompare(const void* key1, const void* key2);
|
||||
int32_t ctgDbCacheInfoSortCompare(const void* key1, const void* key2);
|
||||
int32_t ctgStbVersionSearchCompare(const void* key1, const void* key2);
|
||||
int32_t ctgDbCacheInfoSearchCompare(const void* key1, const void* key2);
|
||||
int32_t ctgViewVersionSearchCompare(const void* key1, const void* key2);
|
||||
int32_t ctgGrantVersionSearchCompare(const void* key1, const void* key2);
|
||||
void ctgFreeSTableMetaOutput(STableMetaOutput* pOutput);
|
||||
int32_t ctgUpdateMsgCtx(SCtgMsgCtx* pCtx, int32_t reqType, void* out, char* target);
|
||||
int32_t ctgAddMsgCtx(SArray* pCtxs, int32_t reqType, void* out, char* target);
|
||||
|
|
|
@ -1739,7 +1739,7 @@ int32_t ctgWriteGrantInfoToCache(SCatalog *pCtg, SGrantHbRsp *pRsp) {
|
|||
pCache->grantInfo = *pRsp;
|
||||
CTG_UNLOCK(CTG_WRITE, &pCache->lock);
|
||||
|
||||
ctgDebug("grant info updated to cache, version");
|
||||
ctgDebug("grant info updated to cache, flags:%u, version:%d", pRsp->flags, pRsp->version);
|
||||
|
||||
CTG_ERR_RET(ctgUpdateRentViewVersion(pCtg, dbFName, viewName, dbCache->dbId, pMeta->viewId, pCache));
|
||||
|
||||
|
@ -2540,15 +2540,18 @@ _return:
|
|||
}
|
||||
|
||||
int32_t ctgOpDropGrantInfo(SCtgCacheOperation *operation) {
|
||||
int32_t code = 0;
|
||||
int32_t code = 0;
|
||||
SCtgDropGrantInfoMsg *msg = operation->data;
|
||||
SCatalog *pCtg = msg->pCtg;
|
||||
SCatalog *pCtg = msg->pCtg;
|
||||
|
||||
if (pCtg->stopUpdate) {
|
||||
goto _return;
|
||||
}
|
||||
|
||||
printf("prop:%s:%d grant %s removed from rent\n");
|
||||
CTG_ERR_JRET(
|
||||
ctgMetaRentRemove(&pCtg->grantRent, msg->grantId, ctgGrantVersionSortCompare, ctgGrantVersionSearchCompare));
|
||||
|
||||
printf("prop:grant:0x%" PRIx64 "removed from rent", msg->grantId);
|
||||
|
||||
_return:
|
||||
|
||||
|
@ -2557,7 +2560,6 @@ _return:
|
|||
CTG_RET(code);
|
||||
}
|
||||
|
||||
|
||||
void ctgClearFreeCache(SCtgCacheOperation *operation) {
|
||||
SCtgClearCacheMsg *msg = operation->data;
|
||||
SCatalog *pCtg = msg->pCtg;
|
||||
|
|
|
@ -301,11 +301,9 @@ int32_t ctgUpdateRentViewVersion(SCatalog *pCtg, char *dbFName, char *viewName,
|
|||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t ctgUpdateRentGrantVersion(SCatalog *pCtg, int32_t grantId,
|
||||
SCtgGrantCache *pCache) {
|
||||
int32_t ctgUpdateRentGrantVersion(SCatalog *pCtg, int32_t grantId, SCtgGrantCache *pCache) {
|
||||
SGrantVersion metaRent = {.grantId = grantId, .version = pCache->grantInfo.version};
|
||||
|
||||
|
||||
CTG_ERR_RET(ctgMetaRentUpdate(&pCtg->grantRent, &metaRent, metaRent.grantId, sizeof(SGrantVersion),
|
||||
ctgGrantVersionSortCompare, ctgGrantVersionSearchCompare));
|
||||
|
||||
|
@ -313,8 +311,3 @@ int32_t ctgUpdateRentGrantVersion(SCatalog *pCtg, int32_t grantId,
|
|||
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue