forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-36880][network] Hybrid shuffle supports job master failover if…
… only external tier used.
- Loading branch information
Showing
18 changed files
with
837 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...k/runtime/io/network/partition/hybrid/tiered/shuffle/AllTieredShuffleMasterSnapshots.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.runtime.io.network.partition.hybrid.tiered.shuffle; | ||
|
||
import org.apache.flink.api.java.tuple.Tuple2; | ||
|
||
import java.io.Serializable; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
|
||
/** | ||
* This is a collection of all {@link TieredShuffleMasterSnapshot}s from every tier in one snapshot | ||
* round. | ||
*/ | ||
public class AllTieredShuffleMasterSnapshots implements Serializable { | ||
/** | ||
* Snapshots of all tires. For each tier, it is a tuple of | ||
* (identifier,TieredShuffleMasterSnapshot) | ||
*/ | ||
private final Collection<Tuple2<String, TieredShuffleMasterSnapshot>> snapshots; | ||
|
||
public AllTieredShuffleMasterSnapshots( | ||
Collection<Tuple2<String, TieredShuffleMasterSnapshot>> snapshots) { | ||
this.snapshots = snapshots; | ||
} | ||
|
||
public Collection<Tuple2<String, TieredShuffleMasterSnapshot>> getSnapshots() { | ||
return snapshots; | ||
} | ||
|
||
public static AllTieredShuffleMasterSnapshots empty() { | ||
return new AllTieredShuffleMasterSnapshots(Collections.emptyList()); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../runtime/io/network/partition/hybrid/tiered/shuffle/EmptyTieredShuffleMasterSnapshot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.runtime.io.network.partition.hybrid.tiered.shuffle; | ||
|
||
/** | ||
* A singleton implementation of {@link TieredShuffleMasterSnapshot} that represents an empty | ||
* snapshot of tiered shuffle master. | ||
*/ | ||
public class EmptyTieredShuffleMasterSnapshot implements TieredShuffleMasterSnapshot { | ||
private static final EmptyTieredShuffleMasterSnapshot INSTANCE = | ||
new EmptyTieredShuffleMasterSnapshot(); | ||
|
||
public static EmptyTieredShuffleMasterSnapshot getInstance() { | ||
return INSTANCE; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
.../flink/runtime/io/network/partition/hybrid/tiered/shuffle/ShuffleDescriptorRetriever.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.runtime.io.network.partition.hybrid.tiered.shuffle; | ||
|
||
import org.apache.flink.api.common.JobID; | ||
import org.apache.flink.runtime.io.network.partition.ResultPartitionID; | ||
import org.apache.flink.runtime.shuffle.ShuffleDescriptor; | ||
|
||
import java.util.Optional; | ||
|
||
/** The retriever for shuffle descriptor. */ | ||
public interface ShuffleDescriptorRetriever { | ||
/** | ||
* Get shuffle descriptor by JobID and ResultPartitionId. | ||
* | ||
* @return shuffle descriptor or empty if not exist. | ||
*/ | ||
Optional<ShuffleDescriptor> getShuffleDescriptor( | ||
JobID jobID, ResultPartitionID resultPartitionID); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...ntime/io/network/partition/hybrid/tiered/shuffle/TieredInternalShuffleMasterSnapshot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.runtime.io.network.partition.hybrid.tiered.shuffle; | ||
|
||
import org.apache.flink.runtime.io.network.partition.ResultPartitionID; | ||
import org.apache.flink.runtime.shuffle.ShuffleDescriptor; | ||
import org.apache.flink.runtime.shuffle.ShuffleMasterSnapshot; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* The internal {@link ShuffleMasterSnapshot} for hybrid shuffle. This bump shuffle descriptors and | ||
* all tiers snapshot. | ||
*/ | ||
public class TieredInternalShuffleMasterSnapshot implements ShuffleMasterSnapshot { | ||
private final Map<ResultPartitionID, ShuffleDescriptor> shuffleDescriptors; | ||
|
||
private final AllTieredShuffleMasterSnapshots allTierSnapshots; | ||
|
||
public TieredInternalShuffleMasterSnapshot( | ||
Map<ResultPartitionID, ShuffleDescriptor> shuffleDescriptors, | ||
AllTieredShuffleMasterSnapshots allTierSnapshots) { | ||
this.shuffleDescriptors = shuffleDescriptors; | ||
this.allTierSnapshots = allTierSnapshots; | ||
} | ||
|
||
public Map<ResultPartitionID, ShuffleDescriptor> getShuffleDescriptors() { | ||
return shuffleDescriptors; | ||
} | ||
|
||
public AllTieredShuffleMasterSnapshots getAllTierSnapshots() { | ||
return allTierSnapshots; | ||
} | ||
|
||
@Override | ||
public boolean isIncremental() { | ||
return true; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...flink/runtime/io/network/partition/hybrid/tiered/shuffle/TieredShuffleMasterSnapshot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.flink.runtime.io.network.partition.hybrid.tiered.shuffle; | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* This class represents a snapshot of tiered shuffle master, which can be used to restore the | ||
* internal state of the shuffle master. | ||
* | ||
* <p>IMPORTANT: It is incremental. | ||
*/ | ||
public interface TieredShuffleMasterSnapshot extends Serializable {} |
Oops, something went wrong.