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(multi-tenancy): upsert groot for namespace after drop data #9113

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions edgraph/access_ee.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,26 @@ func InitializeAcl(closer *z.Closer) {
upsertGuardianAndGroot(closer, x.GalaxyNamespace)
}

func RestoreGuardianAndGroot(ctx context.Context, passwd string) {
for ctx.Err() == nil {
if err := upsertGuardian(ctx); err != nil {
glog.Infof("Unable to upsert the guardian group. Error: %v", err)
time.Sleep(100 * time.Millisecond)
continue
}
break
}

for ctx.Err() == nil {
if err := upsertGroot(ctx, passwd); err != nil {
glog.Infof("Unable to upsert the groot account. Error: %v", err)
time.Sleep(100 * time.Millisecond)
continue
}
break
}
}

// Note: The handling of closer should be done by caller.
func upsertGuardianAndGroot(closer *z.Closer, ns uint64) {
if worker.Config.AclSecretKey == nil {
Expand Down
6 changes: 4 additions & 2 deletions edgraph/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ func (s *Server) Alter(ctx context.Context, op *api.Operation) (*api.Payload, er
// reset their in-memory GraphQL schema
_, err = UpdateGQLSchema(ctx, "", "")
// recreate the admin account after a drop all operation
InitializeAcl(nil)
// InitializeAcl(nil)
RestoreGuardianAndGroot(ctx, "password")
return empty, err
}

Expand Down Expand Up @@ -459,7 +460,8 @@ func (s *Server) Alter(ctx context.Context, op *api.Operation) (*api.Payload, er
// just reinsert the GraphQL schema, no need to alter dgraph schema as this was drop_data
_, err = UpdateGQLSchema(ctx, graphQLSchema, "")
// recreate the admin account after a drop data operation
InitializeAcl(nil)
// InitializeAcl(nil)
RestoreGuardianAndGroot(ctx, "password")
return empty, err
}

Expand Down
Loading