HDDS-4525. Replace Hadoop variables and functions in Ozone shell scripts with Ozone-specific ones#1667
Conversation
…pts with Ozone-specific ones
This reverts commit 3c29455.
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBConfigFromFile.java
Show resolved
Hide resolved
|
Hi @adoroszlai, thank you for working on this change, please find a few comments from me inline. I have a concern about OZONE_CONFIG_DIR, we brake a convention here, as not just Hadoop, but HBase, or Hive as well for example uses the COMPONENT_CONF_DIR to specify the config dir. |
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBConfigFromFile.java
Show resolved
Hide resolved
| . "${HADOOP_LIBEXEC_DIR}/hadoop-config.sh" | ||
| else | ||
| echo "ERROR: Cannot execute ${HADOOP_LIBEXEC_DIR}/hadoop-config.sh." 2>&1 | ||
| if ! ozone_bootstrap; then |
There was a problem hiding this comment.
This seems to be a strange one here...
So in line 45 if ozone_bootstrap is not declared, we error out because ozone-functions.sh could not be loaded.
As I understand here we check for the exit status of ozone_bootstrap function, and if it is false we exit because we can not find ozone-config.sh. Why we need this second check? As I see the ozone_bootstrap function is not doing anything that should fail, but maybe my eye slipped through something.
This same we do in hadoop-ozone/dist/src/shell/ozone/ozone, in hadoop-ozone/dist/src/shell/ozone/start-ozone.sh and in hadoop-ozone/dist/src/shell/ozone/stop-ozone.sh files as well
Usage of this variable was introduced as leftover from copy-paste (of `scmcli` subcommand, which was above the new `insight` case at that time).
Also, We could fix this script, but it would only apply to So we have 3 options:
|
|
Hi Attila, thank you for addressing review comments of mine, and going further and find way more cases than I did! Regarding the CONF_DIR environment variables, I would say we should fix it properly, and I understand that updating the docker images would be a pain, and a bit of a tedious project, and this task is already tedious. On the other hand, we learned that the envtoconf.py may change over time, as requirements are changing, I don't think that option two is hacky. It is hacky in a way that we overwrite a file backed into the docker images, but on the other hand, I would argue that the file should not be in the docker image itself, as even if this does not happen often, the file changes from time to time, so we should preserve the possibility to change it easily. Ofc, a properly done option two would require to modify all the images to leave out envtoconf.py, and to modify all the docker-compose file to mount the file into the image, which is again even more tedious. |
Codecov Report
@@ Coverage Diff @@
## master #1667 +/- ##
============================================
+ Coverage 75.70% 75.76% +0.06%
- Complexity 11301 11310 +9
============================================
Files 1048 1048
Lines 53898 53836 -62
Branches 5324 5307 -17
============================================
- Hits 40801 40787 -14
+ Misses 10564 10531 -33
+ Partials 2533 2518 -15 Continue to review full report at Codecov.
|
|
Hi @adoroszlai, thank you for addressing my concern and revert back to OZONE_CONF_DIR. Let me ask as I did not have the time to go through and understand fully the transformation.py usage and how that effects the environment processing that is problematic with env vars with names like CONF, and to understand what is happening exactly as the consequence of your change? |
|
Thanks @fapifta for taking another look, and also your initial review and nudging me to fix it properly.
Exactly. This change is necessary only for Answered the other part of your question about |
fapifta
left a comment
There was a problem hiding this comment.
After discussing what will happen during env to conf conversion with the CONF environment variables, now it is clear how the changes solve that problem. (Files might get generated, from the environment variables, but those files are not used by anything, so it is fine to left those there as garbage.
I went through the changes again, I haven't spot anything problematic, I am +1 to commit it.
There was a problem hiding this comment.
Thanks @adoroszlai for working on this. Overall looks pretty good to me.
Do we have a HADOOP_ROOT_LOGGER alternative here?
Also do we take in HADOOP_OPTS when OZONE_OPTS is not set? IIRC some CM configs may still append to HADOOP_OPTS at the moment.
Also I think it would be a good idea to put a small table in wiki or somewhere to show the Ozone equivalents of Hadoop environment variables. Should be very helpful for admins adapting Ozone from HDFS. To start:
| Hadoop / HDFS | Ozone | Note |
|---|---|---|
| HADOOP_CONF_DIR | OZONE_CONF_DIR | When OZONE_CONF_DIR is not set, HADOOP_CONF_DIR will be used; if set, HADOOP_CONF_DIR is ignored. |
| HADOOP_OPTS | OZONE_OPTS |
|
|
||
| ozone_add_default_gc_opts | ||
|
|
||
| [[ ! "$OZONE_OPTS" =~ "UseConcMarkSweepGC" ]] |
There was a problem hiding this comment.
Unrelated to this patch but CMS is removed in JDK 14 and on and UseConcMarkSweepGC will be ignored by those higher version JVMs. We might want to come up with a new set of GC params soon.
|
Thanks @smengcl for the review.
Yes, |
|
Thanks @adoroszlai for rechecking. Looks like we got a good run. Will merge this shortly. |
What changes were proposed in this pull request?
HADOOP_*variables, but use their values, unless the correspondingOZONE_variable is also defined (which indicates "new code").(Root cause is fixed in HDDS-4601 instead.)HADOOP_CONF_DIRis replaced byOZONE_CONFIG_DIR(instead ofOZONE_CONF_DIR) to workaround a behaviorenvtoconfthat cannot handle variables named*_CONF_*.mapreduce,yarnetc. directories in final artifact, they are no longer necessary.start-ozone.sh: it was incremented for the first and third commands and unconditionally set for the second one, so the result of the first command was lost. It should be set for the first one instead.https://issues.apache.org/jira/browse/HDDS-4525
How was this patch tested?
Added:
HDFS_OM_OPTSetc. variablesozone classpathandozone envvarscommandsChanged MR acceptance tests to globally define both
HADOOP_CLASSPATHandOZONE_CLASSPATH. This confirms that shaded Ozone FS jar being present inHADOOP_CLASSPATHdoes not break Ozone startup. PreviouslyHADOOP_CLASSPATHhad to be limited to the Hadoop containers.Regular CI:
https://github.com/adoroszlai/hadoop-ozone/actions/runs/405676505
Manually tested
start-ozone.shandstop-ozone.shinozonescriptsenvironment (see HDDS-4556 for automating the smoketest).