You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/06/04 22:40:12 UTC

[GitHub] [activemq-artemis] clebertsuconic opened a new pull request #3610: ARTEMIS-3261 Updating logic to use only replaceable records on compacting verification

clebertsuconic opened a new pull request #3610:
URL: https://github.com/apache/activemq-artemis/pull/3610


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] franz1981 commented on a change in pull request #3610: ARTEMIS-3261 Updating logic to use only replaceable records on compacting verification

Posted by GitBox <gi...@apache.org>.
franz1981 commented on a change in pull request #3610:
URL: https://github.com/apache/activemq-artemis/pull/3610#discussion_r646003682



##########
File path: artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -323,20 +325,26 @@ public JournalImpl setHistoryFolder(File historyFolder, long maxBytes, long peri
    private final ReadWriteLock journalLock = new ReentrantReadWriteLock();
    private final ReadWriteLock compactorLock = new ReentrantReadWriteLock();
 
-   HashSet<Integer> replaceableRecords;
+   ByteObjectHashMap<Byte> replaceableRecords;

Review comment:
       Iteration could be performed with 
   ```java
   for (int recordType = bitSet.nextSetBit(0); recordType != -1; recordType = bitSet.nextSetBit(recordType + 1)) {
       // do something with record type
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] clebertsuconic merged pull request #3610: ARTEMIS-3261 Updating logic to use only replaceable records on compacting verification

Posted by GitBox <gi...@apache.org>.
clebertsuconic merged pull request #3610:
URL: https://github.com/apache/activemq-artemis/pull/3610


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] franz1981 commented on a change in pull request #3610: ARTEMIS-3261 Updating logic to use only replaceable records on compacting verification

Posted by GitBox <gi...@apache.org>.
franz1981 commented on a change in pull request #3610:
URL: https://github.com/apache/activemq-artemis/pull/3610#discussion_r646003861



##########
File path: artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -323,20 +325,26 @@ public JournalImpl setHistoryFolder(File historyFolder, long maxBytes, long peri
    private final ReadWriteLock journalLock = new ReentrantReadWriteLock();
    private final ReadWriteLock compactorLock = new ReentrantReadWriteLock();
 
-   HashSet<Integer> replaceableRecords;
+   ByteObjectHashMap<Byte> replaceableRecords;

Review comment:
       Given that I don't know if it's an hot path I am already happy with the PR as it is: this one is just an improvement, given that we are already changing collection.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] franz1981 commented on a change in pull request #3610: ARTEMIS-3261 Updating logic to use only replaceable records on compacting verification

Posted by GitBox <gi...@apache.org>.
franz1981 commented on a change in pull request #3610:
URL: https://github.com/apache/activemq-artemis/pull/3610#discussion_r646002254



##########
File path: artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -323,20 +325,26 @@ public JournalImpl setHistoryFolder(File historyFolder, long maxBytes, long peri
    private final ReadWriteLock journalLock = new ReentrantReadWriteLock();
    private final ReadWriteLock compactorLock = new ReentrantReadWriteLock();
 
-   HashSet<Integer> replaceableRecords;
+   ByteObjectHashMap<Byte> replaceableRecords;

Review comment:
       I would use a BitSet: it would save tons of memory while being faster too.
   As an alternative, if we know upfront all the record types I would enum them, using the enum as parameter instead of byte and using an EnumSet too.
   IMO the solution with the BitSet is the best one in term of footprint/performance: it always need just a single long[] of capacity 1 if record type is >=0




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] franz1981 commented on a change in pull request #3610: ARTEMIS-3261 Updating logic to use only replaceable records on compacting verification

Posted by GitBox <gi...@apache.org>.
franz1981 commented on a change in pull request #3610:
URL: https://github.com/apache/activemq-artemis/pull/3610#discussion_r646002254



##########
File path: artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -323,20 +325,26 @@ public JournalImpl setHistoryFolder(File historyFolder, long maxBytes, long peri
    private final ReadWriteLock journalLock = new ReentrantReadWriteLock();
    private final ReadWriteLock compactorLock = new ReentrantReadWriteLock();
 
-   HashSet<Integer> replaceableRecords;
+   ByteObjectHashMap<Byte> replaceableRecords;

Review comment:
       I would use a BitSet: it would save tons of memory while being faster too.
   As an alternative, if we know upfront all the record types I would enum them, using the enum as parameter instead of byte and using an EnumSet too.
   IMO the solution with the BitSet is the best one in term of footprint/performance: it always need just a single long[] of capacity 1 if record type is >=0 and the max record type value is < 64




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [activemq-artemis] franz1981 commented on a change in pull request #3610: ARTEMIS-3261 Updating logic to use only replaceable records on compacting verification

Posted by GitBox <gi...@apache.org>.
franz1981 commented on a change in pull request #3610:
URL: https://github.com/apache/activemq-artemis/pull/3610#discussion_r646003682



##########
File path: artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java
##########
@@ -323,20 +325,26 @@ public JournalImpl setHistoryFolder(File historyFolder, long maxBytes, long peri
    private final ReadWriteLock journalLock = new ReentrantReadWriteLock();
    private final ReadWriteLock compactorLock = new ReentrantReadWriteLock();
 
-   HashSet<Integer> replaceableRecords;
+   ByteObjectHashMap<Byte> replaceableRecords;

Review comment:
       Iteration could be performed with 
   ```
   for (int recordType = bitSet.nextSetBit(0); recordType != -1; recordType = bitSet.nextSetBit(recordType + 1)) {
       // do something with record type
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org