[#825][part-5] feat(spark): Adds the RPC interface to reassign the ShuffleServer list. - #1146
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1146 +/- ##
============================================
+ Coverage 53.74% 54.61% +0.86%
+ Complexity 2691 2679 -12
============================================
Files 401 383 -18
Lines 23406 21084 -2322
Branches 1992 1992
============================================
- Hits 12580 11515 -1065
+ Misses 10051 8868 -1183
+ Partials 775 701 -74
... and 23 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
d5d391b to
64c4a68
Compare
59ce524 to
021924f
Compare
021924f to
18782cc
Compare
18782cc to
f6d41c6
Compare
|
@jerqi @leixm Please look at it for me. |
| */ | ||
| void addFailuresShuffleServerInfos(String shuffleServerId); | ||
|
|
||
| boolean reShuffleAssignments(int stageId, int stageAttemptNumber, int shuffleId, int numMaps); |
There was a problem hiding this comment.
reShuffleAssignments -> reassignShuffleServers ?
| } | ||
|
|
||
| @Override | ||
| public void reallocationShuffleServers( |
There was a problem hiding this comment.
reallocationShuffleServers -> reassignShuffleServers?
| * If the shuffleServer is reassigned, we need to clear the metadata of the completed Task, | ||
| * otherwise some of the Stage's data will be lost | ||
| */ | ||
| if (reallocationFlag) { |
There was a problem hiding this comment.
reallocation -> needReassign ?
| public void addFailuresShuffleServerInfos(String shuffleServerId) {} | ||
|
|
||
| @Override | ||
| public boolean reShuffleAssignments( |
There was a problem hiding this comment.
reShuffleAssignments -> reassignShuffleServers
| * @param numPartitions | ||
| */ | ||
| @Override | ||
| public synchronized boolean reShuffleAssignments( |
| * Prevent multiple tasks from reporting FetchFailed, resulting in multiple ShuffleServer | ||
| * assignments, stageID, Attemptnumber Whether to reallocate the combination flag; | ||
| */ | ||
| private Map<String, Boolean> stageAttemptTag; |
There was a problem hiding this comment.
Could we give this variable a better name?
|
@leixm Could you help me review this pr? |
5883c28 to
78b115e
Compare
| * Prevent multiple tasks from reporting FetchFailed, resulting in multiple ShuffleServer | ||
| * assignments, stageID, Attemptnumber Whether to reallocate the combination flag; | ||
| */ | ||
| private Map<String, Boolean> preventDoubleAllocationFlag = JavaUtils.newConcurrentMap(); |
| public synchronized boolean reassignShuffleServers( | ||
| int stageId, int stageAttemptNumber, int shuffleId, int numPartitions) { | ||
| String stageIdAndAttempt = stageId + "_" + stageAttemptNumber; | ||
| Boolean reassignFlag = |
There was a problem hiding this comment.
reassignFlag -> needReassgin
| * Prevent multiple tasks from reporting FetchFailed, resulting in multiple ShuffleServer | ||
| * assignments, stageID, Attemptnumber Whether to reallocate the combination flag; | ||
| */ | ||
| private Map<String, Boolean> preventDoubleAllocationFlag; |
| String stageIdAndAttempt = stageId + "_" + stageAttemptNumber; | ||
| Boolean reallocationFlag = | ||
| preventDoubleAllocationFlag.computeIfAbsent(stageIdAndAttempt, id -> false); | ||
| if (!reallocationFlag) { |
There was a problem hiding this comment.
reallocationFlag -> needReassign?
|
|
||
| public class RssReassignServersReponse extends ClientResponse { | ||
|
|
||
| private boolean reallocationFlag; |
There was a problem hiding this comment.
rellactionFlag -> needReassign?
| rpc getPartitionToShufflerServer(PartitionToShuffleServerRequest) returns (PartitionToShuffleServerResponse); | ||
| // Report write failures to ShuffleManager | ||
| rpc reportShuffleWriteFailure (ReportShuffleWriteFailureRequest) returns (ReportShuffleWriteFailureResponse); | ||
| // Reallocate the RPC interface of the ShuffleServer list |
| } | ||
|
|
||
| @Override | ||
| public RssReassignServersReponse reallocationShuffleServers(RssReassignServersRequest req) { |
There was a problem hiding this comment.
realloctionShuffleServers -> reassignShuffleServers?
| throw new RssException("registerShuffle failed!", throwable); | ||
| } | ||
| /** | ||
| * we need to clear the metadata of the completed Task, otherwise some of the Stage's data |
There was a problem hiding this comment.
completed Task -> completed tasks
roryqi
left a comment
There was a problem hiding this comment.
Two questions:
If one shuffle server is allocated by two stages, one stage trigger the reassignment, what will it happen?
Do we remove the shuffle server and then won't send the heartbeat after we trigger the reassignment?
|
|
||
| message ReassignServersReponse{ | ||
| StatusCode status = 1; | ||
| bool reallocationFlag = 2; |
633502d to
bcf10a1
Compare
|
…the ShuffleServer list.
bcf10a1 to
f26a569
Compare
|
LGTM, let @leixm take an another look. |
| int retryTimes = sparkConf.get(RssSparkConfig.RSS_CLIENT_ASSIGNMENT_RETRY_TIMES); | ||
| int estimateTaskConcurrency = RssSparkShuffleUtils.estimateTaskConcurrency(sparkConf); | ||
| /** Before reassigning ShuffleServer, clear the ShuffleServer list in ShuffleWriteClient. */ | ||
| shuffleWriteClient.unregisterShuffle(appId, shuffleId); |
There was a problem hiding this comment.
When cleaning up at this time, some tasks are reading this data. Will this have any impact?
There was a problem hiding this comment.
When cleaning up at this time, some tasks are reading this data. Will this have any impact?
Write failures are handled here, and read cases should not be involved.
| * will be lost | ||
| */ | ||
| try { | ||
| unregisterAllMapOutput(shuffleId); |
There was a problem hiding this comment.
What happens if there are not enough ShuffleServers to assign at this time?
There was a problem hiding this comment.
What happens if there are not enough ShuffleServers to assign at this time?
The ShuffleServer allocation was done before the metadata was cleaned, and the amount was insufficient to throw an exception directly, a few lines of code before this code.
|
LGTM. |
|
Merged, thanks @jerqi @yl09099 |
What changes were proposed in this pull request?
Adds the RPC interface to reassign the ShuffleServer list.
Ⅰ. Overall objective:
Ⅱ. Implementation logic diagram:
Ⅲ. As shown in the picture above:
2, the Task of Stage starts, solid steps, in accordance with the green by ShuffleManager Client RPC interface gets to be written for shuffleIdToShuffleHandleInfo ShuffleServer list;
Why are the changes needed?
Fix: #825
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Existing UT.