[ 
https://issues.apache.org/jira/browse/ARTEMIS-3850?focusedWorklogId=780846&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-780846
 ]

ASF GitHub Bot logged work on ARTEMIS-3850:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Jun/22 14:42
            Start Date: 13/Jun/22 14:42
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on code in PR #4101:
URL: https://github.com/apache/activemq-artemis/pull/4101#discussion_r895806513


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageEventMessage.java:
##########
@@ -32,43 +32,59 @@ public class ReplicationPageEventMessage extends PacketImpl 
{
     */
    private boolean isDelete;
 
-   public ReplicationPageEventMessage() {
+   private final boolean useLong;
+
+   public ReplicationPageEventMessage(boolean useLong) {
       super(PacketImpl.REPLICATION_PAGE_EVENT);
+      this.useLong = useLong;
    }
 
-   public ReplicationPageEventMessage(final SimpleString storeName, final int 
pageNumber, final boolean isDelete) {
-      this();
+   public ReplicationPageEventMessage(final SimpleString storeName, final long 
pageNumber, final boolean isDelete, final boolean useLong) {
+      this(useLong);
       this.pageNumber = pageNumber;
       this.isDelete = isDelete;
       this.storeName = storeName;
    }
 
    @Override
    public int expectedEncodeSize() {
-      return PACKET_HEADERS_SIZE +
-             SimpleString.sizeofString(storeName) + // 
buffer.writeSimpleString(storeName);
-             DataConstants.SIZE_INT + //  buffer.writeInt(pageNumber);
-             DataConstants.SIZE_BOOLEAN; // buffer.writeBoolean(isDelete);
+      if (useLong) {
+         return PACKET_HEADERS_SIZE + SimpleString.sizeofString(storeName) + 
// buffer.writeSimpleString(storeName);
+            DataConstants.SIZE_LONG + //  buffer.writeLong(pageNumber);
+            DataConstants.SIZE_BOOLEAN; // buffer.writeBoolean(isDelete);
+      } else {
+         return PACKET_HEADERS_SIZE + SimpleString.sizeofString(storeName) + 
// buffer.writeSimpleString(storeName);
+            DataConstants.SIZE_INT + //  buffer.writeInt(pageNumber);
+            DataConstants.SIZE_BOOLEAN; // buffer.writeBoolean(isDelete);
+      }
    }
 
    @Override
    public void encodeRest(final ActiveMQBuffer buffer) {
       buffer.writeSimpleString(storeName);
-      buffer.writeInt(pageNumber);
+      if (useLong) {
+         buffer.writeLong(pageNumber);
+      } else {
+         buffer.writeInt((int) pageNumber);

Review Comment:
   Users always find a way to hit such things when assuming they wont. It 
doesnt seem anywhere near impossible to me. This is trivial to validate now and 
fail-fast later, but will be a nightmare to identify later if hit without doing 
so. It seems pointless not to just cover the situation.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 780846)
    Time Spent: 5h 50m  (was: 5h 40m)

> Add Option to read messages into paging based on sizing and eliminate caching
> -----------------------------------------------------------------------------
>
>                 Key: ARTEMIS-3850
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-3850
>             Project: ActiveMQ Artemis
>          Issue Type: New Feature
>    Affects Versions: 2.22.0
>            Reporter: Clebert Suconic
>            Assignee: Clebert Suconic
>            Priority: Major
>             Fix For: 2.24.0
>
>          Time Spent: 5h 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to