Class DataIntegrityCheckImpl
java.lang.Object
org.apache.bookkeeper.bookie.datainteg.DataIntegrityCheckImpl
- All Implemented Interfaces:
DataIntegrityCheck
An implementation of the DataIntegrityCheck interface.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Constructor Summary
ConstructorsConstructorDescriptionDataIntegrityCheckImpl(BookieId bookieId, LedgerManager ledgerManager, LedgerStorage ledgerStorage, EntryCopier entryCopier, BookKeeperAdmin admin, io.reactivex.rxjava3.core.Scheduler scheduler) -
Method Summary
Modifier and TypeMethodDescription(package private) io.reactivex.rxjava3.core.Single<Long>checkAndRecoverLedgerEntries(long ledgerId, LedgerMetadata metadata, String runId) Check whether the local storage has all the entries as specified in the metadata.(package private) CompletableFuture<Set<DataIntegrityCheckImpl.LedgerResult>>checkAndRecoverLedgers(Map<Long, LedgerMetadata> ledgers, String runId) Check each ledger passed.(package private) static booleanensemblesContainBookie(LedgerMetadata metadata, BookieId bookieId) (package private) CompletableFuture<Map<Long,LedgerMetadata>> getCachedOrReadMetadata(String runId) (package private) booleanisEntryMissing(WriteSets writeSets, NavigableMap<Long, Integer> bookieIndices, long ledgerId, long entryId) (package private) io.reactivex.rxjava3.core.Maybe<Long>maybeCopyEntry(WriteSets writeSets, NavigableMap<Long, Integer> bookieIndices, long ledgerId, long entryId, EntryCopier.Batch batch) booleanWhether we need to run a full check.(package private) io.reactivex.rxjava3.core.Single<LedgerMetadata>recoverLedger(long ledgerId, String runId) (package private) io.reactivex.rxjava3.core.Maybe<LedgerMetadata>recoverLedgerIfInLimbo(long ledgerId, LedgerMetadata origMetadata, String runId) Run ledger recovery on all a ledger if it has been marked as in limbo.Run full check of bookies local data.runPreBootCheck(String reason) Run quick preboot check.(package private) voidupdateMetadataCache(Map<Long, LedgerMetadata> ledgers)
-
Constructor Details
-
DataIntegrityCheckImpl
public DataIntegrityCheckImpl(BookieId bookieId, LedgerManager ledgerManager, LedgerStorage ledgerStorage, EntryCopier entryCopier, BookKeeperAdmin admin, io.reactivex.rxjava3.core.Scheduler scheduler)
-
-
Method Details
-
runPreBootCheck
Description copied from interface:DataIntegrityCheckRun quick preboot check. This check should do enough to ensure that it is safe to complete the boot sequence without compromising correctness. To this end, if it finds that this bookie is part of the last ensemble of an unclosed ledger, it must prevent the bookie from being able store new entries for that ledger and must prevent the bookie from taking part in the discovery of the last entry of that ledger.- Specified by:
runPreBootCheckin interfaceDataIntegrityCheck
-
needsFullCheck
Description copied from interface:DataIntegrityCheckWhether we need to run a full check. This condition can be set by the runPreBoot() call to run a full check in the background once the bookie is running. This can later be used to run the full check periodically, or to exponentially backoff and retry when some transient condition prevents a ledger being fixed during a full check.- Specified by:
needsFullCheckin interfaceDataIntegrityCheck- Throws:
IOException
-
runFullCheck
Description copied from interface:DataIntegrityCheckRun full check of bookies local data. This check should ensure that if the metadata service states that it should have an entry, then it should have that entry. If the entry is missing, it should copy it from another available source.- Specified by:
runFullCheckin interfaceDataIntegrityCheck
-
updateMetadataCache
-
getCachedOrReadMetadata
-
checkAndRecoverLedgers
CompletableFuture<Set<DataIntegrityCheckImpl.LedgerResult>> checkAndRecoverLedgers(Map<Long, LedgerMetadata> ledgers, String runId) Check each ledger passed. If the ledger is in limbo, recover it. Check that the bookie has all entries that it is expected to have. Copy any entries that are missing.- Returns:
- The set of results for all ledgers passed. A result can be OK, Missing or Error. OK and missing ledgers do not need to be looked at again. Error should be retried.
-
recoverLedgerIfInLimbo
io.reactivex.rxjava3.core.Maybe<LedgerMetadata> recoverLedgerIfInLimbo(long ledgerId, LedgerMetadata origMetadata, String runId) Run ledger recovery on all a ledger if it has been marked as in limbo.- Returns:
- a maybe with the most up-to-date metadata we have for the ledger. If the ledger has been deleted, returns empty.
-
recoverLedger
-
checkAndRecoverLedgerEntries
io.reactivex.rxjava3.core.Single<Long> checkAndRecoverLedgerEntries(long ledgerId, LedgerMetadata metadata, String runId) Check whether the local storage has all the entries as specified in the metadata. If not, copy them from other available nodes. Returns a single value which is the ledgerId or an error if any entry failed to copy should throw error if any entry failed to copy. -
ensemblesContainBookie
-