This is an automated email from the ASF dual-hosted git repository.
peterxcli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 426374d18f8 HDDS-15747. Address review comments for HDDS-15083 (#10669)
426374d18f8 is described below
commit 426374d18f8a8c94296c1c3d6eaabfdb1ea57441
Author: Chun-Hung Tseng <[email protected]>
AuthorDate: Mon Jul 6 08:53:25 2026 +0200
HDDS-15747. Address review comments for HDDS-15083 (#10669)
---
hadoop-ozone/tools/pom.xml | 10 ++++------
.../org/apache/hadoop/ozone/local/LocalOzoneCluster.java | 15 ++++++++++++---
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/hadoop-ozone/tools/pom.xml b/hadoop-ozone/tools/pom.xml
index bab0361cd45..683ce8663b6 100644
--- a/hadoop-ozone/tools/pom.xml
+++ b/hadoop-ozone/tools/pom.xml
@@ -78,6 +78,10 @@
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
<dependency>
<!-- required for @MetaInfServices at compile-time, but not at runtime
-->
<groupId>org.kohsuke.metainf-services</groupId>
@@ -106,12 +110,6 @@
<artifactId>ratis-thirdparty-misc</artifactId>
<scope>runtime</scope>
</dependency>
- <dependency>
- <!-- transitive via hdds-common, but also for test in this module -->
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <scope>runtime</scope>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-reload4j</artifactId>
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneCluster.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneCluster.java
index 03505e20d26..4b35fb12c9e 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneCluster.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/LocalOzoneCluster.java
@@ -60,6 +60,8 @@
import org.apache.hadoop.hdds.client.ReplicationFactor;
import org.apache.hadoop.hdds.client.ReplicationType;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Prepares local filesystem state and configuration for {@code ozone local}.
@@ -70,6 +72,9 @@
*/
public final class LocalOzoneCluster implements LocalOzoneRuntime {
+ private static final Logger LOG =
+ LoggerFactory.getLogger(LocalOzoneCluster.class);
+
static final String PORTS_STATE_FILE_NAME = "ports.properties";
private static final String METADATA_DIR_NAME = "metadata";
@@ -85,6 +90,8 @@ public final class LocalOzoneCluster implements
LocalOzoneRuntime {
private static final String OM_HTTP_PORT_KEY = "om.http";
private static final String OM_RATIS_PORT_KEY = "om.ratis";
+ private static final int MAX_PORT = 65_535;
+
private static final String[] REQUIRED_PERSISTED_PORT_KEYS = {
SCM_CLIENT_PORT_KEY,
SCM_BLOCK_PORT_KEY,
@@ -327,7 +334,7 @@ private static String address(String host, int port) {
return host + ":" + port;
}
- private static void deleteDirectory(Path directory) throws IOException {
+ private static void deleteDirectory(Path directory) {
if (!Files.exists(directory)) {
return;
}
@@ -337,6 +344,8 @@ private static void deleteDirectory(Path directory) throws
IOException {
for (Path path : deleteOrder) {
Files.deleteIfExists(path);
}
+ } catch (IOException ex) {
+ LOG.error("Failed to delete local Ozone directory {}", directory, ex);
}
}
@@ -386,7 +395,7 @@ int reserve(int preferredPort) throws IOException {
}
private int reserveConfiguredPort(int port) throws IOException {
- if (port > 65_535) {
+ if (port > MAX_PORT) {
throw new IOException("Port " + port + " is outside the valid range.");
}
if (!reserved.add(port)) {
@@ -443,7 +452,7 @@ int get(String key) throws IOException {
}
try {
int port = Integer.parseInt(trimmedValue);
- if (port < 0 || port > 65_535) {
+ if (port < 0 || port > MAX_PORT) {
throw invalidPortValue(key, value);
}
return port;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]