adoroszlai commented on code in PR #4455:
URL: https://github.com/apache/ozone/pull/4455#discussion_r1168992447
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/Gateway.java:
##########
@@ -63,13 +69,35 @@ public static void main(String[] args) throws Exception {
new Gateway().run(args);
}
+ private void setHttpBaseDir(OzoneConfiguration ozoneConfiguration)
Review Comment:
```
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/Gateway.java
72: 'ozoneConfiguration' hides a field.
```
I guess the parameter is unnecessary, it can use the field directly.
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/Gateway.java:
##########
@@ -63,13 +69,35 @@ public static void main(String[] args) throws Exception {
new Gateway().run(args);
}
+ private void setHttpBaseDir(OzoneConfiguration ozoneConfiguration)
+ throws IOException {
+ if (StringUtils.isEmpty(ozoneConfiguration.get(
+ OzoneConfigKeys.OZONE_HTTP_BASEDIR))) {
+ //Setting ozone.http.basedir if not set so that server setup doesn't
+ // fail.
+ Path tmpMetaDir = Files.createTempDirectory(Paths.get(""),
+ "ozone_s3g_tmp_base_dir");
+ ShutdownHookManager.get().addShutdownHook(() -> {
+ try {
+ FileUtils.deleteDirectory(tmpMetaDir.toFile());
+ } catch (IOException e) {
+ LOG.error("Failed to cleanup temporary S3 Gateway Metadir {}",
+ tmpMetaDir.toFile().getAbsolutePath(), e);
+ }
+ }, 0);
+ ozoneConfiguration.set(OzoneConfigKeys.OZONE_HTTP_BASEDIR,
+ tmpMetaDir.toFile().getAbsolutePath());
Review Comment:
Nit: Please extract `tmpMetaDir.toFile()`, it's executed 3 times.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]