Skip to content

Commit

Permalink
fix: strictly verify whether app is registered especially after serve…
Browse files Browse the repository at this point in the history
…r restart
  • Loading branch information
zuston committed Aug 8, 2023
1 parent ca24531 commit bc11e2c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,15 @@ public long getPartitionDataSize(String appId, int shuffleId, int partitionId) {

public long requireBuffer(
String appId, int shuffleId, List<Integer> partitionIds, int requireSize) {
ShuffleTaskInfo shuffleTaskInfo = shuffleTaskInfos.get(appId);
if (null == shuffleTaskInfo) {
// Once the shuffle server is restarted, the following shuffleTaskInfo may exist as
// a result of the refreshAppId() method being invoked during the process of sending/getting data
// from the client side. However, it is essential for the app's buffer pool to exist once it has been registered.
// This can serve as a crucial criterion for determining whether the app is not registered,
// especially following a server restart.
if (null == shuffleTaskInfos.get(appId) || !shuffleBufferManager.containsBufferByApp(appId)) {
return RequireBufferStatusCode.NO_REGISTER.statusCode();
}

for (int partitionId : partitionIds) {
long partitionUsedDataSize = getPartitionDataSize(appId, shuffleId, partitionId);
if (shuffleBufferManager.limitHugePartition(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,8 @@ public boolean limitHugePartition(
}
return false;
}

public boolean containsBufferByApp(String appId) {
return bufferPool.containsKey(appId);
}
}

0 comments on commit bc11e2c

Please sign in to comment.