clebertsuconic commented on code in PR #4101:
URL: https://github.com/apache/activemq-artemis/pull/4101#discussion_r895777344
##########
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:
@gemmellr I don't think we need to validate on the older version.
on older versions this value will not go beyond integer. and from now on we
will be using longs.
Only at a short time where the two versions are being used.
--
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]