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

[BREAKING] fix(commit): make txn context more robust #7659

Merged
merged 5 commits into from
Apr 1, 2021

Conversation

NamanJain8
Copy link
Contributor

@NamanJain8 NamanJain8 commented Mar 26, 2021

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.

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 Reviewable

@NamanJain8 NamanJain8 marked this pull request as ready for review March 30, 2021 17:51
@NamanJain8 NamanJain8 changed the title fix(commit): make txn context more robust [BREAKING] fix(commit): make txn context more robust Mar 30, 2021
@NamanJain8 NamanJain8 force-pushed the naman/txn-hash branch 3 times, most recently from 766df2e to 245e829 Compare March 31, 2021 12:35
Copy link
Contributor

@ahsanbarkati ahsanbarkati left a 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?

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:

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)

NamanJain8 added a commit to dgraph-io/dgo that referenced this pull request Apr 1, 2021
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.
@NamanJain8 NamanJain8 merged commit 4f8db71 into release/v21.03 Apr 1, 2021
@NamanJain8 NamanJain8 deleted the naman/txn-hash branch April 1, 2021 17:10
aman-bansal pushed a commit that referenced this pull request Apr 8, 2021
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.
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.

3 participants