forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-43179][SHUFFLE] Allowing apps to control whether their metadat…
…a gets saved in the db by the External Shuffle Service ### What changes were proposed in this pull request? This change allows applications to control whether their metadata gets saved in the db. For applications with higher security requirements, storing application secret in the db without any encryption is a potential security risk. While filesystem ACLs can help protect the access to the db, this level of security is not sufficient for some use cases. Such applications can chose to not save their metadata in the db. As a result, these applications may experience more failures in the event of a node restart, but we believe this trade-off is acceptable given the increased security risk. ### Why are the changes needed? These modifications are necessary to reduce the likelihood of security threats for applications with elevated security requirements. ### Does this PR introduce _any_ user-facing change? No. Added a configuration `spark.shuffle.server.recovery.disabled` which by default is `false`. When set to `true`, the metadata of the application will not saved in the db. ### How was this patch tested? Added UTs and also verified with test applications in our test environment. Closes apache#40843 from otterc/SPARK-43179. Authored-by: Chandni Singh <singh.chandni@gmail.com> Signed-off-by: Mridul Muralidharan <mridul<at>gmail.com>
- Loading branch information
Showing
10 changed files
with
425 additions
and
24 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
...work-shuffle/src/main/java/org/apache/spark/network/shuffle/AppsWithRecoveryDisabled.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,66 @@ | ||
/* | ||
* 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.spark.network.shuffle; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
import com.google.common.base.Preconditions; | ||
|
||
/** | ||
* Stores the applications which have recovery disabled. | ||
*/ | ||
public final class AppsWithRecoveryDisabled { | ||
|
||
private static final AppsWithRecoveryDisabled INSTANCE = new AppsWithRecoveryDisabled(); | ||
|
||
private final Set<String> appsWithRecoveryDisabled = Collections.newSetFromMap( | ||
new ConcurrentHashMap<>()); | ||
|
||
private AppsWithRecoveryDisabled() { | ||
} | ||
|
||
/** | ||
* Add an application for which recovery is disabled. | ||
* @param appId application id | ||
*/ | ||
public static void disableRecoveryOfApp(String appId) { | ||
Preconditions.checkNotNull(appId); | ||
INSTANCE.appsWithRecoveryDisabled.add(appId); | ||
} | ||
|
||
/** | ||
* Returns whether an application is enabled for recovery or not. | ||
* @param appId application id | ||
* @return true if the application is enabled for recovery; false otherwise. | ||
*/ | ||
public static boolean isRecoveryEnabledForApp(String appId) { | ||
Preconditions.checkNotNull(appId); | ||
return !INSTANCE.appsWithRecoveryDisabled.contains(appId); | ||
} | ||
|
||
/** | ||
* Removes the application from the store. | ||
* @param appId application id | ||
*/ | ||
public static void removeApp(String appId) { | ||
Preconditions.checkNotNull(appId); | ||
INSTANCE.appsWithRecoveryDisabled.remove(appId); | ||
} | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.