Merge pull request #2986 from alibaba/hotfix_job_execute_condition
[#2985] fix task executable judgment logic problems
This commit is contained in:
commit
99539dd330
@ -160,6 +160,9 @@ public class EmbeddedDumpService extends DumpService {
|
||||
|
||||
@Override
|
||||
protected boolean canExecute() {
|
||||
if (ApplicationUtils.getStandaloneMode()) {
|
||||
return true;
|
||||
}
|
||||
// if is derby + raft mode, only leader can execute
|
||||
CPProtocol protocol = protocolManager.getCpProtocol();
|
||||
return protocol.isLeader(Constants.CONFIG_MODEL_RAFT_GROUP);
|
||||
|
@ -109,15 +109,11 @@ public class MergeDatumService {
|
||||
if (!PropertyUtil.isEmbeddedStorage()) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
ProtocolManager protocolManager = ApplicationUtils.getBean(ProtocolManager.class);
|
||||
return protocolManager.getCpProtocol().isLeader(Constants.CONFIG_MODEL_RAFT_GROUP);
|
||||
} catch (NoSuchRaftGroupException e) {
|
||||
if (ApplicationUtils.getStandaloneMode()) {
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
// It's impossible to get to this point
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
ProtocolManager protocolManager = ApplicationUtils.getBean(ProtocolManager.class);
|
||||
return protocolManager.getCpProtocol().isLeader(Constants.CONFIG_MODEL_RAFT_GROUP);
|
||||
}
|
||||
|
||||
class MergeAllDataWorker extends Thread {
|
||||
|
Loading…
Reference in New Issue
Block a user