This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new 2931a9b931 Call setDropBehind() when reading/writing WAL files (#3077)
2931a9b931 is described below

commit 2931a9b93172a1acaad5cace13e77c452f2bfe68
Author: Dave Marion <dlmar...@apache.org>
AuthorDate: Tue Nov 15 07:56:39 2022 -0500

    Call setDropBehind() when reading/writing WAL files (#3077)
    
    WAL files are not read after being written unless there is a
    failure that causes recovery. We can call setDropBehind on the
    DFSInputStream and DFSOutputStream to inform the DataNodes that
    they don't have to cache the WAL information after the file has
    been read or written.
---
 .../src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java  | 7 +++++++
 .../src/main/java/org/apache/accumulo/tserver/log/LogSorter.java  | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
index c6febc4eb8..b24387050b 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java
@@ -417,6 +417,13 @@ public class DfsLogger implements Comparable<DfsLogger> {
       else
         logFile = fs.create(logfilePath, true, 0, replication, blockSize);
 
+      // Tell the DataNode that the write ahead log does not need to be cached 
in the OS page cache
+      try {
+        logFile.setDropBehind(Boolean.TRUE);
+      } catch (IOException | UnsupportedOperationException e) {
+        log.debug("setDropBehind writes not enabled for wal file: {}", 
logFile);
+      }
+
       // check again that logfile can be sync'd
       if (!fs.canSyncAndFlush(logfilePath)) {
         log.warn("sync not supported for log file {}. Data loss may occur.", 
logPath);
diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
index bcec30621a..6df7729766 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/LogSorter.java
@@ -142,6 +142,14 @@ public class LogSorter {
       fs.deleteRecursively(new Path(destPath));
 
       input = fs.open(srcPath);
+
+      // Tell the DataNode that the write ahead log does not need to be cached 
in the OS page cache
+      try {
+        input.setDropBehind(Boolean.TRUE);
+      } catch (IOException | UnsupportedOperationException e) {
+        log.debug("setDropBehind reads not enabled for wal file: {}", input);
+      }
+
       try {
         decryptingInput = DfsLogger.getDecryptingStream(input, cryptoService);
       } catch (LogHeaderIncompleteException e) {

Reply via email to