【问题标题】:Cannot update Heron topology using SchedulerStateManagerAdaptor无法使用 SchedulerStateManagerAdaptor 更新 Heron 拓扑
【发布时间】:2018-07-03 08:55:45
【问题描述】:

当我尝试创建 Heron 的自定义调度器,并使用 SchedulerStateManagerAaptor 对象更新拓扑时,发生了这个异常:

Exception in thread java.util.ConcurrentModificationException: The update lock can not be obtained for topology AuroraMonitorSentenceWordCountTopology. Another actor is performing an update on it. Failing this request, try again once current update is complete
    at com.twitter.heron.scheduler.UpdateTopologyManager.updateTopology(UpdateTopologyManager.java:117)
    at zyt.custom.my.scheduler.aurora.AuroraHotEdgeSchedulerWithTxtLog.triggerSchedule(AuroraHotEdgeSchedulerWithTxtLog.java:323)
    at zyt.custom.my.scheduler.aurora.AuroraHotEdgeSchedulerWithTxtLog.access$400(AuroraHotEdgeSchedulerWithTxtLog.java:55)
    at zyt.custom.my.scheduler.aurora.AuroraHotEdgeSchedulerWithTxtLog$2.run(AuroraHotEdgeSchedulerWithTxtLog.java:258)
    at java.lang.Thread.run(Thread.java:748)

以及实例化SchedulerStateManagerAdaptor对象的代码如下:

Config config = Config.toClusterMode(this.config);
String stateMgrClass = Context.stateManagerClass(config); // get state manager instance
IStateManager stateMgr = null;
try {
    stateMgr = ReflectionUtils.newInstance(stateMgrClass);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
    e.printStackTrace();
}
stateMgr.initialize(config);
return stateManagerAdaptor = new SchedulerStateManagerAdaptor(stateMgr, 1000); // 5000: timeout

如何解决这个异常?感谢您的帮助!

【问题讨论】:

    标签: heron


    【解决方案1】:

    Yitan - 你想创建一个新的 Aurora 调度器吗?

    【讨论】:

    • 是的,我正在尝试基于默认 Aurora 调度器创建自定义调度器。现在,我希望能够实现一个可以在使用默认极光调度程序创建作业后重新调度的功能。但是我遇到了上面的问题。
    【解决方案2】:

    根据异常消息,当计划进行第二次更新操作时,会进行一次更新操作。第一个正在进行的操作阻止了第二个操作的进行。

    那么你能干净地尝试更新操作吗?并且请检查您的实现是否在更新完成后正确释放锁?

    【讨论】:

    • 这个更新操作是我在AuroraScheduler默认创建作业后的第一个更新过程。在此更新操作之前,我没有执行任何更新操作。所以不知道谁在拿锁,如何正确释放锁?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-11
    • 1970-01-01
    相关资源
    最近更新 更多