Skip to content

[fix][ml] Preserve ledger properties when closing ledger - #26227

Merged
dao-jun merged 2 commits into
apache:masterfrom
dao-jun:fix/perserve_ledger_properties
Jul 23, 2026
Merged

[fix][ml] Preserve ledger properties when closing ledger#26227
dao-jun merged 2 commits into
apache:masterfrom
dao-jun:fix/perserve_ledger_properties

Conversation

@dao-jun

@dao-jun dao-jun commented Jul 22, 2026

Copy link
Copy Markdown
Member

Motivation

When a ledger is closed (either because it reaches max entries or is manually closed), the ledgerClosed() method creates a new LedgerInfo object with only basic fields (ledgerId, entries, size, timestamp), which discards any previously set properties.

This causes a bug where ledger properties are lost after ledger closure:

  1. User calls asyncAddLedgerProperty(ledgerId, key, value) to set a property on the current ledger
  2. The property can be read successfully immediately after setting
  3. When the ledger gets closed (e.g., reaches maxEntriesPerLedger), the ledgerClosed() method replaces the LedgerInfo with a new instance that has no properties
  4. Subsequent reads of the property return null, even though the property was successfully persisted to the metadata store

Modifications

  1. Modified the ManagedLedgerImpl.ledgerClosed() method to preserve existing ledger properties when updating the LedgerInfo on ledger close.
  2. Update tests

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

@dao-jun dao-jun self-assigned this Jul 22, 2026
@dao-jun dao-jun changed the title Fix per ledger properties [fix][ml] Preserve ledger properties when closing ledger Jul 22, 2026
@dao-jun dao-jun added this to the 5.0.0-M2 milestone Jul 22, 2026
@dao-jun
dao-jun merged commit 79a2c6f into apache:master Jul 23, 2026
43 checks passed
@dao-jun
dao-jun deleted the fix/perserve_ledger_properties branch July 23, 2026 04:42
@lhotari

lhotari commented Jul 25, 2026

Copy link
Copy Markdown
Member

PIP-404 doesn't exist on branch-4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants