You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jm...@apache.org on 2022/08/05 17:49:55 UTC
[cassandra] branch trunk updated: Users of NativeLibrary should handle lack of JNA appropriately when running in client mode
This is an automated email from the ASF dual-hosted git repository.
jmckenzie pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push:
new 45f4f8c1e8 Users of NativeLibrary should handle lack of JNA appropriately when running in client mode
45f4f8c1e8 is described below
commit 45f4f8c1e89e4b221b569ff3bd3e78675eff7747
Author: Josh McKenzie <jm...@apache.org>
AuthorDate: Tue Aug 2 14:30:06 2022 -0400
Users of NativeLibrary should handle lack of JNA appropriately when running in client mode
Patch by Doug Rohrer; reviewd by Josh McKenzie and Caleb Rackliffe for CASSANDRA-17794
Co-authored-by: Doug Rohrer <dr...@apple.com>
Co-authored-by: Josh McKenzie <jm...@apache.org>
---
CHANGES.txt | 1 +
.../apache/cassandra/db/lifecycle/LogReplica.java | 23 ++++++++++++++++++++--
.../org/apache/cassandra/hints/HintsCatalog.java | 7 ++++++-
3 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/CHANGES.txt b/CHANGES.txt
index c802607f42..3342318ea2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
4.2
+ * Users of NativeLibrary should handle lack of JNA appropriately when running in client mode (CASSANDRA-17794)
* Warn on unknown directories found in system keyspace directory rather than kill node during startup checks (CASSANDRA-17777)
* Log duplicate rows sharing a partition key found in verify and scrub (CASSANDRA-17789)
* Add separate thread pool for Secondary Index building so it doesn't block compactions (CASSANDRA-17781)
diff --git a/src/java/org/apache/cassandra/db/lifecycle/LogReplica.java b/src/java/org/apache/cassandra/db/lifecycle/LogReplica.java
index 1ea8b832e0..073ac7c61c 100644
--- a/src/java/org/apache/cassandra/db/lifecycle/LogReplica.java
+++ b/src/java/org/apache/cassandra/db/lifecycle/LogReplica.java
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import java.io.IOException;
+import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.io.util.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -58,7 +59,16 @@ final class LogReplica implements AutoCloseable
{
int folderFD = NativeLibrary.tryOpenDirectory(directory.path());
if (folderFD == -1 && REQUIRE_FD)
- throw new FSReadError(new IOException(String.format("Invalid folder descriptor trying to create log replica %s", directory.path())), directory.path());
+ {
+ if (DatabaseDescriptor.isClientInitialized())
+ {
+ logger.warn("Invalid folder descriptor trying to create log replica {}. Continuing without Native I/O support.", directory.path());
+ }
+ else
+ {
+ throw new FSReadError(new IOException(String.format("Invalid folder descriptor trying to create log replica %s", directory.path())), directory.path());
+ }
+ }
return new LogReplica(new File(fileName), folderFD);
}
@@ -67,7 +77,16 @@ final class LogReplica implements AutoCloseable
{
int folderFD = NativeLibrary.tryOpenDirectory(file.parent().path());
if (folderFD == -1)
- throw new FSReadError(new IOException(String.format("Invalid folder descriptor trying to create log replica %s", file.parent().path())), file.parent().path());
+ {
+ if (DatabaseDescriptor.isClientInitialized())
+ {
+ logger.warn("Invalid folder descriptor trying to create log replica {}. Continuing without Native I/O support.", file.parentPath());
+ }
+ else
+ {
+ throw new FSReadError(new IOException(String.format("Invalid folder descriptor trying to create log replica %s", file.parent().path())), file.parent().path());
+ }
+ }
return new LogReplica(file, folderFD);
}
diff --git a/src/java/org/apache/cassandra/hints/HintsCatalog.java b/src/java/org/apache/cassandra/hints/HintsCatalog.java
index 859252f0ca..ecde896b90 100644
--- a/src/java/org/apache/cassandra/hints/HintsCatalog.java
+++ b/src/java/org/apache/cassandra/hints/HintsCatalog.java
@@ -26,10 +26,11 @@ import java.util.stream.Stream;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableMap;
-import org.apache.cassandra.io.util.File;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.io.util.File;
import org.apache.cassandra.io.FSError;
import org.apache.cassandra.io.FSReadError;
import org.apache.cassandra.io.FSWriteError;
@@ -161,6 +162,10 @@ final class HintsCatalog
FileUtils.handleFSErrorAndPropagate(e);
}
}
+ else if (DatabaseDescriptor.isClientInitialized())
+ {
+ logger.warn("Unable to open hint directory using Native library. Skipping sync.");
+ }
else
{
logger.error("Unable to open directory {}", hintsDirectory.absolutePath());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org