-
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
server executes only one of two mutations requested #2815
Comments
The syntax is wrong. {
set {
_:a1 < reg > "a1 content" .
_:a2 < reg > "a2 content" .
}
} Ratel does one mutation at a time. |
I think this is a bug and should remain open. Ratel should execute all the independent mutations supplied in the text given. The syntax is correct for two independent transactions. |
@MichelDiz At the very least this a usability issue. Is certainly surprised me as a first time, new user--and that is a valuable perspective to leverage. Copying transactions from the tour is how I found this. At a minimum, if Ratel is going to ignore some part of the entered text (which is ridiculous), then it should warn the user that part of the user's request is going to be arbitrarily ignored. |
Ratel is just a tool. There's no need for dealing with transactions - cuz Ratel commit it immediately. You can't do much with it. If you wanna for some reason do multiple transactions, you must use a client for this. This usage isn't predict for Ratel. And it does not make much sense within Ratel this feature*. However if you still need this feature, open an issue in Ratel's repository. But notice if there is no duplicate. |
Turns out that the problem is on the server rather than with Ratel. Here I reproduce outside of Ratel:
|
Another, distinct example of syntax which results in data loss and no syntax error would be this one. The difference is that I've deleted
Here a1 is lost and only b2 is set:
|
@glycerine this usage ins't predict anywhere in documentation. This isn't data loss cuz you're using Dgraph in a non-existent way. The "Set" block mutation it is intended to be used only once for each command. If you want two transactions, make two calls. @srfrog @gitlw what do you guys think? make the same thing as the #2675 ? I don't know if would be good to add a check there or just warn in docs that this usage is wrong. |
In my humble opinion (and that of the Go authors), "warnings" are bad: we users rarely see them and almost always ignore them. If its going to result in data loss, just error out with a syntax error and force me to find the right syntax. That teaches me what the right syntax is, and I never succeed in doing something that I expect should add data but has actually discarded data. |
Scalability wise I really think that multiple independent mutations should be allowed. If I am aggregating multiple mutation requests from different partners, I won't know how to re-combine their requests, because that would require me to parse and re-write their requests. And it would be really slow to have to make a client-server roundtrip per request that I am aggregating. Far better to simply write a simple loop in the server to loop over the submitted text and execute all the transactions found. I'm happy to add such code in a PR if someone would kindly point me to the source file where the mutation parsing is done. And re-open this bug. |
We should indeed return error when there are two set instructions. This is a valid issue. Let's treat it as such. |
@glycerine if you want to contribute, you can look at gql module. We should return error if the user input does not eof after the block ends. |
The latest as of this writing. In docker
dgraph/dgraph:latest
What is the hardware spec (RAM, OS)?
OSX 10.13.6, 16GB ram
Steps to reproduce the issue (command/config used to run Dgraph).
Given the following two mutations entered into the Mutate tab of Ratel the web gui:
and then Press Run.
I expected that both mutations would be run.
However, only the first mutation is run. Any mutations after the first are ignored.
update: reg is defined as
The text was updated successfully, but these errors were encountered: