-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-19518. ABFS: [FNSOverBlob] WASB to ABFS Migration Config Support Script #7564
base: trunk
Are you sure you want to change the base?
Conversation
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some thoughts
## Introduction | ||
|
||
ABFS driver has now built support for | ||
FNS accounts (over BlobEndpoint that WASB Driver uses) using the ABFS scheme. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adda link here to fns_blob.md file
ABFS driver has now built support for | ||
FNS accounts (over BlobEndpoint that WASB Driver uses) using the ABFS scheme. | ||
|
||
The legacy WASB driver has been **deprecated** and is no longer recommended for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a link to deprecated_wasb.md here.
May be first documentation PR needs to be merged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, will do
contactTeamMsg="For any queries or support, kindly reach out to us at '[email protected]'." | ||
endpoint=".dfs." | ||
printf "Select 'HNS' if you're migrating to ABFS driver with Hierarchical Namespace enabled account, | ||
or 'Non-HNS' if you're migrating with Non-Hierarchical Namespace (FNS) account. \n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Statement construction should be same for both the options.
Select 'HNS' if you're migrating to ABFS driver for Hierarchical Namespace enabled account, or 'Non-HNS' if you're migrating to ABFS driver for Non-Hierarchical Namespace (FNS) account. \n
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken
# Stop the script if any unsupported config is found | ||
for key in "${unsupported_configs_list[@]}"; do | ||
if grep -q "$key" "$OUTPUT_FILE"; then | ||
echo "FAILURE: Remove the following configuration from file and rerun: '$key'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tell user why to remove?
"Unsupported Config found"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, added
) | ||
|
||
# Configurations not required in ABFS Driver and can be removed | ||
obsolete_configs_list=( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the real mapping for supported configs defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The configs supported and present in both ABFS, WASB remain as it is (except for endpoint change if required)
Script only makes changes for renames, deleting the obsoletes and error for unsupported ones
# Remove the property block if any name tag is empty | ||
xmlstarlet ed -L -d "//property[not(name) or name='']" "$OUTPUT_FILE" | ||
|
||
echo "Updated file: $OUTPUT_FILE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this script tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, tested with a sample config file to test the correct working and that the config values stay intact
093e7fb
to
82c7c02
Compare
@@ -0,0 +1,157 @@ | |||
#!/usr/bin/env bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to keep file name in camel case or all characters in small case just like we have for other test scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken
exit 1 | ||
fi | ||
|
||
if [[ "$1" != *.xml ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we have already assigned $1 to FILE, it would be better to use $FILE. if [[ "$FILE" != *.xml ]]; then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken
done | ||
|
||
# Mapping for renaming configurations | ||
declare -A rename_configs_map=( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
variable naming should be as per java (use camel casing instead of snake casing)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. Corrected
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
do | ||
case $namespaceType in | ||
HNS) | ||
xmlstarlet ed -L -i '//configuration/property[1]' -t elem -n property -v '' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ! command -v xmlstarlet &> /dev/null; then
echo "Error: 'xmlstarlet' is not installed. Please install it to run this script."
exit 1
fi
nit : If xmlstarlet is not installed, we should manually throw error
) | ||
|
||
# Configurations not required in ABFS Driver and can be removed | ||
obseleteConfigsList=( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: obsoleteConfigsList
|
||
FILE=$1 | ||
|
||
if [ ! -f "$FILE" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One overall suggestion would be to break down the different operations into functions, as we have lot going into the script. Some suggestion would be like
check_dependencies() { ... }
validate_input_file() { ... }
prompt_namespace_type() { ... }
rename_configurations() { ... }
remove_obsolete_configs() { ... }
handle_defaultFS_endpoint() { ... }
Description of PR
The legacy WASB driver has been deprecated and is no longer recommended for use. To support customer onboard for migration from WASB to ABFS driver, we've introduced a script to help with the configuration changes required for the same.
The script requires the configuration file (in XML format) used for WASB and would generate configuration file required for ABFS driver respectively.
JIRA ticket: https://issues.apache.org/jira/browse/HADOOP-19518
How was this patch tested?
No production code change, no testing needed.