Github user michaelandrepearce commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/2494#discussion_r246570293
--- Diff:
artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java
---
@@ -864,21 +875,32 @@ private PageCursorInfo processACK(final PagePosition
pos) {
return info;
}
+ private void installTXCallback(final Transaction tx, final PagePosition
position) {
+ installTXCallback(tx, position, -1);
+ }
+
/**
* @param tx
* @param position
+ * @param persistentSize if negative it needs to be calculated on the
fly
*/
- private void installTXCallback(final Transaction tx, final PagePosition
position) {
+ private void installTXCallback(final Transaction tx, final PagePosition
position, final long persistentSize) {
if (position.getRecordID() >= 0) {
// It needs to persist, otherwise the cursor will return to the
fist page position
tx.setContainsPersistent();
}
PageCursorInfo info = getPageInfo(position);
PageCache cache = info.getCache();
- long size = 0;
if (cache != null) {
- size =
getPersistentSize(cache.getMessage(position.getMessageNr()));
+ final long size;
+ if (persistentSize < 0) {
--- End diff --
surely this is checking for something like if its -1? not just that its
negative which would be worrying.... if so this should be more explicit to just
be checking -1, and if anything else thats negative, means illegal argument
---