adoroszlai commented on code in PR #4455:
URL: https://github.com/apache/ozone/pull/4455#discussion_r1150226485
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/Gateway.java:
##########
@@ -70,6 +77,25 @@ public Void call() throws Exception {
OzoneConfigurationHolder.setConfiguration(ozoneConfiguration);
UserGroupInformation.setConfiguration(ozoneConfiguration);
loginS3GUser(ozoneConfiguration);
+
+ if (StringUtils.isEmpty(ozoneConfiguration.get(
+ OzoneConfigKeys.OZONE_METADATA_DIRS))) {
+ //Setting ozone.metadata.dirs if not set so that server setup doesn't
+ // fail.
+ Path tmpMetaDir = Files.createTempDirectory(Paths.get(""),
+ "ozone_s3g_tmp_meta_dir");
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> {
Review Comment:
Please use `ShutdownHookManager` to add the shutdown hook. Also, I think it
should be executed after the other hook (which stops the server), so use a
lower than default priority.
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/Gateway.java:
##########
@@ -70,6 +77,25 @@ public Void call() throws Exception {
OzoneConfigurationHolder.setConfiguration(ozoneConfiguration);
UserGroupInformation.setConfiguration(ozoneConfiguration);
loginS3GUser(ozoneConfiguration);
+
+ if (StringUtils.isEmpty(ozoneConfiguration.get(
+ OzoneConfigKeys.OZONE_METADATA_DIRS))) {
+ //Setting ozone.metadata.dirs if not set so that server setup doesn't
+ // fail.
+ Path tmpMetaDir = Files.createTempDirectory(Paths.get(""),
+ "ozone_s3g_tmp_meta_dir");
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+ try {
+ FileUtils.deleteDirectory(tmpMetaDir.toFile());
+ } catch (IOException e) {
+ LOG.error("Failed to cleanup temporary S3 Gateway Metadir {}",
+ tmpMetaDir.toFile().getAbsolutePath(), e);
+ }
+ }));
+ ozoneConfiguration.set(HddsConfigKeys.OZONE_METADATA_DIRS,
+ tmpMetaDir.toFile().getAbsolutePath());
+ }
Review Comment:
This is still TODO.
--
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]