Skip to content

Commit 319ad5f

Browse files
committed
post-rebase fixes
1 parent ac6e4cd commit 319ad5f

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ private Throwable tryCompleteCursorRecovery(LedgerHandle lh, byte[] data) {
747747
}
748748
}
749749

750-
PositionImpl position = new PositionImpl(positionInfo);
750+
Position position = PositionFactory.create(positionInfo.getLedgerId(), positionInfo.getEntryId());
751751
if (positionInfo.getIndividualDeletedMessagesCount() > 0) {
752752
recoverIndividualDeletedMessages(positionInfo.getIndividualDeletedMessagesList());
753753
}
@@ -3333,9 +3333,9 @@ private void buildBatchEntryDeletionIndexInfoList(
33333333
return;
33343334
}
33353335
int count = 0;
3336-
Iterator<Map.Entry<PositionImpl, BitSetRecyclable>> iterator = batchDeletedIndexes.entrySet().iterator();
3336+
Iterator<Map.Entry<Position, BitSetRecyclable>> iterator = batchDeletedIndexes.entrySet().iterator();
33373337
while (iterator.hasNext() && count < maxBatchDeletedIndexToPersist) {
3338-
Map.Entry<PositionImpl, BitSetRecyclable> entry = iterator.next();
3338+
Map.Entry<Position, BitSetRecyclable> entry = iterator.next();
33393339
long[] array = entry.getValue().toLongArray();
33403340
consumer.acceptRange(entry.getKey().getLedgerId(), entry.getKey().getEntryId(), array);
33413341
count++;
@@ -3436,7 +3436,7 @@ private void writeToBookKeeperLastChunk(LedgerHandle lh,
34363436
VoidCallback callback,
34373437
ByteBuf data,
34383438
int totalLength,
3439-
PositionImpl position,
3439+
Position position,
34403440
Runnable onFinished) {
34413441
lh.asyncAddEntry(data, (rc, lh1, entryId, ctx) -> {
34423442
try {

managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/PositionInfoUtils.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.nio.charset.StandardCharsets;
2424
import java.util.Map;
2525
import java.util.function.Consumer;
26+
27+
import org.apache.bookkeeper.mledger.Position;
2628
import org.apache.pulsar.common.allocator.PulsarByteBufAllocator;
2729

2830
final class PositionInfoUtils {
@@ -35,7 +37,7 @@ interface BatchedEntryDeletionIndexInfoConsumer {
3537
void acceptRange(long ledgerId, long entryId, long[] array);
3638
}
3739

38-
static ByteBuf serializePositionInfo(ManagedCursorImpl.MarkDeleteEntry mdEntry, PositionImpl position,
40+
static ByteBuf serializePositionInfo(ManagedCursorImpl.MarkDeleteEntry mdEntry, Position position,
3941
Consumer<IndividuallyDeletedMessagesRangeConsumer> rangeScanner,
4042
Consumer<BatchedEntryDeletionIndexInfoConsumer> batchDeletedIndexesScanner,
4143
int lastSerializedSize) {

managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedCursorTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3634,7 +3634,7 @@ public void testRecoverCursorCorruptLastEntry() throws Exception {
36343634
assertEquals(c.getReadPosition().getEntryId(), 0);
36353635
assertEquals(ml.getLastConfirmedEntry().getEntryId(), -1);
36363636

3637-
c.resetCursor(PositionImpl.LATEST);
3637+
c.resetCursor(PositionFactory.LATEST);
36383638

36393639
// A reset cursor starts out with these values. The rest of the test assumes this, so we assert it here.
36403640
assertEquals(c.getMarkDeletedPosition().getEntryId(), -1);
@@ -3647,7 +3647,7 @@ public void testRecoverCursorCorruptLastEntry() throws Exception {
36473647
ml.addEntry(new byte[1]);
36483648
ml.addEntry(new byte[1]);
36493649

3650-
c.resetCursor(PositionImpl.LATEST);
3650+
c.resetCursor(PositionFactory.LATEST);
36513651
//corrupt last entry
36523652
LedgerHandle cursorLedger = (LedgerHandle)FieldUtils.readDeclaredField(c, "cursorLedger", true);
36533653
// can't parse json

managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/PositionInfoUtilsTest.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import java.util.Map;
2727
import java.util.List;
2828

29+
import org.apache.bookkeeper.mledger.Position;
30+
import org.apache.bookkeeper.mledger.PositionFactory;
2931
import org.apache.bookkeeper.mledger.proto.LightMLDataFormats;
3032
import org.apache.bookkeeper.mledger.proto.MLDataFormats;
3133
import org.apache.pulsar.common.allocator.PulsarByteBufAllocator;
@@ -38,7 +40,7 @@ public class PositionInfoUtilsTest {
3840

3941
@Test
4042
public void testSerializeDeserialize() throws Exception {
41-
PositionImpl position = new PositionImpl(1, 2);
43+
Position position = PositionFactory.create(1, 2);
4244
ManagedCursorImpl.MarkDeleteEntry entry = new ManagedCursorImpl.MarkDeleteEntry(position,
4345
Map.of("foo", 1L), null, null);
4446

@@ -79,7 +81,7 @@ public void testSerializeDeserialize() throws Exception {
7981

8082
@Test
8183
public void testSerializeDeserializeEmpty() throws Exception {
82-
PositionImpl position = new PositionImpl(1, 2);
84+
Position position = PositionFactory.create(1, 2);
8385
ManagedCursorImpl.MarkDeleteEntry entry = new ManagedCursorImpl.MarkDeleteEntry(position,
8486
null, null, null);
8587

@@ -100,7 +102,7 @@ public void testSerializeDeserializeEmpty() throws Exception {
100102

101103
@Test
102104
public void testSerializeDeserialize2() throws Exception {
103-
PositionImpl position = new PositionImpl(1, 2);
105+
Position position = PositionFactory.create(1, 2);
104106
ManagedCursorImpl.MarkDeleteEntry entry = new ManagedCursorImpl.MarkDeleteEntry(position,
105107
Map.of("foo", 1L), null, null);
106108

0 commit comments

Comments
 (0)