lhotari commented on code in PR #23129:
URL: https://github.com/apache/pulsar/pull/23129#discussion_r1716537019
##########
pulsar-broker/src/test/java/org/apache/pulsar/client/api/NonDurableSubscriptionTest.java:
##########
@@ -542,18 +545,34 @@ public void testReaderInitAtDeletedPosition() throws
Exception {
.getStats(topicName, true, true,
true).getSubscriptions().get("s1");
log.info("backlog size: {}", subscriptionStats.getMsgBacklog());
assertEquals(subscriptionStats.getMsgBacklog(), 0);
- ManagedLedgerInternalStats.CursorStats cursorStats =
-
admin.topics().getInternalStats(topicName).cursors.get("s1");
+ PersistentTopicInternalStats internalStats =
admin.topics().getInternalStats(topicName);
+ ManagedLedgerInternalStats.CursorStats cursorStats =
internalStats.cursors.get("s1");
String[] ledgerIdAndEntryId =
cursorStats.markDeletePosition.split(":");
- Position actMarkDeletedPos =
-
PositionFactory.create(Long.valueOf(ledgerIdAndEntryId[0]),
Long.valueOf(ledgerIdAndEntryId[1]));
- Position expectedMarkDeletedPos =
-
PositionFactory.create(msgIdInDeletedLedger5.getLedgerId(),
msgIdInDeletedLedger5.getEntryId());
+ ImmutablePositionImpl actMarkDeletedPos =
+ new
ImmutablePositionImpl(Long.valueOf(ledgerIdAndEntryId[0]),
Long.valueOf(ledgerIdAndEntryId[1]));
+ ImmutablePositionImpl expectedMarkDeletedPos =
+ new
ImmutablePositionImpl(msgIdInDeletedLedger5.getLedgerId(),
msgIdInDeletedLedger5.getEntryId());
+ log.info("LAC: {}", internalStats.lastConfirmedEntry);
log.info("Expected mark deleted position: {}",
expectedMarkDeletedPos);
log.info("Actual mark deleted position: {}",
cursorStats.markDeletePosition);
- assertTrue(actMarkDeletedPos.compareTo(expectedMarkDeletedPos) >=
0);
+
AssertJUnit.assertTrue(actMarkDeletedPos.compareTo(expectedMarkDeletedPos) >=
0);
});
+ admin.topics().createSubscription(topicName, "s2", MessageId.earliest);
+ admin.topics().createSubscription(topicName, "s3", MessageId.latest);
+ PersistentTopicInternalStats internalStats =
admin.topics().getInternalStats(topicName);
+ ManagedLedgerInternalStats.CursorStats cursorStats2 =
internalStats.cursors.get("s2");
+ String[] ledgerIdAndEntryId2 =
cursorStats2.markDeletePosition.split(":");
+ ImmutablePositionImpl actMarkDeletedPos2 =
Review Comment:
There shouldn't be a need to use ImmutablePositionImpl in code. Simply use
Position as the type and PositionFactory to create instances. They will be
immutable by default.
--
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]