You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/10/18 00:49:59 UTC

[1/2] activemq-artemis git commit: ARTEMIS-2131 Error compacting journal

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 48d8a5413 -> 69447ca1f


ARTEMIS-2131 Error compacting journal

Compaction cannot free a sliced view of a ByteBuffer on Java >=9:
the fix is using the original ByteBuffer instead of the slice
to perform a file write and allow it to be correctly released by
the Cleaner.


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

Branch: refs/heads/master
Commit: cae253d1367c4d3423670af9c769f7885579b631
Parents: 48d8a54
Author: Francesco Nigro <ni...@gmail.com>
Authored: Wed Oct 17 15:10:04 2018 +0200
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Oct 17 20:49:50 2018 -0400

----------------------------------------------------------------------
 .../core/journal/impl/AbstractJournalUpdateTask.java    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/cae253d1/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
----------------------------------------------------------------------
diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
index 7740bef..10f5008 100644
--- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
+++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java
@@ -56,6 +56,8 @@ public abstract class AbstractJournalUpdateTask implements JournalReaderCallback
 
    private ActiveMQBuffer writingChannel;
 
+   private ByteBuffer bufferWrite;
+
    private final ConcurrentLongHashSet recordsSnapshot;
 
    protected final List<JournalFile> newDataFiles = new ArrayList<>();
@@ -214,11 +216,17 @@ public abstract class AbstractJournalUpdateTask implements JournalReaderCallback
          // To Fix the size of the file
          writingChannel.writerIndex(writingChannel.capacity());
 
-         sequentialFile.writeDirect(writingChannel.toByteBuffer(), true);
+         bufferWrite.clear()
+            .position(writingChannel.readerIndex())
+            .limit(writingChannel.readableBytes());
+
+         sequentialFile.writeDirect(bufferWrite, true);
          sequentialFile.close();
          newDataFiles.add(currentFile);
       }
 
+      bufferWrite = null;
+
       writingChannel = null;
    }
 
@@ -237,7 +245,7 @@ public abstract class AbstractJournalUpdateTask implements JournalReaderCallback
    protected void openFile() throws Exception {
       flush();
 
-      ByteBuffer bufferWrite = fileFactory.newBuffer(journal.getFileSize());
+      bufferWrite = fileFactory.newBuffer(journal.getFileSize());
 
       writingChannel = ActiveMQBuffers.wrappedBuffer(bufferWrite);
 


[2/2] activemq-artemis git commit: This closes #2378

Posted by cl...@apache.org.
This closes #2378


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

Branch: refs/heads/master
Commit: 69447ca1f863de810b12a864ed16732f6670e76a
Parents: 48d8a54 cae253d
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Oct 17 20:49:51 2018 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Oct 17 20:49:51 2018 -0400

----------------------------------------------------------------------
 .../core/journal/impl/AbstractJournalUpdateTask.java    | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------