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
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | * the src file is on the local disk. Add it to FS at
* the given dst name.
*
* @param srcFile local file
* @param dstHdfsPath destination hdfs path
* @param deleteSource whether to delete the src
* @param overwrite whether to overwrite an existing file
* @return if success or not
* @throws IOException errors
*/
public boolean copyLocalToHdfs(String srcFile, String dstHdfsPath, boolean deleteSource, boolean overwrite) throws IOException {
Path srcPath = new Path(srcFile);
Path dstPath = new Path(dstHdfsPath);
fs.copyFromLocalFile(deleteSource, overwrite, srcPath, dstPath);
return true;
}
@Override
public boolean upload(String buckName, String srcFile, String dstPath, boolean deleteSource, boolean overwrite) throws IOException {
return copyLocalToHdfs(srcFile, dstPath, deleteSource, overwrite);
}
/*
* copy hdfs file to local
*
* @param srcHdfsFilePath source hdfs file path
* @param dstFile destination file
* @param deleteSource delete source
* @param overwrite overwrite
* @return result of copy hdfs file to local
* @throws IOException errors
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | public boolean copyHdfsToLocal(String srcHdfsFilePath, String dstFile, boolean deleteSource, boolean overwrite) throws IOException {
Path srcPath = new Path(srcHdfsFilePath);
File dstPath = new File(dstFile);
if (dstPath.exists()) {
if (dstPath.isFile()) {
if (overwrite) {
Files.delete(dstPath.toPath());
}
} else {
logger.error("destination file must be a file");
}
}
if (!dstPath.getParentFile().exists() && !dstPath.getParentFile().mkdirs()) {
return false;
}
return FileUtil.copy(fs, srcPath, dstPath, deleteSource, fs.getConf());
}
/**
* delete a file
*
* @param hdfsFilePath the path to delete.
* @param recursive if path is a directory and set to
* true, the directory is deleted else throws an exception. In
* case of a file the recursive can be set to either true or false.
* @return true if delete is successful else false.
* @throws IOException errors
*/
@Override
public boolean delete(String tenantCode, String hdfsFilePath, boolean recursive) throws IOException {
return fs.delete(new Path(hdfsFilePath), recursive); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | }
/**
* check if exists
*
* @param hdfsFilePath source file path
* @return result of exists or not
* @throws IOException errors
*/
@Override
public boolean exists(String tenantCode, String hdfsFilePath) throws IOException {
return fs.exists(new Path(hdfsFilePath));
}
/**
* Gets a list of files in the directory
*
* @param filePath file path
* @return {@link FileStatus} file status
* @throws IOException errors
*/
public FileStatus[] listFileStatus(String filePath) throws IOException {
try {
return fs.listStatus(new Path(filePath));
} catch (IOException e) {
logger.error("Get file list exception", e);
throw new IOException("Get file list exception", e);
}
}
/**
* Renames Path src to Path dst. Can take place on local fs
* or remote DFS. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | *
* @param src path to be renamed
* @param dst new path after rename
* @return true if rename is successful
* @throws IOException on failure
*/
public boolean rename(String src, String dst) throws IOException {
return fs.rename(new Path(src), new Path(dst));
}
/**
* hadoop resourcemanager enabled or not
*
* @return result
*/
public boolean isYarnEnabled() {
return yarnEnabled;
}
/**
* get the state of an application
*
* @param applicationId application id
* @return the return may be null or there may be other parse exceptions
*/
public ExecutionStatus getApplicationStatus(String applicationId) throws BaseException {
if (StringUtils.isEmpty(applicationId)) {
return null;
}
String result;
String applicationUrl = getApplicationUrl(applicationId);
logger.debug("generate yarn application url, applicationUrl={}", applicationUrl); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | String responseContent = Boolean.TRUE.equals(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) ? KerberosHttpClient.get(applicationUrl) : HttpUtils.get(applicationUrl);
if (responseContent != null) {
ObjectNode jsonObject = JSONUtils.parseObject(responseContent);
if (!jsonObject.has("app")) {
return ExecutionStatus.FAILURE;
}
result = jsonObject.path("app").path("finalStatus").asText();
} else {
String jobHistoryUrl = getJobHistoryUrl(applicationId);
logger.debug("generate yarn job history application url, jobHistoryUrl={}", jobHistoryUrl);
responseContent = Boolean.TRUE.equals(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) ? KerberosHttpClient.get(jobHistoryUrl) : HttpUtils.get(jobHistoryUrl);
if (null != responseContent) {
ObjectNode jsonObject = JSONUtils.parseObject(responseContent);
if (!jsonObject.has("job")) {
return ExecutionStatus.FAILURE;
}
result = jsonObject.path("job").path("state").asText();
} else {
return ExecutionStatus.FAILURE;
}
}
return getExecutionStatus(result);
}
private ExecutionStatus getExecutionStatus(String result) {
switch (result) {
case Constants.ACCEPTED:
return ExecutionStatus.SUBMITTED_SUCCESS;
case Constants.SUCCEEDED:
case Constants.ENDED: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | return ExecutionStatus.SUCCESS;
case Constants.NEW:
case Constants.NEW_SAVING:
case Constants.SUBMITTED:
case Constants.FAILED:
return ExecutionStatus.FAILURE;
case Constants.KILLED:
return ExecutionStatus.KILL;
case Constants.RUNNING:
default:
return ExecutionStatus.RUNNING_EXECUTION;
}
}
/**
* get data hdfs path
*
* @return data hdfs path
*/
public static String getHdfsDataBasePath() {
if (FOLDER_SEPARATOR.equals(RESOURCE_UPLOAD_PATH)) {
return "";
} else {
return RESOURCE_UPLOAD_PATH;
}
}
/**
* hdfs resource dir
*
* @param tenantCode tenant code
* @param resourceType resource type |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | * @return hdfs resource dir
*/
public static String getHdfsDir(ResourceType resourceType, String tenantCode) {
String hdfsDir = "";
if (resourceType.equals(ResourceType.FILE)) {
hdfsDir = getHdfsResDir(tenantCode);
} else if (resourceType.equals(ResourceType.UDF)) {
hdfsDir = getHdfsUdfDir(tenantCode);
}
return hdfsDir;
}
@Override
public String getDir(ResourceType resourceType, String tenantCode) {
return getHdfsDir(resourceType, tenantCode);
}
/**
* hdfs resource dir
*
* @param tenantCode tenant code
* @return hdfs resource dir
*/
public static String getHdfsResDir(String tenantCode) {
return String.format("%s/" + RESOURCE_TYPE_FILE, getHdfsTenantDir(tenantCode));
}
/**
* hdfs udf dir
*
* @param tenantCode tenant code
* @return get udf dir on hdfs
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | public static String getHdfsUdfDir(String tenantCode) {
return String.format("%s/" + RESOURCE_TYPE_UDF, getHdfsTenantDir(tenantCode));
}
/**
* get hdfs file name
*
* @param resourceType resource type
* @param tenantCode tenant code
* @param fileName file name
* @return hdfs file name
*/
public static String getHdfsFileName(ResourceType resourceType, String tenantCode, String fileName) {
if (fileName.startsWith(FOLDER_SEPARATOR)) {
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return String.format(FORMAT_S_S, getHdfsDir(resourceType, tenantCode), fileName);
}
/**
* get absolute path and name for resource file on hdfs
*
* @param tenantCode tenant code
* @param fileName file name
* @return get absolute path and name for file on hdfs
*/
public static String getHdfsResourceFileName(String tenantCode, String fileName) {
if (fileName.startsWith(FOLDER_SEPARATOR)) {
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return String.format(FORMAT_S_S, getHdfsResDir(tenantCode), fileName);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | /**
* get absolute path and name for udf file on hdfs
*
* @param tenantCode tenant code
* @param fileName file name
* @return get absolute path and name for udf file on hdfs
*/
public static String getHdfsUdfFileName(String tenantCode, String fileName) {
if (fileName.startsWith(FOLDER_SEPARATOR)) {
fileName = fileName.replaceFirst(FOLDER_SEPARATOR, "");
}
return String.format(FORMAT_S_S, getHdfsUdfDir(tenantCode), fileName);
}
/**
* @param tenantCode tenant code
* @return file directory of tenants on hdfs
*/
public static String getHdfsTenantDir(String tenantCode) {
return String.format(FORMAT_S_S, getHdfsDataBasePath(), tenantCode);
}
/**
* getAppAddress
*
* @param appAddress app address
* @param rmHa resource manager ha
* @return app address
*/
public static String getAppAddress(String appAddress, String rmHa) {
String activeRM = YarnHAAdminUtils.getActiveRMName(rmHa); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | if (StringUtils.isEmpty(activeRM)) {
return null;
}
String[] split1 = appAddress.split(Constants.DOUBLE_SLASH);
if (split1.length != 2) {
return null;
}
String start = split1[0] + Constants.DOUBLE_SLASH;
String[] split2 = split1[1].split(Constants.COLON);
if (split2.length != 2) {
return null;
}
String end = Constants.COLON + split2[1];
return start + activeRM + end;
}
@Override
public void close() throws IOException {
if (fs != null) {
try {
fs.close();
} catch (IOException e) {
logger.error("Close HadoopUtils instance failed", e);
throw new IOException("Close HadoopUtils instance failed", e);
}
}
}
/**
* yarn ha admin utils
*/
private static final class YarnHAAdminUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | /**
* get active resourcemanager
*/
public static String getActiveRMName(String rmIds) {
String[] rmIdArr = rmIds.split(Constants.COMMA);
String yarnUrl = "http://%s:" + HADOOP_RESOURCE_MANAGER_HTTP_ADDRESS_PORT_VALUE + "/ws/v1/cluster/info";
try {
/**
* send http get request to rm
*/
for (String rmId : rmIdArr) {
String state = getRMState(String.format(yarnUrl, rmId));
if (Constants.HADOOP_RM_STATE_ACTIVE.equals(state)) {
return rmId;
}
}
} catch (Exception e) {
logger.error("yarn ha application url generation failed, message:{}", e.getMessage());
}
return null;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,641 | [Bug] [common] throw NullPointerException in HadoopUtils.java casue hdfs local mode is invalid. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened

this exception will cause the hdfs local mode is invalid.

### What you expected to happen
the hdfs local mode valid.
### How to reproduce
put up breakpoint on it and debug run the application.
### Anything else
I did not test whether non-local patterns would be affected by this bug. During the development process, the log output did not record the call stack of this NullPointerException which seriously affected my positioning problem! I don't know if it's the default logging level setting or something else, but I hope you can optimize your logging.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10641 | https://github.com/apache/dolphinscheduler/pull/10642 | 5ebd982e920c9196210fc1e619afb73d81689d2b | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 2022-06-27T16:04:04Z | java | 2022-06-28T14:51:09Z | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java | /**
* get ResourceManager state
*/
public static String getRMState(String url) {
String retStr = Boolean.TRUE.equals(PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE, false)) ? KerberosHttpClient.get(url) : HttpUtils.get(url);
if (StringUtils.isEmpty(retStr)) {
return null;
}
ObjectNode jsonObject = JSONUtils.parseObject(retStr);
if (!jsonObject.has("clusterInfo")) {
return null;
}
return jsonObject.get("clusterInfo").path("haState").asText();
}
}
@Override
public void deleteTenant(String tenantCode) throws Exception {
String tenantPath = getHdfsDataBasePath() + FOLDER_SEPARATOR + tenantCode;
if (exists(tenantCode, tenantPath)) {
delete(tenantCode, tenantPath, true);
}
}
@Override
public ResUploadType returnStorageType() {
return ResUploadType.HDFS;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.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. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.datax;
import static org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils.decodePassword;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.RWXR_XR_X;
import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.dolphinscheduler.plugin.task.api.utils.MapUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.dolphinscheduler.spi.enums.Flag;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.alibaba.druid.sql.ast.SQLStatement;
import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr;
import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr;
import com.alibaba.druid.sql.ast.statement.SQLSelect;
import com.alibaba.druid.sql.ast.statement.SQLSelectItem;
import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.sql.ast.statement.SQLUnionQuery;
import com.alibaba.druid.sql.parser.SQLStatementParser;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class DataxTask extends AbstractTaskExecutor { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | /**
* jvm parameters
*/
public static final String JVM_PARAM = " --jvm=\"-Xms%sG -Xmx%sG\" ";
/**
* python process(datax only supports version 2.7 by default)
*/
private static final String DATAX_PYTHON = "python2.7";
private static final Pattern PYTHON_PATH_PATTERN = Pattern.compile("/bin/python[\\d.]*$");
/**
* datax path
*/
private static final String DATAX_PATH = "${DATAX_HOME}/bin/datax.py";
/**
* datax channel count
*/
private static final int DATAX_CHANNEL_COUNT = 1;
/**
* datax parameters
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | private DataxParameters dataXParameters;
/**
* shell command executor
*/
private ShellCommandExecutor shellCommandExecutor;
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
private DataxTaskExecutionContext dataxTaskExecutionContext;
/**
* constructor
*
* @param taskExecutionContext taskExecutionContext
*/
public DataxTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle,
taskExecutionContext, logger);
}
/**
* init DataX config
*/
@Override
public void init() {
logger.info("datax task params {}", taskExecutionContext.getTaskParams());
dataXParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), DataxParameters.class);
if (!dataXParameters.checkParameters()) {
throw new RuntimeException("datax task params is not valid"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | }
dataxTaskExecutionContext = dataXParameters.generateExtendedContext(taskExecutionContext.getResourceParametersHelper());
}
/**
* run DataX process
*
* @throws Exception if error throws Exception
*/
@Override
public void handle() throws Exception {
try {
Map<String, Property> paramsMap = ParamUtils.convert(taskExecutionContext, getParameters());
if (MapUtils.isEmpty(paramsMap)) {
paramsMap = new HashMap<>();
}
if (MapUtils.isNotEmpty(taskExecutionContext.getParamsMap())) {
paramsMap.putAll(taskExecutionContext.getParamsMap());
}
String jsonFilePath = buildDataxJsonFile(paramsMap);
String shellCommandFilePath = buildShellCommandFile(jsonFilePath, paramsMap);
TaskResponse commandExecuteResult = shellCommandExecutor.run(shellCommandFilePath);
setExitStatusCode(commandExecuteResult.getExitStatusCode());
setAppIds(commandExecuteResult.getAppIds());
setProcessId(commandExecuteResult.getProcessId());
} catch (Exception e) {
setExitStatusCode(EXIT_CODE_FAILURE);
throw e;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | }
/**
* cancel DataX process
*
* @param cancelApplication cancelApplication
* @throws Exception if error throws Exception
*/
@Override
public void cancelApplication(boolean cancelApplication)
throws Exception {
shellCommandExecutor.cancelApplication();
}
/**
* build datax configuration file
*
* @return datax json file name
* @throws Exception if error throws Exception
*/
private String buildDataxJsonFile(Map<String, Property> paramsMap)
throws Exception {
String fileName = String.format("%s/%s_job.json",
taskExecutionContext.getExecutePath(),
taskExecutionContext.getTaskAppId());
String json;
Path path = new File(fileName).toPath();
if (Files.exists(path)) {
return fileName;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | if (dataXParameters.getCustomConfig() == Flag.YES.ordinal()) {
json = dataXParameters.getJson().replaceAll("\\r\\n", "\n");
} else {
ObjectNode job = JSONUtils.createObjectNode();
job.putArray("content").addAll(buildDataxJobContentJson());
job.set("setting", buildDataxJobSettingJson());
ObjectNode root = JSONUtils.createObjectNode();
root.set("job", job);
root.set("core", buildDataxCoreJson());
json = root.toString();
}
json = ParameterUtils.convertParameterPlaceholders(json, ParamUtils.convert(paramsMap));
logger.debug("datax job json : {}", json);
FileUtils.writeStringToFile(new File(fileName), json, StandardCharsets.UTF_8);
return fileName;
}
/**
* build datax job config
*
* @return collection of datax job config JSONObject
* @throws SQLException if error throws SQLException
*/
private List<ObjectNode> buildDataxJobContentJson() {
BaseConnectionParam dataSourceCfg = (BaseConnectionParam) DataSourceUtils.buildConnectionParams(
dataxTaskExecutionContext.getSourcetype(),
dataxTaskExecutionContext.getSourceConnectionParams());
BaseConnectionParam dataTargetCfg = (BaseConnectionParam) DataSourceUtils.buildConnectionParams(
dataxTaskExecutionContext.getTargetType(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | dataxTaskExecutionContext.getTargetConnectionParams());
List<ObjectNode> readerConnArr = new ArrayList<>();
ObjectNode readerConn = JSONUtils.createObjectNode();
ArrayNode sqlArr = readerConn.putArray("querySql");
for (String sql : new String[]{dataXParameters.getSql()}) {
sqlArr.add(sql);
}
ArrayNode urlArr = readerConn.putArray("jdbcUrl");
urlArr.add(DataSourceUtils.getJdbcUrl(DbType.valueOf(dataXParameters.getDsType()), dataSourceCfg));
readerConnArr.add(readerConn);
ObjectNode readerParam = JSONUtils.createObjectNode();
readerParam.put("username", dataSourceCfg.getUser());
readerParam.put("password", decodePassword(dataSourceCfg.getPassword()));
readerParam.putArray("connection").addAll(readerConnArr);
ObjectNode reader = JSONUtils.createObjectNode();
reader.put("name", DataxUtils.getReaderPluginName(dataxTaskExecutionContext.getSourcetype()));
reader.set("parameter", readerParam);
List<ObjectNode> writerConnArr = new ArrayList<>();
ObjectNode writerConn = JSONUtils.createObjectNode();
ArrayNode tableArr = writerConn.putArray("table");
tableArr.add(dataXParameters.getTargetTable());
writerConn.put("jdbcUrl", DataSourceUtils.getJdbcUrl(DbType.valueOf(dataXParameters.getDtType()), dataTargetCfg));
writerConnArr.add(writerConn);
ObjectNode writerParam = JSONUtils.createObjectNode();
writerParam.put("username", dataTargetCfg.getUser());
writerParam.put("password", decodePassword(dataTargetCfg.getPassword()));
String[] columns = parsingSqlColumnNames(dataxTaskExecutionContext.getSourcetype(),
dataxTaskExecutionContext.getTargetType(),
dataSourceCfg, dataXParameters.getSql());
ArrayNode columnArr = writerParam.putArray("column"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | for (String column : columns) {
columnArr.add(column);
}
writerParam.putArray("connection").addAll(writerConnArr);
if (CollectionUtils.isNotEmpty(dataXParameters.getPreStatements())) {
ArrayNode preSqlArr = writerParam.putArray("preSql");
for (String preSql : dataXParameters.getPreStatements()) {
preSqlArr.add(preSql);
}
}
if (CollectionUtils.isNotEmpty(dataXParameters.getPostStatements())) {
ArrayNode postSqlArr = writerParam.putArray("postSql");
for (String postSql : dataXParameters.getPostStatements()) {
postSqlArr.add(postSql);
}
}
ObjectNode writer = JSONUtils.createObjectNode();
writer.put("name", DataxUtils.getWriterPluginName(dataxTaskExecutionContext.getTargetType()));
writer.set("parameter", writerParam);
List<ObjectNode> contentList = new ArrayList<>();
ObjectNode content = JSONUtils.createObjectNode();
content.set("reader", reader);
content.set("writer", writer);
contentList.add(content);
return contentList;
}
/**
* build datax setting config
*
* @return datax setting config JSONObject |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | */
private ObjectNode buildDataxJobSettingJson() {
ObjectNode speed = JSONUtils.createObjectNode();
speed.put("channel", DATAX_CHANNEL_COUNT);
if (dataXParameters.getJobSpeedByte() > 0) {
speed.put("byte", dataXParameters.getJobSpeedByte());
}
if (dataXParameters.getJobSpeedRecord() > 0) {
speed.put("record", dataXParameters.getJobSpeedRecord());
}
ObjectNode errorLimit = JSONUtils.createObjectNode();
errorLimit.put("record", 0);
errorLimit.put("percentage", 0);
ObjectNode setting = JSONUtils.createObjectNode();
setting.set("speed", speed);
setting.set("errorLimit", errorLimit);
return setting;
}
private ObjectNode buildDataxCoreJson() {
ObjectNode speed = JSONUtils.createObjectNode();
speed.put("channel", DATAX_CHANNEL_COUNT);
if (dataXParameters.getJobSpeedByte() > 0) {
speed.put("byte", dataXParameters.getJobSpeedByte());
}
if (dataXParameters.getJobSpeedRecord() > 0) {
speed.put("record", dataXParameters.getJobSpeedRecord());
}
ObjectNode channel = JSONUtils.createObjectNode();
channel.set("speed", speed);
ObjectNode transport = JSONUtils.createObjectNode(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | transport.set("channel", channel);
ObjectNode core = JSONUtils.createObjectNode();
core.set("transport", transport);
return core;
}
/**
* create command
*
* @return shell command file name
* @throws Exception if error throws Exception
*/
private String buildShellCommandFile(String jobConfigFilePath, Map<String, Property> paramsMap)
throws Exception {
String fileName = String.format("%s/%s_node.%s",
taskExecutionContext.getExecutePath(),
taskExecutionContext.getTaskAppId(),
SystemUtils.IS_OS_WINDOWS ? "bat" : "sh");
Path path = new File(fileName).toPath();
if (Files.exists(path)) {
return fileName;
}
StringBuilder sbr = new StringBuilder();
sbr.append(getPythonCommand());
sbr.append(" ");
sbr.append(DATAX_PATH);
sbr.append(" ");
sbr.append(loadJvmEnv(dataXParameters));
sbr.append(jobConfigFilePath); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | String dataxCommand = ParameterUtils.convertParameterPlaceholders(sbr.toString(), ParamUtils.convert(paramsMap));
logger.debug("raw script : {}", dataxCommand);
Set<PosixFilePermission> perms = PosixFilePermissions.fromString(RWXR_XR_X);
FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms);
if (SystemUtils.IS_OS_WINDOWS) {
Files.createFile(path);
} else {
Files.createFile(path, attr);
}
Files.write(path, dataxCommand.getBytes(), StandardOpenOption.APPEND);
return fileName;
}
public String getPythonCommand() {
String pythonHome = System.getenv("PYTHON_HOME");
return getPythonCommand(pythonHome);
}
public String getPythonCommand(String pythonHome) {
if (StringUtils.isEmpty(pythonHome)) {
return DATAX_PYTHON;
}
String pythonBinPath = "/bin/" + DATAX_PYTHON;
Matcher matcher = PYTHON_PATH_PATTERN.matcher(pythonHome);
if (matcher.find()) {
return matcher.replaceAll(pythonBinPath);
}
return Paths.get(pythonHome, pythonBinPath).toString();
}
public String loadJvmEnv(DataxParameters dataXParameters) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | int xms = Math.max(dataXParameters.getXms(), 1);
int xmx = Math.max(dataXParameters.getXmx(), 1);
return String.format(JVM_PARAM, xms, xmx);
}
/**
* parsing synchronized column names in SQL statements
*
* @param sourceType the database type of the data source
* @param targetType the database type of the data target
* @param dataSourceCfg the database connection parameters of the data source
* @param sql sql for data synchronization
* @return Keyword converted column names
*/
private String[] parsingSqlColumnNames(DbType sourceType, DbType targetType, BaseConnectionParam dataSourceCfg, String sql) {
String[] columnNames = tryGrammaticalAnalysisSqlColumnNames(sourceType, sql);
if (columnNames == null || columnNames.length == 0) {
logger.info("try to execute sql analysis query column name");
columnNames = tryExecuteSqlResolveColumnNames(sourceType, dataSourceCfg, sql);
}
notNull(columnNames, String.format("parsing sql columns failed : %s", sql));
return DataxUtils.convertKeywordsColumns(targetType, columnNames);
}
/**
* try grammatical parsing column
*
* @param dbType database type
* @param sql sql for data synchronization
* @return column name array
* @throws RuntimeException if error throws RuntimeException
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | private String[] tryGrammaticalAnalysisSqlColumnNames(DbType dbType, String sql) {
String[] columnNames;
try {
SQLStatementParser parser = DataxUtils.getSqlStatementParser(dbType, sql);
if (parser == null) {
logger.warn("database driver [{}] is not support grammatical analysis sql", dbType);
return new String[0];
}
SQLStatement sqlStatement = parser.parseStatement();
SQLSelectStatement sqlSelectStatement = (SQLSelectStatement) sqlStatement;
SQLSelect sqlSelect = sqlSelectStatement.getSelect();
List<SQLSelectItem> selectItemList = null;
if (sqlSelect.getQuery() instanceof SQLSelectQueryBlock) {
SQLSelectQueryBlock block = (SQLSelectQueryBlock) sqlSelect.getQuery();
selectItemList = block.getSelectList();
} else if (sqlSelect.getQuery() instanceof SQLUnionQuery) {
SQLUnionQuery unionQuery = (SQLUnionQuery) sqlSelect.getQuery();
SQLSelectQueryBlock block = (SQLSelectQueryBlock) unionQuery.getRight();
selectItemList = block.getSelectList();
}
notNull(selectItemList,
String.format("select query type [%s] is not support", sqlSelect.getQuery().toString()));
columnNames = new String[selectItemList.size()];
for (int i = 0; i < selectItemList.size(); i++) {
SQLSelectItem item = selectItemList.get(i);
String columnName = null;
if (item.getAlias() != null) {
columnName = item.getAlias();
} else if (item.getExpr() != null) {
if (item.getExpr() instanceof SQLPropertyExpr) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | SQLPropertyExpr expr = (SQLPropertyExpr) item.getExpr();
columnName = expr.getName();
} else if (item.getExpr() instanceof SQLIdentifierExpr) {
SQLIdentifierExpr expr = (SQLIdentifierExpr) item.getExpr();
columnName = expr.getName();
}
} else {
throw new RuntimeException(
String.format("grammatical analysis sql column [ %s ] failed", item.toString()));
}
if (columnName == null) {
throw new RuntimeException(
String.format("grammatical analysis sql column [ %s ] failed", item.toString()));
}
columnNames[i] = columnName;
}
} catch (Exception e) {
logger.warn(e.getMessage(), e);
return new String[0];
}
return columnNames;
}
/**
* try to execute sql to resolve column names
*
* @param baseDataSource the database connection parameters
* @param sql sql for data synchronization
* @return column name array
*/
public String[] tryExecuteSqlResolveColumnNames(DbType sourceType, BaseConnectionParam baseDataSource, String sql) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java | String[] columnNames;
sql = String.format("SELECT t.* FROM ( %s ) t WHERE 0 = 1", sql);
sql = sql.replace(";", "");
try (
Connection connection = DataSourceClientProvider.getInstance().getConnection(sourceType, baseDataSource);
PreparedStatement stmt = connection.prepareStatement(sql);
ResultSet resultSet = stmt.executeQuery()) {
ResultSetMetaData md = resultSet.getMetaData();
int num = md.getColumnCount();
columnNames = new String[num];
for (int i = 1; i <= num; i++) {
columnNames[i - 1] = md.getColumnName(i);
}
} catch (SQLException | ExecutionException e) {
logger.error(e.getMessage(), e);
return null;
}
return columnNames;
}
@Override
public AbstractParameters getParameters() {
return dataXParameters;
}
private void notNull(Object obj, String message) {
if (obj == null) {
throw new RuntimeException(message);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.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.task.sql;
import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.SQLTaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
import org.apache.dolphinscheduler.plugin.task.api.enums.SqlType;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.plugin.task.api.model.Property; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | import org.apache.dolphinscheduler.plugin.task.api.model.TaskAlertInfo;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parameters.SqlParameters;
import org.apache.dolphinscheduler.plugin.task.api.parameters.resource.UdfFuncParameters;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class SqlTask extends AbstractTaskExecutor { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | /**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
/**
* sql parameters
*/
private SqlParameters sqlParameters;
/**
* base datasource
*/
private BaseConnectionParam baseConnectionParam;
/**
* create function format
* include replace here which can be compatible with more cases, for example a long-running Spark session in Kyuubi will keep its own temp functions instead of destroying them right away
*/
private static final String CREATE_OR_REPLACE_FUNCTION_FORMAT = "create or replace temporary function {0} as ''{1}''";
/**
* default query sql limit
*/
private static final int QUERY_LIMIT = 10000;
private SQLTaskExecutionContext sqlTaskExecutionContext;
/**
* Abstract Yarn Task
*
* @param taskRequest taskRequest
*/
public SqlTask(TaskExecutionContext taskRequest) {
super(taskRequest); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | this.taskExecutionContext = taskRequest;
this.sqlParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class);
assert sqlParameters != null;
if (!sqlParameters.checkParameters()) {
throw new RuntimeException("sql task params is not valid");
}
sqlTaskExecutionContext = sqlParameters.generateExtendedContext(taskExecutionContext.getResourceParametersHelper());
}
@Override
public AbstractParameters getParameters() {
return sqlParameters;
}
@Override
public void handle() throws Exception {
logger.info("Full sql parameters: {}", sqlParameters);
logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {},varPool : {} ,query max result limit {}",
sqlParameters.getType(),
sqlParameters.getDatasource(),
sqlParameters.getSql(),
sqlParameters.getLocalParams(),
sqlParameters.getUdfs(),
sqlParameters.getShowType(),
sqlParameters.getConnParams(),
sqlParameters.getVarPool(),
sqlParameters.getLimit());
try {
baseConnectionParam = (BaseConnectionParam) DataSourceUtils.buildConnectionParams(
DbType.valueOf(sqlParameters.getType()),
sqlTaskExecutionContext.getConnectionParams()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | List<SqlBinds> mainStatementSqlBinds = SqlSplitter.split(sqlParameters.getSql(), sqlParameters.getSegmentSeparator())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<String> createFuncs = createFuncs(sqlTaskExecutionContext.getUdfFuncParametersList(), logger);
executeFuncAndSql(mainStatementSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs);
setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS);
} catch (Exception e) {
setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE);
logger.error("sql task error: {}", e.toString());
throw e;
}
}
/**
* execute function and sql
*
* @param mainStatementsBinds main statements binds
* @param preStatementsBinds pre statements binds |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | * @param postStatementsBinds post statements binds
* @param createFuncs create functions
*/
public void executeFuncAndSql(List<SqlBinds> mainStatementsBinds,
List<SqlBinds> preStatementsBinds,
List<SqlBinds> postStatementsBinds,
List<String> createFuncs) throws Exception {
Connection connection = null;
try {
connection = DataSourceClientProvider.getInstance().getConnection(DbType.valueOf(sqlParameters.getType()), baseConnectionParam);
if (CollectionUtils.isNotEmpty(createFuncs)) {
createTempFunction(connection, createFuncs);
}
executeUpdate(connection, preStatementsBinds, "pre");
String result = null;
if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) {
result = executeQuery(connection, mainStatementsBinds.get(0), "main");
} else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) {
String updateResult = executeUpdate(connection, mainStatementsBinds, "main");
result = setNonQuerySqlReturn(updateResult, sqlParameters.getLocalParams());
}
sqlParameters.dealOutParam(result); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | executeUpdate(connection, postStatementsBinds, "post");
} catch (Exception e) {
logger.error("execute sql error: {}", e.getMessage());
throw e;
} finally {
close(connection);
}
}
private String setNonQuerySqlReturn(String updateResult, List<Property> properties) {
String result = null;
for (Property info : properties) {
if (Direct.OUT == info.getDirect()) {
List<Map<String, String>> updateRL = new ArrayList<>();
Map<String, String> updateRM = new HashMap<>();
updateRM.put(info.getProp(), updateResult);
updateRL.add(updateRM);
result = JSONUtils.toJsonString(updateRL);
break;
}
}
return result;
}
/**
* result process
*
* @param resultSet resultSet
* @throws Exception Exception
*/
private String resultProcess(ResultSet resultSet) throws Exception { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | ArrayNode resultJSONArray = JSONUtils.createArrayNode();
if (resultSet != null) {
ResultSetMetaData md = resultSet.getMetaData();
int num = md.getColumnCount();
int rowCount = 0;
int limit = sqlParameters.getLimit() == 0 ? QUERY_LIMIT : sqlParameters.getLimit();
while (resultSet.next()) {
if (rowCount == limit) {
logger.info("sql result limit : {} exceeding results are filtered", limit);
break;
}
ObjectNode mapOfColValues = JSONUtils.createObjectNode();
for (int i = 1; i <= num; i++) {
mapOfColValues.set(md.getColumnLabel(i), JSONUtils.toJsonNode(resultSet.getObject(i)));
}
resultJSONArray.add(mapOfColValues);
rowCount++;
}
int displayRows = sqlParameters.getDisplayRows() > 0 ? sqlParameters.getDisplayRows() : TaskConstants.DEFAULT_DISPLAY_ROWS;
displayRows = Math.min(displayRows, rowCount);
logger.info("display sql result {} rows as follows:", displayRows);
for (int i = 0; i < displayRows; i++) {
String row = JSONUtils.toJsonString(resultJSONArray.get(i));
logger.info("row {} : {}", i + 1, row);
}
}
String result = JSONUtils.toJsonString(resultJSONArray);
if (sqlParameters.getSendEmail() == null || sqlParameters.getSendEmail()) {
sendAttachment(sqlParameters.getGroupId(), StringUtils.isNotEmpty(sqlParameters.getTitle())
? sqlParameters.getTitle() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | : taskExecutionContext.getTaskName() + " query result sets", result);
}
logger.debug("execute sql result : {}", result);
return result;
}
/**
* send alert as an attachment
*
* @param title title
* @param content content
*/
private void sendAttachment(int groupId, String title, String content) {
setNeedAlert(Boolean.TRUE);
TaskAlertInfo taskAlertInfo = new TaskAlertInfo();
taskAlertInfo.setAlertGroupId(groupId);
taskAlertInfo.setContent(content);
taskAlertInfo.setTitle(title);
setTaskAlertInfo(taskAlertInfo);
}
private String executeQuery(Connection connection, SqlBinds sqlBinds, String handlerType) throws Exception {
try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBinds)) {
logger.info("{} statement execute query, for sql: {}", handlerType, sqlBinds.getSql());
ResultSet resultSet = statement.executeQuery();
return resultProcess(resultSet);
}
}
private String executeUpdate(Connection connection, List<SqlBinds> statementsBinds, String handlerType) throws Exception {
int result = 0;
for (SqlBinds sqlBind : statementsBinds) {
try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBind)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | result = statement.executeUpdate();
logger.info("{} statement execute update result: {}, for sql: {}", handlerType, result, sqlBind.getSql());
}
}
return String.valueOf(result);
}
/**
* create temp function
*
* @param connection connection
* @param createFuncs createFuncs
*/
private void createTempFunction(Connection connection,
List<String> createFuncs) throws Exception {
try (Statement funcStmt = connection.createStatement()) {
for (String createFunc : createFuncs) {
logger.info("hive create function sql: {}", createFunc);
funcStmt.execute(createFunc);
}
}
}
/**
* close jdbc resource
*
* @param connection connection
*/
private void close(Connection connection) {
if (connection != null) {
try {
connection.close(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | } catch (SQLException e) {
logger.error("close connection error : {}", e.getMessage(), e);
}
}
}
/**
* preparedStatement bind
*
* @param connection connection
* @param sqlBinds sqlBinds
* @return PreparedStatement
* @throws Exception Exception
*/
private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) {
boolean timeoutFlag = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED
|| taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED;
try {
PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql());
if (timeoutFlag) {
stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout());
}
Map<Integer, Property> params = sqlBinds.getParamsMap();
if (params != null) {
for (Map.Entry<Integer, Property> entry : params.entrySet()) {
Property prop = entry.getValue();
ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue());
}
}
logger.info("prepare statement replace sql : {} ", stmt); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | return stmt;
} catch (Exception exception) {
throw new TaskException("SQL task prepareStatementAndBind error", exception);
}
}
/**
* print replace sql
*
* @param content content
* @param formatSql format sql
* @param rgex rgex
* @param sqlParamsMap sql params map
*/
private void printReplacedSql(String content, String formatSql, String rgex, Map<Integer, Property> sqlParamsMap) {
logger.info("after replace sql , preparing : {}", formatSql);
StringBuilder logPrint = new StringBuilder("replaced sql , parameters:");
if (sqlParamsMap == null) {
logger.info("printReplacedSql: sqlParamsMap is null.");
} else {
for (int i = 1; i <= sqlParamsMap.size(); i++) {
logPrint.append(sqlParamsMap.get(i).getValue()).append("(").append(sqlParamsMap.get(i).getType()).append(")");
}
}
logger.info("Sql Params are {}", logPrint);
}
/**
* ready to execute SQL and parameter entity Map
*
* @return SqlBinds |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | */
private SqlBinds getSqlAndSqlParamsMap(String sql) {
Map<Integer, Property> sqlParamsMap = new HashMap<>();
StringBuilder sqlBuilder = new StringBuilder();
Map<String, Property> paramsMap = ParamUtils.convert(taskExecutionContext, getParameters());
if (paramsMap == null) {
sqlBuilder.append(sql);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
if (StringUtils.isNotEmpty(sqlParameters.getTitle())) {
String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(),
ParamUtils.convert(paramsMap));
logger.info("SQL title : {}", title);
sqlParameters.setTitle(title);
}
sql = ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime());
setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap,taskExecutionContext.getTaskInstanceId());
String rgexo = "['\"]*\\!\\{(.*?)\\}['\"]*";
sql = replaceOriginalValue(sql, rgexo, paramsMap);
// r
String formatSql = sql.replaceAll(rgex, "?");
sqlBuilder.append(formatSql);
// p
printReplacedSql(sql, formatSql, rgex, sqlParamsMap); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
private String replaceOriginalValue(String content, String rgex, Map<String, Property> sqlParamsMap) {
Pattern pattern = Pattern.compile(rgex);
while (true) {
Matcher m = pattern.matcher(content);
if (!m.find()) {
break;
}
String paramName = m.group(1);
String paramValue = sqlParamsMap.get(paramName).getValue();
content = m.replaceFirst(paramValue);
}
return content;
}
/**
* create function list
*
* @param udfFuncParameters udfFuncParameters
* @param logger logger
* @return
*/
private List<String> createFuncs(List<UdfFuncParameters> udfFuncParameters, Logger logger) {
if (CollectionUtils.isEmpty(udfFuncParameters)) {
logger.info("can't find udf function resource");
return null;
}
// b
List<String> funcList = buildJarSql(udfFuncParameters);
// b |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,655 | [Bug] [Task] SQL task and Datax Task no exception stack trace in task log | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when SQL task or Datax task execution failed, only print exception message, no stack trace, which is not convenient to troubleshoot the cause of the problem
<img width="774" alt="image" src="https://user-images.githubusercontent.com/13765310/176186667-04b65ed0-9e08-4296-82f3-f8b056ed19eb.png">
### What you expected to happen
print exception stack trace to task log after task execution failed.
<img width="824" alt="image" src="https://user-images.githubusercontent.com/13765310/176186974-74d10d4d-3a3e-4fec-9586-a2c6266daf4e.png">
### How to reproduce
execute a sql with a column not exist
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10655 | https://github.com/apache/dolphinscheduler/pull/10656 | e0b0f986f72e3fe4f7b5dea5a80c0366131ba0cd | 7e7df1d8ffa2955a430b4458c11931bce007427c | 2022-06-28T13:14:01Z | java | 2022-06-29T01:57:05Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | List<String> tempFuncList = buildTempFuncSql(udfFuncParameters);
funcList.addAll(tempFuncList);
return funcList;
}
/**
* b
* @param udfFuncParameters udfFuncParameters
* @return
*/
private List<String> buildTempFuncSql(List<UdfFuncParameters> udfFuncParameters) {
return udfFuncParameters.stream().map(value -> MessageFormat
.format(CREATE_OR_REPLACE_FUNCTION_FORMAT, value.getFuncName(), value.getClassName())).collect(Collectors.toList());
}
/**
* b
* @param udfFuncParameters udfFuncParameters
* @return
*/
private List<String> buildJarSql(List<UdfFuncParameters> udfFuncParameters) {
return udfFuncParameters.stream().map(value -> {
String defaultFS = value.getDefaultFS();
String prefixPath = defaultFS.startsWith("file://") ? "file://" : defaultFS;
String uploadPath = CommonUtils.getHdfsUdfDir(value.getTenantCode());
String resourceFullName = value.getResourceName();
resourceFullName = resourceFullName.startsWith("/") ? resourceFullName : String.format("/%s", resourceFullName);
return String.format("add jar %s%s%s", prefixPath, uploadPath, resourceFullName);
}).collect(Collectors.toList());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/Registry.java | /*
* Licensed to 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. Apache Software Foundation (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.registry.api;
import java.io.Closeable;
import java.time.Duration;
import java.util.Collection;
public interface Registry extends Closeable { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-api/src/main/java/org/apache/dolphinscheduler/registry/api/Registry.java | boolean subscribe(String path, SubscribeListener listener);
void unsubscribe(String path);
void addConnectionStateListener(ConnectionListener listener);
String get(String key);
void put(String key, String value, boolean deleteOnDisconnect);
void delete(String key);
Collection<String> children(String key);
boolean exists(String key);
boolean acquireLock(String key);
boolean releaseLock(String key);
Duration getSessionTimeout();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-mysql/src/main/java/org/apache/dolphinscheduler/plugin/registry/mysql/MysqlRegistry.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 | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-mysql/src/main/java/org/apache/dolphinscheduler/plugin/registry/mysql/MysqlRegistry.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.plugin.registry.mysql;
import org.apache.dolphinscheduler.plugin.registry.mysql.task.EphemeralDateManager;
import org.apache.dolphinscheduler.plugin.registry.mysql.task.RegistryLockManager;
import org.apache.dolphinscheduler.plugin.registry.mysql.task.SubscribeDataManager;
import org.apache.dolphinscheduler.registry.api.ConnectionListener;
import org.apache.dolphinscheduler.registry.api.Registry;
import org.apache.dolphinscheduler.registry.api.RegistryException;
import org.apache.dolphinscheduler.registry.api.SubscribeListener;
import java.sql.SQLException;
import java.time.Duration;
import java.util.Collection;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
/**
* This is one of the implementation of {@link Registry}, with this implementation, you need to rely on mysql database to
* store the DolphinScheduler master/worker's metadata and do the server registry/unRegistry.
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-mysql/src/main/java/org/apache/dolphinscheduler/plugin/registry/mysql/MysqlRegistry.java | @ConditionalOnProperty(prefix = "registry", name = "type", havingValue = "mysql")
public class MysqlRegistry implements Registry {
private static Logger LOGGER = LoggerFactory.getLogger(MysqlRegistry.class);
private final EphemeralDateManager ephemeralDateManager;
private final SubscribeDataManager subscribeDataManager;
private final RegistryLockManager registryLockManager;
private final MysqlOperator mysqlOperator;
public MysqlRegistry(MysqlRegistryProperties mysqlRegistryProperties) {
this.mysqlOperator = new MysqlOperator(mysqlRegistryProperties);
mysqlOperator.clearExpireLock();
mysqlOperator.clearExpireEphemeralDate();
this.ephemeralDateManager = new EphemeralDateManager(mysqlRegistryProperties, mysqlOperator);
this.subscribeDataManager = new SubscribeDataManager(mysqlRegistryProperties, mysqlOperator);
this.registryLockManager = new RegistryLockManager(mysqlRegistryProperties, mysqlOperator);
LOGGER.info("Initialize Mysql Registry...");
}
@PostConstruct
public void start() {
LOGGER.info("Starting Mysql Registry...");
ephemeralDateManager.start();
subscribeDataManager.start();
registryLockManager.start();
LOGGER.info("Started Mysql Registry...");
}
@Override
public boolean subscribe(String path, SubscribeListener listener) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-mysql/src/main/java/org/apache/dolphinscheduler/plugin/registry/mysql/MysqlRegistry.java | subscribeDataManager.addListener(path, listener);
return true;
}
@Override
public void unsubscribe(String path) {
subscribeDataManager.removeListener(path);
}
@Override
public void addConnectionStateListener(ConnectionListener listener) {
ephemeralDateManager.addConnectionListener(listener);
}
@Override
public String get(String key) {
return subscribeDataManager.getData(key);
}
@Override
public void put(String key, String value, boolean deleteOnDisconnect) {
try {
if (deleteOnDisconnect) {
ephemeralDateManager.insertOrUpdateEphemeralData(key, value);
} else {
mysqlOperator.insertOrUpdatePersistentData(key, value);
}
} catch (Exception ex) {
throw new RegistryException(String.format("put key:%s, value:%s error", key, value), ex);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-mysql/src/main/java/org/apache/dolphinscheduler/plugin/registry/mysql/MysqlRegistry.java | @Override
public void delete(String key) {
try {
mysqlOperator.deleteEphemeralData(key);
mysqlOperator.deletePersistentData(key);
} catch (Exception e) {
throw new RegistryException(String.format("Delete key: %s error", key), e);
}
}
@Override
public Collection<String> children(String key) {
try {
return mysqlOperator.getChildren(key);
} catch (SQLException e) {
throw new RegistryException(String.format("Get key: %s children error", key), e);
}
}
@Override
public boolean exists(String key) {
try {
return mysqlOperator.existKey(key);
} catch (Exception e) {
throw new RegistryException(String.format("Check key: %s exist error", key), e);
}
}
@Override
public boolean acquireLock(String key) {
try {
registryLockManager.acquireLock(key);
return true; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-mysql/src/main/java/org/apache/dolphinscheduler/plugin/registry/mysql/MysqlRegistry.java | } catch (RegistryException e) {
throw e;
} catch (Exception e) {
throw new RegistryException(String.format("Acquire lock: %s error", key), e);
}
}
@Override
public boolean releaseLock(String key) {
registryLockManager.releaseLock(key);
return true;
}
@Override
public Duration getSessionTimeout() {
throw new UnsupportedOperationException("Not support session timeout at Mysql Registry");
}
@Override
public void close() {
LOGGER.info("Closing Mysql Registry...");
try (EphemeralDateManager closed1 = ephemeralDateManager;
SubscribeDataManager close2 = subscribeDataManager;
RegistryLockManager close3 = registryLockManager;
MysqlOperator closed4 = mysqlOperator) {
} catch (Exception e) {
LOGGER.error("Close Mysql Registry error", e);
}
LOGGER.info("Closed Mysql Registry...");
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/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 java.util.concurrent.TimeUnit.MILLISECONDS; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | import org.apache.dolphinscheduler.registry.api.ConnectionListener;
import org.apache.dolphinscheduler.registry.api.Event;
import org.apache.dolphinscheduler.registry.api.Registry;
import org.apache.dolphinscheduler.registry.api.RegistryException;
import org.apache.dolphinscheduler.registry.api.SubscribeListener;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.api.ACLProvider;
import org.apache.curator.framework.recipes.cache.ChildData;
import org.apache.curator.framework.recipes.cache.TreeCache;
import org.apache.curator.framework.recipes.cache.TreeCacheEvent;
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.KeeperException;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.data.ACL;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.PostConstruct;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import com.google.common.base.Strings;
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | @ConditionalOnProperty(prefix = "registry", name = "type", havingValue = "zookeeper")
public final class ZookeeperRegistry implements Registry {
private final ZookeeperRegistryProperties.ZookeeperProperties properties;
private final CuratorFramework client;
private final Map<String, TreeCache> treeCacheMap = new ConcurrentHashMap<>();
private static final ThreadLocal<Map<String, InterProcessMutex>> threadLocalLockMap = new ThreadLocal<>();
public ZookeeperRegistry(ZookeeperRegistryProperties registryProperties) {
properties = registryProperties.getZookeeper();
final ExponentialBackoffRetry retryPolicy = new ExponentialBackoffRetry(
(int) properties.getRetryPolicy().getBaseSleepTime().toMillis(),
properties.getRetryPolicy().getMaxRetries(),
(int) properties.getRetryPolicy().getMaxSleep().toMillis());
CuratorFrameworkFactory.Builder builder =
CuratorFrameworkFactory.builder()
.connectString(properties.getConnectString())
.retryPolicy(retryPolicy) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | .namespace(properties.getNamespace())
.sessionTimeoutMs((int) properties.getSessionTimeout().toMillis())
.connectionTimeoutMs((int) properties.getConnectionTimeout().toMillis());
final String digest = properties.getDigest();
if (!Strings.isNullOrEmpty(digest)) {
buildDigest(builder, digest);
}
client = builder.build();
}
private void buildDigest(CuratorFrameworkFactory.Builder builder, String digest) {
builder.authorization("digest", 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;
}
});
}
@PostConstruct
public void start() {
client.start();
try {
if (!client.blockUntilConnected((int) properties.getBlockUntilConnected().toMillis(), MILLISECONDS)) {
client.close();
throw new RegistryException("zookeeper connect timeout: " + properties.getConnectString());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | } catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
@Override
public void addConnectionStateListener(ConnectionListener listener) {
client.getConnectionStateListenable().addListener(new ZookeeperConnectionStateListener(listener));
}
@Override
public boolean subscribe(String path, SubscribeListener listener) {
final TreeCache treeCache = treeCacheMap.computeIfAbsent(path, $ -> new TreeCache(client, path));
treeCache.getListenable().addListener(($, event) -> listener.notify(new EventAdaptor(event, path)));
try {
treeCache.start();
} catch (Exception e) {
treeCacheMap.remove(path);
throw new RegistryException("Failed to subscribe listener for key: " + path, e);
}
return true;
}
@Override
public void unsubscribe(String path) {
CloseableUtils.closeQuietly(treeCacheMap.get(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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | }
}
@Override
public boolean exists(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 put(String key, String value, boolean deleteOnDisconnect) {
final CreateMode mode = deleteOnDisconnect ? CreateMode.EPHEMERAL : CreateMode.PERSISTENT;
try {
client.create()
.orSetData()
.creatingParentsIfNeeded()
.withMode(mode)
.forPath(key, value.getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
throw new RegistryException("Failed to put registry key: " + key, e);
}
}
@Override
public List<String> children(String key) {
try {
List<String> result = client.getChildren().forPath(key);
result.sort(Comparator.reverseOrder());
return result;
} catch (Exception e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | throw new RegistryException("zookeeper get children error", e);
}
}
@Override
public void delete(String nodePath) {
try {
client.delete()
.deletingChildrenIfNeeded()
.forPath(nodePath);
} catch (KeeperException.NoNodeException ignored) {
} catch (Exception e) {
throw new RegistryException("Failed to delete registry key: " + nodePath, e);
}
}
@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) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | throw new RegistryException("zookeeper release lock error", e);
}
}
}
@Override
public boolean releaseLock(String key) {
if (null == threadLocalLockMap.get().get(key)) {
return false;
}
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;
}
@Override
public Duration getSessionTimeout() {
return properties.getSessionTimeout();
}
@Override
public void close() {
treeCacheMap.values().forEach(CloseableUtils::closeQuietly);
CloseableUtils.closeQuietly(client);
}
static final class EventAdaptor extends Event { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistry.java | public EventAdaptor(TreeCacheEvent event, String key) {
key(key);
switch (event.getType()) {
case NODE_ADDED:
type(Type.ADD);
break;
case NODE_UPDATED:
type(Type.UPDATE);
break;
case NODE_REMOVED:
type(Type.REMOVE);
break;
default:
break;
}
final ChildData data = event.getData();
if (data != null) {
path(data.getPath());
data(new String(data.getData()));
}
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.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.service.registry;
import static com.google.common.base.Preconditions.checkArgument;
import static org.apache.dolphinscheduler.common.Constants.ADD_OP;
import static org.apache.dolphinscheduler.common.Constants.COLON;
import static org.apache.dolphinscheduler.common.Constants.DELETE_OP;
import static org.apache.dolphinscheduler.common.Constants.DIVISION_STRING;
import static org.apache.dolphinscheduler.common.Constants.MASTER_TYPE;
import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS;
import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_MASTERS;
import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS;
import static org.apache.dolphinscheduler.common.Constants.SINGLE_SLASH; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.java | import static org.apache.dolphinscheduler.common.Constants.UNDERLINE;
import static org.apache.dolphinscheduler.common.Constants.WORKER_TYPE;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.model.Server;
import org.apache.dolphinscheduler.common.utils.HeartBeat;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.registry.api.ConnectionListener;
import org.apache.dolphinscheduler.registry.api.Registry;
import org.apache.dolphinscheduler.registry.api.RegistryException;
import org.apache.dolphinscheduler.registry.api.SubscribeListener;
import java.io.IOException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import com.google.common.base.Strings;
@Component
public class RegistryClient {
private static final Logger logger = LoggerFactory.getLogger(RegistryClient.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.java | private static final String EMPTY = "";
private IStoppable stoppable;
private final Registry registry;
public RegistryClient(Registry registry) {
this.registry = registry;
}
@PostConstruct
public void afterConstruct() {
initNodes();
}
public int getActiveMasterNum() {
Collection<String> childrenList = new ArrayList<>();
try {
if (exists(rootNodePath(NodeType.MASTER))) {
childrenList = getChildrenKeys(rootNodePath(NodeType.MASTER));
}
} catch (Exception e) {
logger.error("getActiveMasterNum error", e);
}
return childrenList.size();
}
public List<Server> getServerList(NodeType nodeType) {
Map<String, String> serverMaps = getServerMaps(nodeType, false);
String parentPath = rootNodePath(nodeType);
List<Server> serverList = new ArrayList<>();
for (Map.Entry<String, String> entry : serverMaps.entrySet()) {
HeartBeat heartBeat = HeartBeat.decodeHeartBeat(entry.getValue());
if (heartBeat == null) {
continue; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.java | }
Server server = new Server();
server.setResInfo(JSONUtils.toJsonString(heartBeat));
server.setCreateTime(new Date(heartBeat.getStartupTime()));
server.setLastHeartbeatTime(new Date(heartBeat.getReportTime()));
server.setId(heartBeat.getProcessId());
String key = entry.getKey();
server.setZkDirectory(parentPath + "/" + key);
String[] hostAndPort = key.split(COLON);
String[] hosts = hostAndPort[0].split(DIVISION_STRING);
server.setHost(hosts[hosts.length - 1]);
server.setPort(Integer.parseInt(hostAndPort[1]));
serverList.add(server);
}
return serverList;
}
public Map<String, String> getServerMaps(NodeType nodeType, boolean hostOnly) {
Map<String, String> serverMap = new HashMap<>();
try {
String path = rootNodePath(nodeType);
Collection<String> serverList = getServerNodes(nodeType);
for (String server : serverList) {
String host = server;
if (nodeType == NodeType.WORKER && hostOnly) {
host = server.split(SINGLE_SLASH)[1];
}
serverMap.putIfAbsent(host, get(path + SINGLE_SLASH + server));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.java | } catch (Exception e) {
logger.error("get server list failed", e);
}
return serverMap;
}
public boolean checkNodeExists(String host, NodeType nodeType) {
return getServerMaps(nodeType, true).keySet()
.stream()
.anyMatch(it -> it.contains(host));
}
public void handleDeadServer(Collection<String> nodes, NodeType nodeType, String opType) {
nodes.forEach(node -> {
final String host = getHostByEventDataPath(node);
final String type = nodeType == NodeType.MASTER ? MASTER_TYPE : WORKER_TYPE;
if (opType.equals(DELETE_OP)) {
removeDeadServerByHost(host, type);
} else if (opType.equals(ADD_OP)) {
String deadServerPath = REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS + SINGLE_SLASH + type + UNDERLINE + host;
registry.put(deadServerPath, type + UNDERLINE + host, false);
logger.info("{} server dead , and {} added to zk dead server path success", nodeType, node);
}
});
}
public boolean checkIsDeadServer(String node, String serverType) {
String[] zNodesPath = node.split("/");
String ipSeqNo = zNodesPath[zNodesPath.length - 1];
String deadServerPath = REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS + SINGLE_SLASH + serverType + UNDERLINE + ipSeqNo;
return !exists(node) || exists(deadServerPath); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.java | }
public Collection<String> getMasterNodesDirectly() {
return getChildrenKeys(REGISTRY_DOLPHINSCHEDULER_MASTERS);
}
public Collection<String> getWorkerGroupDirectly() {
return getChildrenKeys(REGISTRY_DOLPHINSCHEDULER_WORKERS);
}
public Collection<String> getWorkerGroupNodesDirectly(String workerGroup) {
return getChildrenKeys(REGISTRY_DOLPHINSCHEDULER_WORKERS + "/" + workerGroup);
}
/**
* get host ip:port, path format: parentPath/ip:port
*
* @param path path
* @return host ip:port, string format: parentPath/ip:port
*/
public String getHostByEventDataPath(String path) {
checkArgument(!Strings.isNullOrEmpty(path), "path cannot be null or empty");
final String[] pathArray = path.split(SINGLE_SLASH);
checkArgument(pathArray.length >= 1, "cannot parse path: %s", path);
return pathArray[pathArray.length - 1];
}
public void close() throws IOException {
registry.close();
}
public void persistEphemeral(String key, String value) {
registry.put(key, value, true);
}
public void remove(String key) {
registry.delete(key); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.java | }
public String get(String key) {
return registry.get(key);
}
public void subscribe(String path, SubscribeListener listener) {
registry.subscribe(path, listener);
}
public void addConnectionStateListener(ConnectionListener listener) {
registry.addConnectionStateListener(listener);
}
public boolean exists(String key) {
return registry.exists(key);
}
public boolean getLock(String key) {
return registry.acquireLock(key);
}
public boolean releaseLock(String key) {
return registry.releaseLock(key);
}
public void setStoppable(IStoppable stoppable) {
this.stoppable = stoppable;
}
public IStoppable getStoppable() {
return stoppable;
}
public boolean isMasterPath(String path) {
return path != null && path.startsWith(REGISTRY_DOLPHINSCHEDULER_MASTERS);
}
public boolean isWorkerPath(String path) {
return path != null && path.startsWith(REGISTRY_DOLPHINSCHEDULER_WORKERS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.java | }
public Collection<String> getChildrenKeys(final String key) {
return registry.children(key);
}
public Set<String> getServerNodeSet(NodeType nodeType, boolean hostOnly) {
try {
return getServerNodes(nodeType).stream().map(server -> {
if (nodeType == NodeType.WORKER && hostOnly) {
return server.split(SINGLE_SLASH)[1];
}
return server;
}).collect(Collectors.toSet());
} catch (Exception e) {
throw new RegistryException("Failed to get server node: " + nodeType, e);
}
}
private void initNodes() {
registry.put(REGISTRY_DOLPHINSCHEDULER_MASTERS, EMPTY, false);
registry.put(REGISTRY_DOLPHINSCHEDULER_WORKERS, EMPTY, false);
registry.put(REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS, EMPTY, false);
}
private String rootNodePath(NodeType type) {
switch (type) {
case MASTER:
return Constants.REGISTRY_DOLPHINSCHEDULER_MASTERS;
case WORKER:
return Constants.REGISTRY_DOLPHINSCHEDULER_WORKERS;
case DEAD_SERVER:
return Constants.REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS;
default: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,626 | [Improvment][Registry] getSessionTime() that has not been used in the project in the Registry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
There is a function getSessionTime() that has not been used in the project in the Registry interface . And now,there are two class(MySqlRegistry and ZookeeperRegistry) that implement this interface. In the ZookeeperRegistry, just returns the value from the config file.

And in the MySqlRegistry,throw new UnsupportedOperationException.

### Use case
I think this function can be deleted
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10626 | https://github.com/apache/dolphinscheduler/pull/10633 | 7e7df1d8ffa2955a430b4458c11931bce007427c | 75581b7543cfb2560090d349f9879a3d6fda142c | 2022-06-27T03:03:17Z | java | 2022-06-29T03:20:52Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/registry/RegistryClient.java | throw new IllegalStateException("Should not reach here");
}
}
private Collection<String> getServerNodes(NodeType nodeType) {
final String path = rootNodePath(nodeType);
final Collection<String> serverList = getChildrenKeys(path);
if (nodeType != NodeType.WORKER) {
return serverList;
}
return serverList.stream().flatMap(group ->
getChildrenKeys(path + SINGLE_SLASH + group)
.stream()
.map(it -> group + SINGLE_SLASH + it)
).collect(Collectors.toList());
}
private void removeDeadServerByHost(String host, String serverType) {
Collection<String> deadServers = getChildrenKeys(REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS);
for (String serverPath : deadServers) {
if (serverPath.startsWith(serverType + UNDERLINE + host)) {
String server = REGISTRY_DOLPHINSCHEDULER_DEAD_SERVERS + SINGLE_SLASH + serverPath;
remove(server);
logger.info("{} server {} deleted from zk dead server path success", serverType, host);
}
}
}
public Duration getSessionTimeout() {
return registry.getSessionTimeout();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.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.master.runner;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.SlotCheckState;
import org.apache.dolphinscheduler.common.expand.CuringGlobalParamsService;
import org.apache.dolphinscheduler.common.thread.BaseDaemonThread;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.common.utils.NetUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.dao.entity.Command;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.remote.NettyRemotingClient;
import org.apache.dolphinscheduler.remote.config.NettyClientConfig; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.dispatch.executor.NettyExecutorManager;
import org.apache.dolphinscheduler.server.master.metrics.MasterServerMetrics;
import org.apache.dolphinscheduler.server.master.metrics.ProcessInstanceMetrics;
import org.apache.dolphinscheduler.server.master.registry.ServerNodeManager;
import org.apache.dolphinscheduler.service.alert.ProcessAlertManager;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Master scheduler thread, this thread will consume the commands from database and trigger processInstance executed.
*/
@Service
public class MasterSchedulerService extends BaseDaemonThread {
/**
* logger of MasterSchedulerService
*/
private static final Logger logger = LoggerFactory.getLogger(MasterSchedulerService.class);
@Autowired
private ProcessService processService;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | private MasterConfig masterConfig;
@Autowired
private ProcessAlertManager processAlertManager;
private NettyRemotingClient nettyRemotingClient;
@Autowired
private NettyExecutorManager nettyExecutorManager;
/**
* master prepare exec service
*/
private ThreadPoolExecutor masterPrepareExecService;
/**
* workflow exec service
*/
@Autowired
private WorkflowExecuteThreadPool workflowExecuteThreadPool;
@Autowired
private ProcessInstanceExecCacheManager processInstanceExecCacheManager;
@Autowired
private StateWheelExecuteThread stateWheelExecuteThread;
@Autowired
private CuringGlobalParamsService curingGlobalParamsService;
private String masterAddress;
protected MasterSchedulerService() {
super("MasterCommandLoopThread");
}
/**
* constructor of MasterSchedulerService
*/
public void init() {
this.masterPrepareExecService = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("MasterPreExecThread", masterConfig.getPreExecThreads()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | NettyClientConfig clientConfig = new NettyClientConfig();
this.nettyRemotingClient = new NettyRemotingClient(clientConfig);
this.masterAddress = NetUtils.getAddr(masterConfig.getListenPort());
}
@Override
public synchronized void start() {
logger.info("Master schedule service starting..");
this.stateWheelExecuteThread.start();
super.start();
logger.info("Master schedule service started...");
}
public void close() {
logger.info("Master schedule service stopping...");
nettyRemotingClient.close();
logger.info("Master schedule service stopped...");
}
/**
* run of MasterSchedulerService
*/
@Override
public void run() {
while (Stopper.isRunning()) {
try {
boolean isOverload = OSUtils.isOverload(masterConfig.getMaxCpuLoadAvg(), masterConfig.getReservedMemory());
if (isOverload) {
MasterServerMetrics.incMasterOverload();
Thread.sleep(Constants.SLEEP_TIME_MILLIS);
continue;
}
scheduleWorkflow(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | } catch (InterruptedException interruptedException) {
logger.warn("Master schedule service interrupted, close the loop", interruptedException);
Thread.currentThread().interrupt();
break;
} catch (Exception e) {
logger.error("Master schedule service loop command error", e);
}
}
}
/**
* Query command from database by slot, and transform to workflow instance, then submit to workflowExecuteThreadPool.
*/
private void scheduleWorkflow() throws InterruptedException {
List<Command> commands = findCommands();
if (CollectionUtils.isEmpty(commands)) {
Thread.sleep(Constants.SLEEP_TIME_MILLIS);
return;
}
List<ProcessInstance> processInstances = command2ProcessInstance(commands);
if (CollectionUtils.isEmpty(processInstances)) {
return;
}
MasterServerMetrics.incMasterConsumeCommand(commands.size());
for (ProcessInstance processInstance : processInstances) {
try {
LoggerUtils.setWorkflowInstanceIdMDC(processInstance.getId());
logger.info("Master schedule service starting workflow instance");
final WorkflowExecuteRunnable workflowExecuteRunnable = new WorkflowExecuteRunnable(
processInstance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | , processService
, nettyExecutorManager
, processAlertManager
, masterConfig
, stateWheelExecuteThread
, curingGlobalParamsService);
this.processInstanceExecCacheManager.cache(processInstance.getId(), workflowExecuteRunnable);
if (processInstance.getTimeout() > 0) {
stateWheelExecuteThread.addProcess4TimeoutCheck(processInstance);
}
ProcessInstanceMetrics.incProcessInstanceSubmit();
workflowExecuteThreadPool.submit(workflowExecuteRunnable);
logger.info("Master schedule service started workflow instance");
} catch (Exception ex) {
processInstanceExecCacheManager.removeByProcessInstanceId(processInstance.getId());
stateWheelExecuteThread.removeProcess4TimeoutCheck(processInstance.getId());
logger.info("Master submit workflow to thread pool failed, will remove workflow runnable from cache manager", ex);
} finally {
LoggerUtils.removeWorkflowInstanceIdMDC();
}
}
}
private List<ProcessInstance> command2ProcessInstance(List<Command> commands) throws InterruptedException {
long commandTransformStartTime = System.currentTimeMillis();
logger.info("Master schedule service transforming command to ProcessInstance, commandSize: {}", commands.size());
List<ProcessInstance> processInstances = Collections.synchronizedList(new ArrayList<>(commands.size()));
CountDownLatch latch = new CountDownLatch(commands.size());
for (final Command command : commands) {
masterPrepareExecService.execute(() -> {
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | SlotCheckState slotCheckState = slotCheck(command);
if (slotCheckState.equals(SlotCheckState.CHANGE) || slotCheckState.equals(SlotCheckState.INJECT)) {
logger.info("Master handle command {} skip, slot check state: {}", command.getId(), slotCheckState);
return;
}
ProcessInstance processInstance = processService.handleCommand(masterAddress, command);
if (processInstance != null) {
processInstances.add(processInstance);
logger.info("Master handle command {} end, create process instance {}", command.getId(), processInstance.getId());
}
} catch (Exception e) {
logger.error("Master handle command {} error ", command.getId(), e);
processService.moveToErrorCommand(command, e.toString());
} finally {
latch.countDown();
}
});
}
latch.await();
logger.info("Master schedule service transformed command to ProcessInstance, commandSize: {}, processInstanceSize: {}",
commands.size(), processInstances.size());
ProcessInstanceMetrics.recordProcessInstanceGenerateTime(System.currentTimeMillis() - commandTransformStartTime);
return processInstances;
}
private List<Command> findCommands() {
long scheduleStartTime = System.currentTimeMillis();
int thisMasterSlot = ServerNodeManager.getSlot(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | int masterCount = ServerNodeManager.getMasterSize();
if (masterCount <= 0) {
logger.warn("Master count: {} is invalid, the current slot: {}", masterCount, thisMasterSlot);
return Collections.emptyList();
}
int pageNumber = 0;
int pageSize = masterConfig.getFetchCommandNum();
final List<Command> result = processService.findCommandPageBySlot(pageSize, pageNumber, masterCount, thisMasterSlot);
if (CollectionUtils.isNotEmpty(result)) {
logger.info("Master schedule service loop command success, command size: {}, current slot: {}, total slot size: {}",
result.size(), thisMasterSlot, masterCount);
}
ProcessInstanceMetrics.recordCommandQueryTime(System.currentTimeMillis() - scheduleStartTime);
return result;
}
private SlotCheckState slotCheck(Command command) {
int slot = ServerNodeManager.getSlot();
int masterSize = ServerNodeManager.getMasterSize();
SlotCheckState state;
if (masterSize <= 0) {
state = SlotCheckState.CHANGE;
} else if (command.getId() % masterSize == slot) {
state = SlotCheckState.PASS;
} else {
state = SlotCheckState.INJECT;
}
return state;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.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. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.service.process;
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE;
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_EMPTY_SUB_PROCESS;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_FATHER_PARAMS;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID;
import static org.apache.dolphinscheduler.common.Constants.LOCAL_PARAMS;
import static org.apache.dolphinscheduler.plugin.task.api.enums.DataType.VARCHAR;
import static org.apache.dolphinscheduler.plugin.task.api.enums.Direct.IN;
import static org.apache.dolphinscheduler.plugin.task.api.utils.DataQualityConstants.TASK_INSTANCE_ID;
import static java.util.stream.Collectors.toSet;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.TaskDependType;
import org.apache.dolphinscheduler.common.enums.TaskGroupQueueStatus;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.expand.CuringGlobalParamsService;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.model.TaskNode; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | import org.apache.dolphinscheduler.common.model.TaskNodeRelation;
import org.apache.dolphinscheduler.common.process.ProcessDag;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.entity.Command;
import org.apache.dolphinscheduler.dao.entity.DagData;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.DependentProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.DqComparisonType;
import org.apache.dolphinscheduler.dao.entity.DqExecuteResult;
import org.apache.dolphinscheduler.dao.entity.DqRule;
import org.apache.dolphinscheduler.dao.entity.DqRuleExecuteSql;
import org.apache.dolphinscheduler.dao.entity.DqRuleInputEntry;
import org.apache.dolphinscheduler.dao.entity.DqTaskStatisticsValue;
import org.apache.dolphinscheduler.dao.entity.Environment;
import org.apache.dolphinscheduler.dao.entity.ErrorCommand;
import org.apache.dolphinscheduler.dao.entity.K8s;
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.ProcessInstanceMap;
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.ProjectUser;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.Schedule; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskGroup;
import org.apache.dolphinscheduler.dao.entity.TaskGroupQueue;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.CommandMapper;
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
import org.apache.dolphinscheduler.dao.mapper.DqComparisonTypeMapper;
import org.apache.dolphinscheduler.dao.mapper.DqExecuteResultMapper;
import org.apache.dolphinscheduler.dao.mapper.DqRuleExecuteSqlMapper;
import org.apache.dolphinscheduler.dao.mapper.DqRuleInputEntryMapper;
import org.apache.dolphinscheduler.dao.mapper.DqRuleMapper;
import org.apache.dolphinscheduler.dao.mapper.DqTaskStatisticsValueMapper;
import org.apache.dolphinscheduler.dao.mapper.EnvironmentMapper;
import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper;
import org.apache.dolphinscheduler.dao.mapper.K8sMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskGroupMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskGroupQueueMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.dao.mapper.WorkFlowLineageMapper;
import org.apache.dolphinscheduler.dao.utils.DagHelper;
import org.apache.dolphinscheduler.dao.utils.DqRuleUtils;
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.plugin.task.api.enums.dp.DqTaskState;
import org.apache.dolphinscheduler.plugin.task.api.model.DateInterval;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode;
import org.apache.dolphinscheduler.plugin.task.api.parameters.SubProcessParameters;
import org.apache.dolphinscheduler.plugin.task.api.parameters.TaskTimeoutParameter;
import org.apache.dolphinscheduler.remote.command.StateEventChangeCommand;
import org.apache.dolphinscheduler.remote.command.TaskEventChangeCommand;
import org.apache.dolphinscheduler.remote.processor.StateEventCallbackService;
import org.apache.dolphinscheduler.remote.utils.Host;
import org.apache.dolphinscheduler.service.bean.SpringApplicationContext;
import org.apache.dolphinscheduler.service.corn.CronUtils;
import org.apache.dolphinscheduler.service.exceptions.ServiceException;
import org.apache.dolphinscheduler.service.log.LogClientService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager;
import org.apache.dolphinscheduler.spi.enums.ResourceType; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import io.micrometer.core.annotation.Counted;
/**
* process relative dao that some mappers in this.
*/
@Component
public class ProcessServiceImpl implements ProcessService { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private UserMapper userMapper;
@Autowired
private ProcessDefinitionMapper processDefineMapper;
@Autowired
private ProcessDefinitionLogMapper processDefineLogMapper;
@Autowired
private ProcessInstanceMapper processInstanceMapper;
@Autowired
private DataSourceMapper dataSourceMapper;
@Autowired
private ProcessInstanceMapMapper processInstanceMapMapper;
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private CommandMapper commandMapper;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private UdfFuncMapper udfFuncMapper;
@Autowired
private ResourceMapper resourceMapper;
@Autowired
private ResourceUserMapper resourceUserMapper;
@Autowired
private ErrorCommandMapper errorCommandMapper;
@Autowired
private TenantMapper tenantMapper;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | private ProjectMapper projectMapper;
@Autowired
private DqExecuteResultMapper dqExecuteResultMapper;
@Autowired
private DqRuleMapper dqRuleMapper;
@Autowired
private DqRuleInputEntryMapper dqRuleInputEntryMapper;
@Autowired
private DqRuleExecuteSqlMapper dqRuleExecuteSqlMapper;
@Autowired
private DqComparisonTypeMapper dqComparisonTypeMapper;
@Autowired
private DqTaskStatisticsValueMapper dqTaskStatisticsValueMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
@Autowired
private ProcessTaskRelationLogMapper processTaskRelationLogMapper;
@Autowired
StateEventCallbackService stateEventCallbackService;
@Autowired
private EnvironmentMapper environmentMapper;
@Autowired
private TaskGroupQueueMapper taskGroupQueueMapper;
@Autowired
private TaskGroupMapper taskGroupMapper;
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | private WorkFlowLineageMapper workFlowLineageMapper;
@Autowired
private TaskPluginManager taskPluginManager;
@Autowired
private K8sMapper k8sMapper;
@Autowired
private CuringGlobalParamsService curingGlobalParamsService;
/**
* handle Command (construct ProcessInstance from Command) , wrapped in transaction
*
* @param logger logger
* @param host host
* @param command found command
* @return process instance
*/
@Override
@Transactional
public ProcessInstance handleCommand(String host, Command command) {
ProcessInstance processInstance = constructProcessInstance(command, host);
if (processInstance == null) {
logger.error("scan command, command parameter is error: {}", command);
moveToErrorCommand(command, "process instance is null");
return null;
}
processInstance.setCommandType(command.getCommandType());
processInstance.addHistoryCmd(command.getCommandType());
ProcessDefinition processDefinition = this.findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion());
if (processDefinition.getExecutionType().typeIsSerial()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | saveSerialProcess(processInstance, processDefinition);
if (processInstance.getState() != ExecutionStatus.SUBMITTED_SUCCESS) {
setSubProcessParam(processInstance);
deleteCommandWithCheck(command.getId());
return null;
}
} else {
saveProcessInstance(processInstance);
}
setSubProcessParam(processInstance);
deleteCommandWithCheck(command.getId());
return processInstance;
}
protected void saveSerialProcess(ProcessInstance processInstance, ProcessDefinition processDefinition) {
processInstance.setState(ExecutionStatus.SERIAL_WAIT);
saveProcessInstance(processInstance);
if (processDefinition.getExecutionType().typeIsSerialWait()) {
while (true) {
List<ProcessInstance> runningProcessInstances = this.processInstanceMapper.queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion(), Constants.RUNNING_PROCESS_STATE, processInstance.getId());
if (CollectionUtils.isEmpty(runningProcessInstances)) {
processInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
saveProcessInstance(processInstance);
return;
}
ProcessInstance runningProcess = runningProcessInstances.get(0);
if (this.processInstanceMapper.updateNextProcessIdById(processInstance.getId(), runningProcess.getId())) {
return; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
}
} else if (processDefinition.getExecutionType().typeIsSerialDiscard()) {
List<ProcessInstance> runningProcessInstances = this.processInstanceMapper.queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion(), Constants.RUNNING_PROCESS_STATE, processInstance.getId());
if (CollectionUtils.isNotEmpty(runningProcessInstances)) {
processInstance.setState(ExecutionStatus.STOP);
saveProcessInstance(processInstance);
return;
}
processInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
saveProcessInstance(processInstance);
} else if (processDefinition.getExecutionType().typeIsSerialPriority()) {
List<ProcessInstance> runningProcessInstances = this.processInstanceMapper.queryByProcessDefineCodeAndProcessDefinitionVersionAndStatusAndNextId(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion(), Constants.RUNNING_PROCESS_STATE, processInstance.getId());
if (CollectionUtils.isEmpty(runningProcessInstances)) {
processInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
saveProcessInstance(processInstance);
return;
}
for (ProcessInstance info : runningProcessInstances) {
if (Objects.nonNull(info.getState()) && (ExecutionStatus.READY_STOP.equals(info.getState()) || info.getState().typeIsFinished())) {
continue;
}
info.setCommandType(CommandType.STOP);
info.addHistoryCmd(CommandType.STOP);
info.setState(ExecutionStatus.READY_STOP);
int update = updateProcessInstance(info);
if (update > 0) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | StateEventChangeCommand stateEventChangeCommand = new StateEventChangeCommand(
info.getId(), 0, info.getState(), info.getId(), 0
);
try {
Host host = new Host(info.getHost());
stateEventCallbackService.sendResult(host, stateEventChangeCommand.convert2Command());
} catch (Exception e) {
logger.error("sendResultError",e );
}
}
}
}
}
/**
* save error command, and delete original command
*
* @param command command
* @param message message
*/
@Override
public void moveToErrorCommand(Command command, String message) {
ErrorCommand errorCommand = new ErrorCommand(command, message);
this.errorCommandMapper.insert(errorCommand);
this.commandMapper.deleteById(command.getId());
}
/**
* set process waiting thread
*
* @param command command
* @param processInstance processInstance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @return process instance
*/
private ProcessInstance setWaitingThreadProcess(Command command, ProcessInstance processInstance) {
processInstance.setState(ExecutionStatus.WAITING_THREAD);
if (command.getCommandType() != CommandType.RECOVER_WAITING_THREAD) {
processInstance.addHistoryCmd(command.getCommandType());
}
saveProcessInstance(processInstance);
this.setSubProcessParam(processInstance);
createRecoveryWaitingThreadCommand(command, processInstance);
return null;
}
/**
* insert one command
*
* @param command command
* @return create result
*/
@Override
@Counted("ds.workflow.create.command.count")
public int createCommand(Command command) {
int result = 0;
if (command != null) {
Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(command.getProcessDefinitionCode());
Map<String, String> commandParams = JSONUtils.toMap(command.getCommandParam());
if (commandParams != null && schedule != null) {
commandParams.put(Constants.SCHEDULE_TIMEZONE, schedule.getTimezoneId());
command.setCommandParam(JSONUtils.toJsonString(commandParams));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | result = commandMapper.insert(command);
}
return result;
}
/**
* get command page
*/
@Override
public List<Command> findCommandPage(int pageSize, int pageNumber) {
return commandMapper.queryCommandPage(pageSize, pageNumber * pageSize);
}
/**
* get command page
*/
@Override
public List<Command> findCommandPageBySlot(int pageSize, int pageNumber, int masterCount, int thisMasterSlot) {
if (masterCount <= 0) {
return Lists.newArrayList();
}
return commandMapper.queryCommandPageBySlot(pageSize, pageNumber * pageSize, masterCount, thisMasterSlot);
}
/**
* check the input command exists in queue list
*
* @param command command
* @return create command result
*/
@Override
public boolean verifyIsNeedCreateCommand(Command command) {
boolean isNeedCreate = true; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | EnumMap<CommandType, Integer> cmdTypeMap = new EnumMap<>(CommandType.class);
cmdTypeMap.put(CommandType.REPEAT_RUNNING, 1);
cmdTypeMap.put(CommandType.RECOVER_SUSPENDED_PROCESS, 1);
cmdTypeMap.put(CommandType.START_FAILURE_TASK_PROCESS, 1);
CommandType commandType = command.getCommandType();
if (cmdTypeMap.containsKey(commandType)) {
ObjectNode cmdParamObj = JSONUtils.parseObject(command.getCommandParam());
int processInstanceId = cmdParamObj.path(CMD_PARAM_RECOVER_PROCESS_ID_STRING).asInt();
List<Command> commands = commandMapper.selectList(null);
for (Command tmpCommand : commands) {
if (cmdTypeMap.containsKey(tmpCommand.getCommandType())) {
ObjectNode tempObj = JSONUtils.parseObject(tmpCommand.getCommandParam());
if (tempObj != null && processInstanceId == tempObj.path(CMD_PARAM_RECOVER_PROCESS_ID_STRING).asInt()) {
isNeedCreate = false;
break;
}
}
}
}
return isNeedCreate;
}
/**
* find process instance detail by id
*
* @param processId processId
* @return process instance
*/
@Override
public ProcessInstance findProcessInstanceDetailById(int processId) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | return processInstanceMapper.queryDetailById(processId);
}
/**
* get task node list by definitionId
*/
@Override
public List<TaskDefinition> getTaskNodeListByDefinition(long defineCode) {
ProcessDefinition processDefinition = processDefineMapper.queryByCode(defineCode);
if (processDefinition == null) {
logger.error("process define not exists");
return Lists.newArrayList();
}
List<ProcessTaskRelationLog> processTaskRelations = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
Set<TaskDefinition> taskDefinitionSet = new HashSet<>();
for (ProcessTaskRelationLog processTaskRelation : processTaskRelations) {
if (processTaskRelation.getPostTaskCode() > 0) {
taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPostTaskCode(), processTaskRelation.getPostTaskVersion()));
}
}
if (taskDefinitionSet.isEmpty()) {
return Lists.newArrayList();
}
List<TaskDefinitionLog> taskDefinitionLogs = taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitionSet);
return Lists.newArrayList(taskDefinitionLogs);
}
/**
* find process instance by id
*
* @param processId processId
* @return process instance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | */
@Override
public ProcessInstance findProcessInstanceById(int processId) {
return processInstanceMapper.selectById(processId);
}
/**
* find process define by id.
*
* @param processDefinitionId processDefinitionId
* @return process definition
*/
@Override
public ProcessDefinition findProcessDefineById(int processDefinitionId) {
return processDefineMapper.selectById(processDefinitionId);
}
/**
* find process define by code and version.
*
* @param processDefinitionCode processDefinitionCode
* @return process definition
*/
@Override
public ProcessDefinition findProcessDefinition(Long processDefinitionCode, int version) {
ProcessDefinition processDefinition = processDefineMapper.queryByCode(processDefinitionCode);
if (processDefinition == null || processDefinition.getVersion() != version) {
processDefinition = processDefineLogMapper.queryByDefinitionCodeAndVersion(processDefinitionCode, version);
if (processDefinition != null) {
processDefinition.setId(0);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | return processDefinition;
}
/**
* find process define by code.
*
* @param processDefinitionCode processDefinitionCode
* @return process definition
*/
@Override
public ProcessDefinition findProcessDefinitionByCode(Long processDefinitionCode) {
return processDefineMapper.queryByCode(processDefinitionCode);
}
/**
* delete work process instance by id
*
* @param processInstanceId processInstanceId
* @return delete process instance result
*/
@Override
public int deleteWorkProcessInstanceById(int processInstanceId) {
return processInstanceMapper.deleteById(processInstanceId);
}
/**
* delete all sub process by parent instance id
*
* @param processInstanceId processInstanceId
* @return delete all sub process instance result
*/
@Override
public int deleteAllSubWorkProcessByParentId(int processInstanceId) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | List<Integer> subProcessIdList = processInstanceMapMapper.querySubIdListByParentId(processInstanceId);
for (Integer subId : subProcessIdList) {
deleteAllSubWorkProcessByParentId(subId);
deleteWorkProcessMapByParentId(subId);
removeTaskLogFile(subId);
deleteWorkProcessInstanceById(subId);
}
return 1;
}
/**
* remove task log file
*
* @param processInstanceId processInstanceId
*/
@Override
public void removeTaskLogFile(Integer processInstanceId) {
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
try (LogClientService logClient = new LogClientService()) {
for (TaskInstance taskInstance : taskInstanceList) {
String taskLogPath = taskInstance.getLogPath();
if (Strings.isNullOrEmpty(taskInstance.getHost())) {
continue;
}
Host host = Host.of(taskInstance.getHost());
logClient.removeTaskLog(host.getIp(), host.getPort(), taskLogPath);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
}
/**
* recursive delete all task instance by process instance id
*/
@Override
public void deleteWorkTaskInstanceByProcessInstanceId(int processInstanceId) {
List<TaskInstance> taskInstanceList = findValidTaskListByProcessId(processInstanceId);
if (CollectionUtils.isEmpty(taskInstanceList)) {
return;
}
List<Integer> taskInstanceIdList = new ArrayList<>();
for (TaskInstance taskInstance : taskInstanceList) {
taskInstanceIdList.add(taskInstance.getId());
}
taskInstanceMapper.deleteBatchIds(taskInstanceIdList);
}
/**
* recursive query sub process definition id by parent id.
*
* @param parentCode parentCode
* @param ids ids
*/
@Override
public void recurseFindSubProcess(long parentCode, List<Long> ids) {
List<TaskDefinition> taskNodeList = this.getTaskNodeListByDefinition(parentCode);
if (taskNodeList != null && !taskNodeList.isEmpty()) {
for (TaskDefinition taskNode : taskNodeList) {
String parameter = taskNode.getTaskParams();
ObjectNode parameterJson = JSONUtils.parseObject(parameter); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | if (parameterJson.get(CMD_PARAM_SUB_PROCESS_DEFINE_CODE) != null) {
SubProcessParameters subProcessParam = JSONUtils.parseObject(parameter, SubProcessParameters.class);
ids.add(subProcessParam.getProcessDefinitionCode());
recurseFindSubProcess(subProcessParam.getProcessDefinitionCode(), ids);
}
}
}
}
/**
* create recovery waiting thread command when thread pool is not enough for the process instance.
* sub work process instance need not to create recovery command.
* create recovery waiting thread command and delete origin command at the same time.
* if the recovery command is exists, only update the field update_time
*
* @param originCommand originCommand
* @param processInstance processInstance
*/
@Override
public void createRecoveryWaitingThreadCommand(Command originCommand, ProcessInstance processInstance) {
if (processInstance.getIsSubProcess() == Flag.YES) {
if (originCommand != null) {
commandMapper.deleteById(originCommand.getId());
}
return;
}
Map<String, String> cmdParam = new HashMap<>();
cmdParam.put(Constants.CMD_PARAM_RECOVERY_WAITING_THREAD, String.valueOf(processInstance.getId()));
if (originCommand == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,617 | [Improvement][Master] Remove the extra check of slot | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have a many places to check the slot of master.
This is not needed, since this will not gurantee the command to be executed by only one master.
We already have the database transaction to deal with this case. When we transform the command to processInstance, we will delete the command at one transaction, if the delete failed, the generate of processInstance will also failed.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10617 | https://github.com/apache/dolphinscheduler/pull/10618 | 5855274b2634b33f7de3862694d36f3df94dd965 | 247ca4ae8a6d6e7a0580a999e04692a69f885144 | 2022-06-25T16:16:55Z | java | 2022-06-30T07:58:49Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | Command command = new Command(
CommandType.RECOVER_WAITING_THREAD,
processInstance.getTaskDependType(),
processInstance.getFailureStrategy(),
processInstance.getExecutorId(),
processInstance.getProcessDefinition().getCode(),
JSONUtils.toJsonString(cmdParam),
processInstance.getWarningType(),
processInstance.getWarningGroupId(),
processInstance.getScheduleTime(),
processInstance.getWorkerGroup(),
processInstance.getEnvironmentCode(),
processInstance.getProcessInstancePriority(),
processInstance.getDryRun(),
processInstance.getId(),
processInstance.getProcessDefinitionVersion()
);
saveCommand(command);
return;
}
if (originCommand.getCommandType() == CommandType.RECOVER_WAITING_THREAD) {
originCommand.setUpdateTime(new Date());
saveCommand(originCommand);
} else {
commandMapper.deleteById(originCommand.getId());
originCommand.setId(0);
originCommand.setCommandType(CommandType.RECOVER_WAITING_THREAD);
originCommand.setUpdateTime(new Date()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.