简体   繁体   English

Gremlin - 在执行下一行脚本之前等待 schema.drop() 完成

[英]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.我正在尝试针对我们的 Datastax DSE Graph 数据库运行 Gremlin 模式创建脚本,脚本的第一行是schema.drop() ,但脚本似乎立即转到脚本中的下一行并引发错误说它试图创建的新对象仍然存在。 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.通常schema.drop()需要大约一分钟左右的时间,因此在运行下一行脚本之前,它似乎没有等待它完成删除架构。

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?有没有办法强制脚本在schema.drop()行之后等待并让它在尝试运行下一行脚本以创建新模式之前完成删除模式?

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.我注意到在 Gremlin 中添加暂停或等待,但可能的解决方法是中断您的操作,以便schema.drop()独立于架构创建的其余部分执行。 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.使用此解决方法,您可以 (a) 在操作之间手动暂停,或者 (b) 如果您正在运行 shell 脚本,则在两者之间添加sleep

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.需要注意的一点是,在进行架构更改时执行检查以确保每个 DDL 在执行下一个 DDL 之前都成功是很重要的。 Cheers!干杯!

PS I've reached out to the Graph team here at DataStax for the recommended way of handling this. PS 我已经联系了 DataStax 的 Graph 团队,了解处理此问题的推荐方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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