Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package org.apache.spark.shuffle;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

import scala.Tuple2;
Expand Down Expand Up @@ -512,4 +514,15 @@ public static RssConf toRssConf(SparkConf sparkConf) {
}
return rssConf;
}

public static Map<String, String> sparkConfToMap(SparkConf sparkConf) {
Map<String, String> map = new HashMap<>();

for (Tuple2<String, String> tuple : sparkConf.getAll()) {
String key = tuple._1;
map.put(key, tuple._2);
}

return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;

import scala.Tuple2;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
Expand Down Expand Up @@ -1064,7 +1062,7 @@ protected void registerShuffleServers(
}
LOG.info("Start to register shuffleId {}", shuffleId);
long start = System.currentTimeMillis();
Map<String, String> sparkConfMap = sparkConfToMap(getSparkConf());
Map<String, String> sparkConfMap = RssSparkConfig.sparkConfToMap(getSparkConf());
serverToPartitionRanges.entrySet().stream()
.forEach(
entry -> {
Expand Down Expand Up @@ -1095,7 +1093,7 @@ protected void registerShuffleServers(
}
LOG.info("Start to register shuffleId[{}]", shuffleId);
long start = System.currentTimeMillis();
Map<String, String> sparkConfMap = sparkConfToMap(getSparkConf());
Map<String, String> sparkConfMap = RssSparkConfig.sparkConfToMap(getSparkConf());
Set<Map.Entry<ShuffleServerInfo, List<PartitionRange>>> entries =
serverToPartitionRanges.entrySet();
entries.stream()
Expand Down Expand Up @@ -1141,15 +1139,4 @@ public boolean isRssStageRetryForFetchFailureEnabled() {
public SparkConf getSparkConf() {
return sparkConf;
}

public Map<String, String> sparkConfToMap(SparkConf sparkConf) {
Map<String, String> map = new HashMap<>();

for (Tuple2<String, String> tuple : sparkConf.getAll()) {
String key = tuple._1;
map.put(key, tuple._2);
}

return map;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ private boolean tryAccessCluster() {
Map<String, String> extraProperties = Maps.newHashMap();
extraProperties.put(
ACCESS_INFO_REQUIRED_SHUFFLE_NODES_NUM, String.valueOf(assignmentShuffleNodesNum));
// Put all spark conf into extra properties, except which length is longer than 100
// to avoid extra properties too long.
RssSparkConfig.toRssConf(sparkConf).getAll().stream()
.filter(entry -> StringUtils.length((String) entry.getValue()) < 100)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too tricky....

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Em... Thanks for your review! I'm sorry for this.

I would greatly appreciate it if you could give me some advice.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can implement a white list or configuration filter. The white list can be configured in the configuration. The configuration filter could have length configuration filter. The length could be configured in the configuration.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think use black list instead of white list can be possible?

@roryqi roryqi Nov 25, 2024

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok for me, too. black list would better to be replaced by excludeList.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

.forEach(entry -> extraProperties.put(entry.getKey(), (String) entry.getValue()));

Set<String> assignmentTags = RssSparkShuffleUtils.getAssignmentTags(sparkConf);
try {
Expand Down