HBASE-25451 Upgrade commons-io to 2.8.0 (#2825)
Signed-off-by: Guanghao Zhang <zghao@apache.org> Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
29a9a16de4
commit
fbf00f9c28
|
@ -212,9 +212,10 @@ class AsyncConnectionImpl implements AsyncConnection {
|
|||
if(LOG.isDebugEnabled()){
|
||||
logCallStack(Thread.currentThread().getStackTrace());
|
||||
}
|
||||
IOUtils.closeQuietly(clusterStatusListener);
|
||||
IOUtils.closeQuietly(rpcClient);
|
||||
IOUtils.closeQuietly(registry);
|
||||
IOUtils.closeQuietly(clusterStatusListener,
|
||||
e -> LOG.warn("failed to close clusterStatusListener", e));
|
||||
IOUtils.closeQuietly(rpcClient, e -> LOG.warn("failed to close rpcClient", e));
|
||||
IOUtils.closeQuietly(registry, e -> LOG.warn("failed to close registry", e));
|
||||
if (choreService != null) {
|
||||
choreService.shutdown();
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class AsyncClientExample extends Configured implements Tool {
|
|||
CompletableFuture<Void> closeFuture = new CompletableFuture<>();
|
||||
addListener(f, (conn, error) -> {
|
||||
if (error == null) {
|
||||
IOUtils.closeQuietly(conn);
|
||||
IOUtils.closeQuietly(conn, e -> LOG.warn("failed to close conn", e));
|
||||
}
|
||||
closeFuture.complete(null);
|
||||
});
|
||||
|
|
|
@ -21,8 +21,6 @@ import java.io.Closeable;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.fs.CanUnbuffer;
|
||||
import org.apache.hadoop.fs.FSDataInputStream;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
|
@ -33,6 +31,8 @@ import org.apache.yetus.audience.InterfaceAudience;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
/**
|
||||
* Wrapper for input stream(s) that takes care of the interaction of FS and HBase checksums,
|
||||
* as well as closing streams. Initialization is not thread-safe, but normal operation is;
|
||||
|
@ -289,11 +289,11 @@ public class FSDataInputStreamWrapper implements Closeable {
|
|||
}
|
||||
updateInputStreamStatistics(this.streamNoFsChecksum);
|
||||
// we do not care about the close exception as it is for reading, no data loss issue.
|
||||
IOUtils.closeQuietly(streamNoFsChecksum);
|
||||
Closeables.closeQuietly(streamNoFsChecksum);
|
||||
|
||||
|
||||
updateInputStreamStatistics(stream);
|
||||
IOUtils.closeQuietly(stream);
|
||||
Closeables.closeQuietly(stream);
|
||||
}
|
||||
|
||||
public HFileSystem getHfs() {
|
||||
|
|
|
@ -505,7 +505,8 @@ public final class HFile {
|
|||
throw new IllegalArgumentException("Invalid HFile version " + trailer.getMajorVersion());
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
IOUtils.closeQuietly(context.getInputStreamWrapper());
|
||||
IOUtils.closeQuietly(context.getInputStreamWrapper(),
|
||||
e -> LOG.warn("failed to close input stream wrapper", e));
|
||||
throw new CorruptHFileException("Problem reading HFile Trailer from file "
|
||||
+ context.getFilePath(), t);
|
||||
} finally {
|
||||
|
|
|
@ -44,7 +44,11 @@ import org.apache.hadoop.hbase.protobuf.ProtobufMagic;
|
|||
import org.apache.hadoop.hbase.security.EncryptionUtil;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations;
|
||||
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.BytesBytesPair;
|
||||
|
@ -62,6 +66,9 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.HFileProtos;
|
|||
*/
|
||||
@InterfaceAudience.Private
|
||||
public class HFileInfo implements SortedMap<byte[], byte[]> {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(HFileInfo.class);
|
||||
|
||||
static final String RESERVED_PREFIX = "hfile.";
|
||||
static final byte[] RESERVED_PREFIX_BYTES = Bytes.toBytes(RESERVED_PREFIX);
|
||||
static final byte [] LASTKEY = Bytes.toBytes(RESERVED_PREFIX + "LASTKEY");
|
||||
|
@ -344,7 +351,8 @@ public class HFileInfo implements SortedMap<byte[], byte[]> {
|
|||
this.hfileContext = createHFileContext(path, trailer, conf);
|
||||
context.getInputStreamWrapper().unbuffer();
|
||||
} catch (Throwable t) {
|
||||
IOUtils.closeQuietly(context.getInputStreamWrapper());
|
||||
IOUtils.closeQuietly(context.getInputStreamWrapper(),
|
||||
e -> LOG.warn("failed to close input stream wrapper", e));
|
||||
throw new CorruptHFileException("Problem reading HFile Trailer from file "
|
||||
+ context.getFilePath(), t);
|
||||
}
|
||||
|
@ -382,9 +390,10 @@ public class HFileInfo implements SortedMap<byte[], byte[]> {
|
|||
// close the block reader
|
||||
context.getInputStreamWrapper().unbuffer();
|
||||
} catch (Throwable t) {
|
||||
IOUtils.closeQuietly(context.getInputStreamWrapper());
|
||||
throw new CorruptHFileException("Problem reading data index and meta index from file "
|
||||
+ context.getFilePath(), t);
|
||||
IOUtils.closeQuietly(context.getInputStreamWrapper(),
|
||||
e -> LOG.warn("failed to close input stream wrapper", e));
|
||||
throw new CorruptHFileException(
|
||||
"Problem reading data index and meta index from file " + context.getFilePath(), t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||
|
@ -221,6 +220,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
|
||||
import org.apache.hbase.thirdparty.com.google.common.collect.Maps;
|
||||
import org.apache.hbase.thirdparty.com.google.common.collect.Sets;
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors;
|
||||
import org.apache.hbase.thirdparty.com.google.protobuf.Service;
|
||||
import org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server;
|
||||
|
@ -832,7 +832,7 @@ public class HMaster extends HRegionServer implements MasterServices {
|
|||
HBaseFsck.createLockRetryCounterFactory(this.conf).create());
|
||||
} finally {
|
||||
if (result != null) {
|
||||
IOUtils.closeQuietly(result.getSecond());
|
||||
Closeables.close(result.getSecond(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,6 +138,7 @@ import org.apache.hbase.thirdparty.com.google.common.base.Joiner;
|
|||
import org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
|
||||
import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
|
||||
import org.apache.hbase.thirdparty.com.google.common.collect.Sets;
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
import org.apache.yetus.audience.InterfaceStability;
|
||||
|
@ -511,7 +512,7 @@ public class HBaseFsck extends Configured implements Closeable {
|
|||
RetryCounter retryCounter = lockFileRetryCounterFactory.create();
|
||||
do {
|
||||
try {
|
||||
IOUtils.closeQuietly(hbckOutFd);
|
||||
Closeables.close(hbckOutFd, true);
|
||||
CommonFSUtils.delete(CommonFSUtils.getCurrentFileSystem(getConf()), HBCK_LOCK_PATH, true);
|
||||
LOG.info("Finishing hbck");
|
||||
return;
|
||||
|
@ -564,7 +565,7 @@ public class HBaseFsck extends Configured implements Closeable {
|
|||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
IOUtils.closeQuietly(HBaseFsck.this);
|
||||
IOUtils.closeQuietly(HBaseFsck.this, e -> LOG.warn("", e));
|
||||
cleanupHbckZnode();
|
||||
unlockHbck();
|
||||
}
|
||||
|
@ -863,9 +864,9 @@ public class HBaseFsck extends Configured implements Closeable {
|
|||
zkw.close();
|
||||
zkw = null;
|
||||
}
|
||||
IOUtils.closeQuietly(admin);
|
||||
IOUtils.closeQuietly(meta);
|
||||
IOUtils.closeQuietly(connection);
|
||||
IOUtils.closeQuietly(admin, e -> LOG.warn("", e));
|
||||
IOUtils.closeQuietly(meta, e -> LOG.warn("", e));
|
||||
IOUtils.closeQuietly(connection, e -> LOG.warn("", e));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3845,7 +3846,7 @@ public class HBaseFsck extends Configured implements Closeable {
|
|||
setRetCode(code);
|
||||
}
|
||||
} finally {
|
||||
IOUtils.closeQuietly(this);
|
||||
IOUtils.closeQuietly(this, e -> LOG.warn("", e));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -121,8 +121,8 @@ public class RegionMover extends AbstractHBaseTool implements Closeable {
|
|||
|
||||
@Override
|
||||
public void close() {
|
||||
IOUtils.closeQuietly(this.admin);
|
||||
IOUtils.closeQuietly(this.conn);
|
||||
IOUtils.closeQuietly(this.admin, e -> LOG.warn("failed to close admin", e));
|
||||
IOUtils.closeQuietly(this.conn, e -> LOG.warn("failed to close conn", e));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentMap;
|
|||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Supplier;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.Cell;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
|
@ -46,6 +45,8 @@ import org.junit.rules.TestName;
|
|||
import org.junit.runners.Parameterized.Parameter;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
public abstract class AbstractTestAsyncTableRegionReplicasRead {
|
||||
|
||||
protected static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
|
@ -152,7 +153,7 @@ public abstract class AbstractTestAsyncTableRegionReplicasRead {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
IOUtils.closeQuietly(ASYNC_CONN);
|
||||
Closeables.close(ASYNC_CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.regex.Pattern;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.StartMiniClusterOption;
|
||||
|
@ -43,6 +42,8 @@ import org.junit.runners.Parameterized.Parameters;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
/**
|
||||
* Class to test AsyncAdmin.
|
||||
*/
|
||||
|
@ -92,7 +93,7 @@ public abstract class TestAsyncAdminBase extends AbstractTestUpdateConfiguration
|
|||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
IOUtils.closeQuietly(ASYNC_CONN);
|
||||
Closeables.close(ASYNC_CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.concurrent.ForkJoinPool;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Supplier;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
|
@ -53,6 +52,8 @@ import org.junit.runners.Parameterized.Parameters;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
@Category({ LargeTests.class, ClientTests.class })
|
||||
public class TestAsyncAdminBuilder {
|
||||
|
@ -98,7 +99,7 @@ public class TestAsyncAdminBuilder {
|
|||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(ASYNC_CONN);
|
||||
Closeables.close(ASYNC_CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.junit.Assert.assertFalse;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.master.HMaster;
|
||||
|
@ -37,6 +36,8 @@ import org.junit.ClassRule;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
/**
|
||||
* Only used to test stopMaster/stopRegionServer/shutdown methods.
|
||||
*/
|
||||
|
@ -71,7 +72,7 @@ public class TestAsyncClusterAdminApi2 extends TestAsyncAdminBase {
|
|||
@After
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(ASYNC_CONN);
|
||||
Closeables.close(ASYNC_CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.client;
|
|||
|
||||
import static org.apache.hadoop.hbase.client.RegionReplicaTestHelper.testLocator;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HRegionLocation;
|
||||
|
@ -34,6 +33,8 @@ import org.junit.ClassRule;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestAsyncMetaRegionLocator {
|
||||
|
||||
|
@ -60,7 +61,7 @@ public class TestAsyncMetaRegionLocator {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(REGISTRY);
|
||||
Closeables.close(REGISTRY, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.IntStream;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
|
@ -63,6 +62,8 @@ import org.junit.runners.Parameterized;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
@RunWith(Parameterized.class)
|
||||
public class TestAsyncNonMetaRegionLocator {
|
||||
|
@ -116,7 +117,7 @@ public class TestAsyncNonMetaRegionLocator {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(CONN);
|
||||
Closeables.close(CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.IntStream;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
|
@ -55,6 +54,8 @@ import org.junit.ClassRule;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestAsyncNonMetaRegionLocatorConcurrenyLimit {
|
||||
|
||||
|
@ -136,7 +137,7 @@ public class TestAsyncNonMetaRegionLocatorConcurrenyLimit {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(CONN);
|
||||
Closeables.close(CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.util.concurrent.CompletionException;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
|
@ -56,6 +55,8 @@ import org.junit.ClassRule;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestAsyncRegionLocator {
|
||||
|
||||
|
@ -107,7 +108,7 @@ public class TestAsyncRegionLocator {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(CONN);
|
||||
Closeables.close(CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HRegionLocation;
|
||||
|
@ -44,6 +43,8 @@ import org.junit.ClassRule;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestAsyncSingleRequestRpcRetryingCaller {
|
||||
|
||||
|
@ -79,7 +80,7 @@ public class TestAsyncSingleRequestRpcRetryingCaller {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
IOUtils.closeQuietly(CONN);
|
||||
Closeables.close(CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.IntStream;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.CompareOperator;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
|
@ -71,6 +70,8 @@ import org.junit.runners.Parameterized;
|
|||
import org.junit.runners.Parameterized.Parameter;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestAsyncTable {
|
||||
|
@ -128,7 +129,7 @@ public class TestAsyncTable {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
IOUtils.closeQuietly(ASYNC_CONN);
|
||||
Closeables.close(ASYNC_CONN, true);
|
||||
assertTrue(ASYNC_CONN.isClosed());
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ import static org.junit.Assert.assertFalse;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
|
@ -34,6 +33,8 @@ import org.junit.ClassRule;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
/**
|
||||
* Fix an infinite loop in {@link AsyncNonMetaRegionLocator}, see the comments on HBASE-21943 for
|
||||
* more details.
|
||||
|
@ -69,7 +70,7 @@ public class TestAsyncTableLocateRegionForDeletedTable {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
IOUtils.closeQuietly(ASYNC_CONN);
|
||||
Closeables.close(ASYNC_CONN, true);
|
||||
assertTrue(ASYNC_CONN.isClosed());
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Optional;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
|
@ -47,6 +46,8 @@ import org.junit.Test;
|
|||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.rules.TestName;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestAsyncTableNoncedRetry {
|
||||
|
||||
|
@ -114,7 +115,7 @@ public class TestAsyncTableNoncedRetry {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDownAfterClass() throws Exception {
|
||||
IOUtils.closeQuietly(ASYNC_CONN);
|
||||
Closeables.close(ASYNC_CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.PrivateCellUtil;
|
||||
|
@ -45,6 +44,8 @@ import org.junit.runners.Parameterized;
|
|||
import org.junit.runners.Parameterized.Parameter;
|
||||
import org.junit.runners.Parameterized.Parameters;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestAsyncTableScanMetrics {
|
||||
|
@ -105,7 +106,7 @@ public class TestAsyncTableScanMetrics {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(CONN);
|
||||
Closeables.close(CONN, true);
|
||||
UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ import static org.apache.hadoop.hbase.HConstants.EMPTY_START_ROW;
|
|||
import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
|
@ -40,6 +40,8 @@ import org.junit.experimental.categories.Category;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestCatalogReplicaLoadBalanceSimpleSelector {
|
||||
|
||||
|
@ -80,7 +82,7 @@ public class TestCatalogReplicaLoadBalanceSimpleSelector {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(CONN);
|
||||
Closeables.close(CONN, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import static org.junit.Assert.assertFalse;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
|
@ -48,6 +47,8 @@ import org.junit.ClassRule;
|
|||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({SmallTests.class, MasterTests.class })
|
||||
public class TestMetaRegionLocationCache {
|
||||
@ClassRule
|
||||
|
@ -68,7 +69,7 @@ public class TestMetaRegionLocationCache {
|
|||
|
||||
@AfterClass
|
||||
public static void cleanUp() throws Exception {
|
||||
IOUtils.closeQuietly(REGISTRY);
|
||||
Closeables.close(REGISTRY, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import static org.junit.Assert.fail;
|
|||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.IntStream;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
|
@ -48,6 +47,8 @@ import org.junit.experimental.categories.Category;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ MediumTests.class, ClientTests.class })
|
||||
public class TestZKConnectionRegistry {
|
||||
|
||||
|
@ -69,7 +70,7 @@ public class TestZKConnectionRegistry {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(REGISTRY);
|
||||
Closeables.close(REGISTRY, true);
|
||||
TEST_UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.CatalogFamilyFormat;
|
||||
import org.apache.hadoop.hbase.ClientMetaTableAccessor;
|
||||
|
@ -107,7 +106,8 @@ public class TestMasterOperationsForRegionReplicas {
|
|||
}
|
||||
|
||||
private static void resetConnections() throws IOException {
|
||||
IOUtils.closeQuietly(ADMIN, CONNECTION);
|
||||
Closeables.close(ADMIN, true);
|
||||
Closeables.close(CONNECTION, true);
|
||||
CONNECTION = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
|
||||
ADMIN = CONNECTION.getAdmin();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import java.util.Random;
|
|||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.stream.Collectors;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.CatalogFamilyFormat;
|
||||
import org.apache.hadoop.hbase.ChoreService;
|
||||
|
@ -306,24 +305,15 @@ public class TestEndToEndSplitTransaction {
|
|||
|
||||
/** verify region boundaries obtained from HTable.getStartEndKeys() */
|
||||
void verifyRegionsUsingHTable() throws IOException {
|
||||
Table table = null;
|
||||
try {
|
||||
// HTable.getStartEndKeys()
|
||||
table = connection.getTable(tableName);
|
||||
try (RegionLocator rl = connection.getRegionLocator(tableName)) {
|
||||
Pair<byte[][], byte[][]> keys = rl.getStartEndKeys();
|
||||
verifyStartEndKeys(keys);
|
||||
|
||||
try (RegionLocator rl = connection.getRegionLocator(tableName)) {
|
||||
Pair<byte[][], byte[][]> keys = rl.getStartEndKeys();
|
||||
verifyStartEndKeys(keys);
|
||||
|
||||
Set<RegionInfo> regions = new TreeSet<>(RegionInfo.COMPARATOR);
|
||||
for (HRegionLocation loc : rl.getAllRegionLocations()) {
|
||||
regions.add(loc.getRegion());
|
||||
}
|
||||
verifyTableRegions(regions);
|
||||
Set<RegionInfo> regions = new TreeSet<>(RegionInfo.COMPARATOR);
|
||||
for (HRegionLocation loc : rl.getAllRegionLocations()) {
|
||||
regions.add(loc.getRegion());
|
||||
}
|
||||
|
||||
} finally {
|
||||
IOUtils.closeQuietly(table);
|
||||
verifyTableRegions(regions);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
|
@ -116,6 +115,7 @@ import org.mockito.Mockito;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
import org.apache.hbase.thirdparty.com.google.protobuf.RpcController;
|
||||
import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException;
|
||||
|
||||
|
@ -900,7 +900,7 @@ public class TestSplitTransactionOnCluster {
|
|||
HMaster master = cluster.startMaster().getMaster();
|
||||
cluster.waitForActiveAndReadyMaster();
|
||||
// reset the connections
|
||||
IOUtils.closeQuietly(admin);
|
||||
Closeables.close(admin, true);
|
||||
TESTING_UTIL.invalidateConnection();
|
||||
admin = TESTING_UTIL.getAdmin();
|
||||
return master;
|
||||
|
|
|
@ -20,10 +20,10 @@ package org.apache.hadoop.hbase.replication;
|
|||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileSystem;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
|
@ -53,8 +53,10 @@ import org.junit.Before;
|
|||
import org.junit.BeforeClass;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
|
||||
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap;
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
/**
|
||||
* This class is only a base for other integration-level replication tests.
|
||||
|
@ -209,9 +211,9 @@ public class TestReplicationBase {
|
|||
conf2.setBoolean("hbase.tests.use.shortcircuit.reads", false);
|
||||
}
|
||||
|
||||
static void restartSourceCluster(int numSlaves)
|
||||
throws Exception {
|
||||
IOUtils.closeQuietly(hbaseAdmin, htable1);
|
||||
static void restartSourceCluster(int numSlaves) throws Exception {
|
||||
Closeables.close(hbaseAdmin, true);
|
||||
Closeables.close(htable1, true);
|
||||
UTIL1.shutdownMiniHBaseCluster();
|
||||
UTIL1.restartHBaseCluster(numSlaves);
|
||||
// Invalidate the cached connection state.
|
||||
|
@ -222,7 +224,7 @@ public class TestReplicationBase {
|
|||
}
|
||||
|
||||
static void restartTargetHBaseCluster(int numSlaves) throws Exception {
|
||||
IOUtils.closeQuietly(htable2);
|
||||
Closeables.close(htable2, true);
|
||||
UTIL2.restartHBaseCluster(numSlaves);
|
||||
// Invalidate the cached connection state
|
||||
CONF2 = UTIL2.getConfiguration();
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.replication;
|
|||
|
||||
import static org.apache.hadoop.hbase.HConstants.REPLICATION_SCOPE_GLOBAL;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.TableName;
|
||||
|
@ -143,24 +142,28 @@ public abstract class TestReplicationSyncUpToolBase {
|
|||
// Utilities that manager shutdown / restart of source / sink clusters. They take care of
|
||||
// invalidating stale connections after shutdown / restarts.
|
||||
final void shutDownSourceHBaseCluster() throws Exception {
|
||||
IOUtils.closeQuietly(ht1Source, ht2Source);
|
||||
Closeables.close(ht1Source, true);
|
||||
Closeables.close(ht2Source, true);
|
||||
UTIL1.shutdownMiniHBaseCluster();
|
||||
}
|
||||
|
||||
final void shutDownTargetHBaseCluster() throws Exception {
|
||||
IOUtils.closeQuietly(ht1TargetAtPeer1, ht2TargetAtPeer1);
|
||||
Closeables.close(ht1TargetAtPeer1, true);
|
||||
Closeables.close(ht2TargetAtPeer1, true);
|
||||
UTIL2.shutdownMiniHBaseCluster();
|
||||
}
|
||||
|
||||
final void restartSourceHBaseCluster(int numServers) throws Exception {
|
||||
IOUtils.closeQuietly(ht1Source, ht2Source);
|
||||
Closeables.close(ht1Source, true);
|
||||
Closeables.close(ht2Source, true);
|
||||
UTIL1.restartHBaseCluster(numServers);
|
||||
ht1Source = UTIL1.getConnection().getTable(TN1);
|
||||
ht2Source = UTIL1.getConnection().getTable(TN2);
|
||||
}
|
||||
|
||||
final void restartTargetHBaseCluster(int numServers) throws Exception {
|
||||
IOUtils.closeQuietly(ht1TargetAtPeer1, ht2TargetAtPeer1);
|
||||
Closeables.close(ht1TargetAtPeer1, true);
|
||||
Closeables.close(ht2TargetAtPeer1, true);
|
||||
UTIL2.restartHBaseCluster(numServers);
|
||||
ht1TargetAtPeer1 = UTIL2.getConnection().getTable(TN1);
|
||||
ht2TargetAtPeer1 = UTIL2.getConnection().getTable(TN2);
|
||||
|
|
|
@ -25,8 +25,6 @@ import java.util.List;
|
|||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.hbase.Cell;
|
||||
import org.apache.hadoop.hbase.HBaseClassTestRule;
|
||||
|
@ -56,6 +54,7 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList;
|
||||
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap;
|
||||
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
|
||||
|
||||
@Category({ ReplicationTests.class, MediumTests.class })
|
||||
public class TestSerialReplicationEndpoint {
|
||||
|
@ -78,7 +77,7 @@ public class TestSerialReplicationEndpoint {
|
|||
|
||||
@AfterClass
|
||||
public static void tearDown() throws Exception {
|
||||
IOUtils.closeQuietly(CONN);
|
||||
Closeables.close(CONN, true);
|
||||
UTIL.shutdownMiniCluster();
|
||||
}
|
||||
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -1611,7 +1611,7 @@
|
|||
<commons-codec.version>1.13</commons-codec.version>
|
||||
<commons-validator.version>1.6</commons-validator.version>
|
||||
<!-- pretty outdated -->
|
||||
<commons-io.version>2.6</commons-io.version>
|
||||
<commons-io.version>2.8.0</commons-io.version>
|
||||
<commons-lang3.version>3.9</commons-lang3.version>
|
||||
<commons-math.version>3.6.1</commons-math.version>
|
||||
<disruptor.version>3.4.2</disruptor.version>
|
||||
|
|
Loading…
Reference in New Issue