HBASE-19811 Fix findbugs and error-prone warnings in hbase-server (branch-2)
Signed-off-by: Michael Stack <st...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/b1269ec5 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/b1269ec5 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/b1269ec5 Branch: refs/heads/branch-2 Commit: b1269ec57ff77f4077516fb4f866e2fe7ede3a3e Parents: 1e5fc1e Author: Peter Somogyi <psomo...@cloudera.com> Authored: Mon Jan 22 15:32:06 2018 +0100 Committer: Michael Stack <st...@apache.org> Committed: Mon Jan 22 17:14:15 2018 -0800 ---------------------------------------------------------------------- .../hbase/SslRMIServerSocketFactorySecure.java | 1 + .../hadoop/hbase/client/locking/EntityLock.java | 1 + .../hadoop/hbase/conf/ConfigurationManager.java | 2 +- .../ZkSplitLogWorkerCoordination.java | 2 +- .../coprocessor/BaseRowProcessorEndpoint.java | 8 +- .../hbase/coprocessor/CoprocessorHost.java | 1 + .../hbase/coprocessor/ObserverContextImpl.java | 3 + .../coprocessor/ReadOnlyConfiguration.java | 14 +- .../hadoop/hbase/filter/FilterWrapper.java | 1 + .../org/apache/hadoop/hbase/fs/HFileSystem.java | 83 ++-- .../hbase/io/FSDataInputStreamWrapper.java | 11 +- .../hadoop/hbase/io/HalfStoreFileReader.java | 8 + .../org/apache/hadoop/hbase/io/Reference.java | 1 + .../asyncfs/FanOutOneBlockAsyncDFSOutput.java | 1 + .../hadoop/hbase/io/hfile/BlockCache.java | 1 + .../hbase/io/hfile/CompoundBloomFilter.java | 1 + .../hadoop/hbase/io/hfile/FixedFileTrailer.java | 10 +- .../hadoop/hbase/io/hfile/HFileBlock.java | 68 +-- .../hadoop/hbase/io/hfile/HFileReaderImpl.java | 2 +- .../hadoop/hbase/io/hfile/HFileScanner.java | 1 + .../hadoop/hbase/io/hfile/LruBlockCache.java | 4 + .../hadoop/hbase/io/hfile/LruCachedBlock.java | 1 + .../hbase/io/hfile/LruCachedBlockQueue.java | 1 + .../hbase/io/hfile/bucket/BucketAllocator.java | 1 + .../hbase/io/hfile/bucket/BucketCache.java | 18 +- .../hbase/io/hfile/bucket/CachedEntryQueue.java | 1 + .../apache/hadoop/hbase/ipc/BufferChain.java | 2 +- .../ipc/FastPathBalancedQueueRpcExecutor.java | 1 + .../hadoop/hbase/ipc/ServerRpcConnection.java | 5 +- .../hadoop/hbase/ipc/SimpleRpcServer.java | 1 + .../hbase/master/ClusterStatusPublisher.java | 9 +- .../apache/hadoop/hbase/master/DeadServer.java | 1 + .../hadoop/hbase/master/HMasterCommandLine.java | 3 +- .../hadoop/hbase/master/LoadBalancer.java | 1 + ...MasterAnnotationReadingPriorityFunction.java | 1 + .../hbase/master/MasterCoprocessorHost.java | 1 + .../hadoop/hbase/master/MobCompactionChore.java | 2 +- .../hbase/master/RegionServerTracker.java | 2 +- .../hadoop/hbase/master/SplitLogManager.java | 2 +- .../assignment/MergeTableRegionsProcedure.java | 2 +- .../hbase/master/assignment/RegionStates.java | 7 +- .../balancer/FavoredStochasticBalancer.java | 5 +- .../master/balancer/RegionLocationFinder.java | 27 +- .../master/balancer/SimpleLoadBalancer.java | 1 + .../master/balancer/StochasticLoadBalancer.java | 6 +- .../hbase/master/cleaner/CleanerChore.java | 4 +- .../hbase/master/cleaner/HFileCleaner.java | 2 +- .../hadoop/hbase/master/cleaner/LogCleaner.java | 2 +- .../hbase/master/locking/LockProcedure.java | 2 +- .../master/procedure/ProcedurePrepareLatch.java | 4 + .../master/procedure/RSProcedureDispatcher.java | 9 + .../master/snapshot/SnapshotHFileCleaner.java | 2 + .../apache/hadoop/hbase/mob/CachedMobFile.java | 1 + .../hadoop/hbase/mob/ExpiredMobFileCleaner.java | 1 + .../PartitionedMobCompactionRequest.java | 1 + .../monitoring/MonitoredRPCHandlerImpl.java | 12 + .../hbase/monitoring/MonitoredTaskImpl.java | 1 + .../hadoop/hbase/monitoring/TaskMonitor.java | 2 +- .../hadoop/hbase/procedure/Procedure.java | 2 +- .../hbase/procedure/ProcedureManagerHost.java | 6 +- .../hadoop/hbase/procedure/Subprocedure.java | 1 + .../hbase/procedure/ZKProcedureCoordinator.java | 12 +- .../hbase/procedure/ZKProcedureMemberRpcs.java | 1 + .../hadoop/hbase/procedure/ZKProcedureUtil.java | 1 + .../hadoop/hbase/quotas/MasterQuotaManager.java | 4 +- .../hadoop/hbase/quotas/QuotaObserverChore.java | 3 +- .../apache/hadoop/hbase/quotas/RateLimiter.java | 1 + .../quotas/RegionServerSpaceQuotaManager.java | 2 +- .../SpaceQuotaSnapshotNotifierFactory.java | 4 +- .../hbase/regionserver/AbstractMemStore.java | 2 +- .../AdaptiveMemStoreCompactionStrategy.java | 3 + .../regionserver/CellChunkImmutableSegment.java | 2 +- .../hadoop/hbase/regionserver/CellSet.java | 30 ++ .../hbase/regionserver/CompactingMemStore.java | 4 +- .../regionserver/CompositeImmutableSegment.java | 1 + .../regionserver/DateTieredStoreEngine.java | 1 + .../hbase/regionserver/DefaultStoreFlusher.java | 8 +- .../hadoop/hbase/regionserver/HMobStore.java | 56 +-- .../hadoop/hbase/regionserver/HRegion.java | 5 +- .../hbase/regionserver/HRegionServer.java | 10 +- .../regionserver/HRegionServerCommandLine.java | 2 + .../hadoop/hbase/regionserver/HStore.java | 84 ++-- ...IncreasingToUpperBoundRegionSplitPolicy.java | 2 +- .../hbase/regionserver/InternalScanner.java | 1 + .../hadoop/hbase/regionserver/KeyValueHeap.java | 5 + .../hbase/regionserver/KeyValueScanner.java | 1 + .../hbase/regionserver/MemStoreCompactor.java | 4 +- .../hbase/regionserver/MemStoreFlusher.java | 8 +- .../MemStoreMergerSegmentsIterator.java | 1 + .../MetricsRegionServerWrapperImpl.java | 4 +- .../regionserver/MetricsRegionWrapperImpl.java | 2 +- .../MultiVersionConcurrencyControl.java | 9 +- .../hbase/regionserver/RSRpcServices.java | 2 +- .../RegionServerCoprocessorHost.java | 1 + .../hbase/regionserver/ScannerContext.java | 8 +- .../hbase/regionserver/ServerNonceManager.java | 2 +- .../hbase/regionserver/SteppingSplitPolicy.java | 1 + .../hbase/regionserver/StoreFileScanner.java | 6 + .../hbase/regionserver/StripeStoreFlusher.java | 8 +- .../regionserver/compactions/Compactor.java | 7 +- .../compactions/DateTieredCompactionPolicy.java | 1 + .../compactions/RatioBasedCompactionPolicy.java | 1 + .../compactions/SortedCompactionPolicy.java | 2 + .../querymatcher/ExplicitColumnTracker.java | 4 + .../querymatcher/ScanWildcardColumnTracker.java | 2 + .../hbase/regionserver/wal/AsyncFSWAL.java | 2 +- .../hadoop/hbase/regionserver/wal/FSHLog.java | 20 +- .../hbase/regionserver/wal/FSWALEntry.java | 1 + .../regionserver/wal/ProtobufLogReader.java | 6 +- .../replication/BaseReplicationEndpoint.java | 2 +- .../DefaultSourceFSConfigurationProvider.java | 2 +- .../replication/regionserver/Replication.java | 5 + .../regionserver/ReplicationSink.java | 4 +- .../regionserver/ReplicationSource.java | 19 +- .../regionserver/ReplicationSourceManager.java | 2 +- .../ReplicationSourceWALReader.java | 3 +- .../security/access/AccessControlFilter.java | 1 + .../hbase/security/access/AccessController.java | 4 +- .../hbase/security/access/AuthResult.java | 2 + .../token/AuthenticationTokenSecretManager.java | 1 + .../security/visibility/ExpressionParser.java | 4 +- .../visibility/VisibilityController.java | 4 +- .../VisibilityNewVersionBehaivorTracker.java | 2 +- .../expression/LeafExpressionNode.java | 1 + .../expression/NonLeafExpressionNode.java | 1 + .../visibility/expression/Operator.java | 3 +- .../hadoop/hbase/snapshot/SnapshotInfo.java | 6 +- .../hbase/snapshot/SnapshotManifestV1.java | 5 + .../hbase/snapshot/SnapshotManifestV2.java | 5 + .../hbase/tool/LoadIncrementalHFiles.java | 2 +- .../util/BoundedPriorityBlockingQueue.java | 14 + .../apache/hadoop/hbase/util/FSMapRUtils.java | 1 + .../hadoop/hbase/util/FSRegionScanner.java | 2 +- .../hadoop/hbase/util/FSTableDescriptors.java | 2 +- .../org/apache/hadoop/hbase/util/HBaseFsck.java | 6 +- .../org/apache/hadoop/hbase/util/IdLock.java | 1 + .../hadoop/hbase/util/RegionSplitter.java | 2 +- .../hadoop/hbase/util/RowBloomContext.java | 1 + .../hadoop/hbase/util/ShutdownHookManager.java | 6 +- .../hadoop/hbase/wal/AbstractFSWALProvider.java | 3 +- .../hadoop/hbase/wal/DisabledWALProvider.java | 3 +- .../apache/hadoop/hbase/wal/FSHLogProvider.java | 2 +- .../hbase/wal/RegionGroupingProvider.java | 13 +- .../java/org/apache/hadoop/hbase/wal/WAL.java | 1 + .../org/apache/hadoop/hbase/wal/WALFactory.java | 16 +- .../org/apache/hadoop/hbase/wal/WALKeyImpl.java | 4 +- .../apache/hadoop/hbase/wal/WALSplitter.java | 6 +- .../hadoop/hbase/AcidGuaranteesTestTool.java | 4 + .../org/apache/hadoop/hbase/HBaseTestCase.java | 3 +- .../hadoop/hbase/HBaseTestingUtility.java | 9 +- .../apache/hadoop/hbase/MiniHBaseCluster.java | 7 +- .../hadoop/hbase/MultithreadedTestUtil.java | 2 + .../hbase/TestHDFSBlocksDistribution.java | 1 + .../org/apache/hadoop/hbase/TestIOFencing.java | 11 +- .../hbase/TestMetaTableAccessorNoCluster.java | 1 + .../hadoop/hbase/TestMetaTableLocator.java | 6 +- .../hadoop/hbase/TestMovedRegionsCleaner.java | 1 + .../apache/hadoop/hbase/TestMultiVersions.java | 2 + .../org/apache/hadoop/hbase/TestServerName.java | 5 +- ...TestServerSideScanMetricsFromClientSide.java | 8 +- .../apache/hadoop/hbase/client/TestAdmin1.java | 2 +- .../apache/hadoop/hbase/client/TestAdmin2.java | 11 +- .../hbase/client/TestAsyncClusterAdminApi2.java | 2 + .../client/TestAsyncDecommissionAdminApi.java | 2 +- .../client/TestAsyncProcedureAdminApi.java | 2 +- .../hbase/client/TestAsyncRegionAdminApi.java | 25 +- ...estAsyncReplicationAdminApiWithClusters.java | 1 + .../hbase/client/TestAsyncSnapshotAdminApi.java | 105 +++-- .../hbase/client/TestAsyncTableAdminApi.java | 2 +- .../hbase/client/TestAsyncTableBatch.java | 6 +- ...estAvoidCellReferencesIntoShippedBlocks.java | 15 +- .../hadoop/hbase/client/TestClientPushback.java | 8 +- .../client/TestConnectionImplementation.java | 3 +- .../hadoop/hbase/client/TestFastFail.java | 3 +- .../hadoop/hbase/client/TestFromClientSide.java | 356 ++++++++-------- .../hbase/client/TestFromClientSide3.java | 58 +-- .../hadoop/hbase/client/TestMetaCache.java | 3 + .../hbase/client/TestMultipleTimestamps.java | 4 +- .../hadoop/hbase/client/TestReplicasClient.java | 14 +- .../client/TestRestoreSnapshotFromClient.java | 2 +- .../apache/hadoop/hbase/client/TestResult.java | 4 +- .../hbase/client/TestServerBusyException.java | 4 +- .../hadoop/hbase/client/TestSizeFailures.java | 4 +- .../hbase/client/TestSmallReversedScanner.java | 4 +- .../hbase/client/TestSnapshotFromClient.java | 2 +- .../hbase/client/TestSnapshotMetadata.java | 4 +- .../hbase/client/TestSnapshotWithAcl.java | 2 +- .../hbase/client/TestSplitOrMergeStatus.java | 8 +- .../hbase/client/TestTimestampsFilter.java | 20 +- .../hbase/client/TestUpdateConfiguration.java | 17 +- .../TestReplicationAdminWithClusters.java | 10 +- .../hbase/conf/TestConfigurationManager.java | 1 + .../hadoop/hbase/constraint/TestConstraint.java | 10 +- .../coprocessor/SampleRegionWALCoprocessor.java | 3 +- .../hbase/coprocessor/SimpleRegionObserver.java | 4 +- .../TestCoprocessorConfiguration.java | 14 +- .../hbase/coprocessor/TestCoprocessorHost.java | 2 +- ...TestMasterCoprocessorExceptionWithAbort.java | 2 +- .../hbase/coprocessor/TestMasterObserver.java | 1 + .../hbase/coprocessor/TestWALObserver.java | 1 + .../hbase/executor/TestExecutorService.java | 2 +- .../hadoop/hbase/filter/TestBitComparator.java | 8 +- .../apache/hadoop/hbase/filter/TestFilter.java | 9 +- .../hbase/filter/TestFilterFromRegionSide.java | 1 + .../hadoop/hbase/filter/TestFilterList.java | 3 +- .../hbase/filter/TestFilterSerialization.java | 4 +- .../filter/TestFuzzyRowFilterEndToEnd.java | 2 +- .../filter/TestInvocationRecordFilter.java | 4 + .../hadoop/hbase/filter/TestParseFilter.java | 144 ++++--- .../TestSingleColumnValueExcludeFilter.java | 2 +- .../hadoop/hbase/fs/TestBlockReorder.java | 5 +- .../apache/hadoop/hbase/io/TestHFileLink.java | 2 +- .../apache/hadoop/hbase/io/TestHeapSize.java | 4 +- .../encoding/TestBufferedDataBlockEncoder.java | 12 +- .../io/encoding/TestDataBlockEncoders.java | 18 +- .../encoding/TestLoadAndSwitchEncodeOnDisk.java | 2 + .../encoding/TestSeekBeforeWithReverseScan.java | 12 +- .../hadoop/hbase/io/hfile/CacheTestUtils.java | 9 +- .../apache/hadoop/hbase/io/hfile/NanoTimer.java | 1 + .../hadoop/hbase/io/hfile/TestCacheOnWrite.java | 2 +- .../hadoop/hbase/io/hfile/TestHFileBlock.java | 2 +- .../hbase/io/hfile/TestHFileEncryption.java | 2 +- .../hbase/io/hfile/TestLruBlockCache.java | 4 +- .../hbase/io/hfile/bucket/TestBucketCache.java | 20 +- .../apache/hadoop/hbase/ipc/TestNettyIPC.java | 2 +- .../hadoop/hbase/ipc/TestProtoBufRpc.java | 2 +- .../hadoop/hbase/ipc/TestRpcClientLeaks.java | 7 +- .../hbase/ipc/TestSimpleRpcScheduler.java | 8 +- .../hbase/mapreduce/MapreduceTestingShim.java | 4 + .../hbase/master/TestAssignmentListener.java | 11 +- .../hadoop/hbase/master/TestMasterFailover.java | 4 +- .../hbase/master/TestMasterNoCluster.java | 1 + .../TestMasterOperationsForRegionReplicas.java | 5 +- .../hadoop/hbase/master/TestMasterShutdown.java | 1 + .../hbase/master/TestMetaShutdownHandler.java | 6 +- .../hbase/master/TestRegionPlacement.java | 4 +- .../hbase/master/TestSplitLogManager.java | 12 +- .../hbase/master/TestTableStateManager.java | 5 +- .../master/assignment/MockMasterServices.java | 2 + .../TestSplitTableRegionProcedure.java | 4 +- .../hbase/master/balancer/BalancerTestBase.java | 1 + .../hbase/master/cleaner/TestLogsCleaner.java | 1 + .../cleaner/TestReplicationHFileCleaner.java | 1 + .../master/cleaner/TestSnapshotFromMaster.java | 2 +- .../hbase/master/locking/TestLockProcedure.java | 13 +- ...ProcedureSchedulerPerformanceEvaluation.java | 4 + .../procedure/TestModifyNamespaceProcedure.java | 8 +- .../procedure/TestModifyTableProcedure.java | 25 +- .../procedure/TestWALProcedureStoreOnHDFS.java | 2 +- .../master/snapshot/TestSnapshotFileCache.java | 1 + .../snapshot/TestSnapshotHFileCleaner.java | 3 +- .../hadoop/hbase/mob/TestCachedMobFile.java | 36 +- .../apache/hadoop/hbase/mob/TestMobFile.java | 14 +- .../hadoop/hbase/mob/TestMobFileCache.java | 15 +- .../hadoop/hbase/mob/TestMobFileName.java | 11 +- .../hbase/namespace/TestNamespaceAuditor.java | 4 +- .../hadoop/hbase/procedure/TestProcedure.java | 6 +- .../procedure/TestProcedureCoordinator.java | 3 +- .../hadoop/hbase/procedure/TestZKProcedure.java | 2 +- .../hbase/quotas/TestQuotaStatusRPCs.java | 2 +- .../quotas/TestSuperUserQuotaPermissions.java | 1 + .../EncodedSeekPerformanceTest.java | 2 +- .../hbase/regionserver/MockHStoreFile.java | 2 + .../regionserver/StatefulStoreMockMaker.java | 1 + .../hbase/regionserver/TestAtomicOperation.java | 6 +- .../hbase/regionserver/TestBlocksScanned.java | 1 + .../hadoop/hbase/regionserver/TestBulkLoad.java | 6 +- .../hbase/regionserver/TestCellFlatSet.java | 25 +- .../hbase/regionserver/TestCellSkipListSet.java | 1 + .../regionserver/TestCompactingMemStore.java | 5 +- .../TestCompactingToCellFlatMapMemStore.java | 4 +- .../hbase/regionserver/TestCompaction.java | 7 +- .../TestCompactionArchiveConcurrentClose.java | 2 + .../TestCompactionFileNotFound.java | 2 +- .../hbase/regionserver/TestDefaultMemStore.java | 4 +- .../regionserver/TestGetClosestAtOrBefore.java | 3 +- .../hadoop/hbase/regionserver/TestHRegion.java | 79 ++-- .../regionserver/TestHRegionReplayEvents.java | 8 +- .../regionserver/TestHRegionServerBulkLoad.java | 2 + .../hadoop/hbase/regionserver/TestHStore.java | 9 +- .../hbase/regionserver/TestHStoreFile.java | 33 +- .../hbase/regionserver/TestKeyValueHeap.java | 3 +- .../hbase/regionserver/TestMajorCompaction.java | 9 +- .../hbase/regionserver/TestMemStoreLAB.java | 4 +- .../hbase/regionserver/TestMinorCompaction.java | 3 +- .../TestMultiVersionConcurrencyControl.java | 2 + .../hbase/regionserver/TestPriorityRpc.java | 30 +- .../hbase/regionserver/TestRegionReplicas.java | 2 +- .../TestRegionReplicasWithModifyTable.java | 12 +- .../TestRegionServerAccounting.java | 20 +- .../regionserver/TestRegionServerNoMaster.java | 12 +- .../hadoop/hbase/regionserver/TestScanner.java | 4 +- .../regionserver/TestScannerWithBulkload.java | 1 + .../hbase/regionserver/TestSplitLogWorker.java | 2 +- .../TestSplitTransactionOnCluster.java | 8 +- .../hbase/regionserver/TestStoreScanner.java | 6 + .../regionserver/TestSyncTimeRangeTracker.java | 7 +- .../hbase/regionserver/TestWALLockup.java | 2 + .../TestWalAndCompactingMemStoreFlush.java | 2 +- .../compactions/PerfTestCompactionPolicies.java | 6 +- .../regionserver/compactions/TestCompactor.java | 2 + .../querymatcher/TestUserScanQueryMatcher.java | 4 +- .../regionserver/wal/AbstractTestFSWAL.java | 2 +- .../regionserver/wal/AbstractTestWALReplay.java | 12 +- .../regionserver/wal/InstrumentedLogWriter.java | 2 +- .../replication/TestNamespaceReplication.java | 4 +- .../replication/TestPerTableCFReplication.java | 4 +- .../hbase/replication/TestReplicationBase.java | 2 +- .../TestReplicationDisableInactivePeer.java | 2 +- .../replication/TestReplicationKillRS.java | 1 + .../replication/TestReplicationSmallTests.java | 4 +- .../replication/TestReplicationSyncUpTool.java | 4 +- .../replication/TestReplicationWithTags.java | 2 +- .../TestRegionReplicaReplicationEndpoint.java | 8 +- .../regionserver/TestReplicator.java | 60 ++- .../regionserver/TestWALEntryStream.java | 2 +- .../hadoop/hbase/security/TestSecureIPC.java | 3 +- .../apache/hadoop/hbase/security/TestUser.java | 3 + .../access/TestAccessControlFilter.java | 3 + .../security/access/TestAccessController.java | 9 +- .../security/token/TestZKSecretWatcher.java | 2 + .../token/TestZKSecretWatcherRefreshKeys.java | 2 + .../TestDefaultScanLabelGeneratorStack.java | 22 +- .../TestEnforcingScanLabelGenerator.java | 4 + ...sibilityLabelReplicationWithExpAsString.java | 1 + .../visibility/TestVisibilityLabels.java | 41 +- ...sibilityLabelsOnNewVersionBehaviorTable.java | 1 + ...sibilityLabelsOpWithDifferentUsersNoACL.java | 5 + .../TestVisibilityLabelsReplication.java | 3 + .../visibility/TestVisibilityLabelsWithACL.java | 9 + ...VisibilityLabelsWithCustomVisLabService.java | 2 + ...ibilityLabelsWithDefaultVisLabelService.java | 4 + .../TestVisibilityLabelsWithDeletes.java | 426 +++++++++---------- .../TestVisibilityLabelsWithSLGStack.java | 1 + .../TestVisibilityLablesWithGroups.java | 8 + .../TestVisibilityWithCheckAuths.java | 2 +- .../TestWithDisabledAuthorization.java | 8 +- .../snapshot/TestFlushSnapshotFromClient.java | 2 + .../hadoop/hbase/tool/MapreduceTestingShim.java | 4 + .../hbase/tool/TestLoadIncrementalHFiles.java | 2 +- .../TestLoadIncrementalHFilesSplitRecovery.java | 2 +- .../hadoop/hbase/util/MultiThreadedAction.java | 4 +- .../hadoop/hbase/util/MultiThreadedReader.java | 3 +- .../util/TestBoundedPriorityBlockingQueue.java | 6 +- .../hadoop/hbase/util/TestByteBuffUtils.java | 4 +- .../hadoop/hbase/util/TestFSHDFSUtils.java | 3 +- .../apache/hadoop/hbase/util/TestFSVisitor.java | 7 +- .../hbase/util/TestHBaseFsckEncryption.java | 10 +- .../hadoop/hbase/util/TestHBaseFsckMOB.java | 22 +- .../hadoop/hbase/util/TestJSONMetricUtil.java | 2 +- .../hbase/util/TestMiniClusterLoadParallel.java | 1 + .../hbase/util/TestRegionSplitCalculator.java | 4 +- .../hbase/util/test/LoadTestDataGenerator.java | 7 +- .../apache/hadoop/hbase/wal/TestWALFactory.java | 2 +- .../apache/hadoop/hbase/wal/TestWALSplit.java | 112 ++--- .../TestWALSplitBoundedLogWriterCreation.java | 1 + .../hbase/zookeeper/TestZooKeeperACL.java | 52 +-- 357 files changed, 1959 insertions(+), 1495 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/SslRMIServerSocketFactorySecure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/SslRMIServerSocketFactorySecure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/SslRMIServerSocketFactorySecure.java index 8560ddc..3583afe 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/SslRMIServerSocketFactorySecure.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/SslRMIServerSocketFactorySecure.java @@ -33,6 +33,7 @@ public class SslRMIServerSocketFactorySecure extends SslRMIServerSocketFactory { @Override public ServerSocket createServerSocket(int port) throws IOException { return new ServerSocket(port) { + @Override public Socket accept() throws IOException { Socket socket = super.accept(); SSLSocketFactory sslSocketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault(); http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/client/locking/EntityLock.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/locking/EntityLock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/locking/EntityLock.java index 3fea1a2..b956e33 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/client/locking/EntityLock.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/client/locking/EntityLock.java @@ -227,6 +227,7 @@ public class EntityLock { return this; } + @Override public void run() { final LockHeartbeatRequest lockHeartbeatRequest = LockHeartbeatRequest.newBuilder().setProcId(procId).build(); http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java index 2bbb90b..555a5c0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/conf/ConfigurationManager.java @@ -79,7 +79,7 @@ public class ConfigurationManager { // notified when the configuration is reloaded from disk. This is a set // constructed from a WeakHashMap, whose entries would be removed if the // observer classes go out of scope. - private Set<ConfigurationObserver> configurationObservers = + private final Set<ConfigurationObserver> configurationObservers = Collections.newSetFromMap(new WeakHashMap<ConfigurationObserver, Boolean>()); http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java index bcba101..2143f80 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java @@ -74,7 +74,7 @@ public class ZkSplitLogWorkerCoordination extends ZKListener implements private TaskExecutor splitTaskExecutor; - private AtomicInteger taskReadySeq = new AtomicInteger(0); + private final AtomicInteger taskReadySeq = new AtomicInteger(0); private volatile String currentTask = null; private int currentVersion; private volatile boolean shouldStop = false; http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRowProcessorEndpoint.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRowProcessorEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRowProcessorEndpoint.java index f460ac9..ef91bf2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRowProcessorEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/BaseRowProcessorEndpoint.java @@ -118,7 +118,7 @@ extends RowProcessorService implements RegionCoprocessor { Class<?> cls; try { cls = Class.forName(className); - RowProcessor<S,T> ci = (RowProcessor<S,T>) cls.newInstance(); + RowProcessor<S,T> ci = (RowProcessor<S,T>) cls.getDeclaredConstructor().newInstance(); if (request.hasRowProcessorInitializerMessageName()) { Class<?> imn = Class.forName(request.getRowProcessorInitializerMessageName()) .asSubclass(Message.class); @@ -141,11 +141,7 @@ extends RowProcessorService implements RegionCoprocessor { ci.initialize(s); } return ci; - } catch (ClassNotFoundException e) { - throw new IOException(e); - } catch (InstantiationException e) { - throw new IOException(e); - } catch (IllegalAccessException e) { + } catch (Exception e) { throw new IOException(e); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java index 42da86a..05ac9f6 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/CoprocessorHost.java @@ -572,6 +572,7 @@ public abstract class CoprocessorHost<C extends Coprocessor, E extends Coprocess return this.result; } + @Override void callObserver() throws IOException { Optional<O> observer = observerGetter.apply(getEnvironment().getInstance()); if (observer.isPresent()) { http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java index 7de6f0b..6ed1ad3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ObserverContextImpl.java @@ -48,6 +48,7 @@ public class ObserverContextImpl<E extends CoprocessorEnvironment> implements Ob this.bypassable = bypassable; } + @Override public E getEnvironment() { return env; } @@ -60,6 +61,7 @@ public class ObserverContextImpl<E extends CoprocessorEnvironment> implements Ob return this.bypassable; }; + @Override public void bypass() { if (!this.bypassable) { throw new UnsupportedOperationException("This method does not support 'bypass'."); @@ -82,6 +84,7 @@ public class ObserverContextImpl<E extends CoprocessorEnvironment> implements Ob return false; } + @Override public Optional<User> getCaller() { return Optional.ofNullable(caller); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java index b073ada..b805c50 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java @@ -87,7 +87,7 @@ class ReadOnlyConfiguration extends Configuration { } @Override - public void reloadConfiguration() { + public synchronized void reloadConfiguration() { // This is a write operation. We need to allow it though because if any Configuration in // current JVM context calls addDefaultResource, this forces a reload of all Configurations // (all Configurations are 'registered' by the default constructor. Rather than turn @@ -100,10 +100,12 @@ class ReadOnlyConfiguration extends Configuration { return conf.get(name); } + // Do not add @Override because it is not in Hadoop 2.6.5 public void setAllowNullValueProperties(boolean val) { throw new UnsupportedOperationException("Read-only Configuration"); } + @Override public String getTrimmed(String name) { return conf.getTrimmed(name); } @@ -129,12 +131,12 @@ class ReadOnlyConfiguration extends Configuration { } @Override - public void unset(String name) { + public synchronized void unset(String name) { throw new UnsupportedOperationException("Read-only Configuration"); } @Override - public void setIfUnset(String name, String value) { + public synchronized void setIfUnset(String name, String value) { throw new UnsupportedOperationException("Read-only Configuration"); } @@ -239,7 +241,7 @@ class ReadOnlyConfiguration extends Configuration { } @Override - public String[] getPropertySources(String name) { + public synchronized String[] getPropertySources(String name) { return conf.getPropertySources(name); } @@ -326,7 +328,7 @@ class ReadOnlyConfiguration extends Configuration { } @Override - public Class<?>[] getClasses(String name, Class<?>[] defaultValue) { + public Class<?>[] getClasses(String name, Class<?>... defaultValue) { return conf.getClasses(name, defaultValue); } @@ -422,7 +424,7 @@ class ReadOnlyConfiguration extends Configuration { } @Override - public void setQuietMode(boolean quietmode) { + public synchronized void setQuietMode(boolean quietmode) { throw new UnsupportedOperationException("Read-only Configuration"); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java index b7c56e0..9bc072a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/filter/FilterWrapper.java @@ -119,6 +119,7 @@ final public class FilterWrapper extends Filter { return filterCell(c); } + @Override public ReturnCode filterCell(final Cell c) throws IOException { return this.filter.filterCell(c); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java index b89470f..9ea67c1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/fs/HFileSystem.java @@ -235,16 +235,15 @@ public class HFileSystem extends FilterFileSystem { } } - /** + /** * Returns a brand new instance of the FileSystem. It does not use * the FileSystem.Cache. In newer versions of HDFS, we can directly * invoke FileSystem.newInstance(Configuration). - * + * * @param conf Configuration * @return A new instance of the filesystem */ - private static FileSystem newInstanceFileSystem(Configuration conf) - throws IOException { + private static FileSystem newInstanceFileSystem(Configuration conf) throws IOException { URI uri = FileSystem.getDefaultUri(conf); FileSystem fs = null; Class<?> clazz = conf.getClass("fs." + uri.getScheme() + ".impl", null); @@ -361,47 +360,43 @@ public class HFileSystem extends FilterFileSystem { private static ClientProtocol createReorderingProxy(final ClientProtocol cp, final ReorderBlocks lrb, final Configuration conf) { - return (ClientProtocol) Proxy.newProxyInstance - (cp.getClass().getClassLoader(), - new Class[]{ClientProtocol.class, Closeable.class}, - new InvocationHandler() { - public Object invoke(Object proxy, Method method, - Object[] args) throws Throwable { - try { - if ((args == null || args.length == 0) - && "close".equals(method.getName())) { - RPC.stopProxy(cp); - return null; - } else { - Object res = method.invoke(cp, args); - if (res != null && args != null && args.length == 3 - && "getBlockLocations".equals(method.getName()) - && res instanceof LocatedBlocks - && args[0] instanceof String - && args[0] != null) { - lrb.reorderBlocks(conf, (LocatedBlocks) res, (String) args[0]); - } - return res; - } - } catch (InvocationTargetException ite) { - // We will have this for all the exception, checked on not, sent - // by any layer, including the functional exception - Throwable cause = ite.getCause(); - if (cause == null){ - throw new RuntimeException( - "Proxy invocation failed and getCause is null", ite); - } - if (cause instanceof UndeclaredThrowableException) { - Throwable causeCause = cause.getCause(); - if (causeCause == null) { - throw new RuntimeException("UndeclaredThrowableException had null cause!"); - } - cause = cause.getCause(); - } - throw cause; + return (ClientProtocol) Proxy.newProxyInstance(cp.getClass().getClassLoader(), + new Class[]{ClientProtocol.class, Closeable.class}, new InvocationHandler() { + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + try { + if ((args == null || args.length == 0) && "close".equals(method.getName())) { + RPC.stopProxy(cp); + return null; + } else { + Object res = method.invoke(cp, args); + if (res != null && args != null && args.length == 3 + && "getBlockLocations".equals(method.getName()) + && res instanceof LocatedBlocks + && args[0] instanceof String + && args[0] != null) { + lrb.reorderBlocks(conf, (LocatedBlocks) res, (String) args[0]); } + return res; } - }); + } catch (InvocationTargetException ite) { + // We will have this for all the exception, checked on not, sent + // by any layer, including the functional exception + Throwable cause = ite.getCause(); + if (cause == null){ + throw new RuntimeException("Proxy invocation failed and getCause is null", ite); + } + if (cause instanceof UndeclaredThrowableException) { + Throwable causeCause = cause.getCause(); + if (causeCause == null) { + throw new RuntimeException("UndeclaredThrowableException had null cause!"); + } + cause = cause.getCause(); + } + throw cause; + } + } + }); } /** @@ -424,6 +419,7 @@ public class HFileSystem extends FilterFileSystem { * datanode is actually dead, so if we use it it will timeout. */ static class ReorderWALBlocks implements ReorderBlocks { + @Override public void reorderBlocks(Configuration conf, LocatedBlocks lbs, String src) throws IOException { @@ -481,6 +477,7 @@ public class HFileSystem extends FilterFileSystem { * createNonRecursive. This is a hadoop bug and when it is fixed in Hadoop, * this definition will go away. */ + @Override @SuppressWarnings("deprecation") public FSDataOutputStream createNonRecursive(Path f, boolean overwrite, http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java index 5fd9d36..6c73405 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java @@ -22,15 +22,16 @@ import java.io.IOException; import java.io.InputStream; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.commons.io.IOUtils; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hbase.fs.HFileSystem; import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.apache.hadoop.hbase.fs.HFileSystem; import org.apache.hbase.thirdparty.com.google.common.annotations.VisibleForTesting; @@ -73,7 +74,7 @@ public class FSDataInputStreamWrapper implements Closeable { */ private volatile FSDataInputStream stream = null; private volatile FSDataInputStream streamNoFsChecksum = null; - private Object streamNoFsChecksumFirstCreateLock = new Object(); + private final Object streamNoFsChecksumFirstCreateLock = new Object(); // The configuration states that we should validate hbase checksums private boolean useHBaseChecksumConfigured; @@ -86,7 +87,7 @@ public class FSDataInputStreamWrapper implements Closeable { // In the case of a checksum failure, do these many succeeding // reads without hbase checksum verification. - private volatile int hbaseChecksumOffCount = -1; + private AtomicInteger hbaseChecksumOffCount = new AtomicInteger(-1); private Boolean instanceOfCanUnbuffer = null; // Using reflection to get org.apache.hadoop.fs.CanUnbuffer#unbuffer method to avoid compilation @@ -216,7 +217,7 @@ public class FSDataInputStreamWrapper implements Closeable { } if (!partOfConvoy) { this.useHBaseChecksum = false; - this.hbaseChecksumOffCount = offCount; + this.hbaseChecksumOffCount.set(offCount); } return this.stream; } @@ -224,7 +225,7 @@ public class FSDataInputStreamWrapper implements Closeable { /** Report that checksum was ok, so we may ponder going back to HBase checksum. */ public void checksumOk() { if (this.useHBaseChecksumConfigured && !this.useHBaseChecksum - && (this.hbaseChecksumOffCount-- < 0)) { + && (this.hbaseChecksumOffCount.getAndDecrement() < 0)) { // The stream we need is already open (because we were using HBase checksum in the past). assert this.streamNoFsChecksum != null; this.useHBaseChecksum = true; http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java index 80207eb..f30d488 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/HalfStoreFileReader.java @@ -129,35 +129,41 @@ public class HalfStoreFileReader extends StoreFileReader { final HFileScanner delegate = s; public boolean atEnd = false; + @Override public Cell getKey() { if (atEnd) return null; return delegate.getKey(); } + @Override public String getKeyString() { if (atEnd) return null; return delegate.getKeyString(); } + @Override public ByteBuffer getValue() { if (atEnd) return null; return delegate.getValue(); } + @Override public String getValueString() { if (atEnd) return null; return delegate.getValueString(); } + @Override public Cell getCell() { if (atEnd) return null; return delegate.getCell(); } + @Override public boolean next() throws IOException { if (atEnd) return false; @@ -200,10 +206,12 @@ public class HalfStoreFileReader extends StoreFileReader { return (this.delegate.getReader().getComparator().compare(splitCell, getKey())) > 0; } + @Override public org.apache.hadoop.hbase.io.hfile.HFile.Reader getReader() { return this.delegate.getReader(); } + @Override public boolean isSeeked() { return this.delegate.isSeeked(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java index 6dbfd2f..6dce132 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java @@ -222,6 +222,7 @@ public class Reference { return Arrays.hashCode(splitkey) + region.hashCode(); } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutput.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutput.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutput.java index 5f4bb76..1645d68 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutput.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/asyncfs/FanOutOneBlockAsyncDFSOutput.java @@ -507,6 +507,7 @@ public class FanOutOneBlockAsyncDFSOutput implements AsyncFSOutput { * @param syncBlock will call hsync if true, otherwise hflush. * @return A CompletableFuture that hold the acked length after flushing. */ + @Override public CompletableFuture<Long> flush(boolean syncBlock) { CompletableFuture<Long> future = new CompletableFuture<>(); flush0(future, syncBlock); http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCache.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCache.java index 50d8508..dccfe39 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCache.java @@ -126,6 +126,7 @@ public interface BlockCache extends Iterable<CachedBlock> { /** * @return Iterator over the blocks in the cache. */ + @Override Iterator<CachedBlock> iterator(); /** http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CompoundBloomFilter.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CompoundBloomFilter.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CompoundBloomFilter.java index 768b37f..2aceed7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CompoundBloomFilter.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/CompoundBloomFilter.java @@ -156,6 +156,7 @@ public class CompoundBloomFilter extends CompoundBloomFilterBase return result; } + @Override public boolean supportsAutoLoading() { return true; } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java index 70a3d4d..a0d3df3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/FixedFileTrailer.java @@ -545,7 +545,7 @@ public class FixedFileTrailer { try { // If null, it should be the Bytes.BYTES_RAWCOMPARATOR if (klass != null) { - CellComparator comp = klass.newInstance(); + CellComparator comp = klass.getDeclaredConstructor().newInstance(); // if the name wasn't one of the legacy names, maybe its a legit new // kind of comparator. comparatorClassName = klass.getName(); @@ -589,12 +589,8 @@ public class FixedFileTrailer { public static CellComparator createComparator( String comparatorClassName) throws IOException { try { - Class<? extends CellComparator> comparatorClass = getComparatorClass(comparatorClassName); - return comparatorClass != null ? comparatorClass.newInstance() : null; - } catch (InstantiationException e) { - throw new IOException("Comparator class " + comparatorClassName + - " is not instantiable", e); - } catch (IllegalAccessException e) { + return getComparatorClass(comparatorClassName).getDeclaredConstructor().newInstance(); + } catch (Exception e) { throw new IOException("Comparator class " + comparatorClassName + " is not instantiable", e); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java index 992ebbd..5674414 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java @@ -255,42 +255,43 @@ public class HFileBlock implements Cacheable { */ static final CacheableDeserializer<Cacheable> BLOCK_DESERIALIZER = new CacheableDeserializer<Cacheable>() { - public HFileBlock deserialize(ByteBuff buf, boolean reuse, MemoryType memType) + @Override + public HFileBlock deserialize(ByteBuff buf, boolean reuse, MemoryType memType) throws IOException { - // The buf has the file block followed by block metadata. - // Set limit to just before the BLOCK_METADATA_SPACE then rewind. - buf.limit(buf.limit() - BLOCK_METADATA_SPACE).rewind(); - // Get a new buffer to pass the HFileBlock for it to 'own'. - ByteBuff newByteBuff; - if (reuse) { - newByteBuff = buf.slice(); - } else { - int len = buf.limit(); - newByteBuff = new SingleByteBuff(ByteBuffer.allocate(len)); - newByteBuff.put(0, buf, buf.position(), len); - } - // Read out the BLOCK_METADATA_SPACE content and shove into our HFileBlock. - buf.position(buf.limit()); - buf.limit(buf.limit() + HFileBlock.BLOCK_METADATA_SPACE); - boolean usesChecksum = buf.get() == (byte)1; - long offset = buf.getLong(); - int nextBlockOnDiskSize = buf.getInt(); - HFileBlock hFileBlock = - new HFileBlock(newByteBuff, usesChecksum, memType, offset, nextBlockOnDiskSize, null); - return hFileBlock; - } + // The buf has the file block followed by block metadata. + // Set limit to just before the BLOCK_METADATA_SPACE then rewind. + buf.limit(buf.limit() - BLOCK_METADATA_SPACE).rewind(); + // Get a new buffer to pass the HFileBlock for it to 'own'. + ByteBuff newByteBuff; + if (reuse) { + newByteBuff = buf.slice(); + } else { + int len = buf.limit(); + newByteBuff = new SingleByteBuff(ByteBuffer.allocate(len)); + newByteBuff.put(0, buf, buf.position(), len); + } + // Read out the BLOCK_METADATA_SPACE content and shove into our HFileBlock. + buf.position(buf.limit()); + buf.limit(buf.limit() + HFileBlock.BLOCK_METADATA_SPACE); + boolean usesChecksum = buf.get() == (byte) 1; + long offset = buf.getLong(); + int nextBlockOnDiskSize = buf.getInt(); + HFileBlock hFileBlock = + new HFileBlock(newByteBuff, usesChecksum, memType, offset, nextBlockOnDiskSize, null); + return hFileBlock; + } - @Override - public int getDeserialiserIdentifier() { - return DESERIALIZER_IDENTIFIER; - } + @Override + public int getDeserialiserIdentifier() { + return DESERIALIZER_IDENTIFIER; + } - @Override - public HFileBlock deserialize(ByteBuff b) throws IOException { - // Used only in tests - return deserialize(b, false, MemoryType.EXCLUSIVE); - } - }; + @Override + public HFileBlock deserialize(ByteBuff b) throws IOException { + // Used only in tests + return deserialize(b, false, MemoryType.EXCLUSIVE); + } + }; private static final int DESERIALIZER_IDENTIFIER; static { @@ -1480,6 +1481,7 @@ public class HFileBlock implements Cacheable { this(new FSDataInputStreamWrapper(istream), fileSize, null, null, fileContext); } + @Override public BlockIterator blockRange(final long startOffset, final long endOffset) { final FSReader owner = this; // handle for inner class return new BlockIterator() { http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java index a16565e..1f591a0 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java @@ -947,7 +947,7 @@ public class HFileReaderImpl implements HFile.Reader, Configurable { Cell ret; int cellBufSize = getKVBufSize(); - long seqId = 0l; + long seqId = 0L; if (this.reader.shouldIncludeMemStoreTS()) { seqId = currMemstoreTS; } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java index 032c1ad..a2a35fe 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileScanner.java @@ -166,5 +166,6 @@ public interface HFileScanner extends Shipper, Closeable { /** * Close this HFile scanner and do necessary cleanup. */ + @Override void close(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java index 284447a..d26b90a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruBlockCache.java @@ -448,6 +448,7 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize { * @param cacheKey block's cache key * @param buf block buffer */ + @Override public void cacheBlock(BlockCacheKey cacheKey, Cacheable buf) { cacheBlock(cacheKey, buf, false); } @@ -794,6 +795,7 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize { return totalSize; } + @Override public int compareTo(BlockBucket that) { return Long.compare(this.overflow(), that.overflow()); } @@ -970,6 +972,7 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize { * <p>Includes: total accesses, hits, misses, evicted blocks, and runs * of the eviction processes. */ + @Override public CacheStats getStats() { return this.stats; } @@ -1096,6 +1099,7 @@ public class LruBlockCache implements ResizableBlockCache, HeapSize { return (long) Math.floor(this.maxSize * this.memoryFactor * this.minFactor); } + @Override public void shutdown() { if (victimHandler != null) { victimHandler.shutdown(); http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlock.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlock.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlock.java index 21b3bfd..32a277d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlock.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlock.java @@ -90,6 +90,7 @@ public class LruCachedBlock implements HeapSize, Comparable<LruCachedBlock> { return this.cachedTime; } + @Override public long heapSize() { return size; } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java index bed08fe..4c67c9a 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/LruCachedBlockQueue.java @@ -103,6 +103,7 @@ public class LruCachedBlockQueue implements HeapSize { * Total size of all elements in this queue. * @return size of all elements currently in queue, in bytes */ + @Override public long heapSize() { return heapSize; } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java index 7bbb4ed..e31b1cb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketAllocator.java @@ -414,6 +414,7 @@ public final class BucketAllocator { } } + @Override public String toString() { StringBuilder sb = new StringBuilder(1024); for (int i = 0; i < buckets.length; ++i) { http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java index d07c30d..bd2b9c8 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/BucketCache.java @@ -36,6 +36,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.NavigableSet; +import java.util.Objects; import java.util.PriorityQueue; import java.util.Set; import java.util.concurrent.ArrayBlockingQueue; @@ -904,6 +905,7 @@ public class BucketCache implements BlockCache, HeapSize { this.writerEnabled = false; } + @Override public void run() { List<RAMQueueEntry> entries = new ArrayList<>(); try { @@ -1395,10 +1397,22 @@ public class BucketCache implements BlockCache, HeapSize { } @Override - public boolean equals(Object that) { - return this == that; + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BucketEntryGroup that = (BucketEntryGroup) o; + return totalSize == that.totalSize && bucketSize == that.bucketSize + && Objects.equals(queue, that.queue); } + @Override + public int hashCode() { + return Objects.hash(queue, totalSize, bucketSize); + } } /** http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/CachedEntryQueue.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/CachedEntryQueue.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/CachedEntryQueue.java index fa39202..29721ab 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/CachedEntryQueue.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/bucket/CachedEntryQueue.java @@ -59,6 +59,7 @@ public class CachedEntryQueue { } queue = MinMaxPriorityQueue.orderedBy(new Comparator<Map.Entry<BlockCacheKey, BucketEntry>>() { + @Override public int compare(Entry<BlockCacheKey, BucketEntry> entry1, Entry<BlockCacheKey, BucketEntry> entry2) { return BucketEntry.COMPARATOR.compare(entry1.getValue(), entry2.getValue()); http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BufferChain.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BufferChain.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BufferChain.java index c340c06..915b82d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BufferChain.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/BufferChain.java @@ -101,7 +101,7 @@ class BufferChain { try { long ret = channel.write(buffers, bufferOffset, bufCount); if (ret > 0) { - remaining -= ret; + remaining = (int) (remaining - ret); } return ret; } finally { http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java index 9a01a0a..eaea34d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/FastPathBalancedQueueRpcExecutor.java @@ -91,6 +91,7 @@ public class FastPathBalancedQueueRpcExecutor extends BalancedQueueRpcExecutor { this.fastPathHandlerStack = fastPathHandlerStack; } + @Override protected CallRunner getCallRunner() throws InterruptedException { // Get a callrunner if one in the Q. CallRunner cr = this.q.poll(); http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java index 096efa3..17bb362 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/ServerRpcConnection.java @@ -193,14 +193,15 @@ abstract class ServerRpcConnection implements Closeable { String className = header.getCellBlockCodecClass(); if (className == null || className.length() == 0) return; try { - this.codec = (Codec)Class.forName(className).newInstance(); + this.codec = (Codec)Class.forName(className).getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new UnsupportedCellCodecException(className, e); } if (!header.hasCellBlockCompressorClass()) return; className = header.getCellBlockCompressorClass(); try { - this.compressionCodec = (CompressionCodec)Class.forName(className).newInstance(); + this.compressionCodec = + (CompressionCodec)Class.forName(className).getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new UnsupportedCompressionCodecException(className, e); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java index b14c934..13a3cf7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/SimpleRpcServer.java @@ -548,6 +548,7 @@ public class SimpleRpcServer extends RpcServer { * The number of open RPC conections * @return the number of open rpc connections */ + @Override public int getNumOpenConnections() { return connectionManager.size(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java index 6b87194..5e97204 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ClusterStatusPublisher.java @@ -118,10 +118,8 @@ public class ClusterStatusPublisher extends ScheduledChore { this.master = master; this.messagePeriod = conf.getInt(STATUS_PUBLISH_PERIOD, DEFAULT_STATUS_PUBLISH_PERIOD); try { - this.publisher = publisherClass.newInstance(); - } catch (InstantiationException e) { - throw new IOException("Can't create publisher " + publisherClass.getName(), e); - } catch (IllegalAccessException e) { + this.publisher = publisherClass.getDeclaredConstructor().newInstance(); + } catch (Exception e) { throw new IOException("Can't create publisher " + publisherClass.getName(), e); } this.publisher.connect(conf); @@ -166,7 +164,8 @@ public class ClusterStatusPublisher extends ScheduledChore { .build()); } - protected void cleanup() { + @Override + protected synchronized void cleanup() { connected = false; publisher.close(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java index db04c60..116d24e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/DeadServer.java @@ -155,6 +155,7 @@ public class DeadServer { } } + @Override public synchronized String toString() { StringBuilder sb = new StringBuilder(); for (ServerName sn : deadServers.keySet()) { http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java index 3ec70d3..a591025 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMasterCommandLine.java @@ -69,11 +69,12 @@ public class HMasterCommandLine extends ServerCommandLine { this.masterClass = masterClass; } + @Override protected String getUsage() { return USAGE; } - + @Override public int run(String args[]) throws Exception { Options opt = new Options(); opt.addOption("localRegionServers", true, http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java index f1a0593..917da08 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/LoadBalancer.java @@ -156,6 +156,7 @@ public interface LoadBalancer extends Configurable, Stoppable, ConfigurationObse * Notification that config has changed * @param conf */ + @Override void onConfigurationChange(Configuration conf); /** http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java index 18aab6e..f25f3bf 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterAnnotationReadingPriorityFunction.java @@ -52,6 +52,7 @@ public class MasterAnnotationReadingPriorityFunction extends AnnotationReadingPr super(rpcServices, clz); } + @Override public int getPriority(RPCProtos.RequestHeader header, Message param, User user) { // Yes this is copy pasted from the base class but it keeps from having to look in the // annotatedQos table twice something that could get costly since this is called for http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java index 10e1d0a..8396145 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterCoprocessorHost.java @@ -133,6 +133,7 @@ public class MasterCoprocessorHost * @return An instance of MasterServices, an object NOT for general user-space Coprocessor * consumption. */ + @Override public MasterServices getMasterServices() { return this.masterServices; } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MobCompactionChore.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MobCompactionChore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MobCompactionChore.java index 8a7c4e1..6c5d677 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MobCompactionChore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MobCompactionChore.java @@ -89,7 +89,7 @@ public class MobCompactionChore extends ScheduledChore { } @Override - protected void cleanup() { + protected synchronized void cleanup() { super.cleanup(); pool.shutdown(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java index 2f2d536..29218e2 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java @@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory; @InterfaceAudience.Private public class RegionServerTracker extends ZKListener { private static final Logger LOG = LoggerFactory.getLogger(RegionServerTracker.class); - private NavigableMap<ServerName, RegionServerInfo> regionServers = new TreeMap<>(); + private final NavigableMap<ServerName, RegionServerInfo> regionServers = new TreeMap<>(); private ServerManager serverManager; private MasterServices server; http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java index d1c1612..2b88fb1 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitLogManager.java @@ -637,7 +637,7 @@ public class SplitLogManager { public enum TerminationStatus { IN_PROGRESS("in_progress"), SUCCESS("success"), FAILURE("failure"), DELETED("deleted"); - String statusMsg; + final String statusMsg; TerminationStatus(String msg) { statusMsg = msg; http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/MergeTableRegionsProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/MergeTableRegionsProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/MergeTableRegionsProcedure.java index 3810403..8c59776 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/MergeTableRegionsProcedure.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/MergeTableRegionsProcedure.java @@ -612,7 +612,7 @@ public class MergeTableRegionsProcedure final TableDescriptor htd = env.getMasterServices().getTableDescriptors().get(getTableName()); for (String family: regionFs.getFamilies()) { - final ColumnFamilyDescriptor hcd = htd.getColumnFamily(family.getBytes()); + final ColumnFamilyDescriptor hcd = htd.getColumnFamily(Bytes.toBytes(family)); final Collection<StoreFileInfo> storeFiles = regionFs.getStoreFiles(family); if (storeFiles != null && storeFiles.size() > 0) { http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java index 1cf9a54..fa94495 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionStates.java @@ -33,6 +33,7 @@ import java.util.SortedSet; import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentSkipListMap; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.ServerName; @@ -864,7 +865,7 @@ public class RegionStates { private final RegionStateNode regionNode; private volatile Exception exception = null; - private volatile int retries = 0; + private AtomicInteger retries = new AtomicInteger(); public RegionFailedOpen(final RegionStateNode regionNode) { this.regionNode = regionNode; @@ -879,11 +880,11 @@ public class RegionStates { } public int incrementAndGetRetries() { - return ++this.retries; + return this.retries.incrementAndGet(); } public int getRetries() { - return retries; + return retries.get(); } public void setException(final Exception exception) { http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java index b3fbc57..a72478c 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/FavoredStochasticBalancer.java @@ -86,7 +86,7 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements } @Override - public void setMasterServices(MasterServices masterServices) { + public synchronized void setMasterServices(MasterServices masterServices) { super.setMasterServices(masterServices); fnm = masterServices.getFavoredNodesManager(); } @@ -692,7 +692,8 @@ public class FavoredStochasticBalancer extends StochasticLoadBalancer implements * implementation. For the misplaced regions, we assign a bogus server to it and AM takes care. */ @Override - public List<RegionPlan> balanceCluster(Map<ServerName, List<RegionInfo>> clusterState) { + public synchronized List<RegionPlan> balanceCluster(Map<ServerName, + List<RegionInfo>> clusterState) { if (this.services != null) { http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java index a9b1bb7..07e9600 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/RegionLocationFinder.java @@ -72,21 +72,22 @@ class RegionLocationFinder { private CacheLoader<RegionInfo, HDFSBlocksDistribution> loader = new CacheLoader<RegionInfo, HDFSBlocksDistribution>() { - public ListenableFuture<HDFSBlocksDistribution> reload(final RegionInfo hri, - HDFSBlocksDistribution oldValue) throws Exception { - return executor.submit(new Callable<HDFSBlocksDistribution>() { - @Override - public HDFSBlocksDistribution call() throws Exception { - return internalGetTopBlockLocation(hri); - } - }); - } - + @Override + public ListenableFuture<HDFSBlocksDistribution> reload(final RegionInfo hri, + HDFSBlocksDistribution oldValue) throws Exception { + return executor.submit(new Callable<HDFSBlocksDistribution>() { @Override - public HDFSBlocksDistribution load(RegionInfo key) throws Exception { - return internalGetTopBlockLocation(key); + public HDFSBlocksDistribution call() throws Exception { + return internalGetTopBlockLocation(hri); } - }; + }); + } + + @Override + public HDFSBlocksDistribution load(RegionInfo key) throws Exception { + return internalGetTopBlockLocation(key); + } + }; // The cache for where regions are located. private LoadingCache<RegionInfo, HDFSBlocksDistribution> cache = null; http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java index f53683f..b0d3f19 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/SimpleLoadBalancer.java @@ -106,6 +106,7 @@ public class SimpleLoadBalancer extends BaseLoadBalancer { } + @Override public void setClusterLoad(Map<TableName, Map<ServerName, List<RegionInfo>>> clusterLoad){ serverLoadList = new ArrayList<>(); float sum = 0; http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java index 6b4f943..dca9cbb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java @@ -349,8 +349,8 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { // Allow turning this feature off if the locality cost is not going to // be used in any computations. RegionLocationFinder finder = null; - if (this.localityCost != null && this.localityCost.getMultiplier() > 0 - || this.rackLocalityCost != null && this.rackLocalityCost.getMultiplier() > 0) { + if ((this.localityCost != null && this.localityCost.getMultiplier() > 0) + || (this.rackLocalityCost != null && this.rackLocalityCost.getMultiplier() > 0)) { finder = this.regionFinder; } @@ -1401,7 +1401,7 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { // Now if we found a region load get the type of cost that was requested. if (regionLoadList != null) { - cost += getRegionLoadCost(regionLoadList); + cost = (long) (cost + getRegionLoadCost(regionLoadList)); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java index 775d8f9..21f8251 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/CleanerChore.java @@ -205,7 +205,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu Class<? extends FileCleanerDelegate> c = Class.forName(className).asSubclass( FileCleanerDelegate.class); @SuppressWarnings("unchecked") - T cleaner = (T) c.newInstance(); + T cleaner = (T) c.getDeclaredConstructor().newInstance(); cleaner.setConf(conf); cleaner.init(this.params); return cleaner; @@ -360,7 +360,7 @@ public abstract class CleanerChore<T extends FileCleanerDelegate> extends Schedu } @Override - public void cleanup() { + public synchronized void cleanup() { for (T lc : this.cleanersChain) { try { lc.stop("Exiting"); http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/HFileCleaner.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/HFileCleaner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/HFileCleaner.java index 640c8f7..08640a7 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/HFileCleaner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/HFileCleaner.java @@ -182,7 +182,7 @@ public class HFileCleaner extends CleanerChore<BaseHFileCleanerDelegate> { } @Override - public void cleanup() { + public synchronized void cleanup() { super.cleanup(); stopHFileDeleteThreads(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java index db364ee..9beed58 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/cleaner/LogCleaner.java @@ -108,7 +108,7 @@ public class LogCleaner extends CleanerChore<BaseLogCleanerDelegate> { } @Override - public void cleanup() { + public synchronized void cleanup() { super.cleanup(); interruptOldWALsCleaner(); } http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java index edf7642..b4c55f4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/locking/LockProcedure.java @@ -202,7 +202,7 @@ public final class LockProcedure extends Procedure<MasterProcedureEnv> * @return false, so procedure framework doesn't mark this procedure as failure. */ @Override - protected boolean setTimeoutFailure(final MasterProcedureEnv env) { + protected synchronized boolean setTimeoutFailure(final MasterProcedureEnv env) { synchronized (event) { if (LOG.isDebugEnabled()) LOG.debug("Timeout failure " + this.event); if (!event.isReady()) { // Maybe unlock() awakened the event. http://git-wip-us.apache.org/repos/asf/hbase/blob/b1269ec5/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ProcedurePrepareLatch.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ProcedurePrepareLatch.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ProcedurePrepareLatch.java index 09d05e6..535f288 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ProcedurePrepareLatch.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/ProcedurePrepareLatch.java @@ -71,7 +71,9 @@ public abstract class ProcedurePrepareLatch { } private static class NoopLatch extends ProcedurePrepareLatch { + @Override protected void countDown(final Procedure proc) {} + @Override public void await() throws IOException {} } @@ -80,6 +82,7 @@ public abstract class ProcedurePrepareLatch { private IOException exception = null; + @Override protected void countDown(final Procedure proc) { if (proc.hasException()) { exception = proc.getException().unwrapRemoteIOException(); @@ -87,6 +90,7 @@ public abstract class ProcedurePrepareLatch { latch.countDown(); } + @Override public void await() throws IOException { try { latch.await();