From 1505d3f5ff725f5a2dcd775b52e7f962e6f3308e Mon Sep 17 00:00:00 2001 From: Gabor Bota Date: Thu, 12 Sep 2019 19:04:57 +0200 Subject: [PATCH] HADOOP-16566. S3Guard fsck: Use org.apache.hadoop.util.StopWatch instead of com.google.common.base.Stopwatch (#1433). Contributed by Gabor Bota. Change-Id: Ied43ef1522dfc6a1210d6fc58c38d8208824931b --- .../java/org/apache/hadoop/fs/s3a/s3guard/S3GuardFsck.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardFsck.java b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardFsck.java index a9925df521..64496dff92 100644 --- a/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardFsck.java +++ b/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardFsck.java @@ -33,12 +33,12 @@ import com.google.common.base.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Stopwatch; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.s3a.S3AFileStatus; import org.apache.hadoop.fs.s3a.S3AFileSystem; +import org.apache.hadoop.util.StopWatch; import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toSet; @@ -95,7 +95,8 @@ public S3GuardFsck(S3AFileSystem fs, MetadataStore ms) * @throws IOException */ public List compareS3ToMs(Path p) throws IOException { - Stopwatch stopwatch = Stopwatch.createStarted(); + StopWatch stopwatch = new StopWatch(); + stopwatch.start(); int scannedItems = 0; final Path rootPath = rawFS.qualify(p); @@ -146,7 +147,7 @@ public List compareS3ToMs(Path p) throws IOException { new S3GuardFsckViolationHandler(rawFS, metadataStore); comparePairs.forEach(handler::handle); - LOG.info("Total scan time: {}s", stopwatch.elapsed(TimeUnit.SECONDS)); + LOG.info("Total scan time: {}s", stopwatch.now(TimeUnit.SECONDS)); LOG.info("Scanned entries: {}", scannedItems); return comparePairs;