This is an automated email from the ASF dual-hosted git repository.
adoroszlai 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 3f3ec43ec0 HDDS-13266. `ozone debug checknative` to show OpenSSL lib
(#8623)
3f3ec43ec0 is described below
commit 3f3ec43ec0443a898da54eb74c7a013fb0b6bc1b
Author: Wei-Chiu Chuang <[email protected]>
AuthorDate: Sat Jun 14 03:53:14 2025 -0700
HDDS-13266. `ozone debug checknative` to show OpenSSL lib (#8623)
---
.../org/apache/hadoop/ozone/debug/CheckNative.java | 56 +++++++++++++++++++---
.../apache/hadoop/ozone/debug/TestCheckNative.java | 1 +
2 files changed, 50 insertions(+), 7 deletions(-)
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/CheckNative.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/CheckNative.java
index 1225122b4e..5e9bc7f901 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/CheckNative.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/CheckNative.java
@@ -21,6 +21,8 @@
import java.util.Collections;
import java.util.concurrent.Callable;
+import java.util.function.Supplier;
+import org.apache.hadoop.crypto.OpensslCipher;
import org.apache.hadoop.hdds.cli.AbstractSubcommand;
import org.apache.hadoop.hdds.cli.DebugSubcommand;
import org.apache.hadoop.hdds.utils.NativeLibraryLoader;
@@ -37,27 +39,67 @@
@MetaInfServices(DebugSubcommand.class)
public class CheckNative extends AbstractSubcommand implements Callable<Void>,
DebugSubcommand {
+ private static class LibraryCheckResult {
+ private final boolean loaded;
+ private final String detail;
+
+ LibraryCheckResult(boolean loaded, String detail) {
+ this.loaded = loaded;
+ this.detail = detail;
+ }
+
+ public boolean isLoaded() {
+ return loaded;
+ }
+
+ public String getDetail() {
+ return detail;
+ }
+ }
+
+ private LibraryCheckResult getLibraryStatus(
+ Supplier<String> failureReasonSupplier,
+ Supplier<String> libraryNameSupplier) {
+ String failureReason = failureReasonSupplier.get();
+ if (failureReason != null) {
+ return new LibraryCheckResult(false, failureReason);
+ } else {
+ return new LibraryCheckResult(true, libraryNameSupplier.get());
+ }
+ }
+
@Override
public Void call() throws Exception {
boolean nativeHadoopLoaded =
org.apache.hadoop.util.NativeCodeLoader.isNativeCodeLoaded();
String hadoopLibraryName = "";
String isalDetail = "";
boolean isalLoaded = false;
+ String opensslDetail = "";
+ boolean opensslLoaded = false;
+
if (nativeHadoopLoaded) {
hadoopLibraryName =
org.apache.hadoop.util.NativeCodeLoader.getLibraryName();
- isalDetail = ErasureCodeNative.getLoadingFailureReason();
- if (isalDetail != null) {
- isalLoaded = false;
- } else {
- isalDetail = ErasureCodeNative.getLibraryName();
- isalLoaded = true;
- }
+ LibraryCheckResult isalStatus = getLibraryStatus(
+ ErasureCodeNative::getLoadingFailureReason,
+ ErasureCodeNative::getLibraryName
+ );
+ isalLoaded = isalStatus.isLoaded();
+ isalDetail = isalStatus.getDetail();
+
+ // Check OpenSSL status
+ LibraryCheckResult opensslStatus = getLibraryStatus(
+ OpensslCipher::getLoadingFailureReason,
+ OpensslCipher::getLibraryName
+ );
+ opensslLoaded = opensslStatus.isLoaded();
+ opensslDetail = opensslStatus.getDetail();
}
out().println("Native library checking:");
out().printf("hadoop: %b %s%n", nativeHadoopLoaded,
hadoopLibraryName);
out().printf("ISA-L: %b %s%n", isalLoaded, isalDetail);
+ out().printf("OpenSSL: %b %s%n", opensslLoaded, opensslDetail);
// Attempt to load the rocks-tools lib
boolean nativeRocksToolsLoaded =
NativeLibraryLoader.getInstance().loadLibrary(
diff --git
a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/debug/TestCheckNative.java
b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/debug/TestCheckNative.java
index 3550389e21..f66ec1a049 100644
---
a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/debug/TestCheckNative.java
+++
b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/debug/TestCheckNative.java
@@ -62,6 +62,7 @@ private void assertOutput(boolean expectedRocksNative) {
.contains("Native library checking:")
.contains("hadoop: false")
.contains("ISA-L: false")
+ .contains("OpenSSL: false")
.contains("rocks-tools: " + expectedRocksNative);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]