Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ACL): The Acl cache should be updated on restart and restore #7926

Merged
merged 17 commits into from
Jul 15, 2021

Conversation

ahsanbarkati
Copy link
Contributor

@ahsanbarkati ahsanbarkati commented Jun 25, 2021


This change is Reviewable

// ResetAcls is an empty method since ACL is only supported in the enterprise version.
func RefreshAcls(closer *z.Closer) {
// SubscribeForAclUpdates is an empty method since ACL is only supported in the enterprise version.
func SubscribeForAclUpdates(closer *z.Closer) {
// do nothing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return. Why need to wait

@minhaj-shakeel minhaj-shakeel changed the title fix(ACL): The Acl cache should be updated on restart fix(ACL): The Acl cache should be updated on restart and restore Jul 6, 2021
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: Ensure that the licenses are correctly applied.

Reviewed 1 of 3 files at r1, 6 of 7 files at r2, 1 of 1 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ahsanbarkati)


worker/acl_cache.go, line 1 at r3 (raw file):

package worker

Keep the file under the same license. So, this file should stay as enterprise.

Also, if we were to compile with oss flag, would this then build?

edgraph/access_ee.go Outdated Show resolved Hide resolved
edgraph/access_ee.go Outdated Show resolved Hide resolved
Copy link
Contributor

@NamanJain8 NamanJain8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got a few comments. Rest looks good to me. Please address them before merging.

Reviewed 4 of 11 files at r4.
Reviewable status: 7 of 14 files reviewed, 8 unresolved discussions (waiting on @ahsanbarkati and @manishrjain)


edgraph/access_ee.go, line 372 at r4 (raw file):

		}
		maxRefreshTs = refreshTs
		ctx := x.AttachNamespace(closer.Ctx(), ns)

Seems like you probably don't need to attach namespace over here as we are passing the namespace in refreshAclCache.


edgraph/access_ee.go, line 376 at r4 (raw file):

		if !worker.AclCachePtr.Loaded() {
			updaters := z.NewCloser(1)
			RefreshACLs(updaters.Ctx())

Why do we need to call this? This will load the ACLs for all the namespaces 🤔


worker/acl_cache.go, line 43 at r4 (raw file):

}

func (cache *AclCache) Set() {

Don't we need lock over here and in the above functions?


worker/acl_cache.go, line 54 at r4 (raw file):

func (cache *AclCache) GetUserPredPerms(userId string) map[string]int32 {
	return cache.userPredPerms[userId]

I think it would be good to move the lock/unlock from the caller to GetUserPredPerms.

@minhaj-shakeel minhaj-shakeel merged commit 9759fb0 into release/v21.03-slash Jul 15, 2021
@minhaj-shakeel minhaj-shakeel deleted the ahsan/fix-acl-restart branch July 15, 2021 06:58
minhaj-shakeel pushed a commit that referenced this pull request Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants