gemmellr commented on code in PR #4101:
URL: https://github.com/apache/activemq-artemis/pull/4101#discussion_r895809550


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ReplicationPageWriteMessage.java:
##########
@@ -25,45 +25,60 @@
 
 public class ReplicationPageWriteMessage extends PacketImpl implements 
MessagePacketI {
 
-   private int pageNumber;
+   protected long pageNumber;
 
-   private PagedMessage pagedMessage;
+   protected PagedMessage pagedMessage;
 
-   public ReplicationPageWriteMessage() {
+   final boolean useLong;
+
+   public ReplicationPageWriteMessage(final boolean useLong) {
       super(PacketImpl.REPLICATION_PAGE_WRITE);
+      this.useLong = useLong;
    }
 
-   public ReplicationPageWriteMessage(final PagedMessage pagedMessage, final 
int pageNumber) {
-      this();
+   public ReplicationPageWriteMessage(final PagedMessage pagedMessage, final 
long pageNumber, final boolean useLong) {
+      this(useLong);
       this.pageNumber = pageNumber;
       this.pagedMessage = pagedMessage;
    }
 
 
    @Override
    public int expectedEncodeSize() {
-      return PACKET_HEADERS_SIZE +
-             DataConstants.SIZE_INT + // buffer.writeInt(pageNumber);
-             pagedMessage.getEncodeSize(); //  pagedMessage.encode(buffer);
+      if (useLong) {
+         return PACKET_HEADERS_SIZE + DataConstants.SIZE_LONG + // 
buffer.writeLong(pageNumber);
+            pagedMessage.getEncodeSize(); //  pagedMessage.encode(buffer);
+      } else {
+         return PACKET_HEADERS_SIZE + DataConstants.SIZE_INT + // 
buffer.writeInt(pageNumber);
+            pagedMessage.getEncodeSize(); //  pagedMessage.encode(buffer);
+      }
    }
 
    @Override
    public void encodeRest(final ActiveMQBuffer buffer) {
-      buffer.writeInt(pageNumber);
+      if (useLong) {
+         buffer.writeLong(pageNumber);
+      } else {
+         buffer.writeInt((int) pageNumber);

Review Comment:
   ..and those longs can then fail to be sent to any older broker. Or rather, 
perhaps they wont fail as it should, and stuff will instead go wonky. Weve now 
both spent far longer discussing this than it would take to validate it.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to