You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/05/06 03:27:00 UTC
[GitHub] [hadoop-ozone] Simon0806 edited a comment on pull request #897: HDDS-3513. add ozone-site.xml by default
Simon0806 edited a comment on pull request #897:
URL: https://github.com/apache/hadoop-ozone/pull/897#issuecomment-624422878
> Hi @Simon0806
> Thanks for the contribution and welcome to Ozone.
>
> OzoneConfiguration() calls loadDefaults() and in loadDefaults() we add ozone-site.xml.
> I see this has been already taken care of by the below code.
>
> ```
> public OzoneConfiguration() {
> OzoneConfiguration.activate();
> loadDefaults();
> }
> ```
>
> ```
> private void loadDefaults() {
> try {
> //there could be multiple ozone-default-generated.xml files on the
> // classpath, which are generated by the annotation processor.
> // Here we add all of them to the list of the available configuration.
> Enumeration<URL> generatedDefaults =
> OzoneConfiguration.class.getClassLoader().getResources(
> "ozone-default-generated.xml");
> while (generatedDefaults.hasMoreElements()) {
> addResource(generatedDefaults.nextElement());
> }
> } catch (IOException e) {
> e.printStackTrace();
> }
> addResource("ozone-site.xml");
> }
> ```
Hi Bharat
Actually it's true but they are different behaviors. the line you mentioned was add ozone-site.xml into resources belong to OzoneConfiguration but will not add ozone-site.xml into defaultResources belong to Configuration. The initialize process of S3Gateway will use UserGroupInformation.isSecurityEnable to check if security has been configured.
Here is the key point code:
```
private static void ensureInitialized() {
if (!isInitialized()) {
synchronized(UserGroupInformation.class) {
if (!isInitialized()) { // someone might have beat us
initialize(**new Configuration()**, false);
}
}
}
}
```
Here it called new Configuration() which will load defaultResources, which only contains
core-site.xml, hdfs-site.xml, core-default.xml, hdfs-default.xml and ozone-default.xml.
While when initializing OM and SCM it will pass the OzoneConfiguration to do initialize but S3Gateway it use Configuration by default.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org