简体   繁体   中英

Gremlin - wait for schema.drop() to finish before executing next line of script

I'm trying to run a Gremlin schema creation script against our Datastax DSE Graph database, and the first line of the script is schema.drop() , but the script seems to immediately go to the next line in the script and throws an error saying the new object it's trying to create is still there. Normally the schema.drop() takes about a minute or so, so it looks like it isn't waiting for it to finish dropping the schema before running the next line of script.

Is there a way to force the script to wait after the schema.drop() line and let it finish dropping the schema before trying to run the next line of script to create the new schema?

The general recommendation I have given is to avoid making schema changes programatically because it has often been problematic in the enterprises I have worked with. If you provide the details of how you have scripted it, I'd be happy to review it and revise my response.

I am note aware of adding a pause or wait in Gremlin but a possible workaround is to break up your operation so that the schema.drop() is performed independent of the rest of the schema creation. With this workaround, you can either (a) manually pause between operations, or (b) if you are running shell scripts then add a sleep in between.

One thing to note is that it's important to perform checks when making schema changes to make sure that each DDL is successful prior to executing the next DDL. Cheers!

PS I've reached out to the Graph team here at DataStax for the recommended way of handling this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM