Skip to content

Should introduce deleting state for ledger deletionΒ #13238

Closed as not planned
Closed as not planned

Description

@hangc0276

Is your enhancement request related to a problem? Please describe.
In current ledger deletion, we divided it into two separate steps.

  1. Remove all the waiting to delete ledgers from ledger list and update the newest ledger list into meta store.
  2. In the meta store update callback operation, delete the waiting to delete ledgers from storage system, such as BookKeeper or Tiered storage.

Due to the separate step, we can't ensure the ledger deletion transaction. If the first step succeed and the second step failed, it will lead to ledgers can't be deleted from storage system forever. The second step maybe fail by broker restart or storage system deletion failed.

store.asyncUpdateLedgerIds(name, getManagedLedgerInfo(), ledgersStat, new MetaStoreCallback<Void>() {
@Override
public void operationComplete(Void result, Stat stat) {
log.info("[{}] End TrimConsumedLedgers. ledgers={} totalSize={}", name, ledgers.size(),
TOTAL_SIZE_UPDATER.get(ManagedLedgerImpl.this));
ledgersStat = stat;
metadataMutex.unlock();
trimmerMutex.unlock();
for (LedgerInfo ls : ledgersToDelete) {
log.info("[{}] Removing ledger {} - size: {}", name, ls.getLedgerId(), ls.getSize());
asyncDeleteLedger(ls.getLedgerId(), ls);
}
for (LedgerInfo ls : offloadedLedgersToDelete) {
log.info("[{}] Deleting offloaded ledger {} from bookkeeper - size: {}", name, ls.getLedgerId(),
ls.getSize());
asyncDeleteLedgerFromBookKeeper(ls.getLedgerId());
}
promise.complete(null);
}
@Override
public void operationFailed(MetaStoreException e) {
log.warn("[{}] Failed to update the list of ledgers after trimming", name, e);
metadataMutex.unlock();
trimmerMutex.unlock();
promise.completeExceptionally(e);
}
});

In our customer's environment, we have found many orphan ledgers cause by the above reason.

Describe the solution you'd like
We'd better introduce a deleting state for the waiting to delete ledgers. The desired ledger deletion should follow the three steps.

  1. Remove all the waiting to delete ledgers from ledger list and update the newest ledger list into meta store.
  2. Write the waiting to delete ledgers into meta store marked as deleting state.
  3. Use another thread to periodically check the deleting state ledgers, and do ledger delete operation on storage system. Each topic's owner control their own topics' ledger deletion.
  4. After the ledger deletion complete, remove the ledger from meta store.

Activity

  1. added
    type/enhancementThe enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
    on Dec 11, 2021
  2. added this to the 2.10.0 milestone on Dec 11, 2021
  3. wuzhanpeng commented on Dec 11, 2021

    @wuzhanpeng
    Contributor

    I can help with this issue~

  4. hangc0276 commented on Dec 11, 2021

    @hangc0276
    ContributorAuthor

    @wuzhanpeng Thanks for your help, I have assigned this issue to you. If you have any questions or need any help, please ping me at any time. You'd better write a proposal first.

  5. modified the milestones: 2.10.0, 2.11.0 on Feb 14, 2022
  6. github-actions commented on Mar 17, 2022

    @github-actions

    The issue had no activity for 30 days, mark with Stale label.

  7. github-actions commented on May 30, 2022

    @github-actions

    The issue had no activity for 30 days, mark with Stale label.

  8. modified the milestones: 2.11.0, 2.12.0 on Jul 26, 2022
  9. tisonkun commented on Dec 11, 2022

    @tisonkun
    Member

    Superseded by #16569

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

Metadata

Metadata

Assignees

Labels

Stalehelp wantedlifecycle/staletype/enhancementThe enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions