Are DropAll and schema alterations synchronous?


(Francis Chuang) #1

I am using dgraph for integration tests using the Go client. Before each test, I alter the database using DropAll. I then recreate the schema using alter.

I find that I need to set a sleep after executing DropAll. I also need a separate sleep after updating the schema. This method works most of the time but has its own flaws. Sometimes, the schema does not update correctly and I get attribute not indexed errors. In addition, the sleeps slow down my tests significantly, as I am using 5 seconds after DropAll and another 5 seconds after updating the schema.

Are DropAll and schema alterations synchronous? If not, is there an option to have them execute in a synchronous manner?


(Martin Martinez Rivera) #2

You shouldn’t need to do any sleep at all. We have a lot of tests doing a DropAll followed by setting the schema and as far as I know that has not caused any issues.

What happens when you remove the sleep statements?


(Francis Chuang) #3

When I remove the sleep statements it works and doesn’t work. It’s sort of hard to reproduce consistently.
I have a test that updates the schema and a version number in transaction (basically a database migration in dgraph) and verifies that the expected schema is in place using a schema query.

Most of the time, it works and the test passes, but sometimes the expected schema does not match. I’ve not done much debugging to see what the schema in dgraph looks like when the test fails as it’s not reproducible in a consistent manner, however, I’ve added some debugging statements and will post back when I run into the issue.


(Martin Martinez Rivera) #4

Thanks. If you see it again we’d appreciate it if you could share log s, error messages, etc.


(system) closed #5

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.