Skip to content

Commit

Permalink
Bump pulsar to 2.10.0.0-rc12 and fix testListOffsetForEmptyRolloverLe…
Browse files Browse the repository at this point in the history
…dger (#1176)

Fixes #1175

### Motivation

The `ManagedLedger#rollCurrentLedgerIfFull` can only work when the managed ledger's state is `LedgerOpened` since apache/pulsar#14664. The corner case described in streamnative/kop#894 is still possible when some entries are sent but not persisted after a rollover and retention works. Therefore, we should still keep the `testListOffsetForEmptyRolloverLedger` to avoid the regression in KoP.

### Modifications

- Bump Pulsar to 2.10.0.0-rc12, which includes apache/pulsar#14664
- Change the managed ledger's state to `LedgerOpened` in `testListOffsetForEmptyRolloverLedger`.
  • Loading branch information
BewareMyPower authored Mar 14, 2022
1 parent c03cd9e commit bb37893
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<lombok.version>1.18.4</lombok.version>
<mockito.version>2.22.0</mockito.version>
<pulsar.group.id>io.streamnative</pulsar.group.id>
<pulsar.version>2.10.0.0-rc4</pulsar.version>
<pulsar.version>2.10.0.0-rc12</pulsar.version>
<slf4j.version>1.7.25</slf4j.version>
<spotbugs-annotations.version>3.1.8</spotbugs-annotations.version>
<testng.version>6.14.3</testng.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;

import java.lang.reflect.Field;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Base64;
Expand Down Expand Up @@ -206,6 +207,10 @@ public void testListOffsetForEmptyRolloverLedger() throws Exception {
}
assertEquals(managedLedger.getLedgersInfo().size(), numLedgers);

// The rollover can only happen when state is LedgerOpened since https://github.com/apache/pulsar/pull/14664
Field stateUpdater = ManagedLedgerImpl.class.getDeclaredField("state");
stateUpdater.setAccessible(true);
stateUpdater.set(managedLedger, ManagedLedgerImpl.State.LedgerOpened);
// Rollover and delete the old ledgers, wait until there is only one empty ledger
managedLedger.getConfig().setRetentionTime(0, TimeUnit.MILLISECONDS);
managedLedger.rollCurrentLedgerIfFull();
Expand Down

0 comments on commit bb37893

Please sign in to comment.