activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: [AMQ-4947] ensure index page file does not skip forcing metadata - size is important to the page file
Date Wed, 06 Sep 2017 17:50:39 GMT
Repository: activemq
Updated Branches:
  refs/heads/activemq-5.15.x d76b615ad -> 51b428f49


[AMQ-4947] ensure index page file does not skip forcing metadata - size is important to the
page file

(cherry picked from commit 42bf6e9061c4bb5723e380da3b1c2c6a5a162ffd)


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/51b428f4
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/51b428f4
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/51b428f4

Branch: refs/heads/activemq-5.15.x
Commit: 51b428f49d9a2d3db8a225d6737f62d41e906d35
Parents: d76b615
Author: gtully <gary.tully@gmail.com>
Authored: Mon Sep 4 16:43:48 2017 +0100
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Wed Sep 6 13:49:07 2017 -0400

----------------------------------------------------------------------
 .../activemq/store/kahadb/disk/page/PageFile.java     |  2 +-
 .../activemq/util/RecoverableRandomAccessFile.java    | 14 +++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/51b428f4/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java
----------------------------------------------------------------------
diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java
b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java
index 052a586..5699c45 100644
--- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java
+++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java
@@ -378,7 +378,7 @@ public class PageFile {
 
             File file = getMainPageFile();
             IOHelper.mkdirs(file.getParentFile());
-            writeFile = new RecoverableRandomAccessFile(file, "rw");
+            writeFile = new RecoverableRandomAccessFile(file, "rw", false);
             readFile = new RecoverableRandomAccessFile(file, "r");
 
             if (readFile.length() > 0) {

http://git-wip-us.apache.org/repos/asf/activemq/blob/51b428f4/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java
----------------------------------------------------------------------
diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java
b/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java
index 636890e..f9e6a45 100644
--- a/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java
+++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java
@@ -31,17 +31,21 @@ public class RecoverableRandomAccessFile implements java.io.DataOutput,
java.io.
     RandomAccessFile raf;
     File file;
     String mode;
+    final boolean isSkipMetadataUpdate;
 
-    public RecoverableRandomAccessFile(File file, String mode) throws FileNotFoundException
{
+    public RecoverableRandomAccessFile(File file, String mode, boolean skipMetadataUpdate)
throws FileNotFoundException {
         this.file = file;
         this.mode = mode;
         raf = new RandomAccessFile(file, mode);
+        isSkipMetadataUpdate = skipMetadataUpdate;
+    }
+
+    public RecoverableRandomAccessFile(File file, String mode) throws FileNotFoundException
{
+        this(file, mode, SKIP_METADATA_UPDATE);
     }
 
     public RecoverableRandomAccessFile(String name, String mode) throws FileNotFoundException
{
-        this.file = new File(name);
-        this.mode = mode;
-        raf = new RandomAccessFile(file, mode);
+        this(new File(name), mode);
     }
 
     protected RandomAccessFile getRaf() throws IOException {
@@ -394,7 +398,7 @@ public class RecoverableRandomAccessFile implements java.io.DataOutput,
java.io.
 
     public void sync() throws IOException {
         try {
-            getRaf().getChannel().force(!SKIP_METADATA_UPDATE);;
+            getRaf().getChannel().force(!isSkipMetadataUpdate);;
         } catch (IOException ioe) {
             handleException();
             throw ioe;


Mime
View raw message