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 2020/04/02 08:12:19 UTC

[GitHub] [activemq-artemis] franz1981 commented on a change in pull request #3044: ARTEMIS-2676 PageCursorProviderImpl::cleanup can save decoding pages without large messages

franz1981 commented on a change in pull request #3044: ARTEMIS-2676 PageCursorProviderImpl::cleanup can save decoding pages without large messages
URL: https://github.com/apache/activemq-artemis/pull/3044#discussion_r401919551
 
 

 ##########
 File path: artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java
 ##########
 @@ -376,29 +395,38 @@ private static ChannelBufferWrapper wrapWhole(ByteBuffer fileBuffer) {
                      final int endPosition = fileBuffer.position() + encodedSize;
                      //this check must be performed upfront decoding
                      if (fileBuffer.remaining() >= (encodedSize + 1) && fileBuffer.get(endPosition) == Page.END_BYTE) {
-                        final PagedMessageImpl msg = new PagedMessageImpl(encodedSize, storageManager);
                         fileBufferWrapper.setIndex(fileBuffer.position(), endPosition);
-                        msg.decode(fileBufferWrapper);
-                        fileBuffer.position(endPosition + 1);
-                        assert fileBuffer.get(endPosition) == Page.END_BYTE : "decoding cannot change end byte";
-                        msg.initMessage(storage);
-                        assert msg.getMessage() instanceof LargeServerMessage && ((LargeServerMessage)msg.getMessage()).getStorageManager() != null || !(msg.getMessage() instanceof LargeServerMessage);
-                        if (logger.isTraceEnabled()) {
-                           logger.tracef("Reading message %s on pageId=%d for address=%s", msg, pageId, storeName);
+                        final boolean skipMessage;
+                        if (onlyLargeMessages) {
+                           skipMessage = !PagedMessageImpl.isLargeMessage(fileBufferWrapper);
+                        } else {
+                           skipMessage = false;
                         }
-                        messages.add(msg);
+                        if (!skipMessage) {
+                           final PagedMessageImpl msg = new PagedMessageImpl(encodedSize, storageManager);
+                           msg.decode(fileBufferWrapper);
+                           assert fileBuffer.get(endPosition) == Page.END_BYTE : "decoding cannot change end byte";
+                           msg.initMessage(storage);
 
 Review comment:
   @clebertsuconic I see that sometime we use storage and sometime the member storage manager stored on the Page...any idea which one would be the most correct to use?

----------------------------------------------------------------
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


With regards,
Apache Git Services