use of org.corfudb.protocols.logprotocol.CheckpointEntry in project CorfuDB by CorfuDB.
the class BackpointerStreamView method examineCheckpointRecord.
private void examineCheckpointRecord(final QueuedStreamContext context, ILogData currentEntry, boolean considerCheckpoint, long currentRead) {
CheckpointEntry.CheckpointEntryType cpType = currentEntry.getCheckpointType();
UUID cpID = currentEntry.getCheckpointID();
if (context.checkpointSuccessID == null && cpType == CheckpointEntry.CheckpointEntryType.END) {
CheckpointEntry cpEntry = (CheckpointEntry) currentEntry.getPayload(runtime);
log.trace("Checkpoint: address {} found END, id {} author {}", currentRead, cpEntry.getCheckpointID(), cpEntry.getCheckpointAuthorID());
if (considerCheckpoint) {
context.checkpointSuccessID = cpEntry.getCheckpointID();
context.checkpointSuccessNumEntries = 1L;
context.checkpointSuccessBytes = (long) currentEntry.getSizeEstimate();
context.checkpointSuccessEndAddr = currentRead;
}
}
if (context.checkpointSuccessID != null && context.checkpointSuccessID.equals(cpID)) {
CheckpointEntry cpEntry = (CheckpointEntry) currentEntry.getPayload(runtime);
log.trace("Checkpoint: address {} type {} id {} author {}", currentRead, cpEntry.getCpType(), cpEntry.getCheckpointID(), cpEntry.getCheckpointAuthorID());
if (considerCheckpoint) {
context.readCpQueue.add(currentEntry.getGlobalAddress());
context.checkpointSuccessNumEntries++;
context.checkpointSuccessBytes += cpEntry.getSmrEntriesBytes();
if (cpEntry.getCpType().equals(CheckpointEntry.CheckpointEntryType.START)) {
long cpStartAddr;
if (cpEntry.getDict().get(CheckpointEntry.CheckpointDictKey.START_LOG_ADDRESS) != null) {
cpStartAddr = Long.decode(cpEntry.getDict().get(CheckpointEntry.CheckpointDictKey.START_LOG_ADDRESS));
} else {
cpStartAddr = currentRead;
}
context.checkpointSuccessStartAddr = cpStartAddr;
log.trace("Checkpoint: halt backpointer fill at address {} type {} id {} author {}", cpStartAddr, cpEntry.getCpType(), cpEntry.getCheckpointID(), cpEntry.getCheckpointAuthorID());
return;
}
}
} else {
log.trace("Checkpoint: skip address {} type {} id {}", currentRead, cpType, cpID);
}
}
Aggregations