From a712f9fa34ed3ace5ae6bf539c227a110b259a2c Mon Sep 17 00:00:00 2001 From: litao Date: Wed, 11 May 2022 14:36:37 +0800 Subject: [PATCH] HBASE-27020 Fix spotless warn for master branch (#4417) Signed-off-by: Duo Zhang Reviewed by: Rushabh Shah --- .../org/apache/hadoop/hbase/regionserver/HStore.java | 12 +++++------- .../hadoop/hbase/regionserver/StoreEngine.java | 9 +++++---- .../replication/regionserver/ReplicationSource.java | 3 +-- .../client/replication/TestBadReplicationPeer.java | 10 +++++----- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java index d4482dd44ba4..020009c7f5ca 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java @@ -1232,13 +1232,11 @@ private void writeCompactionWalRecord(Collection filesCompacted, allowedOnPath = ".*/(HStore|TestHStore).java") void replaceStoreFiles(Collection compactedFiles, Collection result, boolean writeCompactionMarker) throws IOException { - storeEngine.replaceStoreFiles(compactedFiles, result, - () -> { - if (writeCompactionMarker) { - writeCompactionWalRecord(compactedFiles, result); - } - }, - () -> { + storeEngine.replaceStoreFiles(compactedFiles, result, () -> { + if (writeCompactionMarker) { + writeCompactionWalRecord(compactedFiles, result); + } + }, () -> { synchronized (filesCompacting) { filesCompacting.removeAll(compactedFiles); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreEngine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreEngine.java index a9863ea84511..ab1f56fb772e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreEngine.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreEngine.java @@ -34,7 +34,6 @@ import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Function; - import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.CellComparator; @@ -408,7 +407,9 @@ private void refreshStoreFilesInternal(Collection newFiles) throw List openedFiles = openStoreFiles(toBeAddedFiles, false); // propogate the file changes to the underlying store file manager - replaceStoreFiles(toBeRemovedStoreFiles, openedFiles, () -> {}, () -> {}); // won't throw an exception + replaceStoreFiles(toBeRemovedStoreFiles, openedFiles, () -> { + }, () -> { + }); // won't throw an exception } /** @@ -491,8 +492,8 @@ public void addStoreFiles(Collection storeFiles, } public void replaceStoreFiles(Collection compactedFiles, - Collection newFiles, IOExceptionRunnable walMarkerWriter, - Runnable actionUnderLock) throws IOException { + Collection newFiles, IOExceptionRunnable walMarkerWriter, Runnable actionUnderLock) + throws IOException { storeFileTracker.replace(StoreUtils.toStoreFileInfo(compactedFiles), StoreUtils.toStoreFileInfo(newFiles)); walMarkerWriter.run(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java index 0b69c7c674e3..2373751afbb1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java @@ -538,7 +538,6 @@ private void initialize() { } } - if (!this.isSourceActive()) { setSourceStartupStatus(false); if (Thread.currentThread().isInterrupted()) { @@ -569,7 +568,7 @@ private void initialize() { } } - if(!this.isSourceActive()) { + if (!this.isSourceActive()) { setSourceStartupStatus(false); if (Thread.currentThread().isInterrupted()) { // If source is not running and thread is interrupted this means someone has tried to diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestBadReplicationPeer.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestBadReplicationPeer.java index cf70ab705c6b..04093355af35 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestBadReplicationPeer.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestBadReplicationPeer.java @@ -1,4 +1,4 @@ -/** +/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -39,7 +39,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@Category({ MediumTests.class, ClientTests.class}) +@Category({ MediumTests.class, ClientTests.class }) public class TestBadReplicationPeer { @ClassRule public static final HBaseClassTestRule CLASS_RULE = @@ -65,15 +65,15 @@ public static void tearDownAfterClass() throws Exception { } /* - Add dummy peer and make sure that we are able to remove that peer. + * Add dummy peer and make sure that we are able to remove that peer. */ @Test public void testRemovePeerSucceeds() throws IOException { String peerId = "dummypeer_1"; try (Connection connection = ConnectionFactory.createConnection(conf); - Admin admin = connection.getAdmin()){ + Admin admin = connection.getAdmin()) { ReplicationPeerConfigBuilder rpcBuilder = ReplicationPeerConfig.newBuilder(); - String quorum = TEST_UTIL.getHBaseCluster().getMaster().getZooKeeper().getQuorum(); + String quorum = TEST_UTIL.getHBaseCluster().getMaster().getZooKeeper().getQuorum(); rpcBuilder.setClusterKey(quorum + ":/1"); ReplicationPeerConfig rpc = rpcBuilder.build(); admin.addReplicationPeer(peerId, rpc);