From 3c950836595ed8a0a16f1b898993524b635da6de Mon Sep 17 00:00:00 2001 From: shalumariamsheji Date: Mon, 2 May 2022 16:19:54 +0530 Subject: [PATCH] Resolving conflicts --- .../io/prestosql/server/protocol/Query.java | 52 ++++--------------- 1 file changed, 11 insertions(+), 41 deletions(-) diff --git a/presto-main/src/main/java/io/prestosql/server/protocol/Query.java b/presto-main/src/main/java/io/prestosql/server/protocol/Query.java index 7c5624803..0c4e36bb3 100644 --- a/presto-main/src/main/java/io/prestosql/server/protocol/Query.java +++ b/presto-main/src/main/java/io/prestosql/server/protocol/Query.java @@ -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 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) { @@ -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) @@ -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; @@ -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())