Skip to content

Commit b97c898

Browse files
authored
Merge branch 'apache:trunk' into HDFS-17772
2 parents a38286b + c82bac5 commit b97c898

File tree

7 files changed

+297
-4
lines changed

7 files changed

+297
-4
lines changed

Diff for: LICENSE-binary

-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ javax.inject:javax.inject:1
298298
net.java.dev.jna:jna:5.2.0
299299
net.minidev:accessors-smart:1.2
300300
org.apache.avro:avro:1.11.4
301-
org.apache.avro:avro:1.11.3
302301
org.apache.commons:commons-compress:1.26.1
303302
org.apache.commons:commons-configuration2:2.10.1
304303
org.apache.commons:commons-csv:1.9.0

Diff for: hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpcSingleNS.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ public void testSaveNamespace() throws IOException {
205205
cluster.getCluster().getFileSystem()
206206
.setSafeMode(SafeModeAction.ENTER);
207207
Boolean saveNamespace = routerProtocol.saveNamespace(0, 0);
208-
209208
assertTrue(saveNamespace);
209+
// Leave safe mode after saving the namespace.
210+
cluster.getCluster().getFileSystem()
211+
.setSafeMode(SafeModeAction.LEAVE);
210212
}
211213
}

Diff for: hadoop-project/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<hadoop.protobuf.version>3.25.5</hadoop.protobuf.version>
9797
<protoc.path>${env.HADOOP_PROTOC_PATH}</protoc.path>
9898

