public final class UfsCheckpointManager extends Object
update(URI)
method will update the
journal's checkpoint to the specified location, and recover()
will recover from any
failures that may occur during update(URI)
.
The checkpoint updating process goes
1. Write a new checkpoint named checkpoint.data.tmp 2. Rename checkpoint.data to checkpoint.data.backup.tmp 3. Rename checkpoint.data.backup.tmp to checkpoint.data.backup 4. Rename checkpoint.data.tmp to checkpoint.data 5. Delete completed logs 6. Delete checkpoint.data.backup
Constructor and Description |
---|
UfsCheckpointManager(UnderFileSystem ufs,
URI checkpoint,
UfsJournalWriter writer)
Creates a new instance of
UfsCheckpointManager . |
Modifier and Type | Method and Description |
---|---|
void |
recover()
Recovers the checkpoint in case the master crashed while updating it.
|
void |
update(URI location)
Updates the checkpoint to the specified URI.
|
public UfsCheckpointManager(UnderFileSystem ufs, URI checkpoint, UfsJournalWriter writer)
UfsCheckpointManager
.ufs
- the under file system holding the journalcheckpoint
- the location of the checkpointwriter
- a journal writer which can be used to delete completed logspublic void recover()
public void update(URI location)
location
- the location of the new checkpointCopyright © 2023. All Rights Reserved.