Abacn commented on code in PR #30218:
URL: https://github.com/apache/beam/pull/30218#discussion_r1480551458
##########
sdks/java/io/jms/src/test/java/org/apache/beam/sdk/io/jms/JmsIOIT.java:
##########
@@ -196,11 +204,18 @@ public void testPublishingThenReadingAll() throws
IOException {
MetricsReader metricsReader = new MetricsReader(readResult, NAMESPACE);
long actualRecords =
metricsReader.getCounterMetric(READ_ELEMENT_METRIC_NAME);
+ // TODO(yathu) resolve pending messages with direct runner. Due to direct
runner only finalize
+ // checkpoint at very end, there are open consumers (may with buffer)
and O(open_consumer)
+ // message won't get delivered to other session
+ int remainRecords = countRemain(QUEUE);
+ assertTrue(remainRecords < OPTIONS.getNumberOfRecords() * 0.005);
+ LOG.info("has {} messages remain", remainRecords);
+
assertTrue(
String.format(
"actual number of records %d smaller than expected: %d.",
- actualRecords, OPTIONS.getNumberOfRecords()),
- OPTIONS.getNumberOfRecords() <= actualRecords);
+ actualRecords, OPTIONS.getNumberOfRecords() - remainRecords),
+ OPTIONS.getNumberOfRecords() <= actualRecords + remainRecords);
Review Comment:
For actualRecords (records get read in pipeline), there are two category
- A: acknowledged records
- B: unacknowledged records that read
There is a third category, that is records not get read
- C: unacknowledged records that not read
remainRecords is unacknowledged message, and we have
actualRecords=A+B
remainRecords=B+C
OPTIONS.getNumberOfRecords() =A+B+C
that was why
```
OPTIONS.getNumberOfRecords() <= actualRecords + remainRecords
```
I should rename "remainRecords" as "unackedRecords" for clarification
--
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]