99-
<hadoop-thirdparty.version>1.3.0</hadoop-thirdparty.version>
99+
<hadoop-thirdparty.version>1.4.0</hadoop-thirdparty.version>
100100
<hadoop-thirdparty-protobuf.version>${hadoop-thirdparty.version}</hadoop-thirdparty-protobuf.version>
101101
<hadoop-thirdparty-guava.version>${hadoop-thirdparty.version}</hadoop-thirdparty-guava.version>
102102
<hadoop-thirdparty-shaded-prefix>org.apache.hadoop.thirdparty</hadoop-thirdparty-shaded-prefix>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
# Licensed to the Apache Software Foundation (ASF) under one or more
6+
# contributor license agreements. See the NOTICE file distributed with
7+
# this work for additional information regarding copyright ownership.
8+
# The ASF licenses this file to You under the Apache License, Version 2.0
9+
# (the "License"); you may not use this file except in compliance with
10+
# the License. You may obtain a copy of the License at
11+
#
12+
# http://www.apache.org/licenses/LICENSE-2.0
13+
#
14+
# Unless required by applicable law or agreed to in writing, software
15+
# distributed under the License is distributed on an "AS IS" BASIS,
16+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17+
# See the License for the specific language governing permissions and
18+
# limitations under the License.
19+
20+
FILE=$1
21+
OUTPUT_FILE=""
22+
23+
# ------------------------------------------------------------------------------
24+
# Initialization and Dependency Checks
25+
# ------------------------------------------------------------------------------
26+
27+
checkDependency() {
28+
if ! command -v xmlstarlet &> /dev/null; then
29+
echo "ERROR: 'xmlstarlet' is not installed. Please install it to run this script."
30+
echo "Exiting..."
31+
exit 1
32+
fi
33+
}
34+
35+
validateInputFile() {
36+
if [ ! -f "$FILE" ]; then
37+
echo "Error: File '$FILE' not found. Exiting...."
38+
exit 1
39+
fi
40+
41+
if [[ "$FILE" != *.xml ]]; then
42+
echo "The file provided is not an XML file. Exiting...."
43+
exit 1
44+
fi
45+
}
46+
47+
init() {
48+
checkDependency
49+
validateInputFile
50+
OUTPUT_FILE="abfs-converted-config.xml"
51+
cp "$FILE" "$OUTPUT_FILE"
52+
}
53+
54+
# ------------------------------------------------------------------------------
55+
# Global Variables & Config Mappings
56+
# ------------------------------------------------------------------------------
57+
58+
contactTeamMsg="For any queries or support, kindly reach out to us at '[email protected]'."
59+
endpoint=".dfs."
60+
61+
# Mapping for renaming configurations
62+
declare -A renameConfigsMap=(
63+
["autothrottling.enable"]="enable.autothrottling" #fs.azure.autothrottling.enable to fs.azure.enable.autothrottling
64+
["rename.dir"]="rename.key" # fs.azure.atomic.rename.dir to fs.azure.atomic.rename.key
65+
["block.blob.buffered.pread.disable"]="buffered.pread.disable" #fs.azure.block.blob.buffered.pread.disable to fs.azure.buffered.pread.disable
66+
["fs.azure.sas"]="fs.azure.sas.fixed.token." #fs.azure.sas.CONTAINER_NAME.ACCOUNT_NAME to fs.azure.sas.fixed.token.CONTAINER_NAME.ACCOUNT_NAME
67+
["check.block.md5"]="enable.checksum.validation" #fs.azure.check.block.md5 to fs.azure.enable.checksum.validation
68+
)
69+
70+
# Configs not supported in ABFS
71+
unsupportedConfigsList=(
72+
"fs.azure.page.blob.dir"
73+
"fs.azure.block.blob.with.compaction.dir"
74+
"fs.azure.store.blob.md5"
75+
)
76+
77+
# Configurations not required in ABFS Driver and can be removed
78+
obsoleteConfigsList=(
79+
"azure.authorization" #fs.azure.authorization, fs.azure.authorization.caching.enable , fs.azure.authorization.caching.maxentries, fs.azure.authorization.cacheentry.expiry.period, fs.azure.authorization.remote.service.urls
80+
"azure.selfthrottling" #fs.azure.selfthrottling.enable, fs.azure.selfthrottling.read.factor, fs.azure.selfthrottling.write.factor
81+
"azure.saskey" #fs.azure.saskey.cacheentry.expiry.period , fs.azure.saskey.usecontainersaskeyforallaccess
82+
"copyblob.retry" #fs.azure.io.copyblob.retry.min.backoff.interval, fs.azure.io.copyblob.retry.max.backoff.interval, fs.azure.io.copyblob.retry.backoff.interval, fs.azure.io.copyblob.retry.max.retries
83+
"service.urls" #fs.azure.cred.service.urls , fs.azure.delegation.token.service.urls, fs.azure.authorization.remote.service.urls
84+
"blob.metadata.key.case.sensitive" #fs.azure.blob.metadata.key.case.sensitive
85+
"cacheentry.expiry.period" #fs.azure.cacheentry.expiry.period
86+
"chmod.allowed.userlist" #fs.azure.chmod.allowed.userlist
87+
"chown.allowed.userlist" #fs.azure.chown.allowed.userlist
88+
"daemon.userlist" #fs.azure.daemon.userlist
89+
"delete.threads" #fs.azure.delete.threads
90+
"enable.kerberos.support" #fs.azure.enable.kerberos.support
91+
"flatlist.enable" #fs.azure.flatlist.enable
92+
"fsck.temp.expiry.seconds" #fs.azure.fsck.temp.expiry.seconds
93+
"local.sas.key.mode" #fs.azure.local.sas.key.mode
94+
"override.canonical.service.name" #fs.azure.override.canonical.service.name
95+
"permissions.supergroup" #fs.azure.permissions.supergroup
96+
"rename.threads" #fs.azure.rename.threads
97+
"secure.mode" #fs.azure.secure.mode
98+
"skip.metrics" #fs.azure.skip.metrics
99+
"storage.client.logging" #fs.azure.storage.client.logging
100+
"storage.emulator.account.name" #fs.azure.storage.emulator.account.name
101+
"storage.timeout" #fs.azure.storage.timeout
102+
"enable.append.support" #fs.azure.enable.append.support
103+
)
104+
105+
# ------------------------------------------------------------------------------
106+
# User Interaction
107+
# ------------------------------------------------------------------------------
108+
109+
promptNamespaceType() {
110+
printf "Select 'HNS' if you're migrating to ABFS driver for Hierarchical Namespace enabled account,
111+
or 'Non-HNS' if you're migrating to ABFS driver for Non-Hierarchical Namespace (FNS) account. \n"
112+
printf "WARNING: Please ensure the correct option is chosen as it will affect the configuration changes made to the file. \n"
113+
printf "If you are unsure, follow the instructions below to check from Azure Portal: \n"
114+
printf "* Go to the Azure Portal and navigate to your storage account. \n"
115+
printf "* In the left-hand menu, select 'Overview' section and look for 'Properties'. \n"
116+
printf "* Under 'Blob service', check if 'Hierarchical namespace' is enabled or disabled. \n"
117+
echo "$contactTeamMsg"
118+
select namespaceType in "HNS" "NonHNS"
119+
do
120+
case $namespaceType in
121+
HNS)
122+
xmlstarlet ed -L -i '//configuration/property[1]' -t elem -n property -v '' \
123+
-s '//configuration/property[1]' -t elem -n name -v 'fs.azure.account.hns.enabled' \
124+
-s '//configuration/property[1]' -t elem -n value -v 'true' "$OUTPUT_FILE"
125+
break
126+
;;
127+
NonHNS)
128+
endpoint=".blob."
129+
break
130+
;;
131+
*)
132+
echo "Invalid selection. Please try again. Exiting..."
133+
exit 1
134+
;;
135+
esac
136+
done
137+
}
138+
139+
# ------------------------------------------------------------------------------
140+
# Config File Transformations
141+
# ------------------------------------------------------------------------------
142+
143+
# Stop the script if any unsupported config is found
144+
unsupportedConfigCheck() {
145+
for key in "${unsupportedConfigsList[@]}"; do
146+
if grep -q "$key" "$OUTPUT_FILE"; then
147+
echo "Remove the following configuration from file and rerun: '$key'"
148+
failure=true
149+
fi
150+
done
151+
152+
if [ "$failure" = true ]; then
153+
echo "FAILURE: Unsupported Config Found"
154+
echo "$contactTeamMsg"
155+
echo "Exiting..."
156+
exit 1
157+
fi
158+
}
159+
160+
# Renaming the configs
161+
renameConfigs() {
162+
for old in "${!renameConfigsMap[@]}"; do
163+
new="${renameConfigsMap[$old]}"
164+
xmlstarlet ed -L -u "//property/name[contains(., '$old')]" -x "concat(substring-before(., '$old'),
165+
'$new', substring-after(., '$old'))" "$OUTPUT_FILE"
166+
done
167+
}
168+
169+
# Remove the obsolete configs
170+
removeObsoleteConfigs() {
171+
for key in "${obsoleteConfigsList[@]}"; do
172+
xmlstarlet ed -L -d "//property[name[contains(text(), '$key')]]" "$OUTPUT_FILE"
173+
done
174+
}
175+
176+
# Change the endpoints to DFS if migrating to HNS
177+
changeEndpointForHNS() {
178+
if [ "$endpoint" = ".dfs." ]; then
179+
xmlstarlet ed -L -u "//property/name[contains(., '.blob.')]" -x "concat(substring-before(., '.blob.'),
180+
'$endpoint', substring-after(., '.blob.'))" "$OUTPUT_FILE"
181+
fi
182+
}
183+
184+
# Change the value of fs.defaultFS
185+
handleDefaultFSValue() {
186+
if xmlstarlet sel -t -v "//property[name='fs.defaultFS']/value" "$OUTPUT_FILE" | grep -q "."; then
187+
if xmlstarlet sel -t -v "//property[name='fs.defaultFS']/value" "$OUTPUT_FILE" | grep -q ".blob."; then
188+
xmlstarlet ed -L -u "//property[name='fs.defaultFS']/value" -x "concat('abfs', substring-before(substring-after(., 'wasb'), '@'),
189+
'@', substring-before(substring-after(., '@'), '.blob.'), '$endpoint', 'core.windows.net')" "$OUTPUT_FILE"
190+
else
191+
echo "ERROR: 'fs.defaultFS' does not have 'Blob' as endpoint. Exiting..."
192+
echo "$contactTeamMsg"
193+
exit 1
194+
fi
195+
fi
196+
}
197+
198+
# ------------------------------------------------------------------------------
199+
# Script Execution
200+
# ------------------------------------------------------------------------------
201+
202+
init
203+
promptNamespaceType
204+
unsupportedConfigCheck
205+
removeObsoleteConfigs
206+
renameConfigs
207+
changeEndpointForHNS
208+
handleDefaultFSValue
209+
210+
# Clean up any <property> blocks with empty <name> tags
211+
xmlstarlet ed -L -d "//property[not(name) or name='']" "$OUTPUT_FILE"
212+
213+
echo "Updated file: $OUTPUT_FILE"

Diff for: hadoop-tools/hadoop-azure/src/site/markdown/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ See also:
3636
* [FNS (non-HNS)](./fns_blob.html)
3737
* [Legacy-Deprecated-WASB](./wasb.html)
3838
* [Testing](./testing_azure.html)
39+
* [WASB Migration Config Support](./wasbToAbfsMigration.html)
3940

4041
## <a name="features"></a> Features of the ABFS connector.
4142

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<!---
2+
Licensed under the Apache License, Version 2.0 (the "License");
3+
you may not use this file except in compliance with the License.
4+
You may obtain a copy of the License at
5+
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License. See accompanying LICENSE file.
13+
-->
14+
15+
# WASB to ABFS Driver Configuration Conversion Script
16+
17+
To support customer onboard for migration from WASB to ABFS driver, we've
18+
introduced a script to help with the configuration changes required
19+
for the same.
20+
21+
## Introduction
22+
23+
ABFS driver has now built support for
24+
FNS accounts (over BlobEndpoint that WASB Driver uses) using the ABFS scheme.
25+
Refer to: [ABFS Driver for Namespace Disabled Accounts](./fns_blob.html) for more details.
26+
27+
The legacy WASB driver has been **deprecated** and is no longer recommended for
28+
use. Refer to: [WASB Deprecation](./wasb.html) for more details.
29+
It's highly recommended for current WASB Driver users to migrate to ABFS driver,
30+
the only Microsoft driver for Azure Storage.
31+
32+
Microsoft recommends all Big Data and Analytics users to use
33+
Azure Data Lake Gen2 (ADLS Gen2) using the ABFS driver. It is thus preferred to
34+
upgrade to HNS-enabled accounts and use
35+
ABFS driver with DFS endpoint. Alternatively, if there are dependencies on
36+
features that are incompatible with HNS, ABFS driver can be used with Blob
37+
endpoint over non-HNS accounts.
38+
39+
## Script Overview
40+
41+
This script converts the provided WASB configuration file to be compatible with
42+
the Azure Blob File System (ABFS) driver. It performs the following tasks:
43+
44+
1. Prompts the user to select the type of namespace (HNS or Non-HNS) for the
45+
storage account.
46+
2. Renames specific configurations.
47+
3. Removes unsupported and obsolete configurations.
48+
4. Ensures correct endpoint are used.
49+
50+
## Usage
51+
52+
The user needs to provide the path to the WASB XML configuration file while
53+
running the script.
54+
The script will then prompt the user to select the type of namespace (HNS or
55+
Non-HNS) for the storage account.
56+
This is important as it determines how the script will process the
57+
configurations. Ensuring the correct option is selected is crucial for a
58+
successful migration.
59+
60+
If the user is unsure, please contact our team at **[email protected]** or
61+
follow the instructions below to check from Azure Portal:
62+
63+
* Go to the Azure Portal and navigate to your storage account.
64+
* In the left-hand menu, select 'Overview' section and look for 'Properties'.
65+
* Under 'Blob service', check if 'Hierarchical namespace' is enabled or
66+
disabled.
67+
68+
After the script has completed, it will output the modified configurations to a
69+
new file named `abfs-converted-config.xml` in the same directory.
70+
It would have the necessary configuration changes made to make it compatible
71+
with the ABFS driver.
72+
73+
Example to run the script:
74+
75+
```shell
76+
./configsupport.sh <path-to-xml-file>
77+
```
78+
79+
For any queries or support, kindly reach out to us at '[email protected]'

Diff for: hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemDelegationSAS.java

-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ public void testReadAndWrite() throws Exception {
218218
@Test
219219
public void checkExceptionForRenameOverwrites() throws Exception {
220220
final AzureBlobFileSystem fs = getFileSystem();
221-
222221
Path src = new Path("a/b/f1.txt");
223222
Path dest = new Path("a/b/f2.txt");
224223
touch(src);

0 commit comments

Comments
 (0)