[fix][broker][PIP-195] fix cursor skip read - #19124
Conversation
4a4a1a4 to
f1a7bd7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #19124 +/- ##
============================================
- Coverage 47.73% 47.38% -0.35%
+ Complexity 10819 10746 -73
============================================
Files 712 712
Lines 69645 69644 -1
Branches 7481 7480 -1
============================================
- Hits 33242 33000 -242
- Misses 32699 32944 +245
+ Partials 3704 3700 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| completableFuture.complete(entries.size()); | ||
| try { | ||
| entries.forEach(entry -> { | ||
| assertNotEquals(entry.getEntryId() % 2, 0); |
There was a problem hiding this comment.
It should be assertEquals(entry.getEntryId() % 2, 0);
And due to this one is executed by the SafeRun, so the test will not get failed event if the assert fails.
There was a problem hiding this comment.
| completableFuture2.complete(entries.size()); | ||
| try { | ||
| entries.forEach(entry -> { | ||
| assertEquals(entry.getEntryId() % 2, 0); |
There was a problem hiding this comment.
Same as the above comment. You might need to consider using a different way to assert the result.
| long entryId = firstEntry; | ||
| for (; entryId <= lastEntry; entryId++) { | ||
| if (opReadEntry.skipCondition.test(PositionImpl.get(ledger.getId(), entryId))) { | ||
| if (!opReadEntry.skipCondition.test(PositionImpl.get(ledger.getId(), entryId))) { |
There was a problem hiding this comment.
I suggest Invert if condition to help simple understand this logic. : )
| } | ||
| } | ||
|
|
||
| if (firstValidEntry != -1L) { |
There was a problem hiding this comment.
It looks like this logic just works for the else branch. Can we merge it?
There was a problem hiding this comment.
Yes, we can move this logic to the else branch
5dc2bcc to
a32996f
Compare

PIP: #16763
Motivation
In #19035, the
skipConditionparameter returns need to skip entry when reading entry, but the logic now is reversed.Modifications
Fix skip logic and add test to cover it.
Verifying this change
testReadEntriesWithSkip
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: