Skip to content

Commit

Permalink
Resolving conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
shalumariamsheji committed May 2, 2022
1 parent d918be2 commit 3c95083
Showing 1 changed file with 11 additions and 41 deletions.
52 changes: 11 additions & 41 deletions presto-main/src/main/java/io/prestosql/server/protocol/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -882,48 +882,18 @@ else if (snapshotInfo.getSnapshotResult() == SnapshotResult.IN_PROGRESS) {
capturingSnapshots.add(snapshotId);
}
else {
log.info("Neither successful nor in progress, Snapshot: %d, Status: %s", snapshotId, snapshotInfo.getSnapshotResult().toString());
LOG.info("Neither successful nor in progress, Snapshot: %d, Status: %s", snapshotId, snapshotInfo.getSnapshotResult().toString());
}
});
if (lastSnapshotId > 0) {
SnapshotStats.Builder builder = SnapshotStats.builder();
LOG.debug("SnapshotMetrics: totalWallTimeMillis: [%s]ms, lastWallTimeMillis: [%s]ms", totalWallTimeMillis.toString(), lastWallTimeMillis.toString());
LOG.debug("SnapshotMetrics: allSnapshotsSizeBytes: [%d], lastSnapshotSizeBytes: [%d]", allSnapshotsSizeBytes.get(), lastSnapshotSizeBytes.get());
LOG.debug("SnapshotMetrics: totalCpuTimeMillis: [%d]ms, lastSnapshotCpuTimeMillis: [%d]ms", totalCpuTimeMillis.get(), lastSnapshotCpuTimeMillis.get());
builder.setLastCaptureSnapshotId(lastSnapshotId)
.setAllSnapshotsSizeBytes(allSnapshotsSizeBytes.get())
.setLastSnapshotSizeBytes(lastSnapshotSizeBytes.get())
SnapshotStats.Builder builder = SnapshotStats.builder();
if (capturedSnapshots.size() > 0) {
builder.setAllSnapshotsSizeBytes(allSnapshotsSizeBytes.get())
.setTotalWallTimeMillis(totalWallTimeMillis.get())
.setTotalCpuTimeMillis(totalCpuTimeMillis.get())
.setLastSnapshotCpuTimeMillis(lastSnapshotCpuTimeMillis.get());

// Restore stats
AtomicLong totalRestoreWallTime = new AtomicLong(0L);
AtomicLong totalRestoreCpuTime = new AtomicLong(0L);
AtomicLong totalRestoreSize = new AtomicLong(0L);
long lastRestoreSnapshotId = 0;
int restoreCount = 0;
List<RestoreResult> restoreStats = querySnapshotManager.getRestoreStats();
restoreCount = restoreStats.size();
LOG.debug("SnapshotMetrics: restoreCount: [%d]", restoreCount);
// Add restore stats if restore is happened
if (restoreCount > 0) {
lastRestoreSnapshotId = restoreStats.get(restoreCount - 1).getSnapshotId();
restoreStats.forEach(restoreResult -> {
SnapshotInfo info = restoreResult.getSnapshotInfo();
totalRestoreWallTime.addAndGet(info.getEndTime() - info.getBeginTime());
totalRestoreCpuTime.addAndGet(info.getCpuTime());
totalRestoreSize.addAndGet(info.getSizeBytes());
});
LOG.debug("SnapshotMetrics: totalRestoreWallTime: [%d]ms, totalRestoreCpuTime: [%d]ms", totalRestoreWallTime.get(), totalRestoreCpuTime.get());
LOG.debug("SnapshotMetrics: totalRestoreSize: [%d], lastRestoreSnapshotId: [%d]", totalRestoreSize.get(), lastRestoreSnapshotId);
builder.setSuccessRestoreCount(restoreCount)
.setLastRestoreSnapshotId(lastRestoreSnapshotId)
.setTotalRestoreWallTime(totalRestoreWallTime.get())
.setTotalRestoreCpuTime(totalRestoreCpuTime.get())
.setTotalRestoreSize(totalRestoreSize.get());
}
return builder.build();
.setCapturedSnapshotList(capturedSnapshots);
}
if (capturingSnapshots.size() > 0) {
builder.setCapturingSnapshotIds(capturingSnapshots);
}
// Gather last successful snapshot stats if available
if (lastSnapshotId.get() > 0) {
Expand Down Expand Up @@ -957,7 +927,7 @@ else if (snapshotInfo.getSnapshotResult() == SnapshotResult.IN_PROGRESS) {
restoredSnapshotList.add(restoreResult.getSnapshotId());
}
else {
log.info("Query restarted instead of resume..");
LOG.info("Query restarted instead of resume..");
}
});
builder.setSuccessRestoreCount(restoreCount)
Expand All @@ -972,7 +942,7 @@ else if (snapshotInfo.getSnapshotResult() == SnapshotResult.IN_PROGRESS) {
builder.setRestoringSnapshotId(restoringSnapshotId);
}
SnapshotStats snapshotStats = builder.build();
log.debug("SnapshotStats: " + snapshotStats.toString());
LOG.debug("SnapshotStats: " + snapshotStats.toString());
return snapshotStats;
}
return null;
Expand All @@ -997,7 +967,7 @@ private static StageStats toStageStats(StageInfo stageInfo)
URI uri = task.getTaskStatus().getSelf();
uniqueNodes.add(uri.getHost() + ":" + uri.getPort());
}
log.debug("StageStats Id: %s, IsRestoring: %b, SnapshotId: %d", stageInfo.getStageId().toString(), stageInfo.isRestoring(), stageInfo.getSnapshotId());
LOG.debug("StageStats Id: %s, IsRestoring: %b, SnapshotId: %d", stageInfo.getStageId().toString(), stageInfo.isRestoring(), stageInfo.getSnapshotId());
return StageStats.builder()
.setStageId(String.valueOf(stageInfo.getStageId().getId()))
.setState(stageInfo.getState().toString())
Expand Down

0 comments on commit 3c95083

Please sign in to comment.