yl09099 commented on code in PR #1897:
URL:
https://github.com/apache/incubator-uniffle/pull/1897#discussion_r1686331140
##########
coordinator/src/main/java/org/apache/uniffle/coordinator/SimpleClusterManager.java:
##########
@@ -222,6 +226,35 @@ private void parseExcludeNodesFile(DataInputStream
fsDataInputStream) throws IOE
"Updated exclude nodes and {} nodes were marked as exclude nodes",
excludeNodes.size());
}
+ private boolean putInExcludeNodesFile(List<String> excludeNodes) throws
IOException {
+ StringBuilder appendExecludeNodes = new StringBuilder();
+ String currentDate = DateFormatUtils.format(new Date(), DATE_PATTERN);
+ appendExecludeNodes
+ .append("# Header ")
+ .append(currentDate)
+ .append(":blacklist node added from the page.")
+ .append("\n");
+ for (String excludeNode : excludeNodes) {
+ appendExecludeNodes.append(excludeNode).append("\n");
+ }
+ appendExecludeNodes
+ .append("# End ")
+ .append(currentDate)
+ .append(":blacklist node added from the page.")
+ .append("\n");
+ Path hadoopPath = new Path(excludeNodesPath);
+ if (hadoopFileSystem != null) {
+ FileStatus fileStatus = hadoopFileSystem.getFileStatus(hadoopPath);
+ if (fileStatus != null && fileStatus.isFile()) {
+ try (FSDataOutputStream os = hadoopFileSystem.append(hadoopPath)) {
+
os.write(appendExecludeNodes.toString().getBytes(StandardCharsets.UTF_8));
Review Comment:
> I think it is better to replace all the content. We can display the
content of the excludeFile on the front end and users can modify the contents
at will. It is not easy to delete the excluded nodes from the file if append is
used.
done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]