apache / apache/bookkeeper

Over-replicated ledger GC repeatedly creates metadata driver

Open
#4,800 0 comments 0 reactions 0 assignees View on GitHub
type/bug
Dominant language
Java
Stars
2k
Forks
976
Avg merge
6d 15h
Merged PRs (30d)
7

Description

**BUG REPORT**

***Describe the bug***

`ScanAndCompareGarbageCollector` creates a new metadata bookie driver every time it runs over-replicated ledger cleanup. This repeatedly initializes metadata client resources during GC cycles instead of reusing them for the lifetime of the garbage collector.

This can add unnecessary overhead to the over-replicated ledger cleanup path and may repeatedly create short-lived metadata resources.

***To Reproduce***

Steps to reproduce the behavior:

1. Enable over-replicated ledger GC with `gcOverreplicatedLedgerWaitTime` greater than `0`.
2. Start a bookie with scan-and-compare garbage collection.
3. Let the GC thread run multiple over-replicated ledger cleanup cycles.
4. Observe that each cleanup cycle instantiates a new metadata bookie driver and ledger manager factory.

***Expected behavior***

The garbage collector should reuse the metadata bookie driver and ledger manager factory across over-replicated ledger cleanup cycles, and release those resources when the garbage collector thread shuts down.

***Screenshots***

Not applicable.

***Additional context***

The repeated metadata driver creation happens in the over-replicated ledger cleanup path. Reusing the metadata driver avoids unnecessary metadata client initialization while preserving existing cleanup behavior.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.