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
This commit is contained in:
Gabor Bota 2019-09-12 19:04:57 +02:00 committed by GitHub
parent fe8cdf0ab8
commit 1505d3f5ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -33,12 +33,12 @@ import java.util.concurrent.TimeUnit;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.google.common.base.Stopwatch;
import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.s3a.S3AFileStatus; import org.apache.hadoop.fs.s3a.S3AFileStatus;
import org.apache.hadoop.fs.s3a.S3AFileSystem; 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.toList;
import static java.util.stream.Collectors.toSet; import static java.util.stream.Collectors.toSet;
@ -95,7 +95,8 @@ public class S3GuardFsck {
* @throws IOException * @throws IOException
*/ */
public List<ComparePair> compareS3ToMs(Path p) throws IOException { public List<ComparePair> compareS3ToMs(Path p) throws IOException {
Stopwatch stopwatch = Stopwatch.createStarted(); StopWatch stopwatch = new StopWatch();
stopwatch.start();
int scannedItems = 0; int scannedItems = 0;
final Path rootPath = rawFS.qualify(p); final Path rootPath = rawFS.qualify(p);
@ -146,7 +147,7 @@ public class S3GuardFsck {
new S3GuardFsckViolationHandler(rawFS, metadataStore); new S3GuardFsckViolationHandler(rawFS, metadataStore);
comparePairs.forEach(handler::handle); 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); LOG.info("Scanned entries: {}", scannedItems);
return comparePairs; return comparePairs;