Matteo

 

I will also suggest that you review your logic:

“So I don't want the Ranger plugin cache to act in this case, so I want to 
invalidate it right "before" pushing new policies so that those new policies 
will be soon synced to plugin and so be valid for the resource (e.g. HIVE).”

 

If you invalidate the cache and then add the policies, then there is a small 
window period that the plugin will pull in the policies before your policy 
update API call goes through. E.g. check the flow below T0 to Time 0, etc …

 

T0: Invalidate cache

T1: Plugin gets the Policies

T1: You make the API (same time as plugin is getting policies)

T2: Plugin call to get policies finish

T3: Your API finishes

 

But since there is a time issues, your changes might not have been pulled.

 

Bosco

 

 

From: Matteo Alessandroni <skylar...@apache.org>
Reply-To: <user@ranger.apache.org>
Date: Wednesday, June 26, 2019 at 8:43 PM
To: <user@ranger.apache.org>
Subject: Re: Programmatically invalidate cache of Ranger plugins

 

Madhan,

I am going to check that, thank you!

Regards,
Matteo

On 26/06/19 16:22, Madhan Neethiraj wrote:

Matteo,

 

Enhancements in RANGER-2349 introduced method 
RangerBasePlugin.refreshPoliciesAndTags(), which can be called by a plugin 
implementation to force-sync policies and tags from Ranger Admin (i.e. 
invalidate cache). This should help address your requirements. Please review.

 

Hope this helps.

 

Madhan 

 

 

 

 

From: Matteo Alessandroni <skylar...@apache.org>
Reply-To: "user@ranger.apache.org" <user@ranger.apache.org>
Date: Wednesday, June 26, 2019 at 5:37 AM
To: "user@ranger.apache.org" <user@ranger.apache.org>
Subject: Re: Programmatically invalidate cache of Ranger plugins

 

Hi Bosco,

well in general my flow is the following:
push policies to Ranger via REST API
those policies should be synced via the plugin (e.g. HIVE) right after the push
So I don't want the Ranger plugin cache to act in this case, so I want to 
invalidate it right "before" pushing new policies so that those new policies 
will be soon synced to plugin and so be valid for the resource (e.g. HIVE).

Matteo

 

On 26/06/19 13:22, Don Bosco Durai wrote:

Shouldn’t you be first making the REST API call and then invalidate the cache, 
so that you get the latest?

 

I feel, Abhay’s API should solve your use case, unless I got it wrong.

 

Bosco

 

 

From: Matteo Alessandroni <skylar...@apache.org>
Reply-To: <user@ranger.apache.org>
Date: Wednesday, June 26, 2019 at 12:58 PM
To: <user@ranger.apache.org>
Subject: Re: Programmatically invalidate cache of Ranger plugins

 

Hi Abhay,

thanks for the info!
That logic just downloads the latest policies and tags but it does not 
invalidate cache, right? My problem is that when I try to push new policies via 
REST API the plugin keeps previous cached policies and does not replace those 
with new ones so in that case I need to first invalidate cache and then push 
new policies.

Regards,
Matteo

On 25/06/19 23:11, Abhay Kulkarni wrote:

https://issues.apache.org/jira/browse/RANGER-2349 provides a way to download 
policies (and tags) on demand. Ranger plugin code may call 
RangerBasePlugin.refreshPoliciesAndTags() API to get the latest policies and 
tags. 

 

Thanks,

-Abhay

 

On Tue, Jun 25, 2019 at 9:11 AM Don Bosco Durai <bo...@apache.org> wrote:

You want to shorten the refresh time or explicitly trigger cache invalidate? 
The former is easy and there is a property to do it. 

 

Bosco

 

 

From: Matteo Alessandroni <skylar...@apache.org>
Reply-To: <user@ranger.apache.org>
Date: Tuesday, June 25, 2019 at 8:45 PM
To: "user@ranger.apache.org" <user@ranger.apache.org>
Subject: Programmatically invalidate cache of Ranger plugins

 

Hi,

is there a way to programmatically refresh cache of a Ranger plugin?
I'm talking about the part related to [1].

Thanks.
Best regards,
Matteo


[1] http://community.hortonworks.com/answers/66604/view.html

 








Reply via email to