HBASE-19348 Fix error-prone errors for branch-1
Signed-off-by: Andrew Purtell <apurtell@apache.org>
This commit is contained in:
parent
f7f425e53e
commit
24d82195cb
|
@ -70,7 +70,6 @@ public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPr
|
|||
RegionServerStatusProtos.ReportRegionStateTransitionRequest
|
||||
tRequest = (RegionServerStatusProtos.ReportRegionStateTransitionRequest) param;
|
||||
for (RegionServerStatusProtos.RegionStateTransition rst : tRequest.getTransitionList()) {
|
||||
if (rst.getRegionInfoList() != null) {
|
||||
for (HBaseProtos.RegionInfo info : rst.getRegionInfoList()) {
|
||||
TableName tn = ProtobufUtil.toTableName(info.getTableName());
|
||||
if (tn.isSystemTable()) {
|
||||
|
@ -78,7 +77,6 @@ public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPr
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return HConstants.NORMAL_QOS;
|
||||
}
|
||||
|
||||
|
|
|
@ -183,8 +183,8 @@ implements ServerProcedureInterface {
|
|||
LOG.trace(state);
|
||||
}
|
||||
// Keep running count of cycles
|
||||
if (state.ordinal() != this.previousState) {
|
||||
this.previousState = state.ordinal();
|
||||
if (state.getNumber() != this.previousState) {
|
||||
this.previousState = state.getNumber();
|
||||
this.cycles = 0;
|
||||
} else {
|
||||
this.cycles++;
|
||||
|
|
|
@ -123,7 +123,6 @@ public class CloneSnapshotHandler extends CreateTableHandler implements Snapshot
|
|||
|
||||
// Clone acl of snapshot into newly created table.
|
||||
if (restoreAcl && snapshot.hasUsersAndPermissions()
|
||||
&& snapshot.getUsersAndPermissions() != null
|
||||
&& SnapshotDescriptionUtils.isSecurityAvailable(conf)) {
|
||||
RestoreSnapshotHelper.restoreSnapshotACL(snapshot, tableName, conf);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ public class TestCompare extends TestCase {
|
|||
/**
|
||||
* Sort of HRegionInfo.
|
||||
*/
|
||||
@SuppressWarnings({"SelfComparison"})
|
||||
public void testHRegionInfo() {
|
||||
HRegionInfo a = new HRegionInfo(TableName.valueOf("a"), null, null);
|
||||
HRegionInfo b = new HRegionInfo(TableName.valueOf("b"), null, null);
|
||||
|
|
|
@ -62,6 +62,7 @@ public class TestHRegionLocation {
|
|||
System.out.println(hrl1.toString());
|
||||
}
|
||||
|
||||
@SuppressWarnings("SelfComparison")
|
||||
@Test
|
||||
public void testCompareTo() {
|
||||
ServerName hsa1 = ServerName.valueOf("localhost", 1234, -1L);
|
||||
|
|
|
@ -123,7 +123,7 @@ public class TestIPv6NIOServerSocketChannel {
|
|||
//On Windows JDK6, we will get expected exception:
|
||||
//java.net.SocketException: Address family not supported by protocol family
|
||||
//or java.net.SocketException: Protocol family not supported
|
||||
Assert.assertFalse(ex.getClass().isInstance(BindException.class));
|
||||
Assert.assertFalse(ex instanceof BindException);
|
||||
Assert.assertTrue(ex.getMessage().toLowerCase(Locale.ROOT).contains("protocol family"));
|
||||
LOG.info("Received expected exception:");
|
||||
LOG.info(ex);
|
||||
|
|
|
@ -69,6 +69,7 @@ import org.junit.AfterClass;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
|
@ -141,7 +142,8 @@ public class TestZooKeeper {
|
|||
* @throws InterruptedException
|
||||
*/
|
||||
// fails frequently, disabled for now, see HBASE-6406
|
||||
//@Test
|
||||
@Ignore
|
||||
@Test
|
||||
public void testClientSessionExpired() throws Exception {
|
||||
Configuration c = new Configuration(TEST_UTIL.getConfiguration());
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public class TestMetaScanner {
|
|||
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||
private Connection connection;
|
||||
|
||||
@SuppressWarnings("JUnit4SetUpNotRun")
|
||||
public void setUp() throws Exception {
|
||||
TEST_UTIL.startMiniCluster(1);
|
||||
this.connection = TEST_UTIL.getConnection();
|
||||
|
|
|
@ -217,6 +217,7 @@ public class TestScannersFromClientSide2 {
|
|||
testScan(456, false, 678, false, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReversedScanWithLimit() throws Exception {
|
||||
testReversedScan(998, true, 1, false, 900); // from last region to first region
|
||||
testReversedScan(543, true, 321, true, 100);
|
||||
|
|
|
@ -272,9 +272,7 @@ public class TestCoprocessorInterface {
|
|||
@Override
|
||||
public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e,
|
||||
final Get get, final List<Cell> results) throws IOException {
|
||||
if (1/0 == 1) {
|
||||
e.complete();
|
||||
}
|
||||
throw new RuntimeException();
|
||||
}
|
||||
|
||||
Map<String, Object> getSharedData() {
|
||||
|
|
|
@ -2049,6 +2049,7 @@ public class TestFilter {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNestedFilterListWithSCVF() throws IOException {
|
||||
byte[] columnStatus = Bytes.toBytes("S");
|
||||
HTableDescriptor htd = new HTableDescriptor(TableName.valueOf("testNestedFilterListWithSCVF"));
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.apache.hadoop.hbase.client.Table;
|
|||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
|
@ -232,7 +233,7 @@ public class TestMasterOperationsForRegionReplicas {
|
|||
}
|
||||
}
|
||||
|
||||
//@Test (TODO: enable when we have support for alter_table- HBASE-10361).
|
||||
@Test
|
||||
public void testIncompleteMetaTableReplicaInformation() throws Exception {
|
||||
final TableName table = TableName.valueOf("fooTableTest1");
|
||||
final int numRegions = 3;
|
||||
|
|
|
@ -488,6 +488,8 @@ public class TestMasterProcedureScheduler {
|
|||
case READ:
|
||||
queue.releaseTableSharedLock(proc, getTableName(proc));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,9 @@ public class TestWALProcedureStoreOnHDFS {
|
|||
}
|
||||
};
|
||||
|
||||
private static void initConfig(Configuration conf) {
|
||||
@Before
|
||||
public void initConfig() {
|
||||
Configuration conf = UTIL.getConfiguration();
|
||||
conf.setInt("dfs.replication", 3);
|
||||
conf.setInt("dfs.namenode.replication.min", 3);
|
||||
|
||||
|
@ -93,7 +95,8 @@ public class TestWALProcedureStoreOnHDFS {
|
|||
conf.setInt(WALProcedureStore.MAX_SYNC_FAILURE_ROLL_CONF_KEY, 10);
|
||||
}
|
||||
|
||||
public void setup() throws Exception {
|
||||
// No @Before because some tests need to do additional config first
|
||||
private void setup() throws Exception {
|
||||
MiniDFSCluster dfs = UTIL.startMiniDFSCluster(3);
|
||||
|
||||
Path logDir = new Path(new Path(dfs.getFileSystem().getUri()), "/test-logs");
|
||||
|
@ -103,6 +106,7 @@ public class TestWALProcedureStoreOnHDFS {
|
|||
store.recoverLease();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
store.stop(false);
|
||||
UTIL.getDFSCluster().getFileSystem().delete(store.getWALDir(), true);
|
||||
|
@ -116,9 +120,7 @@ public class TestWALProcedureStoreOnHDFS {
|
|||
|
||||
@Test(timeout=60000, expected=RuntimeException.class)
|
||||
public void testWalAbortOnLowReplication() throws Exception {
|
||||
initConfig(UTIL.getConfiguration());
|
||||
setup();
|
||||
try {
|
||||
assertEquals(3, UTIL.getDFSCluster().getDataNodes().size());
|
||||
|
||||
LOG.info("Stop DataNode");
|
||||
|
@ -133,16 +135,11 @@ public class TestWALProcedureStoreOnHDFS {
|
|||
}
|
||||
assertFalse(store.isRunning());
|
||||
fail("The store.insert() should throw an exeption");
|
||||
} finally {
|
||||
tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout=60000)
|
||||
public void testWalAbortOnLowReplicationWithQueuedWriters() throws Exception {
|
||||
initConfig(UTIL.getConfiguration());
|
||||
setup();
|
||||
try {
|
||||
assertEquals(3, UTIL.getDFSCluster().getDataNodes().size());
|
||||
store.registerListener(new ProcedureStore.ProcedureStoreListener() {
|
||||
@Override
|
||||
|
@ -185,17 +182,12 @@ public class TestWALProcedureStoreOnHDFS {
|
|||
assertFalse(store.isRunning());
|
||||
assertTrue(reCount.toString(), reCount.get() >= store.getNumThreads() &&
|
||||
reCount.get() < thread.length);
|
||||
} finally {
|
||||
tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Test(timeout=60000)
|
||||
public void testWalRollOnLowReplication() throws Exception {
|
||||
initConfig(UTIL.getConfiguration());
|
||||
UTIL.getConfiguration().setInt("dfs.namenode.replication.min", 1);
|
||||
setup();
|
||||
try {
|
||||
int dnCount = 0;
|
||||
store.insert(new TestProcedure(1, -1), null);
|
||||
UTIL.getDFSCluster().restartDataNode(dnCount);
|
||||
|
@ -209,9 +201,6 @@ public class TestWALProcedureStoreOnHDFS {
|
|||
}
|
||||
}
|
||||
assertTrue(store.isRunning());
|
||||
} finally {
|
||||
tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
public void waitForNumReplicas(int numReplicas) throws Exception {
|
||||
|
|
Loading…
Reference in New Issue