-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Prevent dropping or altering of reserved predicates. #2967
Conversation
There is already logic to prevent certain internal predicates (ACL and type preds) from being dropped by a DropAll request. This change adds similar logic to prevent DropAttr and Schema requests from modifying or dropping reserved predicates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @golangcibot and @martinmr)
edgraph/server.go, line 287 at r2 (raw file):
// Reserved predicates cannot be dropped. if _, ok := x.InitialPreds[op.DropAttr]; len(op.DropAttr) > 0 && ok {
Let's keep the flow of code the same. We don't need to do this upfront. Move this to under op.DropAll.
edgraph/server.go, line 295 at r2 (raw file):
updates, schemaErr := schema.Parse(op.Schema) if schemaErr == nil { for _, update := range updates {
Move this to under the previous schema.Parse section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 1 of 2 files reviewed, 3 unresolved discussions (waiting on @golangcibot and @manishrjain)
edgraph/server.go, line 286 at r1 (raw file):
Previously, golangcibot (Bot from GolangCI) wrote…
File is not
goimports
-ed (fromgoimports
)
Done.
edgraph/server.go, line 287 at r2 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
Let's keep the flow of code the same. We don't need to do this upfront. Move this to under op.DropAll.
Done.
edgraph/server.go, line 295 at r2 (raw file):
Previously, manishrjain (Manish R Jain) wrote…
Move this to under the previous schema.Parse section.
Done.
Addressed comments. Ready for another review.
I didn't realized that the test was broken after I addressed the comments in the previous review. I have fixed that and this is ready for another round of review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r3.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @golangcibot and @manishrjain)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @golangcibot and @manishrjain)
Updated all references to x.InitialPreds with IsPredicateReserved()
… into martinmr/reserved-preds
There is already logic to prevent certain internal predicates (ACL and type preds) from being dropped by a DropAll request. This change adds similar logic to prevent DropAttr and Schema requests from modifying or dropping reserved predicates.
There is already logic to prevent certain internal predicates (ACL and
type preds) from being dropped by a DropAll request. This change adds
similar logic to prevent DropAttr and Schema requests from modifying or
dropping reserved predicates.
This change is