Skip to content

Commit

Permalink
chore: logs
Browse files Browse the repository at this point in the history
  • Loading branch information
areyouok committed Dec 6, 2024
1 parent b596b6d commit 31c6c67
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ private FrameCallResult afterTruncate(long matchIndex, int matchTerm) {

class InstallFiberFrame extends AbstractAppendFrame<InstallSnapshotReq> {
private static final DtLog log = DtLogs.getLogger(InstallFiberFrame.class);
private final int groupId = gc.getRaftStatus().getGroupId();

public InstallFiberFrame(ReqInfoEx<InstallSnapshotReq> reqInfo, AppendProcessor processor) {
super("install snapshot", processor, reqInfo);
Expand Down Expand Up @@ -484,8 +485,10 @@ protected FrameCallResult process() {

private FrameCallResult startInstall(RaftStatusImpl raftStatus) {
if (RaftUtil.writeNotFinished(raftStatus)) {
log.info("wait write finish before install snapshot, groupId={}", groupId);
return RaftUtil.waitWriteFinish(raftStatus, this);
}
log.info("start install snapshot, groupId={}", groupId);
raftStatus.setInstallSnapshot(true);
gc.getStatusManager().persistAsync(true);
return gc.getStatusManager().waitUpdateFinish(this::afterStatusPersist);
Expand Down Expand Up @@ -514,6 +517,8 @@ private FrameCallResult applyConfigChange(Void unused) {
private FrameCallResult doInstall(RaftStatusImpl raftStatus, InstallSnapshotReq req) {
boolean finish = req.done;
ByteBuffer buf = req.data == null ? null : req.data.getBuffer();
log.debug("install snapshot, groupId={}, offset={}, dataSize={}, finish={}", groupId,
req.offset, buf == null ? 0 : buf.remaining(), finish);
FiberFuture<Void> f = gc.getStateMachine().installSnapshot(req.lastIncludedIndex,
req.lastIncludedTerm, req.offset, finish, buf);
if (finish) {
Expand Down Expand Up @@ -543,6 +548,7 @@ private FrameCallResult finishInstall(InstallSnapshotReq req, RaftStatusImpl raf
req.lastIncludedIndex + 1, req.nextWritePos);
return Fiber.call(finishFrame, v -> {
gc.getApplyManager().signalStartApply();
log.info("install snapshot finish, groupId={}", groupId);
return writeResp(null);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,12 @@ public FiberFrame<Void> beginInstall() {
return new FiberFrame<>() {
@Override
public FrameCallResult execute(Void unused) {
log.info("log files begin install snapshot");
return Fiber.call(logFiles.beginInstall(), this::afterLogBeginInstall);
}

private FrameCallResult afterLogBeginInstall(Void unused) {
log.info("idx files begin install snapshot");
return Fiber.call(idxFiles.beginInstall(), this::justReturn);
}
};
Expand Down

0 comments on commit 31c6c67

Please sign in to comment.