Pending transactions found when updating Schema

{"errors":[{"message":"resolving updateGQLSchema failed because succeeded in saving GraphQL schema but failed to alter Dgraph schema - this indicates a bug in Dgraph schema generation. Please let us know : https://github.com/dgraph-io/dgraph/issues. Don't forget to post your old and new schemas in the issue description.: Pending transactions found. Please retry operation (Locations: [{Line: 3, Column: 4}])","extensions":{"code":"Error"}}]}

Steps taken to get to this error:

  1. DROP ALL w/schema
  2. Import GraphQL Schema
  3. Stop ec2 Instance (which is running docker with alpha and zero)
  4. Increase ec2 to t3.xlarge for big import
  5. Start ec2 Instance
  6. Use Live Loader to load 8.5M n-quads (we’re growing :slight_smile: )
  7. Stop ec2 Instance
  8. Reduce back down to a t3.large
  9. Start ec2 Instance
  10. Try to import same schema

This has been my process for starting afresh. I am not going to post my schema here because of the sheer size and for security reasons.


Edit: it is working now. hmm… maybe it just took some time to bring everything back online. Maybe this error message needs adjusted because there is not a bug in Dgraph schema generation, just waiting for other startup scripts to finish first.

Why is all this in the error message? @pawan

Seems the predicates that you were trying to import in the schema had some pending transactions when you started the EC2 instance. If there are pending transactions on the predicates in schema, then Dgraph schema can’t be altered, although, the GraphQL schema was saved. This results in an inconsistent state between the GraphQL and Dgraph schema. One should just retry updating the schema after some time in this case. And, as you noticed, it worked for you after some time. So, this one is not really a bug.

But, this error message may also occur when the GraphQL layer has generated a wrong Dgraph schema. And, as that would be a bug, that’s why the message says so :sweat_smile:. I guess we can improve the error message to say that this may be a bug and not necessarily a bug. Depends on what the old and new schema’s were.

We have mentioned the GitHub URL in those error messages which if encountered mean a bug, and should be reported. I guess we can update them to point to Discuss now.

This is a remnant from the days when we had graphql as a subcommand within the dgraph binary. We should remove it now, sending a PR to fix this.

I think we could also a bit better here and report better error messages. Alter can tell us the type of error (temporary or not) and report the error based on that. Could you add that as an issue for us to look at @abhimanyusinghgaur?

2 Likes