status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
unknown | language
stringclasses 5
values | commit_datetime
unknown | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | }
}
/**
* updaProcssInsanc procss insanc sa
* afr ach bach of asks is xcud, h saus of h procss insanc is updad
*/
priva void updaProcssInsancSa() {
ExcuionSaus sa = gProcssInsancSa();
(procssInsanc.gSa() != sa) {
loggr.info(
"work flow procss insanc [id: {}, nam:{}], sa chang from {} o {}, cmd yp: {}",
procssInsanc.gId(), procssInsanc.gNam(),
procssInsanc.gSa(), sa,
procssInsanc.gCommandTyp());
ProcssInsanc insanc = procssSrvic.findProcssInsancById(procssInsanc.gId());
insanc.sSa(sa);
insanc.sProcssDfiniion(procssInsanc.gProcssDfiniion());
procssSrvic.updaProcssInsanc(insanc);
procssInsanc = insanc;
}
}
/**
* g ask dpndncy rsul
*
* @param askInsanc ask insanc
* @rurn DpndRsul
*/
priva DpndRsul gDpndRsulForTask(TaskInsanc askInsanc) {
rurn isTaskDpsCompl(askInsanc.gNam());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | /**
* add ask o sandby lis
*
* @param askInsanc ask insanc
*/
priva void addTaskToSandByLis(TaskInsanc askInsanc) {
loggr.info("add ask o sand by lis: {}", askInsanc.gNam());
ry {
radyToSubmiTaskQuu.pu(askInsanc);
} cach (Excpion ) {
loggr.rror("add ask insanc o radyToSubmiTaskQuu rror, askNam: {}", askInsanc.gNam(), );
}
}
/**
* rmov ask from sand by lis
*
* @param askInsanc ask insanc
*/
priva void rmovTaskFromSandbyLis(TaskInsanc askInsanc) {
loggr.info("rmov ask from sand by lis: {}", askInsanc.gNam());
ry {
radyToSubmiTaskQuu.rmov(askInsanc);
} cach (Excpion ) {
loggr.rror("rmov ask insanc from radyToSubmiTaskQuu rror, askNam: {}", askInsanc.gNam(), );
}
}
/**
* has rry ask in sandby
*
* @rurn Boolan whhr has rry ask in sandby |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | */
priva boolan hasRryTaskInSandBy() {
for (Iraor<TaskInsanc> ir = radyToSubmiTaskQuu.iraor(); ir.hasNx(); ) {
(ir.nx().gSa().ypIsFailur()) {
rurn ru;
}
}
rurn fals;
}
/**
* submi and wach h asks, unil h work flow sop
*/
priva void runProcss() {
// submi sar nod
submiPosNod(null);
boolan sndTimWarning = fals;
whil (!procssInsanc.isProcssInsancSop() && Soppr.isRunning()) {
// snd warn
(!sndTimWarning && chckProcssTimOu(procssInsanc)) {
procssAlrManagr.sndProcssTimouAlr(procssInsanc,
procssSrvic.findProcssDfiniion(procssInsanc.gProcssDfiniionCod(),
procssInsanc.gProcssDfiniionVrsion()));
sndTimWarning = ru;
}
for (Map.Enry<MasrBasTaskExcThrad, Fuur<Boolan>> nry : acivTaskNod.nryS()) {
Fuur<Boolan> fuur = nry.gValu();
TaskInsanc ask = nry.gKy().gTaskInsanc();
(!fuur.isDon()) {
coninu;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | // nod moni
ask = his.procssSrvic.findTaskInsancById(ask.gId());
(ask == null) {
his.askFaildSubmi = ru;
acivTaskNod.rmov(nry.gKy());
coninu;
}
// nod moni
(ask.gSa().ypIsFinishd()) {
acivTaskNod.rmov(nry.gKy());
}
loggr.info("ask :{}, id:{} compl, sa is {} ",
ask.gNam(), ask.gId(), ask.gSa());
// nod succ
(ask.gSa() == ExcuionSaus.SUCCESS) {
procssInsanc = procssSrvic.findProcssInsancById(procssInsanc.gId());
procssInsanc.sVarPool(ask.gVarPool());
procssSrvic.updaProcssInsanc(procssInsanc);
complTaskLis.pu(ask.gNam(), ask);
submiPosNod(ask.gNam());
coninu;
}
// nod fail
(ask.gSa().ypIsFailur()) {
(ask.gSa() == ExcuionSaus.NEED_FAULT_TOLERANCE) {
his.rcovrTolrancFaulTaskLis.add(ask);
}
(ask.askCanRry()) {
addTaskToSandByLis(ask);
} ls { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | complTaskLis.pu(ask.gNam(), ask);
(ask.isCondiionsTask()
|| DagHlpr.havCondiionsAfrNod(ask.gNam(), dag)) {
submiPosNod(ask.gNam());
} ls {
rrorTaskLis.pu(ask.gNam(), ask);
(procssInsanc.gFailurSragy() == FailurSragy.END) {
killThOhrTasks();
}
}
}
coninu;
}
// ohr sa
complTaskLis.pu(ask.gNam(), ask);
}
// snd alr
(CollcionUils.isNoEmpy(his.rcovrTolrancFaulTaskLis)) {
procssAlrManagr.sndAlrWorkrTolrancFaul(procssInsanc, rcovrTolrancFaulTaskLis);
his.rcovrTolrancFaulTaskLis.clar();
}
// updaPro
// failur p
// a ask
// chck
(rrorTaskLis.siz() > 0) {
for (Map.Enry<Sring, TaskInsanc> nry : complTaskLis.nryS()) {
TaskInsanc complTask = nry.gValu();
(complTask.gSa() == ExcuionSaus.PAUSE) {
complTask.sSa(ExcuionSaus.KILL); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | complTaskLis.pu(nry.gKy(), complTask);
procssSrvic.updaTaskInsanc(complTask);
}
}
for (Map.Enry<Sring, TaskInsanc> nry : rrorTaskLis.nryS()) {
TaskInsanc rrorTask = nry.gValu();
TaskInsanc currnTask = procssSrvic.findTaskInsancById(rrorTask.gId());
(currnTask == null) {
coninu;
}
// for nods
(rrorTask.gSa().ypIsFailur() && currnTask.gSa().quals(ExcuionSaus.FORCED_SUCCESS)) {
// upda s
rrorTask.sSa(currnTask.gSa());
loggr.info("ask: {} has bn forcd succss, rmov i from rror ask lis", rrorTask.gNam());
rrorTaskLis.rmov(rrorTask.gNam());
// submi po
submiPosNod(rrorTask.gNam());
}
}
}
(canSubmiTaskToQuu()) {
submiSandByTask();
}
ry {
Thrad.slp(Consans.SLEEP_TIME_MILLIS);
} cach (InrrupdExcpion ) {
loggr.rror(.gMssag(), );
Thrad.currnThrad().inrrup();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | updaProcssInsancSa();
}
loggr.info("procss:{} nd, sa :{}", procssInsanc.gId(), procssInsanc.gSa());
}
/**
* whhr chck procss im ou
*
* @param procssInsanc ask insanc
* @rurn ru im ou of procss insanc > running im of procss insanc
*/
priva boolan chckProcssTimOu(ProcssInsanc procssInsanc) {
(procssInsanc.gTimou() == 0) {
rurn fals;
}
Da now = nw Da();
long runningTim = DaUils.dfMin(now, procssInsanc.gSarTim());
rurn runningTim > procssInsanc.gTimou();
}
/**
* whhr can submi ask o quu
*
* @rurn boolan
*/
priva boolan canSubmiTaskToQuu() {
rurn OSUils.chckRsourc(masrConfig.gMasrMaxCpuloadAvg(), masrConfig.gMasrRsrvdMmory());
}
/**
* clos h on going asks
*/
priva void killThOhrTasks() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | loggr.info("kill calld on : {}, num: {}", procssInsanc.gId(),
acivTaskNod.siz());
for (Map.Enry<MasrBasTaskExcThrad, Fuur<Boolan>> nry : acivTaskNod.nryS()) {
MasrBasTaskExcThrad askExcThrad = nry.gKy();
Fuur<Boolan> fuur = nry.gValu();
TaskInsanc askInsanc = askExcThrad.gTaskInsanc();
askInsanc = procssSrvic.findTaskInsancById(askInsanc.gId());
(askInsanc != null && askInsanc.gSa().ypIsFinishd()) {
coninu;
}
(!fuur.isDon()) {
// rcord ki
loggr.info("kill procss insanc, id: {}, ask: {}", procssInsanc.gId(), askExcThrad.gTaskInsanc().gId());
// kill nod
askExcThrad.kill();
}
}
}
/**
* whhr h rry inrval is imd ou
*
* @param askInsanc ask insanc
* @rurn Boolan
*/
priva boolan rryTaskInrvalOvrTim(TaskInsanc askInsanc) {
(askInsanc.gSa() != ExcuionSaus.FAILURE) {
rurn ru;
}
(askInsanc.gId() == 0
|| |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | askInsanc.gMaxRryTims() == 0
||
askInsanc.gRryInrval() == 0) {
rurn ru;
}
Da now = nw Da();
long faildTimInrval = DaUils.dfrSc(now, askInsanc.gEndTim());
// ask rry dos no ovr im, rurn fals
rurn askInsanc.gRryInrval() * SEC_2_MINUTES_TIME_UNIT < faildTimInrval;
}
/**
* handling h lis of asks o b submid
*/
priva void submiSandByTask() {
ry {
in lngh = radyToSubmiTaskQuu.siz();
for (in i = 0; i < lngh; i++) {
TaskInsanc ask = radyToSubmiTaskQuu.pk();
// sop ask
(ask.askCanRry()) {
TaskInsanc rryTask = procssSrvic.findTaskInsancById(ask.gId());
(rryTask != null && rryTask.gSa().quals(ExcuionSaus.FORCED_SUCCESS)) {
ask.sSa(rryTask.gSa());
loggr.info("ask: {} has bn forcd succss, pu i ino compl ask lis and sop rrying", ask.gNam());
rmovTaskFromSandbyLis(ask);
complTaskLis.pu(ask.gNam(), ask);
submiPosNod(ask.gNam());
coninu;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | //ini varPo
(ask.isFirsRun()) {
//g pr a
S<Sring> prTask = dag.gPrviousNods(ask.gNam());
gPrVarPool(ask, prTask);
}
DpndRsul dpndRsul = gDpndRsulForTask(ask);
(DpndRsul.SUCCESS == dpndRsul) {
(rryTaskInrvalOvrTim(ask)) {
submiTaskExc(ask);
rmovTaskFromSandbyLis(ask);
}
} ls (DpndRsul.FAILED == dpndRsul) {
// h d
dpndFaildTask.pu(ask.gNam(), ask);
rmovTaskFromSandbyLis(ask);
loggr.info("ask {},id:{} dpnd rsul : {}", ask.gNam(), ask.gId(), dpndRsul);
} ls (DpndRsul.NON_EXEC == dpndRsul) {
// for som
rmovTaskFromSandbyLis(ask);
loggr.info("rmov ask {},id:{} , bcaus dpnd rsul : {}", ask.gNam(), ask.gId(), dpndRsul);
}
}
} cach (Excpion ) {
loggr.rror("submi sandby ask rror", );
}
}
/**
* g rcovry ask insanc
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | * @param askId ask id
* @rurn rcovry ask insanc
*/
priva TaskInsanc gRcovryTaskInsanc(Sring askId) {
(!SringUils.isNoEmpy(askId)) {
rurn null;
}
ry {
Ingr inId = Ingr.valuOf(askId);
TaskInsanc ask = procssSrvic.findTaskInsancById(inId);
(ask == null) {
loggr.rror("sar nod id canno b found: {}", askId);
} ls {
rurn ask;
}
} cach (Excpion ) {
loggr.rror("g rcovry ask insanc faild ", );
}
rurn null;
}
/**
* g sar ask insanc lis
*
* @param cmdParam command param
* @rurn ask insanc lis
*/
priva Lis<TaskInsanc> gSarTaskInsancLis(Sring cmdParam) {
Lis<TaskInsanc> insancLis = nw ArrayLis<>();
Map<Sring, Sring> paramMap = JSONUils.oMap(cmdParam);
(paramMap != null && paramMap.conainsKy(CMD_PARAM_RECOVERY_START_NODE_STRING)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | Sring[] idLis = paramMap.g(CMD_PARAM_RECOVERY_START_NODE_STRING).spli(Consans.COMMA);
for (Sring nodId : idLis) {
TaskInsanc ask = gRcovryTaskInsanc(nodId);
(ask != null) {
insancLis.add(ask);
}
}
}
rurn insancLis;
}
/**
* pars "SarNodNamLis" from cmd param
*
* @param cmdParam command param
* @rurn sar nod nam lis
*/
priva Lis<Sring> parsSarNodNam(Sring cmdParam) {
Lis<Sring> sarNodNamLis = nw ArrayLis<>();
Map<Sring, Sring> paramMap = JSONUils.oMap(cmdParam);
(paramMap == null) {
rurn sarNodNamLis;
}
(paramMap.conainsKy(CMD_PARAM_START_NODE_NAMES)) {
sarNodNamLis = Arrays.asLis(paramMap.g(CMD_PARAM_START_NODE_NAMES).spli(Consans.COMMA));
}
rurn sarNodNamLis;
}
/**
* gnra sar nod nam lis from parsing command param;
* "SarNodIdLis" xiss in command param, rurn SarNodIdLis |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 5,908 | [Bug][MasterServer] When executing an compensation task, the execution thread would have a NPE | In the latest dev branch, if the task executes the compensation task, after the task is executed successfully, we can found that the Master throws an exception which would cause the process shows failed.
```java
[ERROR] 2021-07-28 12:58:55.462 org.apache.dolphinscheduler.server.master.runner.MasterExecThread:[224] - master exec thread exception
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.executeComplementProcess(MasterExecThread.java:331)
at org.apache.dolphinscheduler.server.master.runner.MasterExecThread.run(MasterExecThread.java:218)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
``` | https://github.com/apache/dolphinscheduler/issues/5908 | https://github.com/apache/dolphinscheduler/pull/5909 | 67dde65d3207d325d344e472a4be57286a1d379d | 2fa3b419a0598c499ae0e9cb39f2402f43718418 | "2021-07-28T11:52:52Z" | java | "2021-08-25T14:19:28Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterExecThread.java | *
* @rurn rcovry nod nam lis
*/
priva Lis<Sring> gRcovryNodNamLis() {
Lis<Sring> rcovryNodNamLis = nw ArrayLis<>();
(CollcionUils.isNoEmpy(rcovrNodIdLis)) {
for (TaskInsanc ask : rcovrNodIdLis) {
rcovryNodNamLis.add(ask.gNam());
}
}
rurn rcovryNodNamLis;
}
/**
* gnra flow dag
*
* @param oalTaskNodLis oal ask nod lis
* @param sarNodNamLis sar nod nam lis
* @param rcovryNodNamLis rcovry nod nam lis
* @param dpNodTyp dpnd nod yp
* @rurn ProcssDag procss dag
* @hrows Excpion xcpion
*/
public ProcssDag gnraFlowDag(Lis<TaskNod> oalTaskNodLis,
Lis<Sring> sarNodNamLis,
Lis<Sring> rcovryNodNamLis,
TaskDpndTyp dpNodTyp) hrows Excpion {
rurn DagHlpr.gnraFlowDag(oalTaskNodLis, sarNodNamLis, rcovryNodNamLis, dpNodTyp);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.registry.zookeeper;
import static org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConfiguration.BASE_SLEEP_TIME;
import static org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConfiguration.BLOCK_UNTIL_CONNECTED_WAIT_MS;
import static org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConfiguration.CONNECTION_TIMEOUT_MS;
import static org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConfiguration.DIGEST;
import static org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConfiguration.MAX_RETRIES;
import static org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConfiguration.NAME_SPACE;
import static org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConfiguration.SERVERS;
import static org.apache.dolphinscheduler.plugin.registry.zookeeper.ZookeeperConfiguration.SESSION_TIMEOUT_MS;
import static java.util.concurrent.TimeUnit.MILLISECONDS; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | import org.apache.dolphinscheduler.spi.register.DataChangeEvent;
import org.apache.dolphinscheduler.spi.register.ListenerManager;
import org.apache.dolphinscheduler.spi.register.Registry;
import org.apache.dolphinscheduler.spi.register.RegistryConnectListener;
import org.apache.dolphinscheduler.spi.register.RegistryException;
import org.apache.dolphinscheduler.spi.register.SubscribeListener;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.api.ACLProvider;
import org.apache.curator.framework.api.transaction.TransactionOp;
import org.apache.curator.framework.recipes.cache.TreeCache;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
import org.apache.curator.framework.recipes.cache.TreeCacheListener;
import org.apache.curator.framework.recipes.locks.InterProcessMutex;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.curator.utils.CloseableUtils;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
import java.nio.charset.StandardCharsets;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.base.Strings;
public class ZookeeperRegistry implements Registry {
private CuratorFramework client;
/**
* treeCache map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | * k-subscribe key
* v-listener
*/
private Map<String, TreeCache> treeCacheMap = new HashMap<>();
/**
* Distributed lock map
*/
private ThreadLocal<Map<String, InterProcessMutex>> threadLocalLockMap = new ThreadLocal<>();
/**
* build retry policy
*/
private static RetryPolicy buildRetryPolicy(Map<String, String> registerData) {
int baseSleepTimeMs = BASE_SLEEP_TIME.getParameterValue(registerData.get(BASE_SLEEP_TIME.getName()));
int maxRetries = MAX_RETRIES.getParameterValue(registerData.get(MAX_RETRIES.getName()));
int maxSleepMs = baseSleepTimeMs * maxRetries;
return new ExponentialBackoffRetry(baseSleepTimeMs, maxRetries, maxSleepMs);
}
/**
* build digest
*/
private static void buildDigest(CuratorFrameworkFactory.Builder builder, String digest) {
builder.authorization(DIGEST.getName(), digest.getBytes(StandardCharsets.UTF_8))
.aclProvider(new ACLProvider() {
@Override
public List<ACL> getDefaultAcl() {
return ZooDefs.Ids.CREATOR_ALL_ACL;
}
@Override
public List<ACL> getAclForPath(final String path) {
return ZooDefs.Ids.CREATOR_ALL_ACL; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | }
});
}
@Override
public void init(Map<String, String> registerData) {
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
.connectString(SERVERS.getParameterValue(registerData.get(SERVERS.getName())))
.retryPolicy(buildRetryPolicy(registerData))
.namespace(NAME_SPACE.getParameterValue(registerData.get(NAME_SPACE.getName())))
.sessionTimeoutMs(SESSION_TIMEOUT_MS.getParameterValue(registerData.get(SESSION_TIMEOUT_MS.getName())))
.connectionTimeoutMs(CONNECTION_TIMEOUT_MS.getParameterValue(registerData.get(CONNECTION_TIMEOUT_MS.getName())));
String digest = DIGEST.getParameterValue(registerData.get(DIGEST.getName()));
if (!Strings.isNullOrEmpty(digest)) {
buildDigest(builder, digest);
}
client = builder.build();
client.start();
try {
if (!client.blockUntilConnected(BLOCK_UNTIL_CONNECTED_WAIT_MS.getParameterValue(registerData.get(BLOCK_UNTIL_CONNECTED_WAIT_MS.getName())), MILLISECONDS)) {
client.close();
throw new RegistryException("zookeeper connect timeout");
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RegistryException("zookeeper connect error", e);
}
}
@Override
public void addConnectionStateListener(RegistryConnectListener registryConnectListener) {
client.getConnectionStateListenable().addListener(new ZookeeperConnectionStateListener(registryConnectListener)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | }
@Override
public boolean subscribe(String path, SubscribeListener subscribeListener) {
if (null != treeCacheMap.get(path)) {
return false;
}
TreeCache treeCache = new TreeCache(client, path);
TreeCacheListener treeCacheListener = (client, event) -> {
TreeCacheEvent.Type type = event.getType();
DataChangeEvent eventType = null;
String dataPath = null;
switch (type) {
case NODE_ADDED:
dataPath = event.getData().getPath();
eventType = DataChangeEvent.ADD;
break;
case NODE_UPDATED:
eventType = DataChangeEvent.UPDATE;
dataPath = event.getData().getPath();
break;
case NODE_REMOVED:
eventType = DataChangeEvent.REMOVE;
dataPath = event.getData().getPath();
break;
default:
}
if (null != eventType && null != dataPath) {
ListenerManager.dataChange(path, dataPath, eventType);
}
}; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | treeCache.getListenable().addListener(treeCacheListener);
treeCacheMap.put(path, treeCache);
try {
treeCache.start();
} catch (Exception e) {
throw new RegistryException("start zookeeper tree cache error", e);
}
ListenerManager.addListener(path, subscribeListener);
return true;
}
@Override
public void unsubscribe(String path) {
TreeCache treeCache = treeCacheMap.get(path);
treeCache.close();
ListenerManager.removeListener(path);
}
@Override
public String get(String key) {
try {
return new String(client.getData().forPath(key), StandardCharsets.UTF_8);
} catch (Exception e) {
throw new RegistryException("zookeeper get data error", e);
}
}
@Override
public void remove(String key) {
try {
client.delete().deletingChildrenIfNeeded().forPath(key);
} catch (Exception e) {
throw new RegistryException("zookeeper remove error", e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | }
}
@Override
public boolean isExisted(String key) {
try {
return null != client.checkExists().forPath(key);
} catch (Exception e) {
throw new RegistryException("zookeeper check key is existed error", e);
}
}
@Override
public void persist(String key, String value) {
try {
if (isExisted(key)) {
update(key, value);
return;
}
client.create().creatingParentsIfNeeded().withMode(CreateMode.PERSISTENT).forPath(key, value.getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
throw new RegistryException("zookeeper persist error", e);
}
}
@Override
public void persistEphemeral(String key, String value) {
try {
if (isExisted(key)) {
update(key, value);
return;
}
client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL).forPath(key, value.getBytes(StandardCharsets.UTF_8)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | } catch (Exception e) {
throw new RegistryException("zookeeper persist ephemeral error", e);
}
}
@Override
public void update(String key, String value) {
try {
if (!isExisted(key)) {
return;
}
TransactionOp transactionOp = client.transactionOp();
client.transaction().forOperations(transactionOp.check().forPath(key), transactionOp.setData().forPath(key, value.getBytes(StandardCharsets.UTF_8)));
} catch (Exception e) {
throw new RegistryException("zookeeper update error", e);
}
}
@Override
public List<String> getChildren(String key) {
try {
List<String> result = client.getChildren().forPath(key);
result.sort(Comparator.reverseOrder());
return result;
} catch (Exception e) {
throw new RegistryException("zookeeper get children error", e);
}
}
@Override
public boolean delete(String nodePath) {
try {
client.delete() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | .deletingChildrenIfNeeded()
.forPath(nodePath);
} catch (Exception e) {
throw new RegistryException("zookeeper delete key error", e);
}
return true;
}
@Override
public boolean acquireLock(String key) {
InterProcessMutex interProcessMutex = new InterProcessMutex(client, key);
try {
interProcessMutex.acquire();
if (null == threadLocalLockMap.get()) {
threadLocalLockMap.set(new HashMap<>(3));
}
threadLocalLockMap.get().put(key, interProcessMutex);
return true;
} catch (Exception e) {
try {
interProcessMutex.release();
throw new RegistryException("zookeeper get lock error", e);
} catch (Exception exception) {
throw new RegistryException("zookeeper release lock error", e);
}
}
}
@Override
public boolean releaseLock(String key) {
if (null == threadLocalLockMap.get().get(key)) {
return false; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | }
try {
threadLocalLockMap.get().get(key).release();
threadLocalLockMap.get().remove(key);
if (threadLocalLockMap.get().isEmpty()) {
threadLocalLockMap.remove();
}
} catch (Exception e) {
throw new RegistryException("zookeeper release lock error", e);
}
return true;
}
public CuratorFramework getClient() {
return client;
}
@Override
public void close() {
treeCacheMap.forEach((key, value) -> value.close());
waitForCacheClose(500);
CloseableUtils.closeQuietly(client);
}
private void waitForCacheClose(long millis) {
try {
Thread.sleep(millis);
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker;
import org.apache.dolphinscheduler.common.Constants; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.remote.NettyRemotingServer;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.config.NettyServerConfig;
import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
import org.apache.dolphinscheduler.server.worker.processor.DBTaskAckProcessor;
import org.apache.dolphinscheduler.server.worker.processor.DBTaskResponseProcessor;
import org.apache.dolphinscheduler.server.worker.processor.TaskExecuteProcessor;
import org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor;
import org.apache.dolphinscheduler.server.worker.registry.WorkerRegistryClient;
import org.apache.dolphinscheduler.server.worker.runner.RetryReportTaskStatusThread;
import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread;
import org.apache.dolphinscheduler.service.alert.AlertClientService;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import java.util.Set;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.transaction.annotation.EnableTransactionManagement;
/**
* worker server
*/
@ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | @ComponentScan.Filter(type = FilterType.REGEX, pattern = {
"org.apache.dolphinscheduler.server.master.*",
"org.apache.dolphinscheduler.server.monitor.*",
"org.apache.dolphinscheduler.server.log.*"
})
})
@EnableTransactionManagement
public class WorkerServer implements IStoppable {
/**
* logger
*/
private static final Logger logger = LoggerFactory.getLogger(WorkerServer.class);
/**
* netty remote server
*/
private NettyRemotingServer nettyRemotingServer;
/**
* worker registry
*/
@Autowired
private WorkerRegistryClient workerRegistryClient;
/**
* worker config
*/
@Autowired
private WorkerConfig workerConfig;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | * spring application context
* only use it for initialization
*/
@Autowired
private SpringApplicationContext springApplicationContext;
/**
* alert model netty remote server
*/
private AlertClientService alertClientService;
@Autowired
private RetryReportTaskStatusThread retryReportTaskStatusThread;
@Autowired
private WorkerManagerThread workerManagerThread;
/**
* worker server startup, not use web service
*
* @param args arguments
*/
public static void main(String[] args) {
Thread.currentThread().setName(Constants.THREAD_NAME_WORKER_SERVER);
new SpringApplicationBuilder(WorkerServer.class).web(WebApplicationType.NONE).run(args);
}
/**
* worker server run
*/
@PostConstruct
public void run() {
alertClientService = new AlertClientService(workerConfig.getAlertListenHost(), Constants.ALERT_RPC_PORT); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | NettyServerConfig serverConfig = new NettyServerConfig();
serverConfig.setListenPort(workerConfig.getListenPort());
this.nettyRemotingServer = new NettyRemotingServer(serverConfig);
this.nettyRemotingServer.registerProcessor(CommandType.TASK_EXECUTE_REQUEST, new TaskExecuteProcessor(alertClientService));
this.nettyRemotingServer.registerProcessor(CommandType.TASK_KILL_REQUEST, new TaskKillProcessor());
this.nettyRemotingServer.registerProcessor(CommandType.DB_TASK_ACK, new DBTaskAckProcessor());
this.nettyRemotingServer.registerProcessor(CommandType.DB_TASK_RESPONSE, new DBTaskResponseProcessor());
this.nettyRemotingServer.start();
try {
this.workerRegistryClient.registry();
this.workerRegistryClient.setRegistryStoppable(this);
Set<String> workerZkPaths = this.workerRegistryClient.getWorkerZkPaths();
this.workerRegistryClient.handleDeadServer(workerZkPaths, NodeType.WORKER, Constants.DELETE_OP);
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RuntimeException(e);
}
this.workerManagerThread.start();
this.retryReportTaskStatusThread.start();
/**
* registry hooks, which are called before the process exits
*/
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
if (Stopper.isRunning()) {
close("shutdownHook");
}
})); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java | }
public void close(String cause) {
try {
if (Stopper.isStopped()) {
return;
}
logger.info("worker server is stopping ..., cause : {}", cause);
Stopper.stop();
try {
Thread.sleep(3000L);
} catch (Exception e) {
logger.warn("thread sleep exception", e);
}
this.nettyRemotingServer.close();
this.workerRegistryClient.unRegistry();
this.alertClientService.close();
} catch (Exception e) {
logger.error("worker server stop exception ", e);
}
}
@Override
public void stop(String cause) {
close(cause);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/RetryReportTaskStatusThread.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.runner;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.remote.command.Command;
import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/RetryReportTaskStatusThread.java | import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* Retry Report Task Status Thread
*/
@Component
public class RetryReportTaskStatusThread implements Runnable {
private final Logger logger = LoggerFactory.getLogger(RetryReportTaskStatusThread.class);
/**
* every 5 minutes
*/
private static long RETRY_REPORT_TASK_STATUS_INTERVAL = 5 * 60 * 1000L;
/**
* task callback service
*/
private final TaskCallbackService taskCallbackService;
public void start(){
Thread thread = new Thread(this,"RetryReportTaskStatusThread");
thread.start();
}
public RetryReportTaskStatusThread(){
this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class);
}
/**
* retry ack/response
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/RetryReportTaskStatusThread.java | @Override
public void run() {
ResponceCache responceCache = ResponceCache.get();
while (Stopper.isRunning()){
ThreadUtils.sleep(RETRY_REPORT_TASK_STATUS_INTERVAL);
try {
if (!responceCache.getAckCache().isEmpty()){
Map<Integer,Command> ackCache = responceCache.getAckCache();
for (Map.Entry<Integer, Command> entry : ackCache.entrySet()){
Integer taskInstanceId = entry.getKey();
Command ackCommand = entry.getValue();
taskCallbackService.sendAck(taskInstanceId,ackCommand);
}
}
if (!responceCache.getResponseCache().isEmpty()){
Map<Integer,Command> responseCache = responceCache.getResponseCache();
for (Map.Entry<Integer, Command> entry : responseCache.entrySet()){
Integer taskInstanceId = entry.getKey();
Command responseCommand = entry.getValue();
taskCallbackService.sendResult(taskInstanceId,responseCommand);
}
}
}catch (Exception e){
logger.warn("retry report task status error", e);
}
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.runner;
import org.apache.dolphinscheduler.common.enums.Event;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.remote.command.TaskExecuteResponseCommand;
import org.apache.dolphinscheduler.server.entity.TaskExecutionContext;
import org.apache.dolphinscheduler.server.worker.cache.ResponceCache;
import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl;
import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.ExecutorService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* Manage tasks
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | public class WorkerManagerThread implements Runnable {
private final Logger logger = LoggerFactory.getLogger(WorkerManagerThread.class);
/**
* task queue
*/
private final DelayQueue<TaskExecuteThread> workerExecuteQueue = new DelayQueue<>();
/**
* worker config
*/
private final WorkerConfig workerConfig;
/**
* thread executor service
*/
private final ExecutorService workerExecService;
/**
* taskExecutionContextCacheManager
*/
private TaskExecutionContextCacheManager taskExecutionContextCacheManager;
/**
* task callback service
*/
private final TaskCallbackService taskCallbackService;
public WorkerManagerThread() {
this.workerConfig = SpringApplicationContext.getBean(WorkerConfig.class);
this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class);
this.workerExecService = ThreadUtils.newDaemonFixedThreadExecutor("Worker-Execute-Thread", this.workerConfig.getWorkerExecThreads());
this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | /**
* get queue size
*
* @return queue size
*/
public int getQueueSize() {
return workerExecuteQueue.size();
}
/**
* Kill tasks that have not been executed, like delay task
* then send Response to Master, update the execution status of task instance
*/
public void killTaskBeforeExecuteByInstanceId(Integer taskInstanceId) {
workerExecuteQueue.stream()
.filter(taskExecuteThread -> taskExecuteThread.getTaskExecutionContext().getTaskInstanceId() == taskInstanceId)
.forEach(workerExecuteQueue::remove);
sendTaskKillResponse(taskInstanceId);
}
/**
* kill task before execute , like delay task
*/
private void sendTaskKillResponse(Integer taskInstanceId) {
TaskExecutionContext taskExecutionContext = taskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId);
if (taskExecutionContext == null) {
return;
}
TaskExecuteResponseCommand responseCommand = new TaskExecuteResponseCommand(taskExecutionContext.getTaskInstanceId());
responseCommand.setStatus(ExecutionStatus.KILL.getCode());
ResponceCache.get().cache(taskExecutionContext.getTaskInstanceId(), responseCommand.convert2Command(), Event.RESULT);
taskCallbackService.sendResult(taskExecutionContext.getTaskInstanceId(), responseCommand.convert2Command()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,045 | [Bug][Master] Dead server kill itself error(when the register plugin is zookeeper) | **Describe the bug**
When a master/worker session is lost from zookeeper, the Ephemeral node will be removed by zookeeper.
And the failover node will do the failover job, it will create a node in zookeeper dead-server path.
The `HeartBeatTask` of the dead server will check it has been in the dead-server, and it will kill itself.
When it stops, it will unregister from the registry(zookeeper).
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java#L371-L379
https://github.com/apache/dolphinscheduler/blob/04720b327aef0649e9317573680874c20ea20ad5/dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java#L197-L204
The problem is that the dead server's Ephemeral node is already removed, when we use `client.delete()` it will throw an KeeperException.NoNodeException.
**To Reproduce**
1. Start a master server
2. delete the Ephemeral node to simulate the master is dead.
3. see exception, and the master cannot shut down, since some other thread cannot exist.
**Which version of Dolphin Scheduler:**
-[dev]
**Requirement or improvement**
Ignore the KeeperException.NoNodeException, if the node is not exist, we can think the node has been deleted.
| https://github.com/apache/dolphinscheduler/issues/6045 | https://github.com/apache/dolphinscheduler/pull/6046 | 04720b327aef0649e9317573680874c20ea20ad5 | 839d6054eeb32c9efbab4836aa169e1c9c6ca417 | "2021-08-27T09:38:16Z" | java | "2021-08-27T11:43:04Z" | dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | }
/**
* submit task
*
* @param taskExecuteThread taskExecuteThread
* @return submit result
*/
public boolean offer(TaskExecuteThread taskExecuteThread) {
return workerExecuteQueue.offer(taskExecuteThread);
}
public void start() {
Thread thread = new Thread(this, this.getClass().getName());
thread.start();
}
@Override
public void run() {
Thread.currentThread().setName("Worker-Execute-Manager-Thread");
TaskExecuteThread taskExecuteThread;
while (Stopper.isRunning()) {
try {
taskExecuteThread = workerExecuteQueue.take();
workerExecService.submit(taskExecuteThread);
} catch (Exception e) {
logger.error("An unexpected interrupt is happened, "
+ "the exception will be ignored and this thread will continue to run", e);
}
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | */
package org.apache.dolphinscheduler.api.controller;
import static org.apache.dolphinscheduler.api.enums.Status.AUTHORIZED_DATA_SOURCE;
import static org.apache.dolphinscheduler.api.enums.Status.CONNECTION_TEST_FAILURE;
import static org.apache.dolphinscheduler.api.enums.Status.CONNECT_DATASOURCE_FAILURE;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_DATASOURCE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_DATA_SOURCE_FAILURE;
import static org.apache.dolphinscheduler.api.enums.Status.KERBEROS_STARTUP_STATE;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_DATASOURCE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UNAUTHORIZED_DATASOURCE;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_DATASOURCE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_DATASOURCE_NAME_FAILURE;
import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.DataSourceService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.common.datasource.ConnectionParam;
import org.apache.dolphinscheduler.common.datasource.DatasourceUtil;
import org.apache.dolphinscheduler.common.enums.DbType;
import org.apache.dolphinscheduler.common.utils.CommonUtils;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import springfox.documentation.annotations.ApiIgnore;
/**
* data source controller
*/
@Api(tags = "DATA_SOURCE_TAG")
@RestController
@RequestMapping("datasources")
public class DataSourceController extends BaseController {
@Autowired
private DataSourceService dataSourceService;
/**
* create data source
*
* @param loginUser login user
* @param dataSourceParam datasource param
* @return create result code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | */
@ApiOperation(value = "createDataSource", notes = "CREATE_DATA_SOURCE_NOTES")
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true)
@RequestBody BaseDataSourceParamDTO dataSourceParam) {
return dataSourceService.createDataSource(loginUser, dataSourceParam);
}
/**
* updateProcessInstance data source
*
* @param loginUser login user
* @param id datasource id
* @param dataSourceParam datasource param
* @return update result code
*/
@ApiOperation(value = "updateDataSource", notes = "UPDATE_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO")
})
@PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable(value = "id") Integer id, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | @RequestBody BaseDataSourceParamDTO dataSourceParam) {
dataSourceParam.setId(id);
return dataSourceService.updateDataSource(dataSourceParam.getId(), loginUser, dataSourceParam);
}
/**
* query data source detail
*
* @param loginUser login user
* @param id datasource id
* @return data source detail
*/
@ApiOperation(value = "queryDataSource", notes = "QUERY_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable("id") int id) {
Map<String, Object> result = dataSourceService.queryDataSource(id);
return returnDataList(result);
}
/**
* query datasource by type
*
* @param loginUser login user
* @param type data source type
* @return data source list page |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | */
@ApiOperation(value = "queryDataSourceList", notes = "QUERY_DATA_SOURCE_LIST_BY_TYPE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "DB_TYPE", required = true, dataType = "DbType")
})
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryDataSourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("type") DbType type) {
Map<String, Object> result = dataSourceService.queryDataSourceList(loginUser, type.ordinal());
return returnDataList(result);
}
/**
* query datasource with paging
*
* @param loginUser login user
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return data source list page
*/
@ApiOperation(value = "queryDataSourceListPaging", notes = "QUERY_DATA_SOURCE_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
})
@GetMapping() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryDataSourceListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) {
Result result = checkPageParams(pageNo, pageSize);
if (!result.checkResult()) {
return result;
}
searchVal = ParameterUtils.handleEscapes(searchVal);
return dataSourceService.queryDataSourceListPaging(loginUser, searchVal, pageNo, pageSize);
}
/**
* connect datasource
*
* @param loginUser login user
* @param dataSourceParam datasource param
* @return connect result code
*/
@ApiOperation(value = "connectDataSource", notes = "CONNECT_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO")
})
@PostMapping(value = "/connect")
@ResponseStatus(HttpStatus.OK)
@ApiException(CONNECT_DATASOURCE_FAILURE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result connectDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | @RequestBody BaseDataSourceParamDTO dataSourceParam) {
DatasourceUtil.checkDatasourceParam(dataSourceParam);
ConnectionParam connectionParams = DatasourceUtil.buildConnectionParams(dataSourceParam);
return dataSourceService.checkConnection(dataSourceParam.getType(), connectionParams);
}
/**
* connection test
*
* @param loginUser login user
* @param id data source id
* @return connect result code
*/
@ApiOperation(value = "connectionTest", notes = "CONNECT_DATA_SOURCE_TEST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/{id}/connect-test")
@ResponseStatus(HttpStatus.OK)
@ApiException(CONNECTION_TEST_FAILURE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result connectionTest(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable("id") int id) {
return dataSourceService.connectionTest(id);
}
/**
* delete datasource by id
*
* @param loginUser login user
* @param id datasource id
* @return delete result |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | */
@ApiOperation(value = "deleteDataSource", notes = "DELETE_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
})
@DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_DATA_SOURCE_FAILURE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result delete(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable("id") int id) {
return dataSourceService.delete(loginUser, id);
}
/**
* verify datasource name
*
* @param loginUser login user
* @param name data source name
* @return true if data source name not exists.otherwise return false
*/
@ApiOperation(value = "verifyDataSourceName", notes = "VERIFY_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "DATA_SOURCE_NAME", required = true, dataType = "String")
})
@GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_DATASOURCE_NAME_FAILURE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result verifyDataSourceName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "name") String name |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | ) {
return dataSourceService.verifyDataSourceName(name);
}
/**
* unauthorized datasource
*
* @param loginUser login user
* @param userId user id
* @return unauthed data source result code
*/
@ApiOperation(value = "unauthDatasource", notes = "UNAUTHORIZED_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/unauth")
@ResponseStatus(HttpStatus.OK)
@ApiException(UNAUTHORIZED_DATASOURCE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result unauthDatasource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
Map<String, Object> result = dataSourceService.unauthDatasource(loginUser, userId);
return returnDataList(result);
}
/**
* authorized datasource
*
* @param loginUser login user
* @param userId user id
* @return authorized result code
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/DataSourceController.java | @ApiOperation(value = "authedDatasource", notes = "AUTHORIZED_DATA_SOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/authed")
@ResponseStatus(HttpStatus.OK)
@ApiException(AUTHORIZED_DATA_SOURCE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result authedDatasource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
Map<String, Object> result = dataSourceService.authedDatasource(loginUser, userId);
return returnDataList(result);
}
/**
* get user info
*
* @param loginUser login user
* @return user info data
*/
@ApiOperation(value = "getKerberosStartupState", notes = "GET_USER_INFO_NOTES")
@GetMapping(value = "/kerberos-startup-state")
@ResponseStatus(HttpStatus.OK)
@ApiException(KERBEROS_STARTUP_STATE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result getKerberosStartupState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
return success(Status.SUCCESS.getMsg(), CommonUtils.getKerberosStartupState());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.controller;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_PROJECT_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROJECT_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_PROJECT;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROJECT_DETAILS_BY_CODE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_UNAUTHORIZED_PROJECT_ERROR; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_PROJECT_ERROR;
import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
/**
* project controller
*/
@Api(tags = "PROJECT_TAG") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | @RestController
@RequestMapping("projects")
public class ProjectController extends BaseController {
@Autowired
private ProjectService projectService;
/**
* create project
*
* @param loginUser login user
* @param projectName project name
* @param description description
* @return returns an error if it exists
*/
@ApiOperation(value = "create", notes = "CREATE_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"),
@ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String")
})
@PostMapping()
@ResponseStatus(HttpStatus.CREATED) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | @ApiException(CREATE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectName") String projectName,
@RequestParam(value = "description", required = false) String description) {
Map<String, Object> result = projectService.createProject(loginUser, projectName, description);
return returnDataList(result);
}
/**
* update project
*
* @param loginUser login user
* @param code project code
* @param projectName project name
* @param description description
* @return update result code
*/
@ApiOperation(value = "update", notes = "UPDATE_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456"),
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"),
@ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String"),
@ApiImplicitParam(name = "userName", value = "USER_NAME", dataType = "String"),
})
@PutMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable("code") Long code, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | @RequestParam("projectName") String projectName,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "userName") String userName) {
Map<String, Object> result = projectService.update(loginUser, code, projectName, description, userName);
return returnDataList(result);
}
/**
* query project details by code
*
* @param loginUser login user
* @param code project code
* @return project detail information
*/
@ApiOperation(value = "queryProjectByCode", notes = "QUERY_PROJECT_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456")
})
@GetMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROJECT_DETAILS_BY_CODE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProjectByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable("code") long code) {
Map<String, Object> result = projectService.queryByCode(loginUser, code);
return returnDataList(result);
}
/**
* query project list paging
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | * @param searchVal search value
* @param pageSize page size
* @param pageNo page number
* @return project list which the login user have permission to see
*/
@ApiOperation(value = "queryProjectListPaging", notes = "QUERY_PROJECT_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1")
})
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProjectListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("pageNo") Integer pageNo
) {
Result result = checkPageParams(pageNo, pageSize);
if (!result.checkResult()) {
return result;
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = projectService.queryProjectListPaging(loginUser, pageSize, pageNo, searchVal);
return result;
}
/**
* delete project by code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | *
* @param loginUser login user
* @param code project code
* @return delete result code
*/
@ApiOperation(value = "delete", notes = "DELETE_PROJECT_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456")
})
@DeleteMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable("code") Long code) {
Map<String, Object> result = projectService.deleteProject(loginUser, code);
return returnDataList(result);
}
/**
* query unauthorized project
*
* @param loginUser login user
* @param userId user id
* @return the projects which user have not permission to see
*/
@ApiOperation(value = "queryUnauthorizedProject", notes = "QUERY_UNAUTHORIZED_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100")
})
@GetMapping(value = "/unauth") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_UNAUTHORIZED_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryUnauthorizedProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
Map<String, Object> result = projectService.queryUnauthorizedProject(loginUser, userId);
return returnDataList(result);
}
/**
* query authorized project
*
* @param loginUser login user
* @param userId user id
* @return projects which the user have permission to see, Except for items created by this user
*/
@ApiOperation(value = "queryAuthorizedProject", notes = "QUERY_AUTHORIZED_PROJECT_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100")
})
@GetMapping(value = "/authed")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_AUTHORIZED_PROJECT)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryAuthorizedProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
Map<String, Object> result = projectService.queryAuthorizedProject(loginUser, userId);
return returnDataList(result);
}
/**
* query authorized and user created project |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,135 | [Bug][API]the interface of 'authed project' is missed. |
branch: [dev]
"authed-project" in API module is missed

| https://github.com/apache/dolphinscheduler/issues/6135 | https://github.com/apache/dolphinscheduler/pull/6136 | 9d7f70bca777177c14efb3d32e469a54951f4a6b | edb8f3c435a052bdd622b5a9a7c4ce995f5705b5 | "2021-09-08T10:09:49Z" | java | "2021-09-08T12:47:54Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java | *
* @param loginUser login user
* @return projects which the user create and authorized
*/
@ApiOperation(value = "queryProjectCreatedAndAuthorizedByUser", notes = "QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES")
@GetMapping(value = "/created-and-authed")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProjectCreatedAndAuthorizedByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
Map<String, Object> result = projectService.queryProjectCreatedAndAuthorizedByUser(loginUser);
return returnDataList(result);
}
/**
* query all project list
*
* @param loginUser login user
* @return all project list
*/
@ApiOperation(value = "queryAllProjectList", notes = "QUERY_ALL_PROJECT_LIST_NOTES")
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryAllProjectList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
Map<String, Object> result = projectService.queryAllProjectList();
return returnDataList(result);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_ID;
import org.apache.dolphinscheduler.api.dto.DagDataSchedule;
import org.apache.dolphinscheduler.api.dto.treeview.Instance;
import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProcessInstanceService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.utils.CheckUtils;
import org.apache.dolphinscheduler.api.utils.FileUtils;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNode;
import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import org.apache.dolphinscheduler.common.utils.SnowFlakeUtils;
import org.apache.dolphinscheduler.common.utils.SnowFlakeUtils.SnowFlakeException;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.entity.DagData;
import org.apache.dolphinscheduler.dao.entity.ProcessData;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.service.permission.PermissionCheck;
import org.apache.dolphinscheduler.service.process.ProcessService;
import java.io.BufferedOutputStream; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
/**
* process definition service impl
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
private static final String RELEASESTATE = "releaseState";
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private UserMapper userMapper;
@Autowired
private ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProcessInstanceService processInstanceService;
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private ProcessService processService;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private SchedulerService schedulerService;
@Autowired
private TenantMapper tenantMapper;
/**
* create process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return create result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> createProcessDefinition(User loginUser,
long projectCode,
String name,
String description, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
createTaskDefinition(result, loginUser, projectCode, taskDefinitionLogs, taskDefinitionJson);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) {
return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = SnowFlakeUtils.getInstance().nextId();
} catch (SnowFlakeException e) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return result;
}
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description,
globalParams, locations, timeout, loginUser.getId(), tenantId);
return createProcessDefine(loginUser, result, taskRelationList, processDefinition, taskDefinitionLogs);
}
private void createTaskDefinition(Map<String, Object> result,
User loginUser,
long projectCode,
List<TaskDefinitionLog> taskDefinitionLogs,
String taskDefinitionJson) {
if (taskDefinitionLogs.isEmpty()) {
logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson);
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return;
}
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!CheckUtils.checkTaskDefinitionParameters(taskDefinitionLog)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | logger.error("task definition {} parameter invalid", taskDefinitionLog.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
return;
}
}
if (processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs)) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
}
}
private Map<String, Object> createProcessDefine(User loginUser,
Map<String, Object> result,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
List<TaskDefinitionLog> taskDefinitionLogs) {
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true);
if (insertVersion > 0) {
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
}
} else {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
}
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
try {
if (taskRelationList == null || taskRelationList.isEmpty()) {
logger.error("task relation list is null");
putMsg(result, Status.DATA_IS_NOT_VALID, taskRelationJson);
return result;
}
List<TaskNode> taskNodeList = processService.transformTask(taskRelationList, taskDefinitionLogs);
if (taskNodeList.size() != taskRelationList.size()) {
Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode).collect(Collectors.toSet());
Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet());
Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes);
logger.error("the task code is not exit");
putMsg(result, Status.TASK_DEFINE_NOT_EXIST, StringUtils.join(codes, Constants.COMMA));
return result;
}
if (graphHasCycle(taskNodeList)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
if (processTaskRelationLog.getPostTaskCode() == 0) {
logger.error("the post_task_code or post_task_version can't be zero");
putMsg(result, Status.CHECK_PROCESS_TASK_RELATION_ERROR);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
/**
* query process definition list
*
* @param loginUser login user
* @param projectCode project code
* @return definition list
*/
@Override
public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list paging |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | *
* @param loginUser login user
* @param projectCode project code
* @param searchVal search value
* @param userId user id
* @param pageNo page number
* @param pageSize page size
* @return process definition page
*/
@Override
public Result queryProcessDefinitionListPaging(User loginUser, long projectCode, String searchVal, Integer userId, Integer pageNo, Integer pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
Page<ProcessDefinition> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging(
page, searchVal, userId, project.getCode(), isAdmin(loginUser));
List<ProcessDefinition> records = processDefinitionIPage.getRecords();
for (ProcessDefinition pd : records) {
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion());
User user = userMapper.selectById(processDefinitionLog.getOperator());
pd.setModifyBy(user.getUserName());
}
processDefinitionIPage.setRecords(records); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) processDefinitionIPage.getTotal());
pageInfo.setTotalList(processDefinitionIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query detail of process definition
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return process definition detail
*/
@Override
public Map<String, Object> queryProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
} else {
Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId());
if (tenant != null) {
processDefinition.setTenantCode(tenant.getTenantCode()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
@Override
public Map<String, Object> queryProcessDefinitionByName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name);
} else {
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* update process definition
*
* @param loginUser login user
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams global params
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return update result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> updateProcessDefinition(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
createTaskDefinition(result, loginUser, projectCode, taskDefinitionLogs, taskDefinitionJson);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) {
return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class);
processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId);
return updateProcessDefine(loginUser, result, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs);
}
private Map<String, Object> updateProcessDefine(User loginUser,
Map<String, Object> result,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
ProcessDefinition processDefinitionDeepCopy,
List<TaskDefinitionLog> taskDefinitionLogs) {
int insertVersion;
if (processDefinition.equals(processDefinitionDeepCopy)) {
insertVersion = processDefinitionDeepCopy.getVersion();
} else {
processDefinition.setUpdateTime(new Date());
insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true);
}
if (insertVersion > 0) {
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
return result;
}
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectCode project code
* @param name name
* @return true if process definition name not exists, otherwise false
*/
@Override
public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim());
if (processDefinition == null) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
return result;
}
/**
* delete process definition by code
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return delete result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionByCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, code);
return result;
}
List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES);
if (CollectionUtils.isNotEmpty(processInstances)) {
putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_CODE_FAIL, processInstances.size());
return result;
}
List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionCode(code);
if (!schedules.isEmpty() && schedules.size() > 1) {
logger.warn("scheduler num is {},Greater than 1", schedules.size());
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
return result;
} else if (schedules.size() == 1) {
Schedule schedule = schedules.get(0);
if (schedule.getReleaseState() == ReleaseState.OFFLINE) {
scheduleMapper.deleteById(schedule.getId());
} else if (schedule.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId());
return result;
}
}
int delete = processDefinitionMapper.deleteById(processDefinition.getId());
processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode());
if (delete > 0) {
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | } else {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
return result;
}
/**
* release process definition: online / offline
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState release state
* @return release result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
switch (releaseState) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | case ONLINE:
String resourceIds = processDefinition.getResourceIds();
if (StringUtils.isNotBlank(resourceIds)) {
Integer[] resourceIdArray = Arrays.stream(resourceIds.split(Constants.COMMA)).map(Integer::parseInt).toArray(Integer[]::new);
PermissionCheck<Integer> permissionCheck = new PermissionCheck<>(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger);
try {
permissionCheck.checkPermission();
} catch (Exception e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION, RELEASESTATE);
return result;
}
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray(
new long[]{processDefinition.getCode()}
);
for (Schedule schedule : scheduleList) {
logger.info("set schedule offline, project id: {}, schedule id: {}, process definition code: {}", project.getId(), schedule.getId(), code);
schedule.setReleaseState(ReleaseState.OFFLINE);
scheduleMapper.updateById(schedule);
schedulerService.deleteSchedule(project.getId(), schedule.getId());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* batch export process definition by codes
*/
@Override
public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes, HttpServletResponse response) {
if (StringUtils.isEmpty(codes)) {
return;
}
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
List<DagDataSchedule> dagDataSchedules = processDefinitionList.stream().map(this::exportProcessDagData).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(dagDataSchedules)) {
downloadProcessDefinitionFile(response, dagDataSchedules);
}
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * download the process definition file
*/
private void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
BufferedOutputStream buff = null;
ServletOutputStream out = null;
try {
out = response.getOutputStream();
buff = new BufferedOutputStream(out);
buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8));
buff.flush();
buff.close();
} catch (IOException e) {
logger.warn("export process fail", e);
} finally {
if (null != buff) {
try {
buff.close();
} catch (Exception e) {
logger.warn("export process buffer not close", e);
}
}
if (null != out) {
try {
out.close();
} catch (Exception e) {
logger.warn("export process output stream not close", e);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
/**
* get export process dag data
*
* @param processDefinition process definition
* @return DagDataSchedule
*/
public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) {
List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode());
DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition));
if (!schedules.isEmpty()) {
Schedule schedule = schedules.get(0);
schedule.setReleaseState(ReleaseState.OFFLINE);
dagDataSchedule.setSchedule(schedule);
}
return dagDataSchedule;
}
/**
* import process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file process metadata json file
* @return import process
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result = new HashMap<>();
String dagDataScheduleJson = FileUtils.file2String(file); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class);
if (CollectionUtils.isEmpty(dagDataScheduleList)) {
putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result;
}
for (DagDataSchedule dagDataSchedule : dagDataScheduleList) {
if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule)) {
return result;
}
}
return result;
}
/**
* check and import
*/
private boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule) {
if (!checkImportanceParams(dagDataSchedule, result)) {
return false;
}
ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition();
Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, processDefinition.getName());
if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) {
putMsg(result, Status.SUCCESS);
} else {
result.putAll(checkResult);
return false;
}
String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processDefinition.setName(processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp());
processDefinition.setUserId(loginUser.getId());
try {
processDefinition.setCode(SnowFlakeUtils.getInstance().nextId());
} catch (SnowFlakeException e) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return false;
}
List<TaskDefinitionLog> taskDefinitionList = dagDataSchedule.getTaskDefinitionList();
Map<Long, Long> taskCodeMap = new HashMap<>();
Date now = new Date();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionList) {
taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp());
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUserId(loginUser.getId());
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
taskDefinitionLog.setCreateTime(now);
taskDefinitionLog.setUpdateTime(now);
taskDefinitionLog.setOperator(loginUser.getId());
taskDefinitionLog.setOperateTime(now);
try {
long code = SnowFlakeUtils.getInstance().nextId();
taskCodeMap.put(taskDefinitionLog.getCode(), code);
taskDefinitionLog.setCode(code);
} catch (SnowFlakeException e) {
logger.error("Task code get error, ", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
return false;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | int insert = taskDefinitionMapper.batchInsert(taskDefinitionList);
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionList);
if ((logInsert & insert) == 0) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
return false;
}
List<ProcessTaskRelationLog> taskRelationList = dagDataSchedule.getProcessTaskRelationList();
taskRelationList.forEach(processTaskRelationLog -> {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
});
Map<String, Object> createProcessResult = createProcessDefine(loginUser, result, taskRelationList, processDefinition, null);
if (Status.SUCCESS.equals(createProcessResult.get(Constants.STATUS))) {
putMsg(createProcessResult, Status.SUCCESS);
} else {
result.putAll(createProcessResult);
return false;
}
Schedule schedule = dagDataSchedule.getSchedule();
if (null != schedule) {
ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode());
schedule.setProcessDefinitionCode(newProcessDefinition.getCode());
schedule.setUserId(loginUser.getId());
schedule.setCreateTime(now);
schedule.setUpdateTime(now);
int scheduleInsert = scheduleMapper.insert(schedule);
if (0 == scheduleInsert) {
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return false;
}
}
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) {
if (dagDataSchedule.getProcessDefinition() == null) {
putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) {
putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) {
putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList");
return false;
}
return true;
}
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1);
}
/**
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
@Override
public Map<String, Object> checkProcessNodeList(String processTaskRelationJson) {
Map<String, Object> result = new HashMap<>();
try {
if (processTaskRelationJson == null) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson);
return result;
}
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelationLog.class);
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, Lists.newArrayList());
if (CollectionUtils.isEmpty(taskNodes)) {
logger.error("process node info is empty");
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (graphHasCycle(taskNodes)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!CheckUtils.checkTaskNodeParameters(taskNode)) {
logger.error("task node {} parameter invalid", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
CheckUtils.checkOtherParams(taskNode.getExtras());
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
/**
* get task node details based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param code process definition code
* @return task node list |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | */
@Override
public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details map based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param codes define codes
* @return task node list
*/
@Override
public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
Map<Long, List<TaskDefinitionLog>> taskNodeMap = new HashMap<>();
for (ProcessDefinition processDefinition : processDefinitionList) {
DagData dagData = processService.genDagData(processDefinition);
taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList());
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project code
*
* @param loginUser loginUser
* @param projectCode project code
* @return process definitions in the project
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
@Override
public Map<String, Object> viewTree(long code, Integer limit) {
Map<String, Object> result = new HashMap<>();
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit);
processInstanceList.forEach(processInstance -> processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = processService.queryTaskDefinitionListByProcess(code, processDefinition.getVersion());
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), "",
processInstance.getState().toString(), processInstance.getStartTime(), endTime, processInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | while (Stopper.isRunning()) {
Set<String> postNodeList;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeName = en.getKey();
parentTreeViewDtoList = en.getValue();
TreeViewDto treeViewDto = new TreeViewDto();
treeViewDto.setName(nodeName);
TaskNode taskNode = dag.getNode(nodeName);
treeViewDto.setType(taskNode.getType());
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), nodeName);
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
int subProcessId = 0;
if (taskInstance.isSubProcess()) {
TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode());
subProcessId = Integer.parseInt(JSONUtils.parseObject(
taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_ID).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskType(),
taskInstance.getState().toString(), taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessId)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
}
for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
postNodeList = dag.getSubsequentNodes(nodeName);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeName : postNodeList) {
List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeName);
if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>();
}
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeName, treeViewDtoList);
}
}
runningNodeMap.remove(nodeName);
}
if (waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
}
result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* whether the graph has a ring
*
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>();
for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(taskNodeResponse.getName(), taskNodeResponse);
}
for (TaskNode taskNodeResponse : taskNodeResponseList) {
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, taskNodeResponse.getName())) {
return true;
}
}
}
}
return graph.hasCycle();
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true);
return result;
}
/**
* batch move process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (projectCode == targetProjectCode) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
return result;
}
private Map<String, Object> checkParams(User loginUser,
long projectCode,
String processDefinitionCodes,
long targetProjectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isEmpty(processDefinitionCodes)) {
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes);
return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
Map<String, Object> targetResult = projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (targetResult.get(Constants.STATUS) != Status.SUCCESS) {
return targetResult;
}
}
return result;
}
private void doBatchOperateProcessDefinition(User loginUser,
long targetProjectCode,
List<String> failedProcessList,
String processDefinitionCodes,
Map<String, Object> result,
boolean isCopy) {
Set<Long> definitionCodes = Arrays.stream(processDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes);
Set<Long> queryCodes = processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode = definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet());
diffCode.forEach(code -> failedProcessList.add(code + "[null]"));
for (ProcessDefinition processDefinition : processDefinitionList) {
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
List<ProcessTaskRelationLog> taskRelationList = processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
processDefinition.setProjectCode(targetProjectCode);
if (isCopy) {
processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp());
createProcessDefine(loginUser, result, taskRelationList, processDefinition, Lists.newArrayList());
} else {
updateProcessDefine(loginUser, result, taskRelationList, processDefinition, null, Lists.newArrayList());
}
if (result.get(Constants.STATUS) != Status.SUCCESS) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]");
}
}
}
/**
* switch the defined process definition version
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (Objects.isNull(processDefinition)) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR, code);
return result;
}
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper
.queryByDefinitionCodeAndVersion(code, version);
if (Objects.isNull(processDefinitionLog)) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR, processDefinition.getCode(), version); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 6,147 | [Bug] The genTaskCodeList interface returns the same code | Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code

短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code | https://github.com/apache/dolphinscheduler/issues/6147 | https://github.com/apache/dolphinscheduler/pull/6150 | cca48d0a9249917f7dc2ecef1cad67e93e227555 | e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009 | "2021-09-09T03:31:10Z" | java | "2021-09-09T14:01:22Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog);
if (switchVersion > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
return result;
}
/**
* check batch operate result
*
* @param srcProjectCode srcProjectCode
* @param targetProjectCode targetProjectCode
* @param result result
* @param failedProcessList failedProcessList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode,
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) {
if (!failedProcessList.isEmpty()) {
if (isCopy) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList));
} else {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList));
}
} else {
putMsg(result, Status.SUCCESS);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.