advancedxy commented on code in PR #424:
URL: https://github.com/apache/incubator-uniffle/pull/424#discussion_r1053930774
##########
server/src/main/java/org/apache/uniffle/server/ShuffleDataReadEvent.java:
##########
@@ -21,12 +21,14 @@ public class ShuffleDataReadEvent {
private String appId;
private int shuffleId;
+ private int partitionId;
private int startPartition;
- public ShuffleDataReadEvent(String appId, int shuffleId, int startPartition)
{
+ public ShuffleDataReadEvent(String appId, int shuffleId, int partitionId,
int[] range) {
Review Comment:
I don't think `int[] range` is necessary. Just a `int startPartition`
should be sufficient. And we can avoid the range `int[]` creation.
##########
integration-test/common/src/test/java/org/apache/uniffle/test/DiskErrorToleranceTest.java:
##########
@@ -89,6 +90,7 @@ public void closeClient() {
}
@Test
Review Comment:
The `@Test` annotation should be removed?
##########
server/src/main/java/org/apache/uniffle/server/storage/LocalStorageManager.java:
##########
@@ -217,6 +244,34 @@ public void removeResources(PurgeEvent event) {
deleteHandler.delete(deletePaths.toArray(new String[deletePaths.size()]),
appId, user);
}
+ private void cleanupStorageSelectionCache(PurgeEvent event) {
+ Function<String, Boolean> deleteConditionFunc = null;
+ if (event instanceof AppPurgeEvent) {
+ deleteConditionFunc = partitionUnionKey ->
UnionKey.startsWith(partitionUnionKey, event.getAppId());
+ } else if (event instanceof ShufflePurgeEvent) {
+ deleteConditionFunc =
+ partitionUnionKey -> UnionKey.startsWith(
+ partitionUnionKey,
+ event.getAppId(),
+ event.getShuffleIds()
+ );
+ }
+ deleteElement(
+ partitionsOfStorage,
+ deleteConditionFunc
+ );
+ }
+
+ private <K, V> void deleteElement(Map<K, V> map, Function<K, Boolean>
deleteConditionFunc) {
Review Comment:
I'm a little concerned about the performance. Could you add a logging about
how much time cost to delete element?
##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerGrpcService.java:
##########
@@ -511,9 +513,15 @@ public void getLocalShuffleData(GetLocalShuffleDataRequest
request,
String requestInfo = "appId[" + appId + "], shuffleId[" + shuffleId + "],
partitionId["
+ partitionId + "]" + "offset[" + offset + "]" + "length[" + length +
"]";
- shuffleServer.getStorageManager()
- .selectStorage(new ShuffleDataReadEvent(appId, shuffleId, partitionId))
- .updateReadMetrics(new StorageReadMetrics(appId, shuffleId));
+ int[] range = ShuffleStorageUtils.getPartitionRange(partitionId,
partitionNumPerRange, partitionNum);
Review Comment:
Another aspect why `int[]` to `ShuffleDataReadEvent` is unnecessary: we can
calculate start partition directly, which could avoid the `int[]` creation. But
let's do that in another pr.
--
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]