Skip to content

Commit

Permalink
[fix][ml]Expose ledger timestamp (apache#22338)
Browse files Browse the repository at this point in the history
(cherry picked from commit cd49def)
(cherry picked from commit 5e95828)
  • Loading branch information
dao-jun authored and srinath-ctds committed Apr 23, 2024
1 parent d67d44d commit b46b0c3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ public void operationComplete(MLDataFormats.ManagedLedgerInfo pbInfo, Stat stat)
ledgerInfo.ledgerId = pbLedgerInfo.getLedgerId();
ledgerInfo.entries = pbLedgerInfo.hasEntries() ? pbLedgerInfo.getEntries() : null;
ledgerInfo.size = pbLedgerInfo.hasSize() ? pbLedgerInfo.getSize() : null;
ledgerInfo.timestamp = pbLedgerInfo.hasTimestamp() ? pbLedgerInfo.getTimestamp() : null;
ledgerInfo.isOffloaded = pbLedgerInfo.hasOffloadContext();
if (pbLedgerInfo.hasOffloadContext()) {
MLDataFormats.OffloadContext offloadContext = pbLedgerInfo.getOffloadContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.bookkeeper.mledger.impl;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;

import java.util.UUID;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -60,6 +61,10 @@ public void testGetManagedLedgerInfoWithClose() throws Exception {
assertEquals(info.ledgers.get(2).ledgerId, 5);
assertEquals(info.ledgers.get(3).ledgerId, 6);

for (ManagedLedgerInfo.LedgerInfo linfo : info.ledgers) {
assertNotNull(linfo.timestamp);
}

assertEquals(info.cursors.size(), 1);

CursorInfo cursorInfo = info.cursors.get("c1");
Expand Down

0 comments on commit b46b0c3

Please sign in to comment.