-
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
[BREAKING] fix(commit): make txn context more robust #7659
Conversation
65d1881
to
d2e09c3
Compare
766df2e
to
245e829
Compare
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: 0 of 7 files reviewed, 1 unresolved discussion (waiting on @manishrjain, @NamanJain8, and @vvbalaji-dgraph)
edgraph/server.go, line 1121 at r2 (raw file):
ctx = x.AttachJWTNamespace(ctx) if x.WorkerConfig.AclEnabled && req.GetStartTs() != 0 { // A fresh StartTs is assigned if it is 0.
Do we need this change?
245e829
to
d545f5c
Compare
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 7 files at r1, 5 of 6 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @NamanJain8 and @vvbalaji-dgraph)
This PR adds the hash field in Request and TxnContext. These changes will be needed by hypermodeinc/dgraph#7659 which makes the transactions more robust.
Earlier, the transaction was identified by its startTs. It was expected from users to protect their transactions. With the introduction of multi-tenancy, this notion needs to change. As the startTs are shared by namespaces, we need to make sure that users from namespace ns1 can not operate upon transactions from namespace ns2 accidentally or maliciously. This PR makes the context of the transaction more robust by attaching some information for validation of claim over startTs. It is expected from user to send this special hash for commit/abort/mutate/query at that particular timestamp. Note that this change is breaking as the clients have to be modified to operate with Dgraph after this change. Additionally, this PR refactors the tests.
Earlier, the transaction was identified by its
startTs
. It was expected from users to protect their transactions. With the introduction of multi-tenancy, this notion needs to change. As the startTs are shared by namespaces, we need to make sure that users from namespacens1
can not operate upon transactions from namespacens2
accidentally or maliciously.This PR makes the context of the transaction more robust by attaching some information for validation of claim over
startTs
. It is expected from user to send this specialhash
for commit/abort/mutate/query at that particular timestamp.Corresponding PR in dgo: dgraph-io/dgo#146
Note that this change is breaking as the clients have to be modified to operate with Dgraph after this change.
Additionally, this PR refactors the tests.
This change is