You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "Madhan Neethiraj (Jira)" <ji...@apache.org> on 2022/12/10 07:08:00 UTC

[jira] [Resolved] (RANGER-4004) During the service deletion also, we can clear the in-memory cache for that service which got deleted on the ranger side

     [ https://issues.apache.org/jira/browse/RANGER-4004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Madhan Neethiraj resolved RANGER-4004.
--------------------------------------
    Fix Version/s: 3.0.0
                   2.4.0
       Resolution: Fixed

[~ramackri] - thank you for the patch.  It is now merged in master and ranger-2.4 branches.

 
{noformat}
commit 7a4a871559ad2518a99b7d3a08d55f29ff408613 (HEAD -> master, origin/master, origin/HEAD)
Author: Ramachandran Krishnan <ra...@gmail.com>
Date:   Fri Dec 9 08:59:16 2022 +0530

    RANGER-4004: During the service deletion also, we can clear the in-memory cache for that service which got deleted on the ranger side

    Signed-off-by: Madhan Neethiraj <ma...@apache.org>
{noformat}
 
{noformat}
commit f379788d01b9644c367434b0d874ba5fc3cd5406 (HEAD -> ranger-2.4, origin/ranger-2.4)
Author: Ramachandran Krishnan <ra...@gmail.com>
Date:   Fri Dec 9 08:59:16 2022 +0530

    RANGER-4004: During the service deletion also, we can clear the in-memory cache for that service which got deleted on the ranger side

    Signed-off-by: Madhan Neethiraj <ma...@apache.org>
    (cherry picked from commit 7a4a871559ad2518a99b7d3a08d55f29ff408613)
{noformat}

> During the service deletion also, we can clear the in-memory cache for that service which got deleted on the ranger side
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: RANGER-4004
>                 URL: https://issues.apache.org/jira/browse/RANGER-4004
>             Project: Ranger
>          Issue Type: Improvement
>          Components: Ranger
>    Affects Versions: 3.0.0, 2.3.0
>            Reporter: Ramachandran
>            Assignee: Ramachandran
>            Priority: Major
>             Fix For: 3.0.0, 2.4.0
>
>         Attachments: 0001-RANGER-4004-During-the-service-deletion-also-we-can--1.patch, Screenshot 2022-12-08 at 12.58.16 PM.png
>
>
> During the servie deletion ,we need to clear the RangerServicePoliciesCache for the given serviceName
> {code:java}
>  
> @Override
> public void deleteService(Long id) throws Exception {
> if(LOG.isDebugEnabled()) {
> LOG.debug("==> ServiceDBStore.deleteService(" + id + ")");
> }
> RangerService service = getService(id);
> if(service == null) {
> throw new Exception("no service exists with ID=" + id);
> }
> // Manage zone
> disassociateZonesForService(service); //RANGER-3016
> List<Long> policyIds = daoMgr.getXXPolicy().findPolicyIdsByServiceId(service.getId());
> if (CollectionUtils.isNotEmpty(policyIds)) {
> long totalDeletedPolicies = 0;
> for (Long policyID : policyIds) {
> RangerPolicy rangerPolicy = getPolicy(policyID);
> deletePolicy(rangerPolicy, service);
> totalDeletedPolicies = totalDeletedPolicies + 1;
> // its a bulk policy delete call flush and clear
> if (totalDeletedPolicies % RangerBizUtil.policyBatchSize == 0) {
> bizUtil.bulkModeOnlyFlushAndClear();
> }
> }
> bizUtil.bulkModeOnlyFlushAndClear();
> }
> XXServiceConfigMapDao configDao = daoMgr.getXXServiceConfigMap();
> List<XXServiceConfigMap> configs = configDao.findByServiceId(service.getId());
> for (XXServiceConfigMap configMap : configs) {
> configDao.remove(configMap);
> }
> // Purge x_rms data
> daoMgr.getXXRMSServiceResource().purge(service.getId());
> Long version = service.getVersion();
> if(version == null) {
> version = Long.valueOf(1);
> LOG.info("Found Version Value: `null`, so setting value of version to 1, While updating object, version should not be null.");
> } else {
> version = Long.valueOf(version.longValue() + 1);
> }
> service.setVersion(version);
> svcService.delete(service);
> dataHistService.createObjectDataHistory(service, RangerDataHistService.ACTION_DELETE);
> List<XXTrxLog> trxLogList = svcService.getTransactionLog(service, RangerServiceService.OPERATION_DELETE_CONTEXT);
> bizUtil.createTrxLog(trxLogList);
> //During the servie deletion ,we need to clear the RangerServicePoliciesCache for the given serviceName.
> resetPolicyCache(service.getName());
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)