From 3adf1dd6f2460e1c4a77b123942f21c66a3fbc43 Mon Sep 17 00:00:00 2001 From: Christopher Tubbs Date: Fri, 10 Apr 2015 15:10:07 -0400 Subject: [PATCH 1/3] ACCUMULO-3720 Use apilyzer-maven-plugin Use plugin to check for API problems --- core/pom.xml | 30 ++++++++++++++++++++++++++++++ minicluster/pom.xml | 30 ++++++++++++++++++++++++++++++ pom.xml | 5 +++++ 3 files changed, 65 insertions(+) diff --git a/core/pom.xml b/core/pom.xml index 4a3500ced53..f4918bc3f44 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -165,6 +165,36 @@ + + net.revelc.apilyzer + apilyzer-maven-plugin + + + apilyzer + + analyze + + + + org[.]apache[.]accumulo[.]core[.]client[.].* + org[.]apache[.]accumulo[.]core[.]data[.](Mutation|Key|Value|Condition|ConditionalMutation|Range|ByteSequence|PartialKey|Column)([$].*)? + org[.]apache[.]accumulo[.]core[.]security[.](ColumnVisibility|Authorizations|NamespacePermission|SystemPermission|TablePermission)([$].*)? + + + .*Impl + .*[.]impl[.].* + org[.]apache[.]accumulo[.]core[.]client[.]mock[.].* + + + org[.]apache[.]accumulo[.].*[.]thrift[.].* + org[.]apache[.]commons[.].* + org[.]apache[.]hadoop[.].* + org[.]apache[.]log4j[.].* + + + + + org.apache.maven.plugins maven-resources-plugin diff --git a/minicluster/pom.xml b/minicluster/pom.xml index adec106a31c..2f46eaf2fb9 100644 --- a/minicluster/pom.xml +++ b/minicluster/pom.xml @@ -115,4 +115,34 @@ test + + + + net.revelc.apilyzer + apilyzer-maven-plugin + + + apilyzer + + analyze + + + + org[.]apache[.]accumulo[.]minicluster[.].* + + + .*Impl + .*[.]impl[.].* + + + org[.]apache[.]accumulo[.]core[.]client[.].* + org[.]apache[.]accumulo[.]core[.]data[.](Mutation|Key|Value|Condition|ConditionalMutation|Range|ByteSequence|PartialKey|Column)([$].*)? + org[.]apache[.]accumulo[.]core[.]security[.](ColumnVisibility|Authorizations|NamespacePermission|SystemPermission|TablePermission)([$].*)? + + + + + + + diff --git a/pom.xml b/pom.xml index 70ca34bd7f0..f12c7677833 100644 --- a/pom.xml +++ b/pom.xml @@ -898,6 +898,11 @@ maven-bundle-plugin 2.5.3 + + net.revelc.apilyzer + apilyzer-maven-plugin + 1.0.0 + From 0002c6f66ddfa3b60835bdaae8896ecc852d4132 Mon Sep 17 00:00:00 2001 From: Keith Turner Date: Fri, 10 Apr 2015 15:01:43 -0400 Subject: [PATCH 2/3] ACCUMULO-3657 ACCUMULO-3548 Clarify Accumulo API The following changes were made. * Fix API problems with IsolatedScanner * Deprecated public inner class in ClientSiderIteratorScanner that was not intended to be in public API * ACCUMULO-3488 Deprecated KeyExtent from public API * Deprecated use of Property in ClientConfiguration * deprecated ZooKeeperInstance.lookupIntanceName(ZooCache, UUID) * deprecated IteratorUtil.getProperty(IteratorScope) * deprecated class ComparableBytes * ACCUMULO-3724 moved DelegationToken and AuthenticationTokenIdentifier out of public API * deprecated getTabletLocator() in both AbstractInputFormat classes * deprecated getAccumuloConfiguration() in both AccumuloFileOutputFormat classes * deperecated and moved VisibilityConstraint * updated README to accurately communicate Accumulo's API. Update APILyzer config to enforce ACCUMULO-3720 * moved Credentials from core.security to core.client.impl --- README.md | 30 +- core/pom.xml | 37 +- core/src/main/findbugs/exclude-filter.xml | 1 + .../core/client/ClientConfiguration.java | 8 + .../client/ClientSideIteratorScanner.java | 27 +- .../accumulo/core/client/IsolatedScanner.java | 4 +- .../client/MutationsRejectedException.java | 68 +- .../core/client/ZooKeeperInstance.java | 21 +- .../core/client/admin/ActiveCompaction.java | 12 +- .../core/client/admin/ActiveScan.java | 12 +- .../client/admin/DelegationTokenConfig.java | 4 +- .../core/client/admin/SecurityOperations.java | 3 +- .../client/impl/ActiveCompactionImpl.java | 19 +- .../core/client/impl/ActiveScanImpl.java | 14 +- .../impl}/AuthenticationTokenIdentifier.java | 2 +- .../core/client/impl/ClientContext.java | 1 - .../client/impl/ConditionalWriterImpl.java | 2 +- .../impl}/Credentials.java | 2 +- .../core/client/impl/DelegationTokenImpl.java | 144 ++++ .../client/impl/InstanceOperationsImpl.java | 18 + .../client/impl/NamespaceOperationsImpl.java | 1 - .../core/client/impl/OfflineScanner.java | 3 +- .../core/client/impl/RootTabletLocator.java | 2 +- .../client/impl/SecurityOperationsImpl.java | 4 +- .../core/client/impl/TableOperationsImpl.java | 2 +- .../core/client/impl/TabletLocator.java | 2 +- .../core/client/impl/TabletLocatorImpl.java | 2 +- .../impl/TabletServerBatchReaderIterator.java | 2 +- .../client/impl/TabletServerBatchWriter.java | 8 +- .../accumulo/core/client/impl/TabletType.java | 2 +- .../core/client/impl/ThriftScanner.java | 2 +- .../client/impl/TimeoutTabletLocator.java | 2 +- .../accumulo/core/client/impl/Translator.java | 2 +- .../accumulo/core/client/impl/Writer.java | 2 +- .../client/mapred/AbstractInputFormat.java | 20 +- .../mapred/AccumuloFileOutputFormat.java | 5 +- .../client/mapred/AccumuloOutputFormat.java | 23 +- .../client/mapreduce/AbstractInputFormat.java | 26 +- .../mapreduce/AccumuloFileOutputFormat.java | 5 +- .../mapreduce/AccumuloOutputFormat.java | 21 +- .../mapreduce/lib/impl/ConfiguratorBase.java | 16 +- .../mapreduce/lib/impl/InputConfigurator.java | 8 +- .../core/client/mock/MockConnector.java | 2 +- .../core/client/mock/MockInstance.java | 2 +- .../client/mock/impl/MockTabletLocator.java | 2 +- .../security/tokens/DelegationToken.java | 134 +-- .../accumulo/core/constraints/Constraint.java | 2 +- .../constraints/VisibilityConstraint.java | 93 +++ .../accumulo/core/data/ComparableBytes.java | 5 + .../apache/accumulo/core/data/KeyExtent.java | 717 +++------------- .../apache/accumulo/core/data/TabletID.java | 29 + .../core/data/impl/ComparableBytes.java | 53 ++ .../accumulo/core/data/impl/KeyExtent.java | 768 ++++++++++++++++++ .../accumulo/core/data/impl/TabletIDImpl.java | 100 +++ .../accumulo/core/iterators/IteratorUtil.java | 40 +- .../core/iterators/system/MultiIterator.java | 2 +- .../metadata/MetadataLocationObtainer.java | 2 +- .../core/metadata/MetadataServicer.java | 2 +- .../accumulo/core/metadata/RootTable.java | 2 +- .../core/metadata/ServicerForRootTable.java | 2 +- .../core/metadata/TableMetadataServicer.java | 2 +- .../ReplicationConfigurationUtil.java | 2 +- .../rpc/SaslClientDigestCallbackHandler.java | 4 +- .../core/rpc/SaslConnectionParams.java | 6 +- .../core/security/VisibilityConstraint.java | 76 +- .../core/security/VisibilityEvaluator.java | 10 +- .../core/tabletserver/log/LogEntry.java | 2 +- .../org/apache/accumulo/core/util/Merge.java | 2 +- .../core/client/impl/ScannerImplTest.java | 1 - .../client/impl/TableOperationsImplTest.java | 3 +- .../client/impl/TabletLocatorImplTest.java | 3 +- .../impl/TabletServerBatchReaderTest.java | 1 - .../mapred/AccumuloFileOutputFormatTest.java | 5 +- .../core/client/mapred/TokenFileTest.java | 2 +- .../AccumuloFileOutputFormatTest.java | 5 +- .../core/client/mapreduce/TokenFileTest.java | 2 +- ...Test.java => DelegationTokenImplTest.java} | 15 +- .../accumulo/core/data/KeyExtentTest.java | 1 + .../apache/accumulo/core/data/RangeTest.java | 1 + .../accumulo/core/file/rfile/RFileTest.java | 2 +- .../core/iterators/IteratorUtilTest.java | 2 +- .../iterators/system/MultiIteratorTest.java | 2 +- .../core/metadata/MetadataServicerTest.java | 2 +- .../ReplicationConfigurationUtilTest.java | 2 +- .../core/rpc/SaslConnectionParamsTest.java | 12 +- .../AuthenticationTokenIdentifierTest.java | 1 + .../core/security/CredentialsTest.java | 1 + .../security/VisibilityConstraintTest.java | 1 + .../apache/accumulo/core/util/MergeTest.java | 2 +- .../simple/client/RandomBatchWriter.java | 6 +- minicluster/pom.xml | 5 +- .../impl/MiniAccumuloClusterImpl.java | 2 +- .../apache/accumulo/proxy/ProxyServer.java | 8 +- .../server/AccumuloServerContext.java | 2 +- .../accumulo/server/client/BulkImporter.java | 2 +- .../server/client/ClientServiceHandler.java | 2 +- .../server/client/HdfsZooInstance.java | 6 +- .../server/conf/ServerConfiguration.java | 2 +- .../conf/ServerConfigurationFactory.java | 2 +- .../constraints/MetadataConstraints.java | 2 +- .../accumulo/server/fs/VolumeManagerImpl.java | 2 +- .../apache/accumulo/server/fs/VolumeUtil.java | 2 +- .../accumulo/server/init/Initialize.java | 2 +- .../server/master/LiveTServerSet.java | 2 +- .../master/balancer/ChaoticLoadBalancer.java | 2 +- .../master/balancer/DefaultLoadBalancer.java | 2 +- .../server/master/balancer/GroupBalancer.java | 2 +- .../master/balancer/RegexGroupBalancer.java | 2 +- .../master/balancer/TableLoadBalancer.java | 2 +- .../master/balancer/TabletBalancer.java | 2 +- .../server/master/state/Assignment.java | 2 +- .../server/master/state/CurrentState.java | 2 +- .../server/master/state/MergeInfo.java | 2 +- .../master/state/MetaDataTableScanner.java | 2 +- .../master/state/TabletLocationState.java | 2 +- .../server/master/state/TabletMigration.java | 2 +- .../state/TabletStateChangeIterator.java | 2 +- .../rpc/SaslServerDigestCallbackHandler.java | 2 +- ...TCredentialsUpdatingInvocationHandler.java | 4 +- .../security/AuditedSecurityOperation.java | 4 +- .../server/security/SecurityOperation.java | 2 +- .../server/security/SystemCredentials.java | 2 +- .../AuthenticationTokenSecretManager.java | 6 +- .../handler/KerberosAuthenticator.java | 4 +- .../LargestFirstMemoryManager.java | 2 +- .../tabletserver/MemoryManagementActions.java | 2 +- .../server/tabletserver/MemoryManager.java | 2 +- .../server/tabletserver/TabletState.java | 2 +- .../apache/accumulo/server/util/Admin.java | 2 +- .../server/util/CheckForMetadataProblems.java | 2 +- .../apache/accumulo/server/util/FileUtil.java | 2 +- .../server/util/FindOfflineTablets.java | 2 +- .../server/util/MasterMetadataUtil.java | 2 +- .../server/util/MetadataTableUtil.java | 4 +- .../util/RemoveEntriesForMissingFiles.java | 4 +- .../server/util/ReplicationTableUtil.java | 4 +- .../accumulo/server/util/TableDiskUsage.java | 2 +- .../accumulo/server/util/TabletIterator.java | 2 +- .../server/util/VerifyTabletAssignments.java | 4 +- .../server/AccumuloServerContextTest.java | 2 +- .../server/client/BulkImporterTest.java | 4 +- .../balancer/ChaoticLoadBalancerTest.java | 2 +- .../balancer/DefaultLoadBalancerTest.java | 2 +- .../master/balancer/GroupBalancerTest.java | 2 +- .../balancer/TableLoadBalancerTest.java | 2 +- .../server/master/state/MergeInfoTest.java | 2 +- .../master/state/TabletLocationStateTest.java | 2 +- .../rpc/SaslDigestCallbackHandlerTest.java | 2 +- .../security/SystemCredentialsTest.java | 2 +- .../AuthenticationTokenSecretManagerTest.java | 2 +- .../accumulo/server/util/CloneTest.java | 2 +- .../server/util/ReplicationTableUtilTest.java | 4 +- .../server/util/TabletIteratorTest.java | 2 +- .../gc/GarbageCollectionAlgorithm.java | 2 +- .../accumulo/gc/GarbageCollectionTest.java | 2 +- .../gc/SimpleGarbageCollectorTest.java | 2 +- .../CloseWriteAheadLogReferencesTest.java | 2 +- .../org/apache/accumulo/master/Master.java | 2 +- .../master/MasterClientServiceHandler.java | 4 +- .../accumulo/master/TabletGroupWatcher.java | 2 +- .../master/recovery/RecoveryManager.java | 2 +- .../accumulo/master/state/MergeStats.java | 2 +- .../accumulo/master/tableOps/BulkImport.java | 2 +- .../master/tableOps/CompactRange.java | 2 +- .../accumulo/master/tableOps/CreateTable.java | 2 +- .../accumulo/master/tableOps/DeleteTable.java | 2 +- .../accumulo/master/tableOps/ExportTable.java | 2 +- .../accumulo/master/tableOps/ImportTable.java | 2 +- .../master/tableOps/TableRangeOp.java | 2 +- .../master/ReplicationOperationsImplTest.java | 4 +- .../accumulo/master/TestMergeState.java | 2 +- .../SequentialWorkAssignerTest.java | 2 +- .../master/replication/StatusMakerTest.java | 2 +- .../UnorderedWorkAssignerTest.java | 2 +- .../state/RootTabletStateStoreTest.java | 2 +- .../monitor/servlets/TServersServlet.java | 2 +- .../monitor/servlets/TablesServlet.java | 2 +- .../tserver/ActiveAssignmentRunnable.java | 2 +- .../tserver/ConditionalMutationSet.java | 2 +- .../apache/accumulo/tserver/FileManager.java | 2 +- .../org/apache/accumulo/tserver/RowLocks.java | 2 +- .../apache/accumulo/tserver/TabletServer.java | 2 +- .../tserver/TabletServerResourceManager.java | 2 +- .../accumulo/tserver/TservConstraintEnv.java | 2 +- .../apache/accumulo/tserver/WriteTracker.java | 2 +- .../compaction/MajorCompactionRequest.java | 2 +- .../constraints/ConstraintChecker.java | 2 +- .../accumulo/tserver/log/DfsLogger.java | 2 +- .../tserver/log/SortedLogRecovery.java | 2 +- .../tserver/log/TabletServerLogger.java | 2 +- .../accumulo/tserver/logger/LogFileKey.java | 2 +- .../accumulo/tserver/logger/LogReader.java | 2 +- .../mastermessage/SplitReportMessage.java | 2 +- .../mastermessage/TabletStatusMessage.java | 2 +- .../replication/AccumuloReplicaSystem.java | 2 +- .../accumulo/tserver/scan/LookupTask.java | 2 +- .../tserver/session/MultiScanSession.java | 2 +- .../accumulo/tserver/session/ScanSession.java | 2 +- .../tserver/session/UpdateSession.java | 2 +- .../tserver/tablet/CommitSession.java | 2 +- .../tserver/tablet/CompactionInfo.java | 2 +- .../accumulo/tserver/tablet/Compactor.java | 2 +- .../tserver/tablet/DatafileManager.java | 2 +- .../accumulo/tserver/tablet/Tablet.java | 2 +- .../tserver/tablet/TabletCommitter.java | 2 +- .../LargestFirstMemoryManagerTest.java | 2 +- .../tserver/AssignmentWatcherTest.java | 2 +- .../tserver/CheckTabletMetadataTest.java | 2 +- .../tserver/TabletResourceManagerTest.java | 2 +- .../DefaultCompactionStrategyTest.java | 2 +- .../SizeLimitCompactionStrategyTest.java | 2 +- .../ConfigurableCompactionStrategyTest.java | 2 +- .../constraints/ConstraintCheckerTest.java | 2 +- .../tserver/log/SortedLogRecoveryTest.java | 2 +- .../accumulo/tserver/logger/LogFileTest.java | 2 +- .../AccumuloReplicaSystemTest.java | 2 +- .../replication/ReplicationProcessorTest.java | 2 +- .../accumulo/tserver/tablet/TabletTest.java | 2 +- .../commands/ActiveCompactionIterator.java | 2 +- .../shell/commands/ActiveScanIterator.java | 2 +- .../shell/commands/CreateTableCommand.java | 2 +- .../shell/commands/GetSplitsCommand.java | 2 +- .../shell/commands/InsertCommand.java | 6 +- .../accumulo/test/QueryMetadataTable.java | 2 +- .../org/apache/accumulo/test/TestIngest.java | 6 +- .../apache/accumulo/test/WrongTabletTest.java | 4 +- .../continuous/ContinuousStatsCollector.java | 4 +- .../metadata/MetadataBatchScanTest.java | 2 +- .../performance/scan/CollectTabletStats.java | 4 +- .../test/performance/thrift/NullTserver.java | 2 +- .../randomwalk/security/AlterTablePerm.java | 2 +- .../randomwalk/security/Authenticate.java | 2 +- .../test/randomwalk/security/ChangePass.java | 2 +- .../test/randomwalk/security/DropTable.java | 2 +- .../test/randomwalk/security/SetAuths.java | 2 +- .../randomwalk/security/WalkingSecurity.java | 2 +- .../sequential/MapRedVerifyTool.java | 4 +- .../server/security/SystemCredentialsIT.java | 2 +- .../test/MasterRepairsDualAssignmentIT.java | 4 +- .../accumulo/test/MetaConstraintRetryIT.java | 4 +- .../test/MultiTableBatchWriterIT.java | 2 +- .../apache/accumulo/test/NamespacesIT.java | 6 +- .../apache/accumulo/test/SplitRecoveryIT.java | 2 +- .../accumulo/test/TransportCachingIT.java | 2 +- .../org/apache/accumulo/test/VolumeIT.java | 2 +- .../functional/AccumuloInputFormatIT.java | 2 +- .../BalanceAfterCommsFailureIT.java | 2 +- .../BalanceInPresenceOfOfflineTableIT.java | 2 +- .../test/functional/DynamicThreadPoolsIT.java | 2 +- .../accumulo/test/functional/KerberosIT.java | 37 +- .../test/functional/MasterAssignmentIT.java | 4 +- .../test/functional/MetadataMaxFilesIT.java | 2 +- .../test/functional/PermissionsIT.java | 2 +- .../functional/SimpleBalancerFairnessIT.java | 2 +- .../accumulo/test/functional/SplitIT.java | 2 +- .../test/functional/SplitRecoveryIT.java | 2 +- .../accumulo/test/functional/TableIT.java | 2 +- .../TabletStateChangeIteratorIT.java | 2 +- ...geCollectorCommunicatesWithTServersIT.java | 2 +- ...usedWalDoesntCloseReplicationStatusIT.java | 2 +- 260 files changed, 1934 insertions(+), 1228 deletions(-) rename core/src/main/java/org/apache/accumulo/core/{security => client/impl}/AuthenticationTokenIdentifier.java (99%) rename core/src/main/java/org/apache/accumulo/core/{security => client/impl}/Credentials.java (99%) create mode 100644 core/src/main/java/org/apache/accumulo/core/client/impl/DelegationTokenImpl.java create mode 100644 core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java create mode 100644 core/src/main/java/org/apache/accumulo/core/data/TabletID.java create mode 100644 core/src/main/java/org/apache/accumulo/core/data/impl/ComparableBytes.java create mode 100644 core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java create mode 100644 core/src/main/java/org/apache/accumulo/core/data/impl/TabletIDImpl.java rename core/src/test/java/org/apache/accumulo/core/client/security/tokens/{DelegationTokenTest.java => DelegationTokenImplTest.java} (79%) diff --git a/README.md b/README.md index 15be8dbc34f..633e1b5ff03 100644 --- a/README.md +++ b/README.md @@ -76,15 +76,26 @@ API The public Accumulo API is composed of : - * All public classes and interfaces in the org.apache.accumulo.core.client - package, as as well as all of its subpackages excluding those named *impl*. - * Key, Mutation, Value, Range, Condition, and ConditionalMutation in - org.apache.accumulo.core.data. - * All public classes and interfaces in the org.apache.accumulo.minicluster - package, as well as all of its subpackages excluding those named *impl*. - * Anything with public or protected acccess within any Class or Interface that - is in the public API. This includes, but is not limited to: methods, members - classes, interfaces, and enums. +All public types in the following packages and their subpackages excluding +those named *impl*, *thrift*, or *crypto*. + + * org.apache.accumulo.core.client + * org.apache.accumulo.core.data + * org.apache.accumulo.core.security + * org.apache.accumulo.minicluster + +A type is a class, interface, or enum. Anything with public or protected +acccess in an API type is in the API. This includes, but is not limited to: +methods, members classes, interfaces, and enums. Package-private types in +the above packages are *not* considered public API. + +The following regex matches imports that are *not* Accumulo public API. This +regex can be used with [RegexpSingleline][13] to automatically find suspicious +imports in a project using Accumulo. + +``` +import\s+org\.apache\.accumulo\.(.*\.(impl|thrift|crypto)\..*|(?!core|minicluster).*|core\.(?!client|data|security).*) +``` The Accumulo project maintains binary compatibility across this API within a major release, as defined in the Java Language Specification 3rd ed. Starting @@ -100,3 +111,4 @@ with Accumulo 1.6.2 and 1.7.0 all API changes will follow [semver 2.0][12] [8]: http://accumulo.apache.org/notable_features.html [9]: http://maven.apache.org/ [12]: http://semver.org/spec/v2.0.0.html +[13]: http://checkstyle.sourceforge.net/config_regexp.html diff --git a/core/pom.xml b/core/pom.xml index f4918bc3f44..521411caca0 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -177,19 +177,46 @@ org[.]apache[.]accumulo[.]core[.]client[.].* - org[.]apache[.]accumulo[.]core[.]data[.](Mutation|Key|Value|Condition|ConditionalMutation|Range|ByteSequence|PartialKey|Column)([$].*)? - org[.]apache[.]accumulo[.]core[.]security[.](ColumnVisibility|Authorizations|NamespacePermission|SystemPermission|TablePermission)([$].*)? + org[.]apache[.]accumulo[.]core[.]data[.].* + org[.]apache[.]accumulo[.]core[.]security[.].* + + org[.]apache[.]accumulo[.]core[.]util[.](Pair|ComparablePair) + org[.]apache[.]accumulo[.]core[.]iterators[.]IteratorUtil[$]IteratorScope .*Impl .*[.]impl[.].* + .*[.]thrift[.].* + org[.]apache[.]accumulo[.]core[.]security[.]crypto[.].* org[.]apache[.]accumulo[.]core[.]client[.]mock[.].* + org[.]apache[.]accumulo[.].*[.]thrift[.].* - org[.]apache[.]commons[.].* - org[.]apache[.]hadoop[.].* - org[.]apache[.]log4j[.].* + + org[.]apache[.]commons[.]configuration[.]Configuration + org[.]apache[.]commons[.]configuration[.]AbstractConfiguration + org[.]apache[.]commons[.]configuration[.]event[.]EventSource + + org[.]apache[.]hadoop[.]conf[.]Configuration + org[.]apache[.]hadoop[.]fs[.](FileSystem|Path) + org[.]apache[.]hadoop[.]io[.](Text|Writable|WritableComparable|WritableComparator) + org[.]apache[.]hadoop[.]mapred[.](JobConf|RecordReader|InputSplit|RecordWriter|Reporter) + org[.]apache[.]hadoop[.]mapreduce[.](Job|JobContext|RecordReader|InputSplit|TaskAttemptContext|RecordWriter|OutputCommitter|TaskInputOutputContext) + org[.]apache[.]hadoop[.]util[.]Progressable + + org[.]apache[.]log4j[.](Level|Logger) diff --git a/core/src/main/findbugs/exclude-filter.xml b/core/src/main/findbugs/exclude-filter.xml index 3cc5e30aa07..aa854f08c68 100644 --- a/core/src/main/findbugs/exclude-filter.xml +++ b/core/src/main/findbugs/exclude-filter.xml @@ -52,6 +52,7 @@ + diff --git a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java index d37d4718f04..e8f6c202fc4 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java +++ b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java @@ -114,6 +114,10 @@ public String getDefaultValue() { return defaultValue; } + /** + * @deprecated since 1.7.0 This method returns a type that is not part of the public API and not guaranteed to be stable. + */ + @Deprecated public PropertyType getType() { return type; } @@ -122,6 +126,10 @@ public String getDescription() { return description; } + /** + * @deprecated since 1.7.0 This method returns a type that is not part of the public API and not guaranteed to be stable. + */ + @Deprecated public Property getAccumuloProperty() { return accumuloProperty; } diff --git a/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java b/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java index ec13b1f318a..c75f54a1eb8 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java +++ b/core/src/main/java/org/apache/accumulo/core/client/ClientSideIteratorScanner.java @@ -61,10 +61,25 @@ public class ClientSideIteratorScanner extends ScannerOptions implements Scanner private boolean isolated = false; private long readaheadThreshold = Constants.SCANNER_DEFAULT_READAHEAD_THRESHOLD; + /** + * @deprecated since 1.7.0 was never intended for public use. However this could have been used by anything extending this class. + */ + @Deprecated + public class ScannerTranslator extends ScannerTranslatorImpl { + public ScannerTranslator(Scanner scanner) { + super(scanner); + } + + @Override + public SortedKeyValueIterator deepCopy(final IteratorEnvironment env) { + return new ScannerTranslator(scanner); + } + } + /** * A class that wraps a Scanner in a SortedKeyValueIterator so that other accumulo iterators can use it as a source. */ - public class ScannerTranslator implements SortedKeyValueIterator { + private class ScannerTranslatorImpl implements SortedKeyValueIterator { protected Scanner scanner; Iterator> iter; Entry top = null; @@ -75,7 +90,7 @@ public class ScannerTranslator implements SortedKeyValueIterator { * @param scanner * the scanner to iterate over */ - public ScannerTranslator(final Scanner scanner) { + public ScannerTranslatorImpl(final Scanner scanner) { this.scanner = scanner; } @@ -123,11 +138,11 @@ public Value getTopValue() { @Override public SortedKeyValueIterator deepCopy(final IteratorEnvironment env) { - return new ScannerTranslator(scanner); + return new ScannerTranslatorImpl(scanner); } } - private ScannerTranslator smi; + private ScannerTranslatorImpl smi; /** * Constructs a scanner that can execute client-side iterators. @@ -136,7 +151,7 @@ public SortedKeyValueIterator deepCopy(final IteratorEnvironment env) * the source scanner */ public ClientSideIteratorScanner(final Scanner scanner) { - smi = new ScannerTranslator(scanner); + smi = new ScannerTranslatorImpl(scanner); this.range = scanner.getRange(); this.size = scanner.getBatchSize(); this.timeOut = scanner.getTimeout(TimeUnit.MILLISECONDS); @@ -147,7 +162,7 @@ public ClientSideIteratorScanner(final Scanner scanner) { * Sets the source Scanner. */ public void setSource(final Scanner scanner) { - smi = new ScannerTranslator(scanner); + smi = new ScannerTranslatorImpl(scanner); } @Override diff --git a/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java b/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java index 3546cdfc8b1..e530100089a 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java +++ b/core/src/main/java/org/apache/accumulo/core/client/IsolatedScanner.java @@ -170,11 +170,11 @@ public void remove() { } - interface RowBufferFactory { + public static interface RowBufferFactory { RowBuffer newBuffer(); } - interface RowBuffer extends Iterable> { + public static interface RowBuffer extends Iterable> { void add(Entry entry); @Override diff --git a/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java b/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java index 962ef25c0a0..1a7e1acd634 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java +++ b/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java @@ -28,7 +28,11 @@ import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.data.ConstraintViolationSummary; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.TabletID; +import org.apache.accumulo.core.data.impl.TabletIDImpl; + +import com.google.common.base.Function; +import com.google.common.collect.Collections2; /** * Communicate the failed mutations of a BatchWriter back to the client. @@ -38,10 +42,19 @@ public class MutationsRejectedException extends AccumuloException { private static final long serialVersionUID = 1L; private List cvsl; - private Map> af; + private Map> af; private Collection es; private int unknownErrors; + private static Map transformKeys(Map map, Function keyFunction) { + HashMap ret = new HashMap(); + for(Entry entry : map.entrySet()){ + ret.put(keyFunction.apply(entry.getKey()), entry.getValue()); + } + + return ret; + } + /** * @param cvsList * list of constraint violations @@ -55,12 +68,12 @@ public class MutationsRejectedException extends AccumuloException { * @deprecated since 1.6.0, see {@link #MutationsRejectedException(Instance, List, HashMap, Collection, int, Throwable)} */ @Deprecated - public MutationsRejectedException(List cvsList, HashMap> hashMap, + public MutationsRejectedException(List cvsList, HashMap> hashMap, Collection serverSideErrors, int unknownErrors, Throwable cause) { super("# constraint violations : " + cvsList.size() + " security codes: " + hashMap.values() + " # server errors " + serverSideErrors.size() + " # exceptions " + unknownErrors, cause); this.cvsl = cvsList; - this.af = hashMap; + this.af = transformKeys(hashMap, TabletIDImpl.KE_2_TID_OLD); this.es = serverSideErrors; this.unknownErrors = unknownErrors; } @@ -74,8 +87,34 @@ public MutationsRejectedException(List cvsList, Hash * server side errors * @param unknownErrors * number of unknown errors + * + * @deprecated since 1.7.0 see {@link #MutationsRejectedException(Instance, List, Map, Collection, int, Throwable)} */ - public MutationsRejectedException(Instance instance, List cvsList, HashMap> hashMap, + @Deprecated + public MutationsRejectedException(Instance instance, List cvsList, HashMap> hashMap, + Collection serverSideErrors, int unknownErrors, Throwable cause) { + super("# constraint violations : " + cvsList.size() + " security codes: " + format(transformKeys(hashMap, TabletIDImpl.KE_2_TID_OLD), instance) + + " # server errors " + serverSideErrors.size() + " # exceptions " + unknownErrors, cause); + this.cvsl = cvsList; + this.af = transformKeys(hashMap, TabletIDImpl.KE_2_TID_OLD); + this.es = serverSideErrors; + this.unknownErrors = unknownErrors; + } + + /** + * + * @param cvsList + * list of constraint violations + * @param hashMap + * authorization failures + * @param serverSideErrors + * server side errors + * @param unknownErrors + * number of unknown errors + * + * @since 1.7.0 + */ + public MutationsRejectedException(Instance instance, List cvsList, Map> hashMap, Collection serverSideErrors, int unknownErrors, Throwable cause) { super("# constraint violations : " + cvsList.size() + " security codes: " + format(hashMap, instance) + " # server errors " + serverSideErrors.size() + " # exceptions " + unknownErrors, cause); @@ -85,10 +124,10 @@ public MutationsRejectedException(Instance instance, List> hashMap, Instance instance) { + private static String format(Map> hashMap, Instance instance) { Map> result = new HashMap>(); - for (Entry> entry : hashMap.entrySet()) { + for (Entry> entry : hashMap.entrySet()) { String tableInfo = Tables.getPrintableTableInfoFromId(instance, entry.getKey().getTableId().toString()); if (!result.containsKey(tableInfo)) { @@ -113,15 +152,24 @@ public List getConstraintViolationSummaries() { * @deprecated since 1.5, see {@link #getAuthorizationFailuresMap()} */ @Deprecated - public List getAuthorizationFailures() { - return new ArrayList(af.keySet()); + public List getAuthorizationFailures() { + return new ArrayList(Collections2.transform(af.keySet(), TabletIDImpl.TID_2_KE_OLD)); } /** * @return the internal mapping of keyextent mappings to SecurityErrorCode * @since 1.5.0 + * @deprecated since 1.7.0 see {@link #getSecurityErrorCodes()} + */ + @Deprecated + public Map> getAuthorizationFailuresMap() { + return transformKeys(af, TabletIDImpl.TID_2_KE_OLD); + } + + /** + * @return the internal mapping of TabletID to SecurityErrorCodes */ - public Map> getAuthorizationFailuresMap() { + public Map> getSecurityErrorCodes(){ return af; } diff --git a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java index 38078d261a7..c5cb482cb41 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java +++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java @@ -28,12 +28,13 @@ import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.ConnectorImpl; +import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.InstanceOperationsImpl; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.metadata.RootTable; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.ByteBufferUtil; import org.apache.accumulo.core.util.OpTimer; import org.apache.accumulo.core.util.TextUtil; @@ -215,7 +216,7 @@ public String getRootTabletLocation() { @Override public String getInstanceName() { if (instanceName == null) - instanceName = lookupInstanceName(zooCache, UUID.fromString(getInstanceID())); + instanceName = InstanceOperationsImpl.lookupInstanceName(zooCache, UUID.fromString(getInstanceID())); return instanceName; } @@ -267,19 +268,13 @@ public void setConfiguration(AccumuloConfiguration conf) { /** * Given a zooCache and instanceId, look up the instance name. + * + * @deprecated since 1.7.0 {@link ZooCache} is not part of the public API, but its a parameter to this method. Therefore code that uses this method is not + * guaranteed to be stable. This method was deprecated to discourage its use. */ + @Deprecated public static String lookupInstanceName(ZooCache zooCache, UUID instanceId) { - checkArgument(zooCache != null, "zooCache is null"); - checkArgument(instanceId != null, "instanceId is null"); - for (String name : zooCache.getChildren(Constants.ZROOT + Constants.ZINSTANCES)) { - String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + name; - byte[] bytes = zooCache.get(instanceNamePath); - UUID iid = UUID.fromString(new String(bytes, UTF_8)); - if (iid.equals(instanceId)) { - return name; - } - } - return null; + return InstanceOperationsImpl.lookupInstanceName(zooCache, instanceId); } @Override diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveCompaction.java b/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveCompaction.java index b9de4c23ab3..8f3a5aa7447 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveCompaction.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveCompaction.java @@ -20,7 +20,7 @@ import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.TableNotFoundException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.TabletID; /** * @@ -78,8 +78,16 @@ public static enum CompactionReason { /** * @return tablet thats is compacting + * @deprecated since 1.7.0 use {@link #getTablet()} */ - public abstract KeyExtent getExtent(); + @Deprecated + public abstract org.apache.accumulo.core.data.KeyExtent getExtent(); + + /** + * @return tablet thats is compacting + * @since 1.7.0 + */ + public abstract TabletID getTablet(); /** * @return how long the compaction has been running in milliseconds diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveScan.java b/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveScan.java index cde5d27e64d..46213995089 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveScan.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/ActiveScan.java @@ -20,7 +20,7 @@ import java.util.Map; import org.apache.accumulo.core.data.Column; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.TabletID; import org.apache.accumulo.core.security.Authorizations; /** @@ -65,8 +65,16 @@ public abstract class ActiveScan { /** * @return tablet the scan is running against, if a batch scan may be one of many or null + * @deprecated since 1.7.0 use {@link #getTablet()} */ - public abstract KeyExtent getExtent(); + @Deprecated + public abstract org.apache.accumulo.core.data.KeyExtent getExtent(); + + /** + * @return tablet the scan is running against, if a batch scan may be one of many or null + * @since 1.7.0 + */ + public abstract TabletID getTablet(); /** * @return columns requested by the scan diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/DelegationTokenConfig.java b/core/src/main/java/org/apache/accumulo/core/client/admin/DelegationTokenConfig.java index 2e25c3dfc3b..dab146c43f7 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/DelegationTokenConfig.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/DelegationTokenConfig.java @@ -21,10 +21,8 @@ import java.util.concurrent.TimeUnit; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; - /** - * Configuration options for obtaining a {@link DelegationToken} + * Configuration options for obtaining a delegation token created by {@link SecurityOperations#getDelegationToken(DelegationTokenConfig)} * * @since 1.7.0 */ diff --git a/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java b/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java index 2682f95ed85..cb916efde71 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java +++ b/core/src/main/java/org/apache/accumulo/core/client/admin/SecurityOperations.java @@ -352,9 +352,8 @@ public interface SecurityOperations { Set listLocalUsers() throws AccumuloException, AccumuloSecurityException; /** - * Obtain a {@link DelegationToken} for use when Kerberos credentials are unavailable (e.g. YARN Jobs) + * Obtain a {@link DelegationToken} for use when Kerberos credentials cannot be used (e.g. YARN Jobs) * - * @return a {@link DelegationToken} for this user * @since 1.7.0 */ DelegationToken getDelegationToken(DelegationTokenConfig cfg) throws AccumuloException, AccumuloSecurityException; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java index 46259d12ffd..6dbac731cda 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveCompactionImpl.java @@ -24,7 +24,9 @@ import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.ActiveCompaction; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.TabletID; +import org.apache.accumulo.core.data.impl.KeyExtent; +import org.apache.accumulo.core.data.impl.TabletIDImpl; import org.apache.accumulo.core.data.thrift.IterInfo; /** @@ -43,12 +45,21 @@ public class ActiveCompactionImpl extends ActiveCompaction { @Override public String getTable() throws TableNotFoundException { - return Tables.getTableName(instance, getExtent().getTableId().toString()); + return Tables.getTableName(instance, new KeyExtent(tac.getExtent()).getTableId().toString()); + } + + + @Override + @Deprecated + public org.apache.accumulo.core.data.KeyExtent getExtent() { + KeyExtent ke = new KeyExtent(tac.getExtent()); + org.apache.accumulo.core.data.KeyExtent oke = new org.apache.accumulo.core.data.KeyExtent(ke.getTableId(), ke.getEndRow(), ke.getPrevEndRow()); + return oke; } @Override - public KeyExtent getExtent() { - return new KeyExtent(tac.getExtent()); + public TabletID getTablet() { + return new TabletIDImpl(new KeyExtent(tac.getExtent())); } @Override diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java index 5f953e2060c..602a422f68f 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ActiveScanImpl.java @@ -26,7 +26,9 @@ import org.apache.accumulo.core.client.admin.ScanState; import org.apache.accumulo.core.client.admin.ScanType; import org.apache.accumulo.core.data.Column; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.TabletID; +import org.apache.accumulo.core.data.impl.KeyExtent; +import org.apache.accumulo.core.data.impl.TabletIDImpl; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.data.thrift.TColumn; import org.apache.accumulo.core.security.Authorizations; @@ -117,8 +119,14 @@ public ScanState getState() { } @Override - public KeyExtent getExtent() { - return extent; + @Deprecated + public org.apache.accumulo.core.data.KeyExtent getExtent() { + return new org.apache.accumulo.core.data.KeyExtent(extent.getTableId(), extent.getEndRow(), extent.getPrevEndRow()); + } + + @Override + public TabletID getTablet() { + return new TabletIDImpl(extent); } @Override diff --git a/core/src/main/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifier.java b/core/src/main/java/org/apache/accumulo/core/client/impl/AuthenticationTokenIdentifier.java similarity index 99% rename from core/src/main/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifier.java rename to core/src/main/java/org/apache/accumulo/core/client/impl/AuthenticationTokenIdentifier.java index 0b671d87140..1f548bcf620 100644 --- a/core/src/main/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifier.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/AuthenticationTokenIdentifier.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.accumulo.core.security; +package org.apache.accumulo.core.client.impl; import static com.google.common.base.Preconditions.checkNotNull; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java index 9def3ab06b7..cba7e8dd0aa 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java @@ -36,7 +36,6 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.rpc.SaslConnectionParams; import org.apache.accumulo.core.rpc.SslConnectionParams; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.commons.configuration.Configuration; import org.slf4j.Logger; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java index 0aef3b8e511..a2430d45ae7 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java @@ -53,7 +53,7 @@ import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Condition; import org.apache.accumulo.core.data.ConditionalMutation; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.TCMResult; import org.apache.accumulo.core.data.thrift.TCMStatus; import org.apache.accumulo.core.data.thrift.TCondition; diff --git a/core/src/main/java/org/apache/accumulo/core/security/Credentials.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java similarity index 99% rename from core/src/main/java/org/apache/accumulo/core/security/Credentials.java rename to core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java index ed7789a7a30..28a704a827c 100644 --- a/core/src/main/java/org/apache/accumulo/core/security/Credentials.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.accumulo.core.security; +package org.apache.accumulo.core.client.impl; import static java.nio.charset.StandardCharsets.UTF_8; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/DelegationTokenImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/DelegationTokenImpl.java new file mode 100644 index 00000000000..119f1579c18 --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/DelegationTokenImpl.java @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.core.client.impl; + +import static com.google.common.base.Preconditions.checkNotNull; + +import java.io.DataInput; +import java.io.DataOutput; +import java.io.IOException; +import java.util.Collections; +import java.util.Set; + +import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.security.tokens.DelegationToken; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.security.Credentials; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.security.token.Token; +import org.apache.hadoop.security.token.TokenIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DelegationTokenImpl extends PasswordToken implements DelegationToken { + private static final Logger log = LoggerFactory.getLogger(DelegationTokenImpl.class); + + public static final String SERVICE_NAME = "AccumuloDelegationToken"; + + private AuthenticationTokenIdentifier identifier; + + public DelegationTokenImpl() { + super(); + } + + public DelegationTokenImpl(byte[] delegationTokenPassword, AuthenticationTokenIdentifier identifier) { + checkNotNull(delegationTokenPassword); + checkNotNull(identifier); + setPassword(delegationTokenPassword); + this.identifier = identifier; + } + + public DelegationTokenImpl(Instance instance, UserGroupInformation user, AuthenticationTokenIdentifier identifier) { + checkNotNull(instance); + checkNotNull(user); + checkNotNull(identifier); + + Credentials creds = user.getCredentials(); + Token token = creds.getToken(new Text(SERVICE_NAME + "-" + instance.getInstanceID())); + if (null == token) { + throw new IllegalArgumentException("Did not find Accumulo delegation token in provided UserGroupInformation"); + } + setPasswordFromToken(token, identifier); + } + + public DelegationTokenImpl(Token token, AuthenticationTokenIdentifier identifier) { + checkNotNull(token); + checkNotNull(identifier); + setPasswordFromToken(token, identifier); + } + + private void setPasswordFromToken(Token token, AuthenticationTokenIdentifier identifier) { + if (!AuthenticationTokenIdentifier.TOKEN_KIND.equals(token.getKind())) { + String msg = "Expected an AuthenticationTokenIdentifier but got a " + token.getKind(); + log.error(msg); + throw new IllegalArgumentException(msg); + } + + setPassword(token.getPassword()); + this.identifier = identifier; + } + + /** + * The identifier for this token, may be null. + */ + public AuthenticationTokenIdentifier getIdentifier() { + return identifier; + } + + /** + * The service name used to identify the {@link Token} + */ + public Text getServiceName() { + checkNotNull(identifier); + return new Text(SERVICE_NAME + "-" + identifier.getInstanceId()); + } + + @Override + public void init(Properties properties) { + // Encourage use of UserGroupInformation as entry point + } + + @Override + public Set getProperties() { + // Encourage use of UserGroupInformation as entry point + return Collections.emptySet(); + } + + @Override + public void write(DataOutput out) throws IOException { + super.write(out); + identifier.write(out); + } + + @Override + public void readFields(DataInput in) throws IOException { + super.readFields(in); + identifier = new AuthenticationTokenIdentifier(); + identifier.readFields(in); + } + + @Override + public DelegationTokenImpl clone() { + DelegationTokenImpl copy = (DelegationTokenImpl) super.clone(); + copy.setPassword(getPassword()); + copy.identifier = new AuthenticationTokenIdentifier(identifier); + return copy; + } + + @Override + public int hashCode() { + return super.hashCode() ^ identifier.hashCode(); + } + + @Override + public boolean equals(Object obj) { + // We assume we can cast obj to DelegationToken because the super.equals(obj) check ensures obj is of the same type as this + return super.equals(obj) && identifier.equals(((DelegationTokenImpl) obj).identifier); + } + +} diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java index 7b3ee12a4c8..63839676593 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java @@ -23,6 +23,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.UUID; import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.AccumuloException; @@ -221,4 +222,21 @@ public void execute(MasterClientService.Client client) throws Exception { } } + + /** + * Given a zooCache and instanceId, look up the instance name. + */ + public static String lookupInstanceName(ZooCache zooCache, UUID instanceId) { + checkArgument(zooCache != null, "zooCache is null"); + checkArgument(instanceId != null, "instanceId is null"); + for (String name : zooCache.getChildren(Constants.ZROOT + Constants.ZINSTANCES)) { + String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + name; + byte[] bytes = zooCache.get(instanceNamePath); + UUID iid = UUID.fromString(new String(bytes, UTF_8)); + if (iid.equals(instanceId)) { + return name; + } + } + return null; + } } diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java index 264e05a5c3c..ce6bc09610e 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java @@ -48,7 +48,6 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator; import org.apache.accumulo.core.master.thrift.FateOperation; import org.apache.accumulo.core.master.thrift.MasterClientService; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.OpTimer; import org.apache.log4j.Level; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java index 0263bfa8008..2f313195e04 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java @@ -38,11 +38,11 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.KeyValue; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.iterators.IteratorEnvironment; @@ -60,7 +60,6 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.ColumnVisibility; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.accumulo.core.util.LocalityGroupUtil; import org.apache.accumulo.core.util.Pair; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java index 49d5c9e32d3..3a0c0d7e83b 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/RootTabletLocator.java @@ -27,9 +27,9 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.TabletLocatorImpl.TabletServerLockChecker; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.util.OpTimer; import org.apache.accumulo.core.util.UtilWaitThread; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/SecurityOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/SecurityOperationsImpl.java index bfba270012d..73f17a79b1b 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/SecurityOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/SecurityOperationsImpl.java @@ -35,9 +35,7 @@ import org.apache.accumulo.core.client.security.tokens.DelegationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.master.thrift.MasterClientService.Client; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.NamespacePermission; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; @@ -382,7 +380,7 @@ public TDelegationToken execute(Client client) throws Exception { AuthenticationTokenIdentifier identifier = new AuthenticationTokenIdentifier(thriftToken.getIdentifier()); // Get the password out of the thrift delegation token - return new DelegationToken(thriftToken.getPassword(), identifier); + return new DelegationTokenImpl(thriftToken.getPassword(), identifier); } } diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java index d4bcac45bb6..0e30d527387 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java @@ -79,9 +79,9 @@ import org.apache.accumulo.core.constraints.Constraint; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.IteratorUtil; import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java index 2af45d359ce..1fbaee891ba 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java @@ -30,9 +30,9 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableNotFoundException; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataLocationObtainer; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java index 99cd8aab2ba..c28320db5a5 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java @@ -38,10 +38,10 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.util.OpTimer; import org.apache.accumulo.core.util.Pair; import org.apache.accumulo.core.util.TextUtil; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java index 61f6d1505f3..2a0e1d85546 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java @@ -45,9 +45,9 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.InitialMultiScan; import org.apache.accumulo.core.data.thrift.MultiScanResult; import org.apache.accumulo.core.data.thrift.TKeyExtent; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java index 469495a7696..6a4d3482eca 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java @@ -49,8 +49,10 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.constraints.Violations; import org.apache.accumulo.core.data.ConstraintViolationSummary; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.TabletID; +import org.apache.accumulo.core.data.impl.KeyExtent; +import org.apache.accumulo.core.data.impl.TabletIDImpl; import org.apache.accumulo.core.data.thrift.TMutation; import org.apache.accumulo.core.data.thrift.UpdateErrors; import org.apache.accumulo.core.master.state.tables.TableState; @@ -534,7 +536,7 @@ private synchronized void updateUnknownErrors(String msg, Throwable t) { private void checkForFailures() throws MutationsRejectedException { if (somethingFailed) { List cvsList = violations.asList(); - HashMap> af = new HashMap>(); + HashMap> af = new HashMap>(); for (Entry> entry : authorizationFailures.entrySet()) { HashSet codes = new HashSet(); @@ -542,7 +544,7 @@ private void checkForFailures() throws MutationsRejectedException { codes.add(org.apache.accumulo.core.client.security.SecurityErrorCode.valueOf(sce.name())); } - af.put(entry.getKey(), codes); + af.put(new TabletIDImpl(entry.getKey()), codes); } throw new MutationsRejectedException(context.getInstance(), cvsList, af, serverSideErrors, unknownErrors, lastUnknownError); diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletType.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletType.java index d57bf940725..ad7d43ee242 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletType.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletType.java @@ -18,7 +18,7 @@ import java.util.Collection; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; public enum TabletType { ROOT, METADATA, USER; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java index abe91d94a0b..4bfbfa03739 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java @@ -38,11 +38,11 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.KeyValue; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.InitialScan; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.data.thrift.ScanResult; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java index 81c1ccc554d..c0cb2193d4b 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TimeoutTabletLocator.java @@ -25,9 +25,9 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TimedOutException; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.Text; /** diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java index 2503d95be95..e5141cfa38e 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Translator.java @@ -25,8 +25,8 @@ import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.ConstraintViolationSummary; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.TColumn; import org.apache.accumulo.core.data.thrift.TConstraintViolationSummary; import org.apache.accumulo.core.data.thrift.TKeyExtent; diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java index 74b3811ec36..cf2d6428e9f 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java @@ -24,8 +24,8 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.rpc.ThriftUtil; import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException; import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException; diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java index df317e33819..b97d4deca9a 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java @@ -42,7 +42,11 @@ import org.apache.accumulo.core.client.TableOfflineException; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; +import org.apache.accumulo.core.client.admin.SecurityOperations; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.impl.OfflineScanner; import org.apache.accumulo.core.client.impl.ScannerImpl; import org.apache.accumulo.core.client.impl.Tables; @@ -58,13 +62,11 @@ import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.Pair; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.hadoop.io.Text; @@ -90,7 +92,8 @@ public abstract class AbstractInputFormat implements InputFormat { *

* WARNING: Some tokens, when serialized, divulge sensitive information in the configuration as a means to pass the token to MapReduce tasks. This * information is BASE64 encoded to provide a charset safe conversion to a string, but this conversion is not intended to be secure. {@link PasswordToken} is - * one example that is insecure in this way; however {@link DelegationToken}s, acquired using a {@link KerberosToken}, is not subject to this concern. + * one example that is insecure in this way; however {@link DelegationToken}s, acquired using + * {@link SecurityOperations#getDelegationToken(DelegationTokenConfig)}, is not subject to this concern. * * @param job * the Hadoop job instance to be configured @@ -112,8 +115,8 @@ public static void setConnectorInfo(JobConf job, String principal, Authenticatio } } // DelegationTokens can be passed securely from user to task without serializing insecurely in the configuration - if (token instanceof DelegationToken) { - DelegationToken delegationToken = (DelegationToken) token; + if (token instanceof DelegationTokenImpl) { + DelegationTokenImpl delegationToken = (DelegationTokenImpl) token; // Convert it into a Hadoop Token AuthenticationTokenIdentifier identifier = delegationToken.getIdentifier(); @@ -304,7 +307,10 @@ protected static Authorizations getScanAuthorizations(JobConf job) { * @throws org.apache.accumulo.core.client.TableNotFoundException * if the table name set on the configuration doesn't exist * @since 1.6.0 + * @deprecated since 1.7.0 This method returns a type that is not part of the public API and is not guaranteed to be stable. The method was deprecated to + * discourage its use. */ + @Deprecated protected static TabletLocator getTabletLocator(JobConf job, String tableId) throws TableNotFoundException { return InputConfigurator.getTabletLocator(CLASS, job, tableId); } @@ -669,7 +675,7 @@ public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { binnedRanges = binOfflineTable(job, tableId, ranges); } } else { - tl = getTabletLocator(job, tableId); + tl = InputConfigurator.getTabletLocator(CLASS, job, tableId); // its possible that the cache could contain complete, but old information about a tables tablets... so clear it tl.invalidateCache(); diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormat.java index 2f2b4b2013f..0eb304f4f7b 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormat.java @@ -62,7 +62,10 @@ public class AccumuloFileOutputFormat extends FileOutputFormat { * @param job * the Hadoop context for the configured job * @since 1.5.0 + * @deprecated since 1.7.0 This method returns a type that is not part of the public API and is not guaranteed to be stable. The method was deprecated to + * discourage its use. */ + @Deprecated protected static AccumuloConfiguration getAccumuloConfiguration(JobConf job) { return FileOutputConfigurator.getAccumuloConfiguration(CLASS, job); } @@ -141,7 +144,7 @@ public static void setReplication(JobConf job, int replication) { public RecordWriter getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException { // get the path of the temporary output file final Configuration conf = job; - final AccumuloConfiguration acuConf = getAccumuloConfiguration(job); + final AccumuloConfiguration acuConf = FileOutputConfigurator.getAccumuloConfiguration(CLASS, job); final String extension = acuConf.get(Property.TABLE_FILE_TYPE); final Path file = new Path(getWorkOutputPath(job), getUniqueName(job, "part") + "." + extension); diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java index 8bcf2a95896..de2be1bbb94 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java @@ -35,6 +35,9 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; +import org.apache.accumulo.core.client.admin.SecurityOperations; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase; import org.apache.accumulo.core.client.mapreduce.lib.impl.OutputConfigurator; import org.apache.accumulo.core.client.mock.MockInstance; @@ -43,10 +46,10 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer; import org.apache.accumulo.core.client.security.tokens.DelegationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.ColumnUpdate; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.data.TabletID; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.io.Text; @@ -80,10 +83,12 @@ public class AccumuloOutputFormat implements OutputFormat { /** * Sets the connector information needed to communicate with Accumulo in this job. - * + *

- * WARNING: The serialized token is stored in the configuration and shared with all MapReduce tasks. It is BASE64 encoded to provide a charset safe - * conversion to a string, and is not intended to be secure. + * WARNING: Some tokens, when serialized, divulge sensitive information in the configuration as a means to pass the token to MapReduce tasks. This + * information is BASE64 encoded to provide a charset safe conversion to a string, but this conversion is not intended to be secure. {@link PasswordToken} is + * one example that is insecure in this way; however {@link DelegationToken}s, acquired using + * {@link SecurityOperations#getDelegationToken(DelegationTokenConfig)}, is not subject to this concern. * * @param job * the Hadoop job instance to be configured @@ -105,8 +110,8 @@ public static void setConnectorInfo(JobConf job, String principal, Authenticatio } } // DelegationTokens can be passed securely from user to task without serializing insecurely in the configuration - if (token instanceof DelegationToken) { - DelegationToken delegationToken = (DelegationToken) token; + if (token instanceof DelegationTokenImpl) { + DelegationTokenImpl delegationToken = (DelegationTokenImpl) token; // Convert it into a Hadoop Token AuthenticationTokenIdentifier identifier = delegationToken.getIdentifier(); @@ -537,9 +542,9 @@ public void close(Reporter reporter) throws IOException { try { mtbw.close(); } catch (MutationsRejectedException e) { - if (e.getAuthorizationFailuresMap().size() >= 0) { + if (e.getSecurityErrorCodes().size() >= 0) { HashMap> tables = new HashMap>(); - for (Entry> ke : e.getAuthorizationFailuresMap().entrySet()) { + for (Entry> ke : e.getSecurityErrorCodes().entrySet()) { Set secCodes = tables.get(ke.getKey().getTableId().toString()); if (secCodes == null) { secCodes = new HashSet(); diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java index e3c3c42a1c0..c7a304cbd97 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java @@ -41,7 +41,11 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TableOfflineException; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; +import org.apache.accumulo.core.client.admin.SecurityOperations; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.impl.OfflineScanner; import org.apache.accumulo.core.client.impl.ScannerImpl; import org.apache.accumulo.core.client.impl.Tables; @@ -56,13 +60,11 @@ import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.Pair; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.core.client.IteratorSetting; @@ -91,9 +93,10 @@ public abstract class AbstractInputFormat extends InputFormat { * Sets the connector information needed to communicate with Accumulo in this job. * *

- * WARNING: For {@link PasswordToken}, the serialized token is stored in the configuration and shared with all MapReduce tasks. It is BASE64 encoded to - * provide a charset safe conversion to a string, and is not intended to be secure. This is not the case for {@link KerberosToken} and the corresponding - * {@link DelegationToken} acquired using the KerberosToken. + * WARNING: Some tokens, when serialized, divulge sensitive information in the configuration as a means to pass the token to MapReduce tasks. This + * information is BASE64 encoded to provide a charset safe conversion to a string, but this conversion is not intended to be secure. {@link PasswordToken} is + * one example that is insecure in this way; however {@link DelegationToken}s, acquired using + * {@link SecurityOperations#getDelegationToken(DelegationTokenConfig)}, is not subject to this concern. * * @param job * the Hadoop job instance to be configured @@ -115,8 +118,8 @@ public static void setConnectorInfo(Job job, String principal, AuthenticationTok } } // DelegationTokens can be passed securely from user to task without serializing insecurely in the configuration - if (token instanceof DelegationToken) { - DelegationToken delegationToken = (DelegationToken) token; + if (token instanceof DelegationTokenImpl) { + DelegationTokenImpl delegationToken = (DelegationTokenImpl) token; // Convert it into a Hadoop Token AuthenticationTokenIdentifier identifier = delegationToken.getIdentifier(); @@ -360,7 +363,10 @@ protected static InputTableConfig getInputTableConfig(JobContext context, String * @throws org.apache.accumulo.core.client.TableNotFoundException * if the table name set on the configuration doesn't exist * @since 1.6.0 + * @deprecated since 1.7.0 This method returns a type that is not part of the public API and is not guaranteed to be stable. The method was deprecated to + * discourage its use. */ + @Deprecated protected static TabletLocator getTabletLocator(JobContext context, String table) throws TableNotFoundException { return InputConfigurator.getTabletLocator(CLASS, context.getConfiguration(), table); } @@ -714,7 +720,7 @@ public List getSplits(JobContext context) throws IOException { } } else { - tl = getTabletLocator(context, tableId); + tl = InputConfigurator.getTabletLocator(CLASS, context.getConfiguration(), tableId); // its possible that the cache could contain complete, but old information about a tables tablets... so clear it tl.invalidateCache(); @@ -802,4 +808,4 @@ public List getSplits(JobContext context) throws IOException { } return splits; } -} \ No newline at end of file +} diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java index db7b68957e5..abd96b6efee 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java @@ -60,7 +60,10 @@ public class AccumuloFileOutputFormat extends FileOutputFormat { * @param context * the Hadoop context for the configured job * @since 1.5.0 + * @deprecated since 1.7.0 This method returns a type that is not part of the public API and is not guaranteed to be stable. The method was deprecated to + * discourage its use. */ + @Deprecated protected static AccumuloConfiguration getAccumuloConfiguration(JobContext context) { return FileOutputConfigurator.getAccumuloConfiguration(CLASS, context.getConfiguration()); } @@ -139,7 +142,7 @@ public static void setReplication(Job job, int replication) { public RecordWriter getRecordWriter(TaskAttemptContext context) throws IOException { // get the path of the temporary output file final Configuration conf = context.getConfiguration(); - final AccumuloConfiguration acuConf = getAccumuloConfiguration(context); + final AccumuloConfiguration acuConf = FileOutputConfigurator.getAccumuloConfiguration(CLASS, context.getConfiguration()); final String extension = acuConf.get(Property.TABLE_FILE_TYPE); final Path file = this.getDefaultWorkFile(context, "." + extension); diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java index 5ee09624a6f..086cab2bc75 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java @@ -35,6 +35,9 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; +import org.apache.accumulo.core.client.admin.SecurityOperations; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase; import org.apache.accumulo.core.client.mapreduce.lib.impl.OutputConfigurator; import org.apache.accumulo.core.client.mock.MockInstance; @@ -43,10 +46,10 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer; import org.apache.accumulo.core.client.security.tokens.DelegationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.ColumnUpdate; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.data.TabletID; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; @@ -83,8 +86,10 @@ public class AccumuloOutputFormat extends OutputFormat { * Sets the connector information needed to communicate with Accumulo in this job. * *

- * WARNING: The serialized token is stored in the configuration and shared with all MapReduce tasks. It is BASE64 encoded to provide a charset safe - * conversion to a string, and is not intended to be secure. + * WARNING: Some tokens, when serialized, divulge sensitive information in the configuration as a means to pass the token to MapReduce tasks. This + * information is BASE64 encoded to provide a charset safe conversion to a string, but this conversion is not intended to be secure. {@link PasswordToken} is + * one example that is insecure in this way; however {@link DelegationToken}s, acquired using + * {@link SecurityOperations#getDelegationToken(DelegationTokenConfig)}, is not subject to this concern. * * @param job * the Hadoop job instance to be configured @@ -106,8 +111,8 @@ public static void setConnectorInfo(Job job, String principal, AuthenticationTok } } // DelegationTokens can be passed securely from user to task without serializing insecurely in the configuration - if (token instanceof DelegationToken) { - DelegationToken delegationToken = (DelegationToken) token; + if (token instanceof DelegationTokenImpl) { + DelegationTokenImpl delegationToken = (DelegationTokenImpl) token; // Convert it into a Hadoop Token AuthenticationTokenIdentifier identifier = delegationToken.getIdentifier(); @@ -537,9 +542,9 @@ public void close(TaskAttemptContext attempt) throws IOException, InterruptedExc try { mtbw.close(); } catch (MutationsRejectedException e) { - if (e.getAuthorizationFailuresMap().size() >= 0) { + if (e.getSecurityErrorCodes().size() >= 0) { HashMap> tables = new HashMap>(); - for (Entry> ke : e.getAuthorizationFailuresMap().entrySet()) { + for (Entry> ke : e.getSecurityErrorCodes().entrySet()) { Set secCodes = tables.get(ke.getKey().getTableId().toString()); if (secCodes == null) { secCodes = new HashSet(); diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java index b32d1b311e2..5364e4a9d03 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java @@ -31,13 +31,13 @@ import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.ZooKeeperInstance; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.mapreduce.impl.DelegationTokenStub; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.Base64; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; @@ -149,9 +149,9 @@ public static void setConnectorInfo(Class implementingClass, Configuration co checkArgument(token != null, "token is null"); conf.setBoolean(enumToConfKey(implementingClass, ConnectorInfo.IS_CONFIGURED), true); conf.set(enumToConfKey(implementingClass, ConnectorInfo.PRINCIPAL), principal); - if (token instanceof DelegationToken) { + if (token instanceof DelegationTokenImpl) { // Avoid serializing the DelegationToken secret in the configuration -- the Job will do that work for us securely - DelegationToken delToken = (DelegationToken) token; + DelegationTokenImpl delToken = (DelegationTokenImpl) token; conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN), TokenSource.JOB.prefix() + token.getClass().getName() + ":" + delToken.getServiceName().toString()); } else { @@ -252,7 +252,7 @@ public static AuthenticationToken getAuthenticationToken(Class implementingCl String[] args = token.substring(TokenSource.JOB.prefix().length()).split(":", 2); if (args.length == 2) { String className = args[0], serviceName = args[1]; - if (DelegationToken.class.getName().equals(className)) { + if (DelegationTokenImpl.class.getName().equals(className)) { return new DelegationTokenStub(serviceName); } } @@ -466,7 +466,7 @@ public static AuthenticationToken unwrapAuthenticationToken(JobConf job, Authent AuthenticationTokenIdentifier identifier = new AuthenticationTokenIdentifier(); try { identifier.readFields(new DataInputStream(new ByteArrayInputStream(hadoopToken.getIdentifier()))); - return new DelegationToken(hadoopToken.getPassword(), identifier); + return new DelegationTokenImpl(hadoopToken.getPassword(), identifier); } catch (IOException e) { throw new RuntimeException("Could not construct DelegationToken from JobConf Credentials", e); } @@ -491,7 +491,7 @@ public static AuthenticationToken unwrapAuthenticationToken(JobContext job, Auth AuthenticationTokenIdentifier identifier = new AuthenticationTokenIdentifier(); try { identifier.readFields(new DataInputStream(new ByteArrayInputStream(hadoopToken.getIdentifier()))); - return new DelegationToken(hadoopToken.getPassword(), identifier); + return new DelegationTokenImpl(hadoopToken.getPassword(), identifier); } catch (IOException e) { throw new RuntimeException("Could not construct DelegationToken from JobConf Credentials", e); } diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java index 6b8fe344f68..109ef1c6af3 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java @@ -46,23 +46,23 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.impl.TabletLocator; import org.apache.accumulo.core.client.mapreduce.InputTableConfig; import org.apache.accumulo.core.client.mock.impl.MockTabletLocator; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.util.Base64; import org.apache.accumulo.core.util.Pair; @@ -717,7 +717,7 @@ public static void validatePermissions(Class implementingClass, Configuration * *

* The implementation (JobContext or JobConf which created the Configuration) needs to be used to extract the proper {@link AuthenticationToken} for - * {@link DelegationToken} support. + * {@link DelegationTokenImpl} support. * * @param implementingClass * the class whose name will be used as a prefix for the property configuration key diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java index 4d320934948..d3484007dbe 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java @@ -35,10 +35,10 @@ import org.apache.accumulo.core.client.admin.ReplicationOperations; import org.apache.accumulo.core.client.admin.SecurityOperations; import org.apache.accumulo.core.client.admin.TableOperations; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.NullToken; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; public class MockConnector extends Connector { diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java index 01dc91b5b29..57cd5ee1c10 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java @@ -27,12 +27,12 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.DefaultConfiguration; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.ByteBufferUtil; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.accumulo.core.util.TextUtil; diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java b/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java index 8927495ec6a..1c0c6a96c07 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java @@ -27,9 +27,9 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.TabletLocator; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.Text; public class MockTabletLocator extends TabletLocator { diff --git a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/DelegationToken.java b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/DelegationToken.java index 1c52bcf31a3..8256d66ac11 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/DelegationToken.java +++ b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/DelegationToken.java @@ -14,138 +14,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.accumulo.core.client.security.tokens; - -import static com.google.common.base.Preconditions.checkNotNull; -import java.io.DataInput; -import java.io.DataOutput; -import java.io.IOException; -import java.util.Collections; -import java.util.Set; +package org.apache.accumulo.core.client.security.tokens; -import org.apache.accumulo.core.client.Instance; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; -import org.apache.hadoop.io.Text; -import org.apache.hadoop.security.Credentials; -import org.apache.hadoop.security.UserGroupInformation; -import org.apache.hadoop.security.token.Token; -import org.apache.hadoop.security.token.TokenIdentifier; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.apache.accumulo.core.client.admin.SecurityOperations; /** - * An {@link AuthenticationToken} that wraps a "Hadoop style" delegation token created by Accumulo. The only intended scope of this implementation is when a - * KerberosToken cannot be used instead. The most common reason for this is within YARN jobs. The Kerberos credentials of the user are not passed over the wire - * to the job itself. The delegation token serves as a mechanism to obtain a shared secret with Accumulo using a {@link KerberosToken} and then run some task - * authenticating with that shared secret, this {@link DelegationToken}. + * An {@link AuthenticationToken} that wraps a "Hadoop style" delegation token created by Accumulo. The intended scope of this token is when a KerberosToken + * cannot be used instead. The most common reason for this is within YARN jobs. The Kerberos credentials of the user are not passed over the wire to the job + * itself. The delegation token serves as a mechanism to obtain a transient shared secret with Accumulo using a {@link KerberosToken} and then run some task + * authenticating with that shared secret. + * + *

Obtain a delegation token by calling {@link SecurityOperations#getDelegationToken(org.apache.accumulo.core.client.admin.DelegationTokenConfig)} * * @since 1.7.0 */ -public class DelegationToken extends PasswordToken { - private static final Logger log = LoggerFactory.getLogger(DelegationToken.class); - - public static final String SERVICE_NAME = "AccumuloDelegationToken"; - - private AuthenticationTokenIdentifier identifier; - - public DelegationToken() { - super(); - } - - public DelegationToken(byte[] delegationTokenPassword, AuthenticationTokenIdentifier identifier) { - checkNotNull(delegationTokenPassword); - checkNotNull(identifier); - setPassword(delegationTokenPassword); - this.identifier = identifier; - } - - public DelegationToken(Instance instance, UserGroupInformation user, AuthenticationTokenIdentifier identifier) { - checkNotNull(instance); - checkNotNull(user); - checkNotNull(identifier); - - Credentials creds = user.getCredentials(); - Token token = creds.getToken(new Text(SERVICE_NAME + "-" + instance.getInstanceID())); - if (null == token) { - throw new IllegalArgumentException("Did not find Accumulo delegation token in provided UserGroupInformation"); - } - setPasswordFromToken(token, identifier); - } - - public DelegationToken(Token token, AuthenticationTokenIdentifier identifier) { - checkNotNull(token); - checkNotNull(identifier); - setPasswordFromToken(token, identifier); - } - - private void setPasswordFromToken(Token token, AuthenticationTokenIdentifier identifier) { - if (!AuthenticationTokenIdentifier.TOKEN_KIND.equals(token.getKind())) { - String msg = "Expected an AuthenticationTokenIdentifier but got a " + token.getKind(); - log.error(msg); - throw new IllegalArgumentException(msg); - } - - setPassword(token.getPassword()); - this.identifier = identifier; - } - - /** - * The identifier for this token, may be null. - */ - public AuthenticationTokenIdentifier getIdentifier() { - return identifier; - } - - /** - * The service name used to identify the {@link Token} - */ - public Text getServiceName() { - checkNotNull(identifier); - return new Text(SERVICE_NAME + "-" + identifier.getInstanceId()); - } - - @Override - public void init(Properties properties) { - // Encourage use of UserGroupInformation as entry point - } - - @Override - public Set getProperties() { - // Encourage use of UserGroupInformation as entry point - return Collections.emptySet(); - } - - @Override - public void write(DataOutput out) throws IOException { - super.write(out); - identifier.write(out); - } - - @Override - public void readFields(DataInput in) throws IOException { - super.readFields(in); - identifier = new AuthenticationTokenIdentifier(); - identifier.readFields(in); - } - - @Override - public DelegationToken clone() { - DelegationToken copy = (DelegationToken) super.clone(); - copy.setPassword(getPassword()); - copy.identifier = new AuthenticationTokenIdentifier(identifier); - return copy; - } - - @Override - public int hashCode() { - return super.hashCode() ^ identifier.hashCode(); - } - @Override - public boolean equals(Object obj) { - // We assume we can cast obj to DelegationToken because the super.equals(obj) check ensures obj is of the same type as this - return super.equals(obj) && identifier.equals(((DelegationToken) obj).identifier); - } +public interface DelegationToken extends AuthenticationToken { } diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java index e95088a628d..78ec0acaeaf 100644 --- a/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java +++ b/core/src/main/java/org/apache/accumulo/core/constraints/Constraint.java @@ -18,8 +18,8 @@ import java.util.List; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.security.AuthorizationContainer; import org.apache.accumulo.core.security.Authorizations; diff --git a/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java b/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java new file mode 100644 index 00000000000..91bc22f6977 --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/core/constraints/VisibilityConstraint.java @@ -0,0 +1,93 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.core.constraints; + +import static java.nio.charset.StandardCharsets.UTF_8; + +import java.util.Collections; +import java.util.HashSet; +import java.util.List; + +import org.apache.accumulo.core.data.ColumnUpdate; +import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.security.ColumnVisibility; +import org.apache.accumulo.core.security.VisibilityEvaluator; +import org.apache.accumulo.core.security.VisibilityParseException; +import org.apache.accumulo.core.util.BadArgumentException; + +/** + * A constraint that checks the visibility of columns against the actor's authorizations. Violation codes: + *

+ *

    + *
  • 1 = failure to parse visibility expression
  • + *
  • 2 = insufficient authorization
  • + *
+ */ +public class VisibilityConstraint implements Constraint { + + @Override + public String getViolationDescription(short violationCode) { + switch (violationCode) { + case 1: + return "Malformed column visibility"; + case 2: + return "User does not have authorization on column visibility"; + } + + return null; + } + + @Override + public List check(Environment env, Mutation mutation) { + List updates = mutation.getUpdates(); + + HashSet ok = null; + if (updates.size() > 1) + ok = new HashSet(); + + VisibilityEvaluator ve = null; + + for (ColumnUpdate update : updates) { + + byte[] cv = update.getColumnVisibility(); + if (cv.length > 0) { + String key = null; + if (ok != null && ok.contains(key = new String(cv, UTF_8))) + continue; + + try { + + if (ve == null) + ve = new VisibilityEvaluator(env.getAuthorizationsContainer()); + + if (!ve.evaluate(new ColumnVisibility(cv))) + return Collections.singletonList(Short.valueOf((short) 2)); + + } catch (BadArgumentException bae) { + return Collections.singletonList(new Short((short) 1)); + } catch (VisibilityParseException e) { + return Collections.singletonList(new Short((short) 1)); + } + + if (ok != null) + ok.add(key); + } + } + + return null; + } +} diff --git a/core/src/main/java/org/apache/accumulo/core/data/ComparableBytes.java b/core/src/main/java/org/apache/accumulo/core/data/ComparableBytes.java index 11aaf2b790f..78c0e56402e 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/ComparableBytes.java +++ b/core/src/main/java/org/apache/accumulo/core/data/ComparableBytes.java @@ -20,7 +20,12 @@ /** * An array of bytes wrapped so as to extend Hadoop's BinaryComparable class. + * + * @deprecated since 1.7.0 In an attempt to clean up types in the data package that were not intended to be in public API this type was deprecated. Technically + * this method was not considered part of the public API in 1.6.0 and earlier, therefore it could have been deleted. However a decision was made to + * deprecate in order to be cautious and avoid confusion between 1.6.0 and 1.7.0. */ +@Deprecated public class ComparableBytes extends BinaryComparable { public byte[] data; diff --git a/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java b/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java index fe7f776204e..f730cf62146 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java +++ b/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java @@ -16,750 +16,243 @@ */ package org.apache.accumulo.core.data; -/** - * keeps track of information needed to identify a tablet - * apparently, we only need the endKey and not the start as well - * - */ - -import java.io.ByteArrayOutputStream; import java.io.DataInput; import java.io.DataOutput; -import java.io.DataOutputStream; import java.io.IOException; -import java.lang.ref.WeakReference; -import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Map.Entry; import java.util.Set; import java.util.SortedMap; import java.util.SortedSet; +import java.util.TreeMap; import java.util.TreeSet; import java.util.UUID; -import java.util.WeakHashMap; import org.apache.accumulo.core.data.thrift.TKeyExtent; -import org.apache.accumulo.core.metadata.MetadataTable; -import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; -import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; -import org.apache.accumulo.core.util.ByteBufferUtil; -import org.apache.accumulo.core.util.TextUtil; import org.apache.hadoop.io.BinaryComparable; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.WritableComparable; +/** + * keeps track of information needed to identify a tablet + * + * @deprecated since 1.7.0 use {@link TabletID} + */ +@Deprecated public class KeyExtent implements WritableComparable { - private static final WeakHashMap> tableIds = new WeakHashMap>(); - - private static Text dedupeTableId(Text tableId) { - synchronized (tableIds) { - WeakReference etir = tableIds.get(tableId); - if (etir != null) { - Text eti = etir.get(); - if (eti != null) { - return eti; - } - } - - tableId = new Text(tableId); - tableIds.put(tableId, new WeakReference(tableId)); - return tableId; - } - } - - private Text textTableId; - private Text textEndRow; - private Text textPrevEndRow; - - private void check() { - - if (getTableId() == null) - throw new IllegalArgumentException("null table id not allowed"); + // Wrapping impl.KeyExtent to resuse code. Did not want to extend impl.KeyExtent because any changes to impl.KeyExtent would be reflected in this class. + // Wrapping impl.KeyExtent allows the API of this deprecated class to be frozen. + private org.apache.accumulo.core.data.impl.KeyExtent wrapped; - if (getEndRow() == null || getPrevEndRow() == null) - return; - - if (getPrevEndRow().compareTo(getEndRow()) >= 0) { - throw new IllegalArgumentException("prevEndRow (" + getPrevEndRow() + ") >= endRow (" + getEndRow() + ")"); - } - } - - /** - * Default constructor - * - */ public KeyExtent() { - this.setTableId(new Text()); - this.setEndRow(new Text(), false, false); - this.setPrevEndRow(new Text(), false, false); + this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(); } public KeyExtent(Text table, Text endRow, Text prevEndRow) { - this.setTableId(table); - this.setEndRow(endRow, false, true); - this.setPrevEndRow(prevEndRow, false, true); - - check(); + this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(table, endRow, prevEndRow); } public KeyExtent(KeyExtent extent) { - // extent has already deduped table id, so there is no need to do it again - this.textTableId = extent.textTableId; - this.setEndRow(extent.getEndRow(), false, true); - this.setPrevEndRow(extent.getPrevEndRow(), false, true); - - check(); + this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(extent.getTableId(), extent.getEndRow(), extent.getPrevEndRow()); } public KeyExtent(TKeyExtent tke) { - this.setTableId(new Text(ByteBufferUtil.toBytes(tke.table))); - this.setEndRow(tke.endRow == null ? null : new Text(ByteBufferUtil.toBytes(tke.endRow)), false, false); - this.setPrevEndRow(tke.prevEndRow == null ? null : new Text(ByteBufferUtil.toBytes(tke.prevEndRow)), false, false); - - check(); - } - - /** - * Returns a String representing this extent's entry in the Metadata table - * - */ - public Text getMetadataEntry() { - return getMetadataEntry(getTableId(), getEndRow()); - } - - public static Text getMetadataEntry(Text tableId, Text endRow) { - return MetadataSchema.TabletsSection.getRow(tableId, endRow); + this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(tke); } // constructor for loading extents from metadata rows public KeyExtent(Text flattenedExtent, Value prevEndRow) { - decodeMetadataRow(flattenedExtent); - - // decode the prev row - this.setPrevEndRow(decodePrevEndRow(prevEndRow), false, true); - - check(); + this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(flattenedExtent, prevEndRow); } // recreates an encoded extent from a string representation // this encoding is what is stored as the row id of the metadata table public KeyExtent(Text flattenedExtent, Text prevEndRow) { + this.wrapped = new org.apache.accumulo.core.data.impl.KeyExtent(flattenedExtent, prevEndRow); + } - decodeMetadataRow(flattenedExtent); - - this.setPrevEndRow(null, false, false); - if (prevEndRow != null) - this.setPrevEndRow(prevEndRow, false, true); - - check(); + public Text getMetadataEntry() { + return wrapped.getMetadataEntry(); } - /** - * Sets the extents table id - * - */ public void setTableId(Text tId) { - - if (tId == null) - throw new IllegalArgumentException("null table name not allowed"); - - this.textTableId = dedupeTableId(tId); - - hashCode = 0; + wrapped.setTableId(tId); } - /** - * Returns the extent's table id - * - */ public Text getTableId() { - return textTableId; + return wrapped.getTableId(); } - private void setEndRow(Text endRow, boolean check, boolean copy) { - if (endRow != null) - if (copy) - this.textEndRow = new Text(endRow); - else - this.textEndRow = endRow; - else - this.textEndRow = null; - - hashCode = 0; - if (check) - check(); - } - - /** - * Sets this extent's end row - * - */ public void setEndRow(Text endRow) { - setEndRow(endRow, true, true); + wrapped.setEndRow(endRow); } - /** - * Returns this extent's end row - * - */ public Text getEndRow() { - return textEndRow; + return wrapped.getEndRow(); } - /** - * Return the previous extent's end row - * - */ public Text getPrevEndRow() { - return textPrevEndRow; - } - - private void setPrevEndRow(Text prevEndRow, boolean check, boolean copy) { - if (prevEndRow != null) - if (copy) - this.textPrevEndRow = new Text(prevEndRow); - else - this.textPrevEndRow = prevEndRow; - else - this.textPrevEndRow = null; - - hashCode = 0; - if (check) - check(); + return wrapped.getPrevEndRow(); } - /** - * Sets the previous extent's end row - * - */ public void setPrevEndRow(Text prevEndRow) { - setPrevEndRow(prevEndRow, true, true); + wrapped.setPrevEndRow(prevEndRow); } @Override public void readFields(DataInput in) throws IOException { - Text tid = new Text(); - tid.readFields(in); - setTableId(tid); - boolean hasRow = in.readBoolean(); - if (hasRow) { - Text er = new Text(); - er.readFields(in); - setEndRow(er, false, false); - } else { - setEndRow(null, false, false); - } - boolean hasPrevRow = in.readBoolean(); - if (hasPrevRow) { - Text per = new Text(); - per.readFields(in); - setPrevEndRow(per, false, true); - } else { - setPrevEndRow((Text) null); - } - - hashCode = 0; - check(); + wrapped.readFields(in); } @Override public void write(DataOutput out) throws IOException { - getTableId().write(out); - if (getEndRow() != null) { - out.writeBoolean(true); - getEndRow().write(out); - } else { - out.writeBoolean(false); - } - if (getPrevEndRow() != null) { - out.writeBoolean(true); - getPrevEndRow().write(out); - } else { - out.writeBoolean(false); - } + wrapped.write(out); } - /** - * Returns a String representing the previous extent's entry in the Metadata table - * - */ public Mutation getPrevRowUpdateMutation() { - return getPrevRowUpdateMutation(this); - } - - /** - * Empty start or end rows tell the method there are no start or end rows, and to use all the keyextents that are before the end row if no start row etc. - * - * @deprecated this method not intended for public use and is likely to be removed in a future version. - * @return all the key extents that the rows cover - */ - @Deprecated - public static Collection getKeyExtentsForRange(Text startRow, Text endRow, Set kes) { - if (kes == null) - return Collections.emptyList(); - if (startRow == null) - startRow = new Text(); - if (endRow == null) - endRow = new Text(); - Collection keys = new ArrayList(); - for (KeyExtent ckes : kes) { - if (ckes.getPrevEndRow() == null) { - if (ckes.getEndRow() == null) { - // only tablet - keys.add(ckes); - } else { - // first tablet - // if start row = '' then we want everything up to the endRow which will always include the first tablet - if (startRow.getLength() == 0) { - keys.add(ckes); - } else if (ckes.getEndRow().compareTo(startRow) >= 0) { - keys.add(ckes); - } - } - } else { - if (ckes.getEndRow() == null) { - // last tablet - // if endRow = '' and we're at the last tablet, add it - if (endRow.getLength() == 0) { - keys.add(ckes); - } - if (ckes.getPrevEndRow().compareTo(endRow) < 0) { - keys.add(ckes); - } - } else { - // tablet in the middle - if (startRow.getLength() == 0) { - // no start row - - if (endRow.getLength() == 0) { - // no start & end row - keys.add(ckes); - } else { - // just no start row - if (ckes.getPrevEndRow().compareTo(endRow) < 0) { - keys.add(ckes); - } - } - } else if (endRow.getLength() == 0) { - // no end row - if (ckes.getEndRow().compareTo(startRow) >= 0) { - keys.add(ckes); - } - } else { - // no null prevend or endrows and no empty string start or end rows - if (ckes.getPrevEndRow().compareTo(endRow) < 0 && ckes.getEndRow().compareTo(startRow) >= 0) { - keys.add(ckes); - } - } - - } - } - } - return keys; - } - - public static Text decodePrevEndRow(Value ibw) { - Text per = null; - - if (ibw.get()[0] != 0) { - per = new Text(); - per.set(ibw.get(), 1, ibw.get().length - 1); - } - - return per; - } - - public static Value encodePrevEndRow(Text per) { - if (per == null) - return new Value(new byte[] {0}); - byte[] b = new byte[per.getLength() + 1]; - b[0] = 1; - System.arraycopy(per.getBytes(), 0, b, 1, per.getLength()); - return new Value(b); - } - - public static Mutation getPrevRowUpdateMutation(KeyExtent ke) { - Mutation m = new Mutation(ke.getMetadataEntry()); - TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.put(m, encodePrevEndRow(ke.getPrevEndRow())); - return m; + return wrapped.getPrevRowUpdateMutation(); } @Override public int compareTo(KeyExtent other) { - - int result = getTableId().compareTo(other.getTableId()); - if (result != 0) - return result; - - if (this.getEndRow() == null) { - if (other.getEndRow() != null) - return 1; - } else { - if (other.getEndRow() == null) - return -1; - - result = getEndRow().compareTo(other.getEndRow()); - if (result != 0) - return result; - } - if (this.getPrevEndRow() == null) { - if (other.getPrevEndRow() == null) - return 0; - return -1; - } - if (other.getPrevEndRow() == null) - return 1; - return this.getPrevEndRow().compareTo(other.getPrevEndRow()); + return wrapped.compareTo(other.wrapped); } - private int hashCode = 0; - @Override public int hashCode() { - if (hashCode != 0) - return hashCode; - - int prevEndRowHash = 0; - int endRowHash = 0; - if (this.getEndRow() != null) { - endRowHash = this.getEndRow().hashCode(); - } - - if (this.getPrevEndRow() != null) { - prevEndRowHash = this.getPrevEndRow().hashCode(); - } - - hashCode = getTableId().hashCode() + endRowHash + prevEndRowHash; - return hashCode; - } - - private boolean equals(Text t1, Text t2) { - if (t1 == null || t2 == null) - return t1 == t2; - - return t1.equals(t2); + return wrapped.hashCode(); } @Override public boolean equals(Object o) { - if (o == this) - return true; - if (!(o instanceof KeyExtent)) - return false; - KeyExtent oke = (KeyExtent) o; - return textTableId.equals(oke.textTableId) && equals(textEndRow, oke.textEndRow) && equals(textPrevEndRow, oke.textPrevEndRow); + if(o instanceof KeyExtent){ + return wrapped.equals(((KeyExtent)o).wrapped); + } + + return false; } @Override public String toString() { - String endRowString; - String prevEndRowString; - String tableIdString = getTableId().toString().replaceAll(";", "\\\\;").replaceAll("\\\\", "\\\\\\\\"); - - if (getEndRow() == null) - endRowString = "<"; - else - endRowString = ";" + TextUtil.truncate(getEndRow()).toString().replaceAll(";", "\\\\;").replaceAll("\\\\", "\\\\\\\\"); - - if (getPrevEndRow() == null) - prevEndRowString = "<"; - else - prevEndRowString = ";" + TextUtil.truncate(getPrevEndRow()).toString().replaceAll(";", "\\\\;").replaceAll("\\\\", "\\\\\\\\"); - - return tableIdString + endRowString + prevEndRowString; + return wrapped.toString(); } public UUID getUUID() { - try { - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - DataOutputStream dos = new DataOutputStream(baos); - - // to get a unique hash it is important to encode the data - // like it is being serialized - - this.write(dos); - - dos.close(); - - return UUID.nameUUIDFromBytes(baos.toByteArray()); - - } catch (IOException e) { - // should not happen since we are writing to memory - throw new RuntimeException(e); - } - } - - // note: this is only the encoding of the table id and the last row, not the prev row - /** - * Populates the extent's fields based on a flatted extent - * - */ - private void decodeMetadataRow(Text flattenedExtent) { - int semiPos = -1; - int ltPos = -1; - - for (int i = 0; i < flattenedExtent.getLength(); i++) { - if (flattenedExtent.getBytes()[i] == ';' && semiPos < 0) { - // want the position of the first semicolon - semiPos = i; - } - - if (flattenedExtent.getBytes()[i] == '<') { - ltPos = i; - } - } - - if (semiPos < 0 && ltPos < 0) { - throw new IllegalArgumentException("Metadata row does not contain ; or < " + flattenedExtent); - } - - if (semiPos < 0) { - - if (ltPos != flattenedExtent.getLength() - 1) { - throw new IllegalArgumentException("< must come at end of Metadata row " + flattenedExtent); - } - - Text tableId = new Text(); - tableId.set(flattenedExtent.getBytes(), 0, flattenedExtent.getLength() - 1); - this.setTableId(tableId); - this.setEndRow(null, false, false); - } else { - - Text tableId = new Text(); - tableId.set(flattenedExtent.getBytes(), 0, semiPos); - - Text endRow = new Text(); - endRow.set(flattenedExtent.getBytes(), semiPos + 1, flattenedExtent.getLength() - (semiPos + 1)); - - this.setTableId(tableId); - - this.setEndRow(endRow, false, false); - } - } - - public static byte[] tableOfMetadataRow(Text row) { - KeyExtent ke = new KeyExtent(); - ke.decodeMetadataRow(row); - return TextUtil.getBytes(ke.getTableId()); + return wrapped.getUUID(); } - public boolean contains(final ByteSequence bsrow) { - if (bsrow == null) { - throw new IllegalArgumentException("Passing null to contains is ambiguous, could be in first or last extent of table"); - } - - BinaryComparable row = new BinaryComparable() { - - @Override - public int getLength() { - return bsrow.length(); - } - - @Override - public byte[] getBytes() { - if (bsrow.isBackedByArray() && bsrow.offset() == 0) - return bsrow.getBackingArray(); - - return bsrow.toArray(); - } - }; - - if ((this.getPrevEndRow() == null || this.getPrevEndRow().compareTo(row) < 0) && (this.getEndRow() == null || this.getEndRow().compareTo(row) >= 0)) { - return true; - } - return false; + public boolean contains(ByteSequence bsrow) { + return wrapped.contains(bsrow); } public boolean contains(BinaryComparable row) { - if (row == null) { - throw new IllegalArgumentException("Passing null to contains is ambiguous, could be in first or last extent of table"); - } - - if ((this.getPrevEndRow() == null || this.getPrevEndRow().compareTo(row) < 0) && (this.getEndRow() == null || this.getEndRow().compareTo(row) >= 0)) { - return true; - } - return false; + return wrapped.contains(row); } public Range toDataRange() { - return new Range(getPrevEndRow(), false, getEndRow(), true); + return wrapped.toDataRange(); } public Range toMetadataRange() { - Text metadataPrevRow = new Text(getTableId()); - metadataPrevRow.append(new byte[] {';'}, 0, 1); - if (getPrevEndRow() != null) { - metadataPrevRow.append(getPrevEndRow().getBytes(), 0, getPrevEndRow().getLength()); - } - - Range range = new Range(metadataPrevRow, getPrevEndRow() == null, getMetadataEntry(), true); - return range; + return wrapped.toMetadataRange(); } - public static SortedSet findChildren(KeyExtent ke, SortedSet tablets) { - - SortedSet children = null; - - for (KeyExtent tabletKe : tablets) { - - if (ke.getPrevEndRow() == tabletKe.getPrevEndRow() || ke.getPrevEndRow() != null && tabletKe.getPrevEndRow() != null - && tabletKe.getPrevEndRow().compareTo(ke.getPrevEndRow()) == 0) { - children = new TreeSet(); - } - - if (children != null) { - children.add(tabletKe); - } - - if (ke.getEndRow() == tabletKe.getEndRow() || ke.getEndRow() != null && tabletKe.getEndRow() != null - && tabletKe.getEndRow().compareTo(ke.getEndRow()) == 0) { - return children; - } - } - - return new TreeSet(); + public boolean overlaps(KeyExtent other) { + return wrapped.overlaps(other.wrapped); } - public static KeyExtent findContainingExtent(KeyExtent extent, SortedSet extents) { - - KeyExtent lookupExtent = new KeyExtent(extent); - lookupExtent.setPrevEndRow((Text) null); - - SortedSet tailSet = extents.tailSet(lookupExtent); - - if (tailSet.isEmpty()) { - return null; - } - - KeyExtent first = tailSet.first(); - - if (first.getTableId().compareTo(extent.getTableId()) != 0) { - return null; - } - - if (first.getPrevEndRow() == null) { - return first; - } - - if (extent.getPrevEndRow() == null) { - return null; - } + public TKeyExtent toThrift() { + return wrapped.toThrift(); + } - if (extent.getPrevEndRow().compareTo(first.getPrevEndRow()) >= 0) - return first; - return null; + public boolean isPreviousExtent(KeyExtent prevExtent) { + return wrapped.isPreviousExtent(prevExtent.wrapped); } - private static boolean startsAfter(KeyExtent nke, KeyExtent ke) { + public boolean isMeta() { + return wrapped.isMeta(); + } - int tiCmp = ke.getTableId().compareTo(nke.getTableId()); + public boolean isRootTablet() { + return wrapped.isRootTablet(); + } - if (tiCmp > 0) { - return true; + private static SortedSet unwrap(Set tablets){ + SortedSet trans = new TreeSet<>(); + for (KeyExtent wrapper : tablets) { + trans.add(wrapper.wrapped); } - return ke.getPrevEndRow() != null && nke.getEndRow() != null && ke.getPrevEndRow().compareTo(nke.getEndRow()) >= 0; + return trans; } - private static Text rowAfterPrevRow(KeyExtent nke) { - Text row = new Text(nke.getPrevEndRow()); - row.append(new byte[] {0}, 0, 1); - return row; + private static KeyExtent wrap(org.apache.accumulo.core.data.impl.KeyExtent ke){ + return new KeyExtent(ke.getTableId(), ke.getEndRow(), ke.getPrevEndRow()); } - // Some duplication with TabletLocatorImpl - public static Set findOverlapping(KeyExtent nke, SortedSet extents) { - if (nke == null || extents == null || extents.isEmpty()) - return Collections.emptySet(); - - SortedSet start; - - if (nke.getPrevEndRow() != null) { - Text row = rowAfterPrevRow(nke); - KeyExtent lookupKey = new KeyExtent(nke.getTableId(), row, null); - start = extents.tailSet(lookupKey); - } else { - KeyExtent lookupKey = new KeyExtent(nke.getTableId(), new Text(), null); - start = extents.tailSet(lookupKey); + private static SortedSet wrap(Collection unwrapped){ + SortedSet wrapped = new TreeSet<>(); + for (org.apache.accumulo.core.data.impl.KeyExtent wrappee : unwrapped) { + wrapped.add(wrap(wrappee)); } - TreeSet result = new TreeSet(); - for (KeyExtent ke : start) { - if (startsAfter(nke, ke)) { - break; - } - result.add(ke); - } - return result; + return wrapped; } - public boolean overlaps(KeyExtent other) { - SortedSet set = new TreeSet(); - set.add(other); - return !findOverlapping(this, set).isEmpty(); + public static Text getMetadataEntry(Text tableId, Text endRow) { + return MetadataSchema.TabletsSection.getRow(tableId, endRow); } - // Specialization of findOverlapping(KeyExtent, SortedSet to work with SortedMap - public static Set findOverlapping(KeyExtent nke, SortedMap extents) { - if (nke == null || extents == null || extents.isEmpty()) - return Collections.emptySet(); - - SortedMap start; - - if (nke.getPrevEndRow() != null) { - Text row = rowAfterPrevRow(nke); - KeyExtent lookupKey = new KeyExtent(nke.getTableId(), row, null); - start = extents.tailMap(lookupKey); - } else { - KeyExtent lookupKey = new KeyExtent(nke.getTableId(), new Text(), null); - start = extents.tailMap(lookupKey); - } - - TreeSet result = new TreeSet(); - for (Entry entry : start.entrySet()) { - KeyExtent ke = entry.getKey(); - if (startsAfter(nke, ke)) { - break; - } - result.add(ke); - } - return result; + /** + * Empty start or end rows tell the method there are no start or end rows, and to use all the keyextents that are before the end row if no start row etc. + * + * @deprecated this method not intended for public use and is likely to be removed in a future version. + * @return all the key extents that the rows cover + */ + @Deprecated + public static Collection getKeyExtentsForRange(Text startRow, Text endRow, Set kes) { + return wrap(org.apache.accumulo.core.data.impl.KeyExtent.getKeyExtentsForRange(startRow, endRow, unwrap(kes))); } - public static Text getMetadataEntry(KeyExtent extent) { - return getMetadataEntry(extent.getTableId(), extent.getEndRow()); + public static Text decodePrevEndRow(Value ibw) { + return org.apache.accumulo.core.data.impl.KeyExtent.decodePrevEndRow(ibw); } - public TKeyExtent toThrift() { - return new TKeyExtent(TextUtil.getByteBuffer(textTableId), textEndRow == null ? null : TextUtil.getByteBuffer(textEndRow), textPrevEndRow == null ? null - : TextUtil.getByteBuffer(textPrevEndRow)); + public static Value encodePrevEndRow(Text per) { + return org.apache.accumulo.core.data.impl.KeyExtent.encodePrevEndRow(per); } - public boolean isPreviousExtent(KeyExtent prevExtent) { - if (prevExtent == null) - return getPrevEndRow() == null; - - if (!prevExtent.getTableId().equals(getTableId())) - throw new IllegalArgumentException("Cannot compare accross tables " + prevExtent + " " + this); + public static Mutation getPrevRowUpdateMutation(KeyExtent ke) { + return org.apache.accumulo.core.data.impl.KeyExtent.getPrevRowUpdateMutation(ke.wrapped); + } - if (prevExtent.getEndRow() == null) - return false; + public static byte[] tableOfMetadataRow(Text row) { + return org.apache.accumulo.core.data.impl.KeyExtent.tableOfMetadataRow(row); + } - if (getPrevEndRow() == null) - return false; + public static SortedSet findChildren(KeyExtent ke, SortedSet tablets) { + return wrap(org.apache.accumulo.core.data.impl.KeyExtent.findChildren(ke.wrapped, unwrap(tablets))); + } - return prevExtent.getEndRow().equals(getPrevEndRow()); + public static KeyExtent findContainingExtent(KeyExtent extent, SortedSet extents) { + return wrap(org.apache.accumulo.core.data.impl.KeyExtent.findContainingExtent(extent.wrapped, unwrap(extents))); } - public boolean isMeta() { - return getTableId().toString().equals(MetadataTable.ID) || isRootTablet(); + public static Set findOverlapping(KeyExtent nke, SortedSet extents) { + return wrap(org.apache.accumulo.core.data.impl.KeyExtent.findOverlapping(nke.wrapped, unwrap(extents))); } - public boolean isRootTablet() { - return getTableId().toString().equals(RootTable.ID); + public static Set findOverlapping(KeyExtent nke, SortedMap extents) { + SortedMap trans = new TreeMap<>(); + for(Entry entry : extents.entrySet()){ + trans.put(entry.getKey().wrapped, entry.getValue()); + } + + return wrap(org.apache.accumulo.core.data.impl.KeyExtent.findOverlapping(nke.wrapped, trans)); + } + public static Text getMetadataEntry(KeyExtent extent) { + return org.apache.accumulo.core.data.impl.KeyExtent.getMetadataEntry(extent.wrapped); } } diff --git a/core/src/main/java/org/apache/accumulo/core/data/TabletID.java b/core/src/main/java/org/apache/accumulo/core/data/TabletID.java new file mode 100644 index 00000000000..bfcb7425d3b --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/core/data/TabletID.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.accumulo.core.data; + +import org.apache.hadoop.io.Text; + +/** + * @since 1.7.0 + */ +public interface TabletID extends Comparable { + public Text getTableId(); + public Text getEndRow(); + public Text getPrevEndRow(); +} diff --git a/core/src/main/java/org/apache/accumulo/core/data/impl/ComparableBytes.java b/core/src/main/java/org/apache/accumulo/core/data/impl/ComparableBytes.java new file mode 100644 index 00000000000..3bf4357ef4d --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/core/data/impl/ComparableBytes.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.core.data.impl; + +import org.apache.hadoop.io.BinaryComparable; + +/** + * An array of bytes wrapped so as to extend Hadoop's BinaryComparable class. + */ +public class ComparableBytes extends BinaryComparable { + + public byte[] data; + + /** + * Creates a new byte wrapper. The given byte array is used directly as a backing array, so later changes made to the array reflect into the new object. + * + * @param b + * bytes to wrap + */ + public ComparableBytes(byte[] b) { + this.data = b; + } + + /** + * Gets the wrapped bytes in this object. + * + * @return bytes + */ + @Override + public byte[] getBytes() { + return data; + } + + @Override + public int getLength() { + return data.length; + } + +} diff --git a/core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java b/core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java new file mode 100644 index 00000000000..d2ae00be1c2 --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/core/data/impl/KeyExtent.java @@ -0,0 +1,768 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.core.data.impl; + +import java.io.ByteArrayOutputStream; +import java.io.DataInput; +import java.io.DataOutput; +import java.io.DataOutputStream; +import java.io.IOException; +import java.lang.ref.WeakReference; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Map.Entry; +import java.util.Set; +import java.util.SortedMap; +import java.util.SortedSet; +import java.util.TreeSet; +import java.util.UUID; +import java.util.WeakHashMap; + +import org.apache.accumulo.core.data.ByteSequence; +import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.thrift.TKeyExtent; +import org.apache.accumulo.core.metadata.MetadataTable; +import org.apache.accumulo.core.metadata.RootTable; +import org.apache.accumulo.core.metadata.schema.MetadataSchema; +import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; +import org.apache.accumulo.core.util.ByteBufferUtil; +import org.apache.accumulo.core.util.TextUtil; +import org.apache.hadoop.io.BinaryComparable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.io.WritableComparable; + +/** + * keeps track of information needed to identify a tablet + * + */ + +public class KeyExtent implements WritableComparable { + + private static final WeakHashMap> tableIds = new WeakHashMap>(); + + private static Text dedupeTableId(Text tableId) { + synchronized (tableIds) { + WeakReference etir = tableIds.get(tableId); + if (etir != null) { + Text eti = etir.get(); + if (eti != null) { + return eti; + } + } + + tableId = new Text(tableId); + tableIds.put(tableId, new WeakReference(tableId)); + return tableId; + } + } + + private Text textTableId; + private Text textEndRow; + private Text textPrevEndRow; + + private void check() { + + if (getTableId() == null) + throw new IllegalArgumentException("null table id not allowed"); + + if (getEndRow() == null || getPrevEndRow() == null) + return; + + if (getPrevEndRow().compareTo(getEndRow()) >= 0) { + throw new IllegalArgumentException("prevEndRow (" + getPrevEndRow() + ") >= endRow (" + getEndRow() + ")"); + } + } + + /** + * Default constructor + * + */ + public KeyExtent() { + this.setTableId(new Text()); + this.setEndRow(new Text(), false, false); + this.setPrevEndRow(new Text(), false, false); + } + + public KeyExtent(Text table, Text endRow, Text prevEndRow) { + this.setTableId(table); + this.setEndRow(endRow, false, true); + this.setPrevEndRow(prevEndRow, false, true); + + check(); + } + + public KeyExtent(KeyExtent extent) { + // extent has already deduped table id, so there is no need to do it again + this.textTableId = extent.textTableId; + this.setEndRow(extent.getEndRow(), false, true); + this.setPrevEndRow(extent.getPrevEndRow(), false, true); + + check(); + } + + public KeyExtent(TKeyExtent tke) { + this.setTableId(new Text(ByteBufferUtil.toBytes(tke.table))); + this.setEndRow(tke.endRow == null ? null : new Text(ByteBufferUtil.toBytes(tke.endRow)), false, false); + this.setPrevEndRow(tke.prevEndRow == null ? null : new Text(ByteBufferUtil.toBytes(tke.prevEndRow)), false, false); + + check(); + } + + /** + * Returns a String representing this extent's entry in the Metadata table + * + */ + public Text getMetadataEntry() { + return getMetadataEntry(getTableId(), getEndRow()); + } + + public static Text getMetadataEntry(Text tableId, Text endRow) { + return MetadataSchema.TabletsSection.getRow(tableId, endRow); + } + + // constructor for loading extents from metadata rows + public KeyExtent(Text flattenedExtent, Value prevEndRow) { + decodeMetadataRow(flattenedExtent); + + // decode the prev row + this.setPrevEndRow(decodePrevEndRow(prevEndRow), false, true); + + check(); + } + + // recreates an encoded extent from a string representation + // this encoding is what is stored as the row id of the metadata table + public KeyExtent(Text flattenedExtent, Text prevEndRow) { + + decodeMetadataRow(flattenedExtent); + + this.setPrevEndRow(null, false, false); + if (prevEndRow != null) + this.setPrevEndRow(prevEndRow, false, true); + + check(); + } + + /** + * Sets the extents table id + * + */ + public void setTableId(Text tId) { + + if (tId == null) + throw new IllegalArgumentException("null table name not allowed"); + + this.textTableId = dedupeTableId(tId); + + hashCode = 0; + } + + /** + * Returns the extent's table id + * + */ + public Text getTableId() { + return textTableId; + } + + private void setEndRow(Text endRow, boolean check, boolean copy) { + if (endRow != null) + if (copy) + this.textEndRow = new Text(endRow); + else + this.textEndRow = endRow; + else + this.textEndRow = null; + + hashCode = 0; + if (check) + check(); + } + + /** + * Sets this extent's end row + * + */ + public void setEndRow(Text endRow) { + setEndRow(endRow, true, true); + } + + /** + * Returns this extent's end row + * + */ + public Text getEndRow() { + return textEndRow; + } + + /** + * Return the previous extent's end row + * + */ + public Text getPrevEndRow() { + return textPrevEndRow; + } + + private void setPrevEndRow(Text prevEndRow, boolean check, boolean copy) { + if (prevEndRow != null) + if (copy) + this.textPrevEndRow = new Text(prevEndRow); + else + this.textPrevEndRow = prevEndRow; + else + this.textPrevEndRow = null; + + hashCode = 0; + if (check) + check(); + } + + /** + * Sets the previous extent's end row + * + */ + public void setPrevEndRow(Text prevEndRow) { + setPrevEndRow(prevEndRow, true, true); + } + + @Override + public void readFields(DataInput in) throws IOException { + Text tid = new Text(); + tid.readFields(in); + setTableId(tid); + boolean hasRow = in.readBoolean(); + if (hasRow) { + Text er = new Text(); + er.readFields(in); + setEndRow(er, false, false); + } else { + setEndRow(null, false, false); + } + boolean hasPrevRow = in.readBoolean(); + if (hasPrevRow) { + Text per = new Text(); + per.readFields(in); + setPrevEndRow(per, false, true); + } else { + setPrevEndRow((Text) null); + } + + hashCode = 0; + check(); + } + + @Override + public void write(DataOutput out) throws IOException { + getTableId().write(out); + if (getEndRow() != null) { + out.writeBoolean(true); + getEndRow().write(out); + } else { + out.writeBoolean(false); + } + if (getPrevEndRow() != null) { + out.writeBoolean(true); + getPrevEndRow().write(out); + } else { + out.writeBoolean(false); + } + } + + /** + * Returns a String representing the previous extent's entry in the Metadata table + * + */ + public Mutation getPrevRowUpdateMutation() { + return getPrevRowUpdateMutation(this); + } + + /** + * Empty start or end rows tell the method there are no start or end rows, and to use all the keyextents that are before the end row if no start row etc. + * + * @deprecated this method not intended for public use and is likely to be removed in a future version. + * @return all the key extents that the rows cover + */ + @Deprecated + public static Collection getKeyExtentsForRange(Text startRow, Text endRow, Set kes) { + if (kes == null) + return Collections.emptyList(); + if (startRow == null) + startRow = new Text(); + if (endRow == null) + endRow = new Text(); + Collection keys = new ArrayList(); + for (KeyExtent ckes : kes) { + if (ckes.getPrevEndRow() == null) { + if (ckes.getEndRow() == null) { + // only tablet + keys.add(ckes); + } else { + // first tablet + // if start row = '' then we want everything up to the endRow which will always include the first tablet + if (startRow.getLength() == 0) { + keys.add(ckes); + } else if (ckes.getEndRow().compareTo(startRow) >= 0) { + keys.add(ckes); + } + } + } else { + if (ckes.getEndRow() == null) { + // last tablet + // if endRow = '' and we're at the last tablet, add it + if (endRow.getLength() == 0) { + keys.add(ckes); + } + if (ckes.getPrevEndRow().compareTo(endRow) < 0) { + keys.add(ckes); + } + } else { + // tablet in the middle + if (startRow.getLength() == 0) { + // no start row + + if (endRow.getLength() == 0) { + // no start & end row + keys.add(ckes); + } else { + // just no start row + if (ckes.getPrevEndRow().compareTo(endRow) < 0) { + keys.add(ckes); + } + } + } else if (endRow.getLength() == 0) { + // no end row + if (ckes.getEndRow().compareTo(startRow) >= 0) { + keys.add(ckes); + } + } else { + // no null prevend or endrows and no empty string start or end rows + if (ckes.getPrevEndRow().compareTo(endRow) < 0 && ckes.getEndRow().compareTo(startRow) >= 0) { + keys.add(ckes); + } + } + + } + } + } + return keys; + } + + public static Text decodePrevEndRow(Value ibw) { + Text per = null; + + if (ibw.get()[0] != 0) { + per = new Text(); + per.set(ibw.get(), 1, ibw.get().length - 1); + } + + return per; + } + + public static Value encodePrevEndRow(Text per) { + if (per == null) + return new Value(new byte[] {0}); + byte[] b = new byte[per.getLength() + 1]; + b[0] = 1; + System.arraycopy(per.getBytes(), 0, b, 1, per.getLength()); + return new Value(b); + } + + public static Mutation getPrevRowUpdateMutation(KeyExtent ke) { + Mutation m = new Mutation(ke.getMetadataEntry()); + TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.put(m, encodePrevEndRow(ke.getPrevEndRow())); + return m; + } + + @Override + public int compareTo(KeyExtent other) { + + int result = getTableId().compareTo(other.getTableId()); + if (result != 0) + return result; + + if (this.getEndRow() == null) { + if (other.getEndRow() != null) + return 1; + } else { + if (other.getEndRow() == null) + return -1; + + result = getEndRow().compareTo(other.getEndRow()); + if (result != 0) + return result; + } + if (this.getPrevEndRow() == null) { + if (other.getPrevEndRow() == null) + return 0; + return -1; + } + if (other.getPrevEndRow() == null) + return 1; + return this.getPrevEndRow().compareTo(other.getPrevEndRow()); + } + + private int hashCode = 0; + + @Override + public int hashCode() { + if (hashCode != 0) + return hashCode; + + int prevEndRowHash = 0; + int endRowHash = 0; + if (this.getEndRow() != null) { + endRowHash = this.getEndRow().hashCode(); + } + + if (this.getPrevEndRow() != null) { + prevEndRowHash = this.getPrevEndRow().hashCode(); + } + + hashCode = getTableId().hashCode() + endRowHash + prevEndRowHash; + return hashCode; + } + + private boolean equals(Text t1, Text t2) { + if (t1 == null || t2 == null) + return t1 == t2; + + return t1.equals(t2); + } + + @Override + public boolean equals(Object o) { + if (o == this) + return true; + if (!(o instanceof KeyExtent)) + return false; + KeyExtent oke = (KeyExtent) o; + return textTableId.equals(oke.textTableId) && equals(textEndRow, oke.textEndRow) && equals(textPrevEndRow, oke.textPrevEndRow); + } + + @Override + public String toString() { + String endRowString; + String prevEndRowString; + String tableIdString = getTableId().toString().replaceAll(";", "\\\\;").replaceAll("\\\\", "\\\\\\\\"); + + if (getEndRow() == null) + endRowString = "<"; + else + endRowString = ";" + TextUtil.truncate(getEndRow()).toString().replaceAll(";", "\\\\;").replaceAll("\\\\", "\\\\\\\\"); + + if (getPrevEndRow() == null) + prevEndRowString = "<"; + else + prevEndRowString = ";" + TextUtil.truncate(getPrevEndRow()).toString().replaceAll(";", "\\\\;").replaceAll("\\\\", "\\\\\\\\"); + + return tableIdString + endRowString + prevEndRowString; + } + + public UUID getUUID() { + try { + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + DataOutputStream dos = new DataOutputStream(baos); + + // to get a unique hash it is important to encode the data + // like it is being serialized + + this.write(dos); + + dos.close(); + + return UUID.nameUUIDFromBytes(baos.toByteArray()); + + } catch (IOException e) { + // should not happen since we are writing to memory + throw new RuntimeException(e); + } + } + + // note: this is only the encoding of the table id and the last row, not the prev row + /** + * Populates the extent's fields based on a flatted extent + * + */ + private void decodeMetadataRow(Text flattenedExtent) { + int semiPos = -1; + int ltPos = -1; + + for (int i = 0; i < flattenedExtent.getLength(); i++) { + if (flattenedExtent.getBytes()[i] == ';' && semiPos < 0) { + // want the position of the first semicolon + semiPos = i; + } + + if (flattenedExtent.getBytes()[i] == '<') { + ltPos = i; + } + } + + if (semiPos < 0 && ltPos < 0) { + throw new IllegalArgumentException("Metadata row does not contain ; or < " + flattenedExtent); + } + + if (semiPos < 0) { + + if (ltPos != flattenedExtent.getLength() - 1) { + throw new IllegalArgumentException("< must come at end of Metadata row " + flattenedExtent); + } + + Text tableId = new Text(); + tableId.set(flattenedExtent.getBytes(), 0, flattenedExtent.getLength() - 1); + this.setTableId(tableId); + this.setEndRow(null, false, false); + } else { + + Text tableId = new Text(); + tableId.set(flattenedExtent.getBytes(), 0, semiPos); + + Text endRow = new Text(); + endRow.set(flattenedExtent.getBytes(), semiPos + 1, flattenedExtent.getLength() - (semiPos + 1)); + + this.setTableId(tableId); + + this.setEndRow(endRow, false, false); + } + } + + public static byte[] tableOfMetadataRow(Text row) { + KeyExtent ke = new KeyExtent(); + ke.decodeMetadataRow(row); + return TextUtil.getBytes(ke.getTableId()); + } + + public boolean contains(final ByteSequence bsrow) { + if (bsrow == null) { + throw new IllegalArgumentException("Passing null to contains is ambiguous, could be in first or last extent of table"); + } + + BinaryComparable row = new BinaryComparable() { + + @Override + public int getLength() { + return bsrow.length(); + } + + @Override + public byte[] getBytes() { + if (bsrow.isBackedByArray() && bsrow.offset() == 0) + return bsrow.getBackingArray(); + + return bsrow.toArray(); + } + }; + + if ((this.getPrevEndRow() == null || this.getPrevEndRow().compareTo(row) < 0) && (this.getEndRow() == null || this.getEndRow().compareTo(row) >= 0)) { + return true; + } + return false; + } + + public boolean contains(BinaryComparable row) { + if (row == null) { + throw new IllegalArgumentException("Passing null to contains is ambiguous, could be in first or last extent of table"); + } + + if ((this.getPrevEndRow() == null || this.getPrevEndRow().compareTo(row) < 0) && (this.getEndRow() == null || this.getEndRow().compareTo(row) >= 0)) { + return true; + } + return false; + } + + public Range toDataRange() { + return new Range(getPrevEndRow(), false, getEndRow(), true); + } + + public Range toMetadataRange() { + Text metadataPrevRow = new Text(getTableId()); + metadataPrevRow.append(new byte[] {';'}, 0, 1); + if (getPrevEndRow() != null) { + metadataPrevRow.append(getPrevEndRow().getBytes(), 0, getPrevEndRow().getLength()); + } + + Range range = new Range(metadataPrevRow, getPrevEndRow() == null, getMetadataEntry(), true); + return range; + } + + public static SortedSet findChildren(KeyExtent ke, SortedSet tablets) { + + SortedSet children = null; + + for (KeyExtent tabletKe : tablets) { + + if (ke.getPrevEndRow() == tabletKe.getPrevEndRow() || ke.getPrevEndRow() != null && tabletKe.getPrevEndRow() != null + && tabletKe.getPrevEndRow().compareTo(ke.getPrevEndRow()) == 0) { + children = new TreeSet(); + } + + if (children != null) { + children.add(tabletKe); + } + + if (ke.getEndRow() == tabletKe.getEndRow() || ke.getEndRow() != null && tabletKe.getEndRow() != null + && tabletKe.getEndRow().compareTo(ke.getEndRow()) == 0) { + return children; + } + } + + return new TreeSet(); + } + + public static KeyExtent findContainingExtent(KeyExtent extent, SortedSet extents) { + + KeyExtent lookupExtent = new KeyExtent(extent); + lookupExtent.setPrevEndRow((Text) null); + + SortedSet tailSet = extents.tailSet(lookupExtent); + + if (tailSet.isEmpty()) { + return null; + } + + KeyExtent first = tailSet.first(); + + if (first.getTableId().compareTo(extent.getTableId()) != 0) { + return null; + } + + if (first.getPrevEndRow() == null) { + return first; + } + + if (extent.getPrevEndRow() == null) { + return null; + } + + if (extent.getPrevEndRow().compareTo(first.getPrevEndRow()) >= 0) + return first; + return null; + } + + private static boolean startsAfter(KeyExtent nke, KeyExtent ke) { + + int tiCmp = ke.getTableId().compareTo(nke.getTableId()); + + if (tiCmp > 0) { + return true; + } + + return ke.getPrevEndRow() != null && nke.getEndRow() != null && ke.getPrevEndRow().compareTo(nke.getEndRow()) >= 0; + } + + private static Text rowAfterPrevRow(KeyExtent nke) { + Text row = new Text(nke.getPrevEndRow()); + row.append(new byte[] {0}, 0, 1); + return row; + } + + // Some duplication with TabletLocatorImpl + public static Set findOverlapping(KeyExtent nke, SortedSet extents) { + if (nke == null || extents == null || extents.isEmpty()) + return Collections.emptySet(); + + SortedSet start; + + if (nke.getPrevEndRow() != null) { + Text row = rowAfterPrevRow(nke); + KeyExtent lookupKey = new KeyExtent(nke.getTableId(), row, null); + start = extents.tailSet(lookupKey); + } else { + KeyExtent lookupKey = new KeyExtent(nke.getTableId(), new Text(), null); + start = extents.tailSet(lookupKey); + } + + TreeSet result = new TreeSet(); + for (KeyExtent ke : start) { + if (startsAfter(nke, ke)) { + break; + } + result.add(ke); + } + return result; + } + + public boolean overlaps(KeyExtent other) { + SortedSet set = new TreeSet(); + set.add(other); + return !findOverlapping(this, set).isEmpty(); + } + + // Specialization of findOverlapping(KeyExtent, SortedSet to work with SortedMap + public static Set findOverlapping(KeyExtent nke, SortedMap extents) { + if (nke == null || extents == null || extents.isEmpty()) + return Collections.emptySet(); + + SortedMap start; + + if (nke.getPrevEndRow() != null) { + Text row = rowAfterPrevRow(nke); + KeyExtent lookupKey = new KeyExtent(nke.getTableId(), row, null); + start = extents.tailMap(lookupKey); + } else { + KeyExtent lookupKey = new KeyExtent(nke.getTableId(), new Text(), null); + start = extents.tailMap(lookupKey); + } + + TreeSet result = new TreeSet(); + for (Entry entry : start.entrySet()) { + KeyExtent ke = entry.getKey(); + if (startsAfter(nke, ke)) { + break; + } + result.add(ke); + } + return result; + } + + public static Text getMetadataEntry(KeyExtent extent) { + return getMetadataEntry(extent.getTableId(), extent.getEndRow()); + } + + public TKeyExtent toThrift() { + return new TKeyExtent(TextUtil.getByteBuffer(textTableId), textEndRow == null ? null : TextUtil.getByteBuffer(textEndRow), textPrevEndRow == null ? null + : TextUtil.getByteBuffer(textPrevEndRow)); + } + + public boolean isPreviousExtent(KeyExtent prevExtent) { + if (prevExtent == null) + return getPrevEndRow() == null; + + if (!prevExtent.getTableId().equals(getTableId())) + throw new IllegalArgumentException("Cannot compare accross tables " + prevExtent + " " + this); + + if (prevExtent.getEndRow() == null) + return false; + + if (getPrevEndRow() == null) + return false; + + return prevExtent.getEndRow().equals(getPrevEndRow()); + } + + public boolean isMeta() { + return getTableId().toString().equals(MetadataTable.ID) || isRootTablet(); + } + + public boolean isRootTablet() { + return getTableId().toString().equals(RootTable.ID); + } +} diff --git a/core/src/main/java/org/apache/accumulo/core/data/impl/TabletIDImpl.java b/core/src/main/java/org/apache/accumulo/core/data/impl/TabletIDImpl.java new file mode 100644 index 00000000000..dd90e0dfcc6 --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/core/data/impl/TabletIDImpl.java @@ -0,0 +1,100 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.accumulo.core.data.impl; + +import org.apache.accumulo.core.data.TabletID; +import org.apache.hadoop.io.Text; + +import com.google.common.base.Function; + +public class TabletIDImpl implements TabletID { + + private KeyExtent ke; + + @SuppressWarnings("deprecation") + public static final Function KE_2_TID_OLD = new Function() { + @Override + public TabletID apply(org.apache.accumulo.core.data.KeyExtent input) { + //the following if null check is to appease findbugs... grumble grumble spent a good part of my morning looking into this + // http://sourceforge.net/p/findbugs/bugs/1139/ + // https://code.google.com/p/guava-libraries/issues/detail?id=920 + if(input == null) + return null; + return new TabletIDImpl(input); + } + }; + + @SuppressWarnings("deprecation") + public static final Function TID_2_KE_OLD = new Function() { + @Override + public org.apache.accumulo.core.data.KeyExtent apply(TabletID input) { + if(input == null) + return null; + return new org.apache.accumulo.core.data.KeyExtent(input.getTableId(), input.getEndRow(), input.getPrevEndRow()); + } + + }; + + @Deprecated + public TabletIDImpl(org.apache.accumulo.core.data.KeyExtent ke) { + this.ke = new KeyExtent(ke.getTableId(), ke.getEndRow(), ke.getPrevEndRow()); + } + + public TabletIDImpl(KeyExtent ke) { + this.ke = ke; + } + + @Override + public int compareTo(TabletID o) { + return ke.compareTo(((TabletIDImpl) o).ke); + } + + @Override + public Text getTableId() { + return ke.getTableId(); + } + + @Override + public Text getEndRow() { + return ke.getEndRow(); + } + + @Override + public Text getPrevEndRow() { + return ke.getPrevEndRow(); + } + + @Override + public int hashCode() { + return ke.hashCode(); + } + + @Override + public boolean equals(Object o) { + if (o instanceof TabletIDImpl) { + return ke.equals(((TabletIDImpl) o).ke); + } + + return false; + } + + @Override + public String toString(){ + return ke.toString(); + } +} diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java b/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java index 587fc33394a..5efa2c21a87 100644 --- a/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java +++ b/core/src/main/java/org/apache/accumulo/core/iterators/IteratorUtil.java @@ -33,8 +33,8 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.constraints.DefaultKeySizeConstraint; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.iterators.system.SynchronizedIterator; import org.apache.accumulo.core.iterators.user.VersioningIterator; @@ -56,24 +56,21 @@ public class IteratorUtil { private static final Logger log = LoggerFactory.getLogger(IteratorUtil.class); + /** + * Even though this type is not in a public API package, its used by methods in the public API. Therefore it should be treated as public API and should not + * reference any non public API types. Also this type can not be moved. + */ public static enum IteratorScope { majc, minc, scan; /** * Fetch the correct configuration key prefix for the given scope. Throws an IllegalArgumentException if no property exists for the given scope. + * + * @deprecated since 1.7.0 This method returns a type that is not part of the public API and is not guaranteed to be stable. The method was deprecated to discourage its use. */ + @Deprecated public static Property getProperty(IteratorScope scope) { - Preconditions.checkNotNull(scope); - switch (scope) { - case scan: - return Property.TABLE_ITERATOR_SCAN_PREFIX; - case minc: - return Property.TABLE_ITERATOR_MINC_PREFIX; - case majc: - return Property.TABLE_ITERATOR_MAJC_PREFIX; - default: - throw new IllegalStateException("Could not find configuration property for IteratorScope"); - } + return IteratorUtil.getProperty(scope); } } @@ -87,6 +84,23 @@ public int compare(IterInfo o1, IterInfo o2) { } + /** + * Fetch the correct configuration key prefix for the given scope. Throws an IllegalArgumentException if no property exists for the given scope. + */ + static Property getProperty(IteratorScope scope) { + Preconditions.checkNotNull(scope); + switch (scope) { + case scan: + return Property.TABLE_ITERATOR_SCAN_PREFIX; + case minc: + return Property.TABLE_ITERATOR_MINC_PREFIX; + case majc: + return Property.TABLE_ITERATOR_MAJC_PREFIX; + default: + throw new IllegalStateException("Could not find configuration property for IteratorScope"); + } + } + /** * Generate the initial (default) properties for a table * @@ -124,7 +138,7 @@ public static int getMaxPriority(IteratorScope scope, AccumuloConfiguration conf } protected static void parseIterConf(IteratorScope scope, List iters, Map> allOptions, AccumuloConfiguration conf) { - final Property scopeProperty = IteratorScope.getProperty(scope); + final Property scopeProperty = getProperty(scope); final String scopePropertyKey = scopeProperty.getKey(); for (Entry entry : conf.getAllPropertiesWithPrefix(scopeProperty).entrySet()) { diff --git a/core/src/main/java/org/apache/accumulo/core/iterators/system/MultiIterator.java b/core/src/main/java/org/apache/accumulo/core/iterators/system/MultiIterator.java index 426ae5fa56f..aef6aeb63cd 100644 --- a/core/src/main/java/org/apache/accumulo/core/iterators/system/MultiIterator.java +++ b/core/src/main/java/org/apache/accumulo/core/iterators/system/MultiIterator.java @@ -24,9 +24,9 @@ import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.IteratorEnvironment; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java index 20f2130f76e..c8c61aa9d79 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataLocationObtainer.java @@ -44,10 +44,10 @@ import org.apache.accumulo.core.client.impl.ThriftScanner; import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.iterators.user.WholeRowIterator; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java index 3b443f42420..c6cf61ea3b3 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataServicer.java @@ -24,7 +24,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; /** * Provides a consolidated API for handling table metadata diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java index 24148b18aed..292ba3b7903 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java @@ -17,7 +17,7 @@ package org.apache.accumulo.core.metadata; import org.apache.accumulo.core.client.impl.Namespaces; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.Text; /** diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java index d02242c9e66..73a943d84c9 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/ServicerForRootTable.java @@ -23,7 +23,7 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; /** * A metadata servicer for the root table.
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java b/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java index 7e2ae0a8dc2..fcd74a3dbcf 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/TableMetadataServicer.java @@ -27,8 +27,8 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.security.Authorizations; import org.apache.hadoop.io.Text; diff --git a/core/src/main/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtil.java b/core/src/main/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtil.java index 0817d3b40c6..f7118682f76 100644 --- a/core/src/main/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtil.java +++ b/core/src/main/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtil.java @@ -18,7 +18,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; /** * Encapsulates configuration semantics around replication diff --git a/core/src/main/java/org/apache/accumulo/core/rpc/SaslClientDigestCallbackHandler.java b/core/src/main/java/org/apache/accumulo/core/rpc/SaslClientDigestCallbackHandler.java index 18dd7e13f34..65047410dff 100644 --- a/core/src/main/java/org/apache/accumulo/core/rpc/SaslClientDigestCallbackHandler.java +++ b/core/src/main/java/org/apache/accumulo/core/rpc/SaslClientDigestCallbackHandler.java @@ -27,7 +27,7 @@ import javax.security.sasl.RealmCallback; import javax.security.sasl.RealmChoiceCallback; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.commons.lang.builder.HashCodeBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -43,7 +43,7 @@ public class SaslClientDigestCallbackHandler extends SaslDigestCallbackHandler { private final String userName; private final char[] userPassword; - public SaslClientDigestCallbackHandler(DelegationToken token) { + public SaslClientDigestCallbackHandler(DelegationTokenImpl token) { checkNotNull(token); this.userName = encodeIdentifier(token.getIdentifier().getBytes()); this.userPassword = encodePassword(token.getPassword()); diff --git a/core/src/main/java/org/apache/accumulo/core/rpc/SaslConnectionParams.java b/core/src/main/java/org/apache/accumulo/core/rpc/SaslConnectionParams.java index 33392b9637c..0e889678b2d 100644 --- a/core/src/main/java/org/apache/accumulo/core/rpc/SaslConnectionParams.java +++ b/core/src/main/java/org/apache/accumulo/core/rpc/SaslConnectionParams.java @@ -30,8 +30,8 @@ import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; @@ -150,9 +150,9 @@ protected void updateFromToken(AuthenticationToken token) { mechanism = SaslMechanism.GSSAPI; // No callbackhandlers necessary for GSSAPI callbackHandler = null; - } else if (token instanceof DelegationToken) { + } else if (token instanceof DelegationTokenImpl) { mechanism = SaslMechanism.DIGEST_MD5; - callbackHandler = new SaslClientDigestCallbackHandler((DelegationToken) token); + callbackHandler = new SaslClientDigestCallbackHandler((DelegationTokenImpl) token); } else { throw new IllegalArgumentException("Cannot determine SASL mechanism for token class: " + token.getClass()); } diff --git a/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java b/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java index 90cf951bfff..611c8d49505 100644 --- a/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java +++ b/core/src/main/java/org/apache/accumulo/core/security/VisibilityConstraint.java @@ -14,78 +14,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.accumulo.core.security; - -import static java.nio.charset.StandardCharsets.UTF_8; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import org.apache.accumulo.core.constraints.Constraint; -import org.apache.accumulo.core.data.ColumnUpdate; -import org.apache.accumulo.core.data.Mutation; -import org.apache.accumulo.core.util.BadArgumentException; +package org.apache.accumulo.core.security; /** - * A constraint that checks the visibility of columns against the actor's authorizations. Violation codes: - *

- *

    - *
  • 1 = failure to parse visibility expression
  • - *
  • 2 = insufficient authorization
  • - *
+ * + * @deprecated since 1.7.0 This is server side code not intended to exist in a public API package. This class references types that are not in the public API + * and therefore is not guaranteed to be stable. It was deprecated to clearly communicate this. Use + * {@link org.apache.accumulo.core.constraints.VisibilityConstraint} instead. */ -public class VisibilityConstraint implements Constraint { - - @Override - public String getViolationDescription(short violationCode) { - switch (violationCode) { - case 1: - return "Malformed column visibility"; - case 2: - return "User does not have authorization on column visibility"; - } - - return null; - } - - @Override - public List check(Environment env, Mutation mutation) { - List updates = mutation.getUpdates(); - - HashSet ok = null; - if (updates.size() > 1) - ok = new HashSet(); - - VisibilityEvaluator ve = null; - - for (ColumnUpdate update : updates) { - - byte[] cv = update.getColumnVisibility(); - if (cv.length > 0) { - String key = null; - if (ok != null && ok.contains(key = new String(cv, UTF_8))) - continue; - - try { - - if (ve == null) - ve = new VisibilityEvaluator(env); - - if (!ve.evaluate(new ColumnVisibility(cv))) - return Collections.singletonList(Short.valueOf((short) 2)); - - } catch (BadArgumentException bae) { - return Collections.singletonList(new Short((short) 1)); - } catch (VisibilityParseException e) { - return Collections.singletonList(new Short((short) 1)); - } - - if (ok != null) - ok.add(key); - } - } +@Deprecated +public class VisibilityConstraint extends org.apache.accumulo.core.constraints.VisibilityConstraint { - return null; - } } diff --git a/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java b/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java index dd076192813..99aa3839580 100644 --- a/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java +++ b/core/src/main/java/org/apache/accumulo/core/security/VisibilityEvaluator.java @@ -18,7 +18,6 @@ import java.util.ArrayList; -import org.apache.accumulo.core.constraints.Constraint.Environment; import org.apache.accumulo.core.security.ColumnVisibility.Node; /** @@ -80,13 +79,12 @@ public static byte[] escape(byte[] auth, boolean quote) { } /** - * Creates a new evaluator for the authorizations found in the given environment. + * Creates a new evaluator for the authorizations found in the given container. * - * @param env - * environment containing authorizations + * @since 1.7.0 */ - VisibilityEvaluator(Environment env) { - this.auths = env.getAuthorizationsContainer(); + public VisibilityEvaluator(AuthorizationContainer authsContainer) { + this.auths = authsContainer; } /** diff --git a/core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java b/core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java index f13f77ed3d2..7fe61d112ee 100644 --- a/core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java +++ b/core/src/main/java/org/apache/accumulo/core/tabletserver/log/LogEntry.java @@ -22,8 +22,8 @@ import java.util.Collection; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.hadoop.io.DataInputBuffer; import org.apache.hadoop.io.DataOutputBuffer; diff --git a/core/src/main/java/org/apache/accumulo/core/util/Merge.java b/core/src/main/java/org/apache/accumulo/core/util/Merge.java index 6bef51a2b97..3c60d25a4fa 100644 --- a/core/src/main/java/org/apache/accumulo/core/util/Merge.java +++ b/core/src/main/java/org/apache/accumulo/core/util/Merge.java @@ -31,8 +31,8 @@ import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java index 0c654220c9a..95b0903706d 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/ScannerImplTest.java @@ -23,7 +23,6 @@ import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java index 73a90247a8a..523d157cf6c 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TableOperationsImplTest.java @@ -23,11 +23,10 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.hadoop.io.Text; import org.easymock.EasyMock; import org.junit.Test; diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java index 939a64c5ebb..2e78bd8887d 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletLocatorImplTest.java @@ -47,16 +47,15 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataLocationObtainer; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; -import org.apache.accumulo.core.security.Credentials; import org.apache.hadoop.io.Text; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderTest.java b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderTest.java index 5c7eb1b4a77..23c223e577d 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderTest.java @@ -21,7 +21,6 @@ import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java index 9fead34668c..e389c0be43a 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormatTest.java @@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase; +import org.apache.accumulo.core.client.mapreduce.lib.impl.FileOutputConfigurator; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; @@ -224,7 +225,7 @@ public void validateConfiguration() throws IOException, InterruptedException { AccumuloFileOutputFormat.setIndexBlockSize(job, d); AccumuloFileOutputFormat.setCompressionType(job, e); - AccumuloConfiguration acuconf = AccumuloFileOutputFormat.getAccumuloConfiguration(job); + AccumuloConfiguration acuconf = FileOutputConfigurator.getAccumuloConfiguration(AccumuloFileOutputFormat.class, job); assertEquals(7, acuconf.getCount(Property.TABLE_FILE_REPLICATION)); assertEquals(300l, acuconf.getMemoryInBytes(Property.TABLE_FILE_BLOCK_SIZE)); @@ -245,7 +246,7 @@ public void validateConfiguration() throws IOException, InterruptedException { AccumuloFileOutputFormat.setIndexBlockSize(job, d); AccumuloFileOutputFormat.setCompressionType(job, e); - acuconf = AccumuloFileOutputFormat.getAccumuloConfiguration(job); + acuconf = FileOutputConfigurator.getAccumuloConfiguration(AccumuloFileOutputFormat.class, job); assertEquals(17, acuconf.getCount(Property.TABLE_FILE_REPLICATION)); assertEquals(1300l, acuconf.getMemoryInBytes(Property.TABLE_FILE_BLOCK_SIZE)); diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java index a8ca12ec81e..f025783f3e3 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java @@ -31,13 +31,13 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java index d9658ae7bf9..abc99c944e1 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java @@ -27,6 +27,7 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.mapreduce.lib.impl.FileOutputConfigurator; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; @@ -212,7 +213,7 @@ public void validateConfiguration() throws IOException, InterruptedException { AccumuloFileOutputFormat.setIndexBlockSize(job1, d); AccumuloFileOutputFormat.setCompressionType(job1, e); - AccumuloConfiguration acuconf = AccumuloFileOutputFormat.getAccumuloConfiguration(job1); + AccumuloConfiguration acuconf = FileOutputConfigurator.getAccumuloConfiguration(AccumuloFileOutputFormat.class, job1.getConfiguration()); assertEquals(7, acuconf.getCount(Property.TABLE_FILE_REPLICATION)); assertEquals(300l, acuconf.getMemoryInBytes(Property.TABLE_FILE_BLOCK_SIZE)); @@ -233,7 +234,7 @@ public void validateConfiguration() throws IOException, InterruptedException { AccumuloFileOutputFormat.setIndexBlockSize(job2, d); AccumuloFileOutputFormat.setCompressionType(job2, e); - acuconf = AccumuloFileOutputFormat.getAccumuloConfiguration(job2); + acuconf = FileOutputConfigurator.getAccumuloConfiguration(AccumuloFileOutputFormat.class, job2.getConfiguration()); assertEquals(17, acuconf.getCount(Property.TABLE_FILE_REPLICATION)); assertEquals(1300l, acuconf.getMemoryInBytes(Property.TABLE_FILE_BLOCK_SIZE)); diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java index 092c930a9fe..8f497517082 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java @@ -31,13 +31,13 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; diff --git a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenTest.java b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenImplTest.java similarity index 79% rename from core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenTest.java rename to core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenImplTest.java index f66a1eef180..99de3b2321f 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/security/tokens/DelegationTokenImplTest.java @@ -25,23 +25,24 @@ import java.io.DataOutputStream; import java.io.IOException; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.junit.Test; -public class DelegationTokenTest { +public class DelegationTokenImplTest { @Test public void testSerialization() throws IOException { AuthenticationTokenIdentifier identifier = new AuthenticationTokenIdentifier("user", 1, 1000l, 2000l, "instanceid"); // We don't need a real serialized Token for the password - DelegationToken token = new DelegationToken(new byte[] {'f', 'a', 'k', 'e'}, identifier); + DelegationTokenImpl token = new DelegationTokenImpl(new byte[] {'f', 'a', 'k', 'e'}, identifier); assertEquals(token, token); assertEquals(token.hashCode(), token.hashCode()); ByteArrayOutputStream baos = new ByteArrayOutputStream(); token.write(new DataOutputStream(baos)); - DelegationToken copy = new DelegationToken(); + DelegationTokenImpl copy = new DelegationTokenImpl(); copy.readFields(new DataInputStream(new ByteArrayInputStream(baos.toByteArray()))); assertEquals(token, copy); @@ -52,17 +53,17 @@ public void testSerialization() throws IOException { public void testEquality() throws IOException { AuthenticationTokenIdentifier identifier = new AuthenticationTokenIdentifier("user", 1, 1000l, 2000l, "instanceid"); // We don't need a real serialized Token for the password - DelegationToken token = new DelegationToken(new byte[] {'f', 'a', 'k', 'e'}, identifier); + DelegationTokenImpl token = new DelegationTokenImpl(new byte[] {'f', 'a', 'k', 'e'}, identifier); AuthenticationTokenIdentifier identifier2 = new AuthenticationTokenIdentifier("user1", 1, 1000l, 2000l, "instanceid"); // We don't need a real serialized Token for the password - DelegationToken token2 = new DelegationToken(new byte[] {'f', 'a', 'k', 'e'}, identifier2); + DelegationTokenImpl token2 = new DelegationTokenImpl(new byte[] {'f', 'a', 'k', 'e'}, identifier2); assertNotEquals(token, token2); assertNotEquals(token.hashCode(), token2.hashCode()); // We don't need a real serialized Token for the password - DelegationToken token3 = new DelegationToken(new byte[] {'f', 'a', 'k', 'e', '0'}, identifier); + DelegationTokenImpl token3 = new DelegationTokenImpl(new byte[] {'f', 'a', 'k', 'e', '0'}, identifier); assertNotEquals(token, token3); assertNotEquals(token.hashCode(), token3.hashCode()); diff --git a/core/src/test/java/org/apache/accumulo/core/data/KeyExtentTest.java b/core/src/test/java/org/apache/accumulo/core/data/KeyExtentTest.java index 749f14ca14c..b1ac1c5d8cc 100644 --- a/core/src/test/java/org/apache/accumulo/core/data/KeyExtentTest.java +++ b/core/src/test/java/org/apache/accumulo/core/data/KeyExtentTest.java @@ -37,6 +37,7 @@ import java.util.TreeMap; import java.util.TreeSet; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.Text; import org.junit.Before; import org.junit.Test; diff --git a/core/src/test/java/org/apache/accumulo/core/data/RangeTest.java b/core/src/test/java/org/apache/accumulo/core/data/RangeTest.java index 1f9a40d2d03..1e5e985d39c 100644 --- a/core/src/test/java/org/apache/accumulo/core/data/RangeTest.java +++ b/core/src/test/java/org/apache/accumulo/core/data/RangeTest.java @@ -27,6 +27,7 @@ import junit.framework.TestCase; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.TRange; import org.apache.hadoop.io.Text; diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java index eafadc0042e..2e2b346836d 100644 --- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java +++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java @@ -44,10 +44,10 @@ import org.apache.accumulo.core.data.ArrayByteSequence; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.file.blockfile.cache.LruBlockCache; import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile; diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/IteratorUtilTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/IteratorUtilTest.java index 5ff57228f9f..87ad39233d2 100644 --- a/core/src/test/java/org/apache/accumulo/core/iterators/IteratorUtilTest.java +++ b/core/src/test/java/org/apache/accumulo/core/iterators/IteratorUtilTest.java @@ -32,9 +32,9 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; import org.apache.accumulo.core.iterators.system.MultiIteratorTest; diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java index c8ef180d0f5..3fbf92d8e20 100644 --- a/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java +++ b/core/src/test/java/org/apache/accumulo/core/iterators/system/MultiIteratorTest.java @@ -26,9 +26,9 @@ import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; import org.apache.accumulo.core.iterators.SortedMapIterator; import org.apache.accumulo.core.util.LocalityGroupUtil; diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java index b8ef346cef7..0e59025b586 100644 --- a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java +++ b/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java @@ -28,9 +28,9 @@ import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.Credentials; import org.junit.Test; public class MetadataServicerTest { diff --git a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java index b2b91d7e303..c0609178c31 100644 --- a/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java +++ b/core/src/test/java/org/apache/accumulo/core/replication/ReplicationConfigurationUtilTest.java @@ -22,7 +22,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.hadoop.io.Text; diff --git a/core/src/test/java/org/apache/accumulo/core/rpc/SaslConnectionParamsTest.java b/core/src/test/java/org/apache/accumulo/core/rpc/SaslConnectionParamsTest.java index 9b77d25c826..8727e584950 100644 --- a/core/src/test/java/org/apache/accumulo/core/rpc/SaslConnectionParamsTest.java +++ b/core/src/test/java/org/apache/accumulo/core/rpc/SaslConnectionParamsTest.java @@ -27,14 +27,14 @@ import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; import org.apache.accumulo.core.client.impl.ClientContext; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.rpc.SaslConnectionParams.QualityOfProtection; import org.apache.accumulo.core.rpc.SaslConnectionParams.SaslMechanism; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.security.UserGroupInformation; @@ -118,8 +118,8 @@ public Void run() throws Exception { } @Test - public void testDelegationToken() throws Exception { - final DelegationToken token = new DelegationToken(new byte[0], new AuthenticationTokenIdentifier("user", 1, 10l, 20l, "instanceid")); + public void testDelegationTokenImpl() throws Exception { + final DelegationTokenImpl token = new DelegationTokenImpl(new byte[0], new AuthenticationTokenIdentifier("user", 1, 10l, 20l, "instanceid")); testUser.doAs(new PrivilegedExceptionAction() { @Override public Void run() throws Exception { @@ -189,7 +189,7 @@ public SaslConnectionParams run() throws Exception { assertEquals(params1, params2); assertEquals(params1.hashCode(), params2.hashCode()); - final DelegationToken delToken1 = new DelegationToken(new byte[0], new AuthenticationTokenIdentifier("user", 1, 10l, 20l, "instanceid")); + final DelegationTokenImpl delToken1 = new DelegationTokenImpl(new byte[0], new AuthenticationTokenIdentifier("user", 1, 10l, 20l, "instanceid")); SaslConnectionParams params3 = testUser.doAs(new PrivilegedExceptionAction() { @Override public SaslConnectionParams run() throws Exception { @@ -211,7 +211,7 @@ public SaslConnectionParams run() throws Exception { assertNotEquals(params2, params3); assertNotEquals(params2.hashCode(), params3.hashCode()); - final DelegationToken delToken2 = new DelegationToken(new byte[0], new AuthenticationTokenIdentifier("user", 1, 10l, 20l, "instanceid")); + final DelegationTokenImpl delToken2 = new DelegationTokenImpl(new byte[0], new AuthenticationTokenIdentifier("user", 1, 10l, 20l, "instanceid")); SaslConnectionParams params4 = testUser.doAs(new PrivilegedExceptionAction() { @Override public SaslConnectionParams run() throws Exception { diff --git a/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifierTest.java b/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifierTest.java index d3c1f20f364..ef6d7be5ece 100644 --- a/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifierTest.java +++ b/core/src/test/java/org/apache/accumulo/core/security/AuthenticationTokenIdentifierTest.java @@ -26,6 +26,7 @@ import java.io.DataOutputStream; import java.io.IOException; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; import org.apache.hadoop.security.UserGroupInformation; import org.junit.Test; diff --git a/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java b/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java index a39931084e4..0457caad32a 100644 --- a/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java +++ b/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java @@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer; diff --git a/core/src/test/java/org/apache/accumulo/core/security/VisibilityConstraintTest.java b/core/src/test/java/org/apache/accumulo/core/security/VisibilityConstraintTest.java index c9aa5d25b41..b61ae96a56b 100644 --- a/core/src/test/java/org/apache/accumulo/core/security/VisibilityConstraintTest.java +++ b/core/src/test/java/org/apache/accumulo/core/security/VisibilityConstraintTest.java @@ -27,6 +27,7 @@ import java.util.Arrays; import java.util.List; +import org.apache.accumulo.core.constraints.VisibilityConstraint; import org.apache.accumulo.core.constraints.Constraint.Environment; import org.apache.accumulo.core.data.ArrayByteSequence; import org.apache.accumulo.core.data.Mutation; diff --git a/core/src/test/java/org/apache/accumulo/core/util/MergeTest.java b/core/src/test/java/org/apache/accumulo/core/util/MergeTest.java index 95d7b66d06c..5b0dc550176 100644 --- a/core/src/test/java/org/apache/accumulo/core/util/MergeTest.java +++ b/core/src/test/java/org/apache/accumulo/core/util/MergeTest.java @@ -24,7 +24,7 @@ import java.util.List; import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.util.Merge.Size; import org.apache.hadoop.io.Text; import org.junit.Test; diff --git a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java index b4d92c860a5..c1fb8751864 100644 --- a/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java +++ b/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java @@ -31,8 +31,8 @@ import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.security.SecurityErrorCode; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.TabletID; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.hadoop.io.Text; @@ -155,9 +155,9 @@ public static void main(String[] args) throws AccumuloException, AccumuloSecurit try { bw.close(); } catch (MutationsRejectedException e) { - if (e.getAuthorizationFailuresMap().size() > 0) { + if (e.getSecurityErrorCodes().size() > 0) { HashMap> tables = new HashMap>(); - for (Entry> ke : e.getAuthorizationFailuresMap().entrySet()) { + for (Entry> ke : e.getSecurityErrorCodes().entrySet()) { Set secCodes = tables.get(ke.getKey().getTableId().toString()); if (secCodes == null) { secCodes = new HashSet(); diff --git a/minicluster/pom.xml b/minicluster/pom.xml index 2f46eaf2fb9..fa7cacc8d96 100644 --- a/minicluster/pom.xml +++ b/minicluster/pom.xml @@ -135,9 +135,8 @@ .*[.]impl[.].* - org[.]apache[.]accumulo[.]core[.]client[.].* - org[.]apache[.]accumulo[.]core[.]data[.](Mutation|Key|Value|Condition|ConditionalMutation|Range|ByteSequence|PartialKey|Column)([$].*)? - org[.]apache[.]accumulo[.]core[.]security[.](ColumnVisibility|Authorizations|NamespacePermission|SystemPermission|TablePermission)([$].*)? + org[.]apache[.]accumulo[.]core[.](client|data|security)[.](?!.*(impl|thrift|crypto).*).* + org.apache.commons.configuration.PropertiesConfiguration diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java index b1b59f263fc..a21ba64336b 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java @@ -61,6 +61,7 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; @@ -70,7 +71,6 @@ import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.master.thrift.MasterGoalState; import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.accumulo.core.util.Daemon; diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index b3e7639da8e..c6f004a3801 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -59,6 +59,7 @@ import org.apache.accumulo.core.client.admin.CompactionConfig; import org.apache.accumulo.core.client.admin.NewTableConfiguration; import org.apache.accumulo.core.client.admin.TimeType; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType; import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; import org.apache.accumulo.core.client.mock.MockInstance; @@ -68,15 +69,14 @@ import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.ConditionalMutation; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.TabletID; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.ColumnVisibility; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.util.ByteBufferUtil; @@ -725,7 +725,7 @@ public List getActiveScans(ByteBuff pscan.idleTime = scan.getIdleTime(); pscan.type = ScanType.valueOf(scan.getType().toString()); pscan.state = ScanState.valueOf(scan.getState().toString()); - KeyExtent e = scan.getExtent(); + TabletID e = scan.getTablet(); pscan.extent = new org.apache.accumulo.proxy.thrift.KeyExtent(e.getTableId().toString(), TextUtil.getByteBuffer(e.getEndRow()), TextUtil.getByteBuffer(e.getPrevEndRow())); pscan.columns = new ArrayList(); @@ -777,7 +777,7 @@ public List getActiveCompacti pcomp.age = comp.getAge(); pcomp.entriesRead = comp.getEntriesRead(); pcomp.entriesWritten = comp.getEntriesWritten(); - KeyExtent e = comp.getExtent(); + TabletID e = comp.getTablet(); pcomp.extent = new org.apache.accumulo.proxy.thrift.KeyExtent(e.getTableId().toString(), TextUtil.getByteBuffer(e.getEndRow()), TextUtil.getByteBuffer(e.getPrevEndRow())); pcomp.inputFiles = new ArrayList(); diff --git a/server/base/src/main/java/org/apache/accumulo/server/AccumuloServerContext.java b/server/base/src/main/java/org/apache/accumulo/server/AccumuloServerContext.java index 315ea598a03..a35f39ce11d 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/AccumuloServerContext.java +++ b/server/base/src/main/java/org/apache/accumulo/server/AccumuloServerContext.java @@ -25,12 +25,12 @@ import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.ConnectorImpl; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.rpc.SslConnectionParams; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.client.HdfsZooInstance; import org.apache.accumulo.server.conf.ServerConfigurationFactory; import org.apache.accumulo.server.rpc.SaslServerConnectionParams; diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java index 747e2243025..283d3041943 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java +++ b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java @@ -46,8 +46,8 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.ByteSequence; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.TKeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVIterator; diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java index aabda72872a..00e0346c075 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java +++ b/server/base/src/main/java/org/apache/accumulo/server/client/ClientServiceHandler.java @@ -34,6 +34,7 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Namespaces; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.impl.thrift.ClientService; @@ -50,7 +51,6 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.NamespacePermission; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; diff --git a/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java b/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java index f64f941e4eb..0d7aaf14758 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java +++ b/server/base/src/main/java/org/apache/accumulo/server/client/HdfsZooInstance.java @@ -29,16 +29,16 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; -import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.ConnectorImpl; +import org.apache.accumulo.core.client.impl.Credentials; +import org.apache.accumulo.core.client.impl.InstanceOperationsImpl; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; import org.apache.accumulo.core.metadata.RootTable; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.ByteBufferUtil; import org.apache.accumulo.core.util.OpTimer; import org.apache.accumulo.core.util.TextUtil; @@ -141,7 +141,7 @@ private static synchronized void _getInstanceID() { @Override public String getInstanceName() { - return ZooKeeperInstance.lookupInstanceName(zooCache, UUID.fromString(getInstanceID())); + return InstanceOperationsImpl.lookupInstanceName(zooCache, UUID.fromString(getInstanceID())); } @Override diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfiguration.java b/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfiguration.java index f2b2042e3fc..0b639276936 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfiguration.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfiguration.java @@ -18,7 +18,7 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.conf.AccumuloConfiguration; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; public abstract class ServerConfiguration { diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java b/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java index 2ec9ba1a19d..a45ff565923 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/ServerConfigurationFactory.java @@ -26,7 +26,7 @@ import org.apache.accumulo.core.conf.ConfigSanityCheck; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.SiteConfiguration; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.fate.zookeeper.ZooCacheFactory; /** diff --git a/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java b/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java index c95fad9705d..fd5af143a1a 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java +++ b/server/base/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java @@ -27,9 +27,9 @@ import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.constraints.Constraint; import org.apache.accumulo.core.data.ColumnUpdate; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java index e04738380b8..d167dd25a53 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java @@ -33,7 +33,7 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.rfile.RFile; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.accumulo.core.volume.NonConfiguredVolume; diff --git a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java index fc26ca4eb56..c3595cdd24b 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/fs/VolumeUtil.java @@ -26,7 +26,7 @@ import java.util.SortedMap; import java.util.TreeMap; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.core.protobuf.ProtobufUtil; import org.apache.accumulo.core.tabletserver.log.LogEntry; diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java index e5bddeddc6e..c6f1dd890f2 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java +++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java @@ -47,8 +47,8 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVWriter; import org.apache.accumulo.core.iterators.Combiner; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java index cad9bb70ab9..0ea6b41a415 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/LiveTServerSet.java @@ -29,7 +29,7 @@ import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.rpc.ThriftUtil; import org.apache.accumulo.core.tabletserver.thrift.NotServingTabletException; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java index aa8e21921ce..dc58495d70d 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancer.java @@ -26,7 +26,7 @@ import java.util.SortedMap; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.metadata.MetadataTable; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java index 810dd25d7f1..56b3839a22a 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancer.java @@ -27,7 +27,7 @@ import java.util.Set; import java.util.SortedMap; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.tabletserver.thrift.TabletStats; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java index ac74f15e652..fb4e0d95715 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/GroupBalancer.java @@ -33,8 +33,8 @@ import org.apache.accumulo.core.client.RowIterator; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/RegexGroupBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/RegexGroupBalancer.java index 9ebf178e3d0..724a606a0db 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/RegexGroupBalancer.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/RegexGroupBalancer.java @@ -23,7 +23,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.Text; import com.google.common.base.Function; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java index dfce953f1df..7d765725741 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TableLoadBalancer.java @@ -29,7 +29,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.admin.TableOperations; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.server.master.state.TServerInstance; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java index 02d5ffb04b7..a1992884021 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/balancer/TabletBalancer.java @@ -24,7 +24,7 @@ import java.util.SortedMap; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.rpc.ThriftUtil; import org.apache.accumulo.core.tabletserver.thrift.TabletClientService; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/Assignment.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/Assignment.java index f1a9b3fbc0b..6a7530b81a7 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/state/Assignment.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/Assignment.java @@ -16,7 +16,7 @@ */ package org.apache.accumulo.server.master.state; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; public class Assignment { public KeyExtent tablet; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/CurrentState.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/CurrentState.java index af02dded69a..8b1c6f329ba 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/state/CurrentState.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/CurrentState.java @@ -19,7 +19,7 @@ import java.util.Collection; import java.util.Set; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.MasterState; public interface CurrentState { diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/MergeInfo.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/MergeInfo.java index 388da05dbfd..076876c848d 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/state/MergeInfo.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/MergeInfo.java @@ -20,7 +20,7 @@ import java.io.DataOutput; import java.io.IOException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.Writable; /** diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java index 9be5a67528e..d64c1083813 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/MetaDataTableScanner.java @@ -32,9 +32,9 @@ import org.apache.accumulo.core.client.ScannerBase; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.user.WholeRowIterator; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletLocationState.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletLocationState.java index 2e79ba97919..fb30440ddc0 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletLocationState.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletLocationState.java @@ -20,7 +20,7 @@ import java.util.Collections; import java.util.Set; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.Text; /** diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletMigration.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletMigration.java index 573b2eb3d89..4c18b318d9e 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletMigration.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletMigration.java @@ -16,7 +16,7 @@ */ package org.apache.accumulo.server.master.state; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; public class TabletMigration { public KeyExtent tablet; diff --git a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java index a972a6a64e6..236b602eb18 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java +++ b/server/base/src/main/java/org/apache/accumulo/server/master/state/TabletStateChangeIterator.java @@ -31,8 +31,8 @@ import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.IteratorEnvironment; import org.apache.accumulo.core.iterators.SkippingIterator; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; diff --git a/server/base/src/main/java/org/apache/accumulo/server/rpc/SaslServerDigestCallbackHandler.java b/server/base/src/main/java/org/apache/accumulo/server/rpc/SaslServerDigestCallbackHandler.java index c43f7edbd3c..6e5e8df9101 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/rpc/SaslServerDigestCallbackHandler.java +++ b/server/base/src/main/java/org/apache/accumulo/server/rpc/SaslServerDigestCallbackHandler.java @@ -27,8 +27,8 @@ import javax.security.sasl.AuthorizeCallback; import javax.security.sasl.RealmCallback; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; import org.apache.accumulo.core.rpc.SaslDigestCallbackHandler; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; import org.apache.accumulo.server.security.delegation.AuthenticationTokenSecretManager; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.SecretManager.InvalidToken; diff --git a/server/base/src/main/java/org/apache/accumulo/server/rpc/TCredentialsUpdatingInvocationHandler.java b/server/base/src/main/java/org/apache/accumulo/server/rpc/TCredentialsUpdatingInvocationHandler.java index 4e0e931de90..06ca99f2d1c 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/rpc/TCredentialsUpdatingInvocationHandler.java +++ b/server/base/src/main/java/org/apache/accumulo/server/rpc/TCredentialsUpdatingInvocationHandler.java @@ -21,10 +21,10 @@ import java.lang.reflect.Method; import java.util.concurrent.ConcurrentHashMap; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.rpc.SaslConnectionParams.SaslMechanism; @@ -88,7 +88,7 @@ protected void updateArgs(Object[] args) throws ThriftSecurityException { final String principal = UGIAssumingProcessor.rpcPrincipal(); // If we authenticated the user over DIGEST-MD5 and they have a DelegationToken, the principals should match - if (SaslMechanism.DIGEST_MD5 == UGIAssumingProcessor.rpcMechanism() && DelegationToken.class.isAssignableFrom(tokenClass)) { + if (SaslMechanism.DIGEST_MD5 == UGIAssumingProcessor.rpcMechanism() && DelegationTokenImpl.class.isAssignableFrom(tokenClass)) { if (!principal.equals(tcreds.principal)) { log.warn("{} issued RPC with delegation token over DIGEST-MD5 as the Accumulo principal {}. Disallowing RPC", principal, tcreds.principal); throw new ThriftSecurityException("RPC principal did not match provided Accumulo principal", SecurityErrorCode.BAD_CREDENTIALS); diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java b/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java index 283cba3e8b2..60f36e0414b 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java @@ -25,12 +25,13 @@ import java.util.Map.Entry; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.impl.Translator; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.data.Column; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.data.thrift.TColumn; import org.apache.accumulo.core.data.thrift.TKeyExtent; @@ -38,7 +39,6 @@ import org.apache.accumulo.core.master.thrift.FateOperation; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.security.thrift.TCredentials; diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java b/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java index d7bee3186f8..c463cad613f 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java @@ -27,6 +27,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Namespaces; import org.apache.accumulo.core.client.impl.SecurityOperationsImpl; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; @@ -43,7 +44,6 @@ import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.replication.ReplicationTable; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.NamespacePermission; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java b/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java index 6a915c6e2f4..0b4472796e2 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java @@ -28,12 +28,12 @@ import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.util.Base64; import org.apache.accumulo.server.ServerConstants; diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManager.java b/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManager.java index 4848609aeda..a52b5f459b6 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManager.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManager.java @@ -32,8 +32,8 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.hadoop.io.Text; import org.apache.hadoop.security.token.SecretManager; import org.apache.hadoop.security.token.Token; @@ -152,7 +152,7 @@ public Entry,AuthenticationTokenIdentifier> final AuthenticationTokenIdentifier id = new AuthenticationTokenIdentifier(username, cfg); - final StringBuilder svcName = new StringBuilder(DelegationToken.SERVICE_NAME); + final StringBuilder svcName = new StringBuilder(DelegationTokenImpl.SERVICE_NAME); if (null != id.getInstanceId()) { svcName.append("-").append(id.getInstanceId()); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java index fd7d0556a58..4ec4ba4df2b 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/KerberosAuthenticator.java @@ -24,10 +24,10 @@ import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.SiteConfiguration; @@ -132,7 +132,7 @@ public boolean authenticateUser(String principal, AuthenticationToken token) thr } // User is authenticated at the transport layer -- nothing extra is necessary - if (token instanceof KerberosToken || token instanceof DelegationToken) { + if (token instanceof KerberosToken || token instanceof DelegationTokenImpl) { return true; } return false; diff --git a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java index 2dced614a89..323e59d126d 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java +++ b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java @@ -23,7 +23,7 @@ import java.util.TreeMap; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.conf.ServerConfiguration; import org.apache.hadoop.io.Text; import org.slf4j.Logger; diff --git a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/MemoryManagementActions.java b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/MemoryManagementActions.java index 3cbe25d2a60..09dbff6efa5 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/MemoryManagementActions.java +++ b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/MemoryManagementActions.java @@ -18,7 +18,7 @@ import java.util.List; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; public class MemoryManagementActions { public List tabletsToMinorCompact; diff --git a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/MemoryManager.java b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/MemoryManager.java index 11327f6c3d2..24aa45f6922 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/MemoryManager.java +++ b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/MemoryManager.java @@ -18,7 +18,7 @@ import java.util.List; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.conf.ServerConfiguration; /** diff --git a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/TabletState.java b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/TabletState.java index 78301e8dc2d..dfb0a7061cc 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/TabletState.java +++ b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/TabletState.java @@ -16,7 +16,7 @@ */ package org.apache.accumulo.server.tabletserver; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; public interface TabletState { KeyExtent getExtent(); diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java index 8ad8eeb1951..bdbc7f084bc 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java @@ -40,6 +40,7 @@ import org.apache.accumulo.core.client.admin.InstanceOperations; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.ClientExec; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.DefaultConfiguration; @@ -48,7 +49,6 @@ import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.NamespacePermission; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java b/server/base/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java index 253b6663d0e..b081a60bde4 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java @@ -26,8 +26,8 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java index 29700c7ca55..04e17d5c58e 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/FileUtil.java @@ -32,10 +32,10 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.file.FileSKVWriter; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java b/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java index 9461d8d8c7d..1db53a450c2 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java @@ -24,8 +24,8 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.Tables; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java index d5a4223f160..14eba685129 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java @@ -33,11 +33,11 @@ import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.ScannerImpl; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java index 0e2a2e756b9..5e74aacec67 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java @@ -48,14 +48,15 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.BatchWriterImpl; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.ScannerImpl; import org.apache.accumulo.core.client.impl.Writer; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.DataFileValue; @@ -69,7 +70,6 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ServerColumnFamily; import org.apache.accumulo.core.replication.ReplicationTable; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.tabletserver.log.LogEntry; import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException; import org.apache.accumulo.core.util.ColumnFQ; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java b/server/base/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java index 0a2cbe9f2c1..c9d4dd55bf3 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java @@ -34,18 +34,18 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.cli.ClientOpts; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.fs.VolumeManagerImpl; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java b/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java index af02a8d3fca..8e755a30e3f 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/ReplicationTableUtil.java @@ -31,18 +31,18 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.TableOperations; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Writer; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.Combiner; import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.metadata.schema.MetadataSchema.ReplicationSection; import org.apache.accumulo.core.protobuf.ProtobufUtil; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.server.replication.StatusCombiner; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java index 9086d142661..684e5320581 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java @@ -37,8 +37,8 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; import org.apache.accumulo.core.security.Authorizations; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java b/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java index 0bfdf6b6361..ea308d6d6b1 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/TabletIterator.java @@ -26,10 +26,10 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.util.UtilWaitThread; diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java b/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java index 42eb41485fe..c0c979b8559 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java @@ -32,10 +32,11 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.InitialMultiScan; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.data.thrift.MultiScanResult; @@ -45,7 +46,6 @@ import org.apache.accumulo.core.metadata.MetadataServicer; import org.apache.accumulo.core.rpc.ThriftUtil; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.tabletserver.thrift.NoSuchScanIDException; import org.apache.accumulo.core.tabletserver.thrift.TabletClientService; import org.apache.accumulo.core.trace.Tracer; diff --git a/server/base/src/test/java/org/apache/accumulo/server/AccumuloServerContextTest.java b/server/base/src/test/java/org/apache/accumulo/server/AccumuloServerContextTest.java index 92b6be8efe1..a596d9f4209 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/AccumuloServerContextTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/AccumuloServerContextTest.java @@ -27,12 +27,12 @@ import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.conf.ServerConfigurationFactory; import org.apache.accumulo.server.rpc.SaslServerConnectionParams; import org.apache.accumulo.server.rpc.ThriftServerType; diff --git a/server/base/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java b/server/base/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java index fad6398dbfb..8d649d242bf 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/client/BulkImporterTest.java @@ -29,18 +29,18 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.TabletLocator; import org.apache.accumulo.core.client.impl.TabletLocator.TabletLocation; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVWriter; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.fs.VolumeManagerImpl; diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancerTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancerTest.java index 1b691c7ef91..0fb9182aa9a 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancerTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/ChaoticLoadBalancerTest.java @@ -29,7 +29,7 @@ import java.util.TreeMap; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.tabletserver.thrift.TabletStats; diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java index aee15bc36b7..aee1795a05f 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/DefaultLoadBalancerTest.java @@ -32,7 +32,7 @@ import java.util.TreeMap; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.tabletserver.thrift.TabletStats; diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java index 3ceb07eb53f..5de4923ea4a 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/GroupBalancerTest.java @@ -28,7 +28,7 @@ import java.util.SortedMap; import java.util.TreeMap; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.util.MapCounter; import org.apache.accumulo.core.util.Pair; diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java index 4d36f47ca55..c957009ed8f 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/TableLoadBalancerTest.java @@ -32,7 +32,7 @@ import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.tabletserver.thrift.TabletStats; diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java index 6f8795b2cbf..1ce5dd86bd8 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java @@ -31,7 +31,7 @@ import java.io.DataInputStream; import java.io.DataOutputStream; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.DataInputBuffer; import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.io.Text; diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/state/TabletLocationStateTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/state/TabletLocationStateTest.java index a7b673b7bad..0a0afd1ce03 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/master/state/TabletLocationStateTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/master/state/TabletLocationStateTest.java @@ -28,7 +28,7 @@ import java.util.Collection; import java.util.Set; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.Text; import org.junit.Before; import org.junit.BeforeClass; diff --git a/server/base/src/test/java/org/apache/accumulo/server/rpc/SaslDigestCallbackHandlerTest.java b/server/base/src/test/java/org/apache/accumulo/server/rpc/SaslDigestCallbackHandlerTest.java index 6c965ffbe05..616bc45eb0d 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/rpc/SaslDigestCallbackHandlerTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/rpc/SaslDigestCallbackHandlerTest.java @@ -34,8 +34,8 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; import org.apache.accumulo.core.rpc.SaslDigestCallbackHandler; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; import org.apache.accumulo.server.security.delegation.AuthenticationKey; import org.apache.accumulo.server.security.delegation.AuthenticationTokenSecretManager; import org.apache.hadoop.security.token.Token; diff --git a/server/base/src/test/java/org/apache/accumulo/server/security/SystemCredentialsTest.java b/server/base/src/test/java/org/apache/accumulo/server/security/SystemCredentialsTest.java index 9d5dd68668f..1af908b35ba 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/security/SystemCredentialsTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/security/SystemCredentialsTest.java @@ -24,8 +24,8 @@ import java.util.UUID; import org.apache.accumulo.core.client.impl.ConnectorImpl; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.ServerConstants; import org.apache.accumulo.server.security.SystemCredentials.SystemToken; import org.junit.BeforeClass; diff --git a/server/base/src/test/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManagerTest.java b/server/base/src/test/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManagerTest.java index b6148191ca0..2649a03c237 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManagerTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/security/delegation/AuthenticationTokenSecretManagerTest.java @@ -40,7 +40,7 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; import org.apache.hadoop.security.token.SecretManager.InvalidToken; import org.apache.hadoop.security.token.Token; import org.junit.After; diff --git a/server/base/src/test/java/org/apache/accumulo/server/util/CloneTest.java b/server/base/src/test/java/org/apache/accumulo/server/util/CloneTest.java index ebb83bf7199..0c696a1a306 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/util/CloneTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/util/CloneTest.java @@ -28,9 +28,9 @@ import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; diff --git a/server/base/src/test/java/org/apache/accumulo/server/util/ReplicationTableUtilTest.java b/server/base/src/test/java/org/apache/accumulo/server/util/ReplicationTableUtilTest.java index b1010c221a3..3983bde2c96 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/util/ReplicationTableUtilTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/util/ReplicationTableUtilTest.java @@ -37,20 +37,20 @@ import org.apache.accumulo.core.client.IteratorSetting.Column; import org.apache.accumulo.core.client.admin.TableOperations; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Writer; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.ColumnUpdate; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.Combiner; import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.metadata.schema.MetadataSchema.ReplicationSection; import org.apache.accumulo.core.protobuf.ProtobufUtil; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.replication.StatusCombiner; import org.apache.accumulo.server.replication.StatusUtil; import org.apache.accumulo.server.replication.proto.Replication.Status; diff --git a/server/base/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java b/server/base/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java index 0e81b7960a9..9c6cee11c9f 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java @@ -27,10 +27,10 @@ import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java b/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java index 16212c70844..b0818fda392 100644 --- a/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java +++ b/server/gc/src/main/java/org/apache/accumulo/gc/GarbageCollectionAlgorithm.java @@ -33,8 +33,8 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ScanFileColumnFamily; diff --git a/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java b/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java index ed71e987d0d..544bd69a7b0 100644 --- a/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java +++ b/server/gc/src/test/java/org/apache/accumulo/gc/GarbageCollectionTest.java @@ -31,8 +31,8 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.server.replication.StatusUtil; diff --git a/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java b/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java index d30f00b2c1e..59f1b366000 100644 --- a/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java +++ b/server/gc/src/test/java/org/apache/accumulo/gc/SimpleGarbageCollectorTest.java @@ -35,10 +35,10 @@ import java.util.Map.Entry; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.trace.thrift.TInfo; import org.apache.accumulo.gc.SimpleGarbageCollector.Opts; diff --git a/server/gc/src/test/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferencesTest.java b/server/gc/src/test/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferencesTest.java index 23db83a7fda..3115de1d588 100644 --- a/server/gc/src/test/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferencesTest.java +++ b/server/gc/src/test/java/org/apache/accumulo/gc/replication/CloseWriteAheadLogReferencesTest.java @@ -46,9 +46,9 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.ReplicationSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java index a7e8db15cea..4d52cc554fd 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/Master.java +++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java @@ -51,8 +51,8 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.conf.SiteConfiguration; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.master.thrift.MasterClientService.Iface; import org.apache.accumulo.core.master.thrift.MasterClientService.Processor; diff --git a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java index 06f91a03095..592d9ae7f72 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java +++ b/server/master/src/main/java/org/apache/accumulo/master/MasterClientServiceHandler.java @@ -36,6 +36,7 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; import org.apache.accumulo.core.client.impl.DelegationTokenConfigSerializer; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; @@ -45,9 +46,9 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.TKeyExtent; import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.master.thrift.MasterGoalState; @@ -64,7 +65,6 @@ import org.apache.accumulo.core.protobuf.ProtobufUtil; import org.apache.accumulo.core.replication.ReplicationSchema.OrderSection; import org.apache.accumulo.core.replication.ReplicationTable; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.security.thrift.TDelegationToken; diff --git a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java b/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java index 1cf00d4851c..4c47953e1c8 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java +++ b/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java @@ -42,11 +42,11 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.master.thrift.MasterState; import org.apache.accumulo.core.master.thrift.TabletServerStatus; diff --git a/server/master/src/main/java/org/apache/accumulo/master/recovery/RecoveryManager.java b/server/master/src/main/java/org/apache/accumulo/master/recovery/RecoveryManager.java index b872d6597ca..c1c1713c943 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/recovery/RecoveryManager.java +++ b/server/master/src/main/java/org/apache/accumulo/master/recovery/RecoveryManager.java @@ -33,7 +33,7 @@ import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.util.NamingThreadFactory; import org.apache.accumulo.core.zookeeper.ZooUtil; import org.apache.accumulo.master.Master; diff --git a/server/master/src/main/java/org/apache/accumulo/master/state/MergeStats.java b/server/master/src/main/java/org/apache/accumulo/master/state/MergeStats.java index 5815a463013..a3c7e46c013 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/state/MergeStats.java +++ b/server/master/src/main/java/org/apache/accumulo/master/state/MergeStats.java @@ -25,9 +25,9 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.security.Authorizations; diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java index 6f77a823e8f..7f839889e36 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/BulkImport.java @@ -52,8 +52,8 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.metadata.MetadataTable; diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CompactRange.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CompactRange.java index c7b5f0c2794..133663d01f9 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CompactRange.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CompactRange.java @@ -37,9 +37,9 @@ import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType; import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java index 2132ce4d976..94367046f15 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CreateTable.java @@ -26,7 +26,7 @@ import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.impl.thrift.TableOperation; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.fate.Repo; diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteTable.java index ab1227f3061..05676e72f89 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteTable.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/DeleteTable.java @@ -31,9 +31,9 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.user.GrepIterator; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.metadata.MetadataTable; diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ExportTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ExportTable.java index 4661dea8dbe..e5b7e863d7f 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ExportTable.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ExportTable.java @@ -44,8 +44,8 @@ import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java index 961e8996da8..31bc52c1ee6 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/ImportTable.java @@ -45,9 +45,9 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.metadata.MetadataTable; diff --git a/server/master/src/main/java/org/apache/accumulo/master/tableOps/TableRangeOp.java b/server/master/src/main/java/org/apache/accumulo/master/tableOps/TableRangeOp.java index 68c3e726c71..a9a923b9d0e 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/tableOps/TableRangeOp.java +++ b/server/master/src/main/java/org/apache/accumulo/master/tableOps/TableRangeOp.java @@ -20,7 +20,7 @@ import org.apache.accumulo.core.client.impl.thrift.TableOperation; import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType; import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.util.TextUtil; import org.apache.accumulo.fate.Repo; diff --git a/server/master/src/test/java/org/apache/accumulo/master/ReplicationOperationsImplTest.java b/server/master/src/test/java/org/apache/accumulo/master/ReplicationOperationsImplTest.java index a127dcdc63a..679085875d7 100644 --- a/server/master/src/test/java/org/apache/accumulo/master/ReplicationOperationsImplTest.java +++ b/server/master/src/test/java/org/apache/accumulo/master/ReplicationOperationsImplTest.java @@ -31,21 +31,21 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.ReplicationOperationsImpl; import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.ReplicationSection; import org.apache.accumulo.core.protobuf.ProtobufUtil; import org.apache.accumulo.core.replication.ReplicationSchema.StatusSection; import org.apache.accumulo.core.replication.ReplicationTable; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.tabletserver.log.LogEntry; import org.apache.accumulo.core.trace.thrift.TInfo; diff --git a/server/master/src/test/java/org/apache/accumulo/master/TestMergeState.java b/server/master/src/test/java/org/apache/accumulo/master/TestMergeState.java index b0240f138d4..634ee895eb9 100644 --- a/server/master/src/test/java/org/apache/accumulo/master/TestMergeState.java +++ b/server/master/src/test/java/org/apache/accumulo/master/TestMergeState.java @@ -28,10 +28,10 @@ import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.mock.MockInstance; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.MasterState; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/server/master/src/test/java/org/apache/accumulo/master/replication/SequentialWorkAssignerTest.java b/server/master/src/test/java/org/apache/accumulo/master/replication/SequentialWorkAssignerTest.java index 3f3250d8ef6..e05a17ee8f3 100644 --- a/server/master/src/test/java/org/apache/accumulo/master/replication/SequentialWorkAssignerTest.java +++ b/server/master/src/test/java/org/apache/accumulo/master/replication/SequentialWorkAssignerTest.java @@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; @@ -39,7 +40,6 @@ import org.apache.accumulo.core.replication.ReplicationSchema.WorkSection; import org.apache.accumulo.core.replication.ReplicationTable; import org.apache.accumulo.core.replication.ReplicationTarget; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.zookeeper.ZooUtil; import org.apache.accumulo.server.replication.DistributedWorkQueueWorkAssignerHelper; diff --git a/server/master/src/test/java/org/apache/accumulo/master/replication/StatusMakerTest.java b/server/master/src/test/java/org/apache/accumulo/master/replication/StatusMakerTest.java index c691f924de7..b57fd895470 100644 --- a/server/master/src/test/java/org/apache/accumulo/master/replication/StatusMakerTest.java +++ b/server/master/src/test/java/org/apache/accumulo/master/replication/StatusMakerTest.java @@ -29,6 +29,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; @@ -40,7 +41,6 @@ import org.apache.accumulo.core.replication.ReplicationSchema.StatusSection; import org.apache.accumulo.core.replication.ReplicationTable; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.replication.StatusUtil; import org.apache.accumulo.server.replication.proto.Replication.Status; import org.apache.accumulo.server.util.ReplicationTableUtil; diff --git a/server/master/src/test/java/org/apache/accumulo/master/replication/UnorderedWorkAssignerTest.java b/server/master/src/test/java/org/apache/accumulo/master/replication/UnorderedWorkAssignerTest.java index febd54ca6e3..35df3446ed6 100644 --- a/server/master/src/test/java/org/apache/accumulo/master/replication/UnorderedWorkAssignerTest.java +++ b/server/master/src/test/java/org/apache/accumulo/master/replication/UnorderedWorkAssignerTest.java @@ -33,6 +33,7 @@ import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.AccumuloConfiguration; @@ -43,7 +44,6 @@ import org.apache.accumulo.core.replication.ReplicationSchema.WorkSection; import org.apache.accumulo.core.replication.ReplicationTable; import org.apache.accumulo.core.replication.ReplicationTarget; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.server.replication.DistributedWorkQueueWorkAssignerHelper; import org.apache.accumulo.server.replication.StatusUtil; diff --git a/server/master/src/test/java/org/apache/accumulo/master/state/RootTabletStateStoreTest.java b/server/master/src/test/java/org/apache/accumulo/master/state/RootTabletStateStoreTest.java index abceae4e079..d2cc0cfe613 100644 --- a/server/master/src/test/java/org/apache/accumulo/master/state/RootTabletStateStoreTest.java +++ b/server/master/src/test/java/org/apache/accumulo/master/state/RootTabletStateStoreTest.java @@ -27,7 +27,7 @@ import java.util.HashSet; import java.util.List; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.server.master.state.Assignment; import org.apache.accumulo.server.master.state.DistributedStore; diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java index 5ead979d691..16b05d48671 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TServersServlet.java @@ -27,7 +27,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.accumulo.core.client.impl.ClientContext; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.DeadServer; import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; import org.apache.accumulo.core.master.thrift.TableInfo; diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java index 37008747df2..4d7d94dcda8 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/TablesServlet.java @@ -29,8 +29,8 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.Tables; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.metadata.MetadataTable; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/ActiveAssignmentRunnable.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/ActiveAssignmentRunnable.java index bfc34a64eda..a25d22ff193 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/ActiveAssignmentRunnable.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/ActiveAssignmentRunnable.java @@ -18,7 +18,7 @@ import java.util.concurrent.ConcurrentHashMap; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/ConditionalMutationSet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/ConditionalMutationSet.java index 68ccdf0f1ff..82e5057ecdd 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/ConditionalMutationSet.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/ConditionalMutationSet.java @@ -24,7 +24,7 @@ import java.util.Map; import java.util.Map.Entry; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.tserver.data.ServerConditionalMutation; import org.apache.hadoop.io.WritableComparator; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/FileManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/FileManager.java index b5f5e166d5a..f8d0280cc2c 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/FileManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/FileManager.java @@ -31,8 +31,8 @@ import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.file.blockfile.cache.BlockCache; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/RowLocks.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/RowLocks.java index babd6295ba4..03707d17763 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/RowLocks.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/RowLocks.java @@ -25,7 +25,7 @@ import org.apache.accumulo.core.data.ArrayByteSequence; import org.apache.accumulo.core.data.ByteSequence; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.tserver.ConditionalMutationSet.DeferFilter; import org.apache.accumulo.tserver.data.ServerConditionalMutation; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java index d9c3775ffd9..afd3454fa55 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java @@ -78,10 +78,10 @@ import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.ConstraintViolationSummary; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.InitialMultiScan; import org.apache.accumulo.core.data.thrift.InitialScan; import org.apache.accumulo.core.data.thrift.IterInfo; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java index 077fbb80e98..65cbdf1c07a 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java @@ -37,7 +37,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.blockfile.cache.LruBlockCache; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.core.util.Daemon; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TservConstraintEnv.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TservConstraintEnv.java index edaca319a47..fc371c9fabe 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TservConstraintEnv.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TservConstraintEnv.java @@ -22,7 +22,7 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.constraints.Constraint.Environment; import org.apache.accumulo.core.data.ByteSequence; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.security.AuthorizationContainer; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.thrift.TCredentials; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java index b9b89a15849..db025263468 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/WriteTracker.java @@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicLong; import org.apache.accumulo.core.client.impl.TabletType; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.tserver.tablet.Tablet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/MajorCompactionRequest.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/MajorCompactionRequest.java index 03817c1fd47..712e8df54d2 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/MajorCompactionRequest.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/compaction/MajorCompactionRequest.java @@ -22,7 +22,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.metadata.schema.DataFileValue; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java index 605d768f1c2..13e7c4f5998 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/constraints/ConstraintChecker.java @@ -26,9 +26,9 @@ import org.apache.accumulo.core.constraints.Constraint; import org.apache.accumulo.core.constraints.Constraint.Environment; import org.apache.accumulo.core.constraints.Violations; -import org.apache.accumulo.core.data.ComparableBytes; import org.apache.accumulo.core.data.ConstraintViolationSummary; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.ComparableBytes; import org.apache.accumulo.server.conf.TableConfiguration; import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader; import org.slf4j.Logger; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java index ed2ce060a70..851269002f7 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java @@ -44,8 +44,8 @@ import org.apache.accumulo.core.client.Durability; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.security.crypto.CryptoModule; import org.apache.accumulo.core.security.crypto.CryptoModuleFactory; import org.apache.accumulo.core.security.crypto.CryptoModuleParameters; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/SortedLogRecovery.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/SortedLogRecovery.java index c4d9fabdc4e..37882cdf934 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/SortedLogRecovery.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/SortedLogRecovery.java @@ -28,8 +28,8 @@ import java.util.List; import java.util.Set; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.tserver.logger.LogFileKey; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java index ec5fa38d911..1d385d919ec 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/TabletServerLogger.java @@ -33,8 +33,8 @@ import java.util.concurrent.locks.ReentrantReadWriteLock; import org.apache.accumulo.core.client.Durability; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.protobuf.ProtobufUtil; import org.apache.accumulo.core.replication.ReplicationConfigurationUtil; import org.apache.accumulo.core.util.UtilWaitThread; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogFileKey.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogFileKey.java index 1959ffb0c06..42f9d76b43a 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogFileKey.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogFileKey.java @@ -25,7 +25,7 @@ import java.io.DataOutput; import java.io.IOException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.WritableComparable; public class LogFileKey implements WritableComparable { diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java index 09bc705d5ce..6ceba5aa47c 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/logger/LogReader.java @@ -30,8 +30,8 @@ import org.apache.accumulo.core.cli.Help; import org.apache.accumulo.core.conf.SiteConfiguration; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.fs.VolumeManagerImpl; import org.apache.accumulo.tserver.log.DfsLogger; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/SplitReportMessage.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/SplitReportMessage.java index cd68e361b6a..372209fa945 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/SplitReportMessage.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/SplitReportMessage.java @@ -22,7 +22,7 @@ import org.apache.accumulo.core.client.impl.Translator; import org.apache.accumulo.core.client.impl.Translators; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.master.thrift.TabletSplit; import org.apache.accumulo.core.security.thrift.TCredentials; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/TabletStatusMessage.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/TabletStatusMessage.java index d40e514e0c8..50d10784407 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/TabletStatusMessage.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/mastermessage/TabletStatusMessage.java @@ -17,7 +17,7 @@ package org.apache.accumulo.tserver.mastermessage; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.thrift.MasterClientService.Iface; import org.apache.accumulo.core.master.thrift.TabletLoadState; import org.apache.accumulo.core.security.thrift.TCredentials; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java index d18e4348084..be682102884 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystem.java @@ -38,6 +38,7 @@ import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.ClientExecReturn; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.ReplicationClient; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; @@ -53,7 +54,6 @@ import org.apache.accumulo.core.replication.thrift.ReplicationServicer; import org.apache.accumulo.core.replication.thrift.ReplicationServicer.Client; import org.apache.accumulo.core.replication.thrift.WalEdits; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.trace.ProbabilitySampler; import org.apache.accumulo.core.trace.Span; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java index 85b71b175e2..08597f4a31c 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/scan/LookupTask.java @@ -29,8 +29,8 @@ import org.apache.accumulo.core.client.impl.Translators; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.MultiScanResult; import org.apache.accumulo.core.data.thrift.TKey; import org.apache.accumulo.core.data.thrift.TKeyExtent; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/MultiScanSession.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/MultiScanSession.java index b91c9e6633c..b326e10e61c 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/MultiScanSession.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/MultiScanSession.java @@ -21,8 +21,8 @@ import java.util.Map; import org.apache.accumulo.core.data.Column; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.data.thrift.MultiScanResult; import org.apache.accumulo.core.security.Authorizations; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/ScanSession.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/ScanSession.java index f4d72a08963..d5b00273a12 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/ScanSession.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/ScanSession.java @@ -22,7 +22,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.accumulo.core.data.Column; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.thrift.TCredentials; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/UpdateSession.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/UpdateSession.java index 08930ac5cd1..4a9b265e83a 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/UpdateSession.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/UpdateSession.java @@ -23,8 +23,8 @@ import org.apache.accumulo.core.client.Durability; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.constraints.Violations; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.security.thrift.TCredentials; import org.apache.accumulo.core.util.MapCounter; import org.apache.accumulo.core.util.Stat; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java index b4814e42732..d908f1d8b93 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CommitSession.java @@ -19,8 +19,8 @@ import java.util.ArrayList; import java.util.List; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.tserver.InMemoryMap; import org.apache.accumulo.tserver.log.DfsLogger; import org.slf4j.Logger; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionInfo.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionInfo.java index 2023d2c03d6..c7ca29d3538 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionInfo.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/CompactionInfo.java @@ -22,7 +22,7 @@ import java.util.Map; import org.apache.accumulo.core.client.IteratorSetting; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.tabletserver.thrift.ActiveCompaction; import org.apache.accumulo.core.tabletserver.thrift.CompactionReason; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java index 7dd819b681f..0a8a9e35946 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Compactor.java @@ -35,8 +35,8 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.file.FileSKVWriter; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java index 594d9c5d705..db1b418366a 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/DatafileManager.java @@ -31,7 +31,7 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.core.replication.ReplicationConfigurationUtil; import org.apache.accumulo.core.trace.Span; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java index fd7537dd13c..1f4625b5cd3 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java @@ -57,10 +57,10 @@ import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.ColumnUpdate; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.data.thrift.MapFileInfo; import org.apache.accumulo.core.file.FileOperations; diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletCommitter.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletCommitter.java index 3f1af829643..c7e3a667b15 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletCommitter.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/TabletCommitter.java @@ -20,8 +20,8 @@ import java.util.List; import org.apache.accumulo.core.client.Durability; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.conf.TableConfiguration; import org.apache.accumulo.tserver.InMemoryMap; import org.apache.accumulo.tserver.log.DfsLogger; diff --git a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java index e17281a0728..7c15cfceda3 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java @@ -25,7 +25,7 @@ import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.DefaultConfiguration; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.conf.NamespaceConfiguration; import org.apache.accumulo.server.conf.ServerConfiguration; import org.apache.accumulo.server.conf.ServerConfigurationFactory; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java index 6ce893c51bb..b809a35e20d 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/AssignmentWatcherTest.java @@ -21,7 +21,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.util.time.SimpleTimer; import org.apache.accumulo.tserver.TabletServerResourceManager.AssignmentWatcher; import org.apache.hadoop.io.Text; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java index 54be3958bf5..8c00ece0761 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/CheckTabletMetadataTest.java @@ -20,8 +20,8 @@ import java.util.TreeMap; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.util.ColumnFQ; import org.apache.accumulo.server.master.state.TServerInstance; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/TabletResourceManagerTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/TabletResourceManagerTest.java index baa6f7b3643..e34ba1a935b 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/TabletResourceManagerTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/TabletResourceManagerTest.java @@ -19,7 +19,7 @@ import static org.easymock.EasyMock.createMock; import static org.junit.Assert.assertEquals; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.conf.TableConfiguration; import org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager; import org.junit.Before; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java index 6414a0317f1..55226fbca11 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/DefaultCompactionStrategyTest.java @@ -33,9 +33,9 @@ import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.FileSKVIterator; import org.apache.accumulo.core.file.NoSuchMetaStoreException; import org.apache.accumulo.core.iterators.IteratorEnvironment; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java index ed75a607d3f..e5cdd7247ee 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/SizeLimitCompactionStrategyTest.java @@ -22,7 +22,7 @@ import java.util.Map; import org.apache.accumulo.core.conf.AccumuloConfiguration; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.server.fs.FileRef; import org.apache.hadoop.io.Text; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java index a896537b3fe..62962db103e 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/compaction/strategies/ConfigurableCompactionStrategyTest.java @@ -22,7 +22,7 @@ import org.apache.accumulo.core.compaction.CompactionSettings; import org.apache.accumulo.core.conf.AccumuloConfiguration; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.schema.DataFileValue; import org.apache.accumulo.server.fs.FileRef; import org.apache.accumulo.tserver.compaction.CompactionPlan; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java index dd09f69dd38..ec30da4d6d9 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/constraints/ConstraintCheckerTest.java @@ -31,8 +31,8 @@ import org.apache.accumulo.core.constraints.Constraint; import org.apache.accumulo.core.constraints.Constraint.Environment; import org.apache.accumulo.core.data.ConstraintViolationSummary; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.hadoop.io.BinaryComparable; import org.junit.Before; import org.junit.Test; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java index f842a6892e4..b47b376521b 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/log/SortedLogRecoveryTest.java @@ -35,9 +35,9 @@ import java.util.Set; import java.util.TreeMap; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.data.ServerMutation; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.fs.VolumeManagerImpl; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/logger/LogFileTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/logger/LogFileTest.java index cf2266f9f14..06fe1d5c168 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/logger/LogFileTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/logger/LogFileTest.java @@ -28,9 +28,9 @@ import java.io.IOException; import java.util.Arrays; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.accumulo.server.data.ServerMutation; import org.apache.hadoop.io.DataInputBuffer; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystemTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystemTest.java index e504dc0c517..76c8bdfc093 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystemTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/AccumuloReplicaSystemTest.java @@ -39,9 +39,9 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.replication.ReplicationTarget; import org.apache.accumulo.core.replication.thrift.ReplicationServicer.Client; import org.apache.accumulo.core.replication.thrift.WalEdits; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/ReplicationProcessorTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/ReplicationProcessorTest.java index 0c444b98983..3ac5f2f4b54 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/ReplicationProcessorTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/ReplicationProcessorTest.java @@ -24,11 +24,11 @@ import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.ConfigurationCopy; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.replication.ReplicationTarget; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.fs.VolumeManager; import org.apache.accumulo.server.replication.DistributedWorkQueueWorkAssignerHelper; import org.apache.accumulo.server.replication.ReplicaSystem; diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/TabletTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/TabletTest.java index 930d432bc68..4b1ff9ad7f6 100644 --- a/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/TabletTest.java +++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/tablet/TabletTest.java @@ -21,7 +21,7 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationObserver; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.server.conf.TableConfiguration; import org.apache.accumulo.server.tablets.TabletTime; import org.apache.accumulo.tserver.TabletServer; diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java index c3722464e0c..bd039b02ba6 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveCompactionIterator.java @@ -89,7 +89,7 @@ public int compare(ActiveCompaction o1, ActiveCompaction o2) { compactions.add(String.format("%21s | %9s | %5s | %6s | %5s | %5s | %15s | %-40s | %5s | %35s | %9s | %s", tserver, Duration.format(ac.getAge(), "", "-"), ac.getType(), ac.getReason(), shortenCount(ac.getEntriesRead()), shortenCount(ac.getEntriesWritten()), - ac.getTable(), ac.getExtent(), ac.getInputFiles().size(), output, iterList, iterOpts)); + ac.getTable(), ac.getTablet(), ac.getInputFiles().size(), output, iterList, iterOpts)); } } catch (Exception e) { compactions.add(tserver + " ERROR " + e.getMessage()); diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java index 498eb2fe148..d446534211c 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ActiveScanIterator.java @@ -45,7 +45,7 @@ private void readNext() { scans .add(String.format("%21s |%21s |%9s |%9s |%7s |%6s |%8s |%8s |%10s |%20s |%10s |%10s | %s", tserver, as.getClient(), Duration.format(as.getAge(), "", "-"), Duration.format(as.getLastContactTime(), "", "-"), as.getState(), as.getType(), as.getUser(), - as.getTable(), as.getColumns(), as.getAuthorizations(), (as.getType() == ScanType.SINGLE ? as.getExtent() : "N/A"), as.getSsiList(), + as.getTable(), as.getColumns(), as.getAuthorizations(), (as.getType() == ScanType.SINGLE ? as.getTablet() : "N/A"), as.getSsiList(), as.getSsio())); } } catch (Exception e) { diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java index 48e9f7406d7..b0aca9262e2 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/CreateTableCommand.java @@ -32,8 +32,8 @@ import org.apache.accumulo.core.client.admin.TimeType; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.constraints.VisibilityConstraint; import org.apache.accumulo.core.iterators.IteratorUtil; -import org.apache.accumulo.core.security.VisibilityConstraint; import org.apache.accumulo.shell.Shell; import org.apache.accumulo.shell.Shell.Command; import org.apache.accumulo.shell.ShellUtil; diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java index d780aee5af6..9d82269f9ae 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/GetSplitsCommand.java @@ -27,9 +27,9 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java index 05037d54d42..71e38557250 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/InsertCommand.java @@ -32,8 +32,8 @@ import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.data.ConstraintViolationSummary; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.TabletID; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException; @@ -107,10 +107,10 @@ public int execute(final String fullCommand, final CommandLine cl, final Shell s bw.close(); } catch (MutationsRejectedException e) { final ArrayList lines = new ArrayList(); - if (e.getAuthorizationFailuresMap().isEmpty() == false) { + if (e.getSecurityErrorCodes().isEmpty() == false) { lines.add("\tAuthorization Failures:"); } - for (Entry> entry : e.getAuthorizationFailuresMap().entrySet()) { + for (Entry> entry : e.getSecurityErrorCodes().entrySet()) { lines.add("\t\t" + entry); } if (e.getConstraintViolationSummaries().isEmpty() == false) { diff --git a/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java b/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java index 713f3ae11ed..dd58cc8af43 100644 --- a/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java +++ b/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java @@ -32,9 +32,9 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.security.Authorizations; diff --git a/test/src/main/java/org/apache/accumulo/test/TestIngest.java b/test/src/main/java/org/apache/accumulo/test/TestIngest.java index d4346de084f..a18f61020bd 100644 --- a/test/src/main/java/org/apache/accumulo/test/TestIngest.java +++ b/test/src/main/java/org/apache/accumulo/test/TestIngest.java @@ -38,8 +38,8 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.data.ConstraintViolationSummary; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.TabletID; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVWriter; @@ -312,8 +312,8 @@ public static void ingest(Connector connector, Opts opts, BatchWriterOpts bwOpts try { bw.close(); } catch (MutationsRejectedException e) { - if (e.getAuthorizationFailuresMap().size() > 0) { - for (Entry> entry : e.getAuthorizationFailuresMap().entrySet()) { + if (e.getSecurityErrorCodes().size() > 0) { + for (Entry> entry : e.getSecurityErrorCodes().entrySet()) { System.err.println("ERROR : Not authorized to write to : " + entry.getKey() + " due to " + entry.getValue()); } } diff --git a/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java b/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java index 0cbc871bfdd..6a01e8cb117 100644 --- a/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java +++ b/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java @@ -19,10 +19,10 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.ClientContext; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.rpc.ThriftUtil; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.tabletserver.thrift.TDurability; import org.apache.accumulo.core.tabletserver.thrift.TabletClientService; import org.apache.accumulo.core.trace.Tracer; diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java index d06df4c3f87..cf4e3c1b4c0 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java @@ -27,11 +27,12 @@ import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.iterators.ColumnFamilyCounter; import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; @@ -39,7 +40,6 @@ import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.CachedConfiguration; import org.apache.accumulo.core.util.Stat; diff --git a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java index a61182909f4..34308aea2a9 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java @@ -36,10 +36,10 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; diff --git a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java index 00ff6cf1ca3..97fbf5933fd 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java @@ -38,15 +38,16 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.data.ArrayByteSequence; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Column; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.IterInfo; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVIterator; @@ -61,7 +62,6 @@ import org.apache.accumulo.core.iterators.system.VisibilityFilter; import org.apache.accumulo.core.metadata.MetadataServicer; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.Stat; import org.apache.accumulo.server.cli.ClientOnRequiredTable; import org.apache.accumulo.server.conf.ServerConfigurationFactory; diff --git a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java index b42960751ad..d0de29feacc 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java @@ -31,8 +31,8 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Range; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.data.thrift.InitialMultiScan; import org.apache.accumulo.core.data.thrift.InitialScan; import org.apache.accumulo.core.data.thrift.IterInfo; diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java index 8befe8aa376..c43ca6cbb61 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/AlterTablePerm.java @@ -22,8 +22,8 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.test.randomwalk.Environment; import org.apache.accumulo.test.randomwalk.State; diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java index bceeaebea57..abc5d0117fa 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/Authenticate.java @@ -22,9 +22,9 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.test.randomwalk.Environment; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java index 28414c2744c..e8561bbbe75 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/ChangePass.java @@ -22,9 +22,9 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.test.randomwalk.Environment; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java index a0bff7ad327..f10bef11846 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/DropTable.java @@ -23,9 +23,9 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.test.randomwalk.Environment; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java index e80e4757bb9..97ce6ed6fc4 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/SetAuths.java @@ -22,9 +22,9 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.test.randomwalk.Environment; import org.apache.accumulo.test.randomwalk.State; import org.apache.accumulo.test.randomwalk.Test; diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java index 6c9775114dc..457b4787019 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java @@ -29,12 +29,12 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.NamespacePermission; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java index 8c907ae8a1a..5de5cf7d2bd 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/sequential/MapRedVerifyTool.java @@ -26,7 +26,7 @@ import org.apache.accumulo.core.client.admin.DelegationTokenConfig; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; +import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Key; @@ -125,7 +125,7 @@ public int run(String[] args) throws Exception { } // Fetch a delegation token from Accumulo - DelegationToken dt = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); + AuthenticationToken dt = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); // Set the delegation token instead of the kerberos token AccumuloInputFormat.setConnectorInfo(job, newPrincipal, dt); diff --git a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java b/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java index 5e85ddbc394..00c5f516eb5 100644 --- a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java +++ b/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java @@ -28,6 +28,7 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; @@ -36,7 +37,6 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.server.client.HdfsZooInstance; import org.apache.accumulo.test.functional.ConfigurableMacIT; import org.junit.Test; diff --git a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java index d95e0cdb4b2..deb7a1cceeb 100644 --- a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java +++ b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java @@ -28,14 +28,14 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.replication.ReplicationTable; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.fate.util.UtilWaitThread; import org.apache.accumulo.minicluster.ServerType; diff --git a/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java b/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java index ab7e125e275..dbc10af0878 100644 --- a/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java +++ b/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java @@ -18,11 +18,11 @@ package org.apache.accumulo.test; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Writer; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.core.tabletserver.thrift.ConstraintViolationException; import org.apache.accumulo.harness.AccumuloClusterIT; diff --git a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java index d4d0f8a8ebc..5e99f6e5c69 100644 --- a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java +++ b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java @@ -34,13 +34,13 @@ import org.apache.accumulo.core.client.TableOfflineException; import org.apache.accumulo.core.client.admin.TableOperations; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MultiTableBatchWriterImpl; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.harness.AccumuloClusterIT; import org.junit.Assert; import org.junit.Before; diff --git a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java index f5ae882829e..f29f356aa2a 100644 --- a/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java +++ b/test/src/test/java/org/apache/accumulo/test/NamespacesIT.java @@ -658,9 +658,9 @@ public void testPermissions() throws Exception { bw.close(); fail(); } catch (MutationsRejectedException e) { - assertEquals(1, e.getAuthorizationFailuresMap().size()); - assertEquals(1, e.getAuthorizationFailuresMap().entrySet().iterator().next().getValue().size()); - switch (e.getAuthorizationFailuresMap().entrySet().iterator().next().getValue().iterator().next()) { + assertEquals(1, e.getSecurityErrorCodes().size()); + assertEquals(1, e.getSecurityErrorCodes().entrySet().iterator().next().getValue().size()); + switch (e.getSecurityErrorCodes().entrySet().iterator().next().getValue().iterator().next()) { case PERMISSION_DENIED: break; default: diff --git a/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java index 0f0a7b1526f..e47b20a26ba 100644 --- a/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java +++ b/test/src/test/java/org/apache/accumulo/test/SplitRecoveryIT.java @@ -26,10 +26,10 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection; import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily; diff --git a/test/src/test/java/org/apache/accumulo/test/TransportCachingIT.java b/test/src/test/java/org/apache/accumulo/test/TransportCachingIT.java index fc508435999..5f9d6017d7c 100644 --- a/test/src/test/java/org/apache/accumulo/test/TransportCachingIT.java +++ b/test/src/test/java/org/apache/accumulo/test/TransportCachingIT.java @@ -28,11 +28,11 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.ThriftTransportKey; import org.apache.accumulo.core.client.impl.ThriftTransportPool; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.util.ServerServices; import org.apache.accumulo.core.util.ServerServices.Service; import org.apache.accumulo.core.zookeeper.ZooUtil; diff --git a/test/src/test/java/org/apache/accumulo/test/VolumeIT.java b/test/src/test/java/org/apache/accumulo/test/VolumeIT.java index 2bb165c23cc..d9b9429cdad 100644 --- a/test/src/test/java/org/apache/accumulo/test/VolumeIT.java +++ b/test/src/test/java/org/apache/accumulo/test/VolumeIT.java @@ -49,10 +49,10 @@ import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java b/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java index bc607c3c4a8..0336c2927e3 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/AccumuloInputFormatIT.java @@ -94,7 +94,7 @@ public void testGetSplits() throws Exception { for (ClientProperty prop : sslProperties) { // The default property is returned if it's not in the ClientConfiguration so we don't have to check if the value is actually defined - clientConf.setProperty(prop, clusterClientConf.get(prop.getAccumuloProperty())); + clientConf.setProperty(prop, clusterClientConf.get(prop.getKey())); } } diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java index a2a43e404b0..7b35db4f179 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java @@ -28,6 +28,7 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; @@ -36,7 +37,6 @@ import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.fate.util.UtilWaitThread; import org.apache.accumulo.minicluster.ServerType; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java index 8138ac043b8..b77ce1c16f0 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/BalanceInPresenceOfOfflineTableIT.java @@ -33,13 +33,13 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.master.thrift.MasterClientService; import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; import org.apache.accumulo.core.master.thrift.TableInfo; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.harness.AccumuloClusterIT; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java index 34493b209a0..2425d20b211 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java @@ -25,6 +25,7 @@ import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; @@ -32,7 +33,6 @@ import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.harness.AccumuloClusterIT; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java b/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java index e351c50cb47..2c1dddffbcf 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java @@ -45,7 +45,9 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.CompactionConfig; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; -import org.apache.accumulo.core.client.security.tokens.DelegationToken; +import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; +import org.apache.accumulo.core.client.impl.DelegationTokenImpl; +import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; @@ -55,7 +57,6 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; -import org.apache.accumulo.core.security.AuthenticationTokenIdentifier; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.accumulo.core.security.SystemPermission; @@ -344,9 +345,9 @@ public void testDelegationToken() throws Exception { final int numRows = 100, numColumns = 10; // As the "root" user, open up the connection and get a delegation token - final DelegationToken delegationToken = root.doAs(new PrivilegedExceptionAction() { + final AuthenticationToken delegationToken = root.doAs(new PrivilegedExceptionAction() { @Override - public DelegationToken run() throws Exception { + public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); @@ -395,7 +396,7 @@ public void testDelegationTokenAsDifferentUser() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); - final DelegationToken delegationToken = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); + final AuthenticationToken delegationToken = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); // The above login with keytab doesn't have a way to logout, so make a fake user that won't have krb credentials UserGroupInformation userWithoutPrivs = UserGroupInformation.createUserForTesting("fake_user", new String[0]); @@ -448,14 +449,14 @@ public void testRestartedMasterReusesSecretKey() throws Exception { log.info("Logged in as {}", rootUser.getPrincipal()); // As the "root" user, open up the connection and get a delegation token - final DelegationToken delegationToken1 = root.doAs(new PrivilegedExceptionAction() { + final AuthenticationToken delegationToken1 = root.doAs(new PrivilegedExceptionAction() { @Override - public DelegationToken run() throws Exception { + public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); - DelegationToken token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); + AuthenticationToken token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); assertTrue("Could not get tables with delegation token", mac.getConnector(rootUser.getPrincipal(), token).tableOperations().list().size() > 0); @@ -482,14 +483,14 @@ public Void run() throws Exception { }); // Get a new token, so we can compare the keyId on the second to the first - final DelegationToken delegationToken2 = root.doAs(new PrivilegedExceptionAction() { + final AuthenticationToken delegationToken2 = root.doAs(new PrivilegedExceptionAction() { @Override - public DelegationToken run() throws Exception { + public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); - DelegationToken token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); + AuthenticationToken token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig()); assertTrue("Could not get tables with delegation token", mac.getConnector(rootUser.getPrincipal(), token).tableOperations().list().size() > 0); @@ -498,7 +499,9 @@ public DelegationToken run() throws Exception { }); // A restarted master should reuse the same secret key after a restart if the secret key hasn't expired (1day by default) - assertEquals(delegationToken1.getIdentifier().getKeyId(), delegationToken2.getIdentifier().getKeyId()); + DelegationTokenImpl dt1 = (DelegationTokenImpl)delegationToken1; + DelegationTokenImpl dt2 = (DelegationTokenImpl)delegationToken2; + assertEquals(dt1.getIdentifier().getKeyId(), dt2.getIdentifier().getKeyId()); } @Test(expected = AccumuloException.class) @@ -509,9 +512,9 @@ public void testDelegationTokenWithInvalidLifetime() throws Throwable { // As the "root" user, open up the connection and get a delegation token try { - root.doAs(new PrivilegedExceptionAction() { + root.doAs(new PrivilegedExceptionAction() { @Override - public DelegationToken run() throws Exception { + public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); @@ -537,9 +540,9 @@ public void testDelegationTokenWithReducedLifetime() throws Throwable { log.info("Logged in as {}", rootUser.getPrincipal()); // As the "root" user, open up the connection and get a delegation token - final DelegationToken dt = root.doAs(new PrivilegedExceptionAction() { + final AuthenticationToken dt = root.doAs(new PrivilegedExceptionAction() { @Override - public DelegationToken run() throws Exception { + public AuthenticationToken run() throws Exception { Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken()); log.info("Created connector as {}", rootUser.getPrincipal()); assertEquals(rootUser.getPrincipal(), conn.whoami()); @@ -548,7 +551,7 @@ public DelegationToken run() throws Exception { } }); - AuthenticationTokenIdentifier identifier = dt.getIdentifier(); + AuthenticationTokenIdentifier identifier = ((DelegationTokenImpl)dt).getIdentifier(); assertTrue("Expected identifier to expire in no more than 5 minutes: " + identifier, identifier.getExpirationDate() - identifier.getIssueDate() <= (5 * 60 * 1000)); } diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java index 92c621c4599..a7cdae5d3f0 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java @@ -26,10 +26,10 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.impl.ClientContext; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; -import org.apache.accumulo.core.security.Credentials; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.fate.util.UtilWaitThread; import org.apache.accumulo.harness.AccumuloClusterIT; import org.apache.accumulo.server.master.state.MetaDataTableScanner; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java index 19977d32279..e6c9a0eeaf5 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java @@ -26,6 +26,7 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; @@ -35,7 +36,6 @@ import org.apache.accumulo.core.master.thrift.TabletServerStatus; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java index 022a3a05e74..4aea354f6d8 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java @@ -596,7 +596,7 @@ private void testMissingTablePermission(Connector test_user_conn, ClusterUser te try { writer.close(); } catch (MutationsRejectedException e1) { - if (e1.getAuthorizationFailuresMap().size() > 0) + if (e1.getSecurityErrorCodes().size() > 0) throw new AccumuloSecurityException(test_user_conn.whoami(), org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.PERMISSION_DENIED, e1); } throw new IllegalStateException("Should NOT be able to write to a table"); diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java index 8b140e78643..1ad363b395a 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java @@ -26,6 +26,7 @@ import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.impl.ClientContext; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; @@ -33,7 +34,6 @@ import org.apache.accumulo.core.master.thrift.MasterMonitorInfo; import org.apache.accumulo.core.master.thrift.TableInfo; import org.apache.accumulo.core.master.thrift.TabletServerStatus; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.minicluster.MemoryUnit; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java index 93a4f69d33c..8e7e2b5c528 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java @@ -34,8 +34,8 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.security.Authorizations; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java index 7439e23a73a..0b0e3306141 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java @@ -35,9 +35,9 @@ import org.apache.accumulo.core.client.impl.ScannerImpl; import org.apache.accumulo.core.client.impl.Writer; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.file.rfile.RFile; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.DataFileValue; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java b/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java index ded599e71b3..a1c7fc2663e 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/TableIT.java @@ -30,7 +30,7 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.TableOperations; -import org.apache.accumulo.core.data.KeyExtent; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.security.Authorizations; diff --git a/test/src/test/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java index a0d6008b993..2e49708ef6e 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/TabletStateChangeIteratorIT.java @@ -36,8 +36,8 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.master.state.tables.TableState; import org.apache.accumulo.core.master.thrift.MasterState; import org.apache.accumulo.core.metadata.MetadataTable; diff --git a/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java b/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java index 5b89d9c2ed6..75f61f179cd 100644 --- a/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java +++ b/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java @@ -28,6 +28,7 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.impl.ClientContext; import org.apache.accumulo.core.client.impl.ClientExecReturn; +import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.MasterClient; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; @@ -42,7 +43,6 @@ import org.apache.accumulo.core.replication.ReplicationTable; import org.apache.accumulo.core.rpc.ThriftUtil; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.core.security.Credentials; import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client; import org.apache.accumulo.core.trace.Tracer; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; diff --git a/test/src/test/java/org/apache/accumulo/test/replication/UnusedWalDoesntCloseReplicationStatusIT.java b/test/src/test/java/org/apache/accumulo/test/replication/UnusedWalDoesntCloseReplicationStatusIT.java index f8626aa56ad..bdd5db5c86a 100644 --- a/test/src/test/java/org/apache/accumulo/test/replication/UnusedWalDoesntCloseReplicationStatusIT.java +++ b/test/src/test/java/org/apache/accumulo/test/replication/UnusedWalDoesntCloseReplicationStatusIT.java @@ -32,9 +32,9 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; -import org.apache.accumulo.core.data.KeyExtent; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.core.data.impl.KeyExtent; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.protobuf.ProtobufUtil; From 8c046ba463d778d5bf70f04892e27fb6e5601237 Mon Sep 17 00:00:00 2001 From: Keith Turner Date: Tue, 21 Apr 2015 17:30:48 -0400 Subject: [PATCH 3/3] ACCUMULO-3602 ACCUMULO-3657 Minimize AccumuloInputSplit in API --- .../client/mapred/AbstractInputFormat.java | 58 ++++++++------- .../client/mapreduce/AbstractInputFormat.java | 56 +++++++------- .../client/mapreduce/RangeInputSplit.java | 24 ++---- .../mapreduce/impl/AccumuloInputSplit.java | 73 ++++++++----------- .../mapreduce/impl/BatchInputSplit.java | 21 ++---- .../client/mapreduce/impl/SplitUtils.java | 59 +++++++++++++++ 6 files changed, 162 insertions(+), 129 deletions(-) create mode 100644 core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java index b97d4deca9a..f2e3a79c599 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java @@ -29,18 +29,18 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.ClientSideIteratorScanner; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.IsolatedScanner; +import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.Scanner; -import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.ScannerBase; import org.apache.accumulo.core.client.TableDeletedException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TableOfflineException; -import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.admin.DelegationTokenConfig; import org.apache.accumulo.core.client.admin.SecurityOperations; import org.apache.accumulo.core.client.impl.AuthenticationTokenIdentifier; @@ -54,6 +54,7 @@ import org.apache.accumulo.core.client.mapred.impl.BatchInputSplit; import org.apache.accumulo.core.client.mapreduce.InputTableConfig; import org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit; +import org.apache.accumulo.core.client.mapreduce.impl.SplitUtils; import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase; import org.apache.accumulo.core.client.mapreduce.lib.impl.InputConfigurator; import org.apache.accumulo.core.client.mock.MockInstance; @@ -394,7 +395,8 @@ public static InputTableConfig getInputTableConfig(JobConf job, String tableName protected abstract static class AbstractRecordReader implements RecordReader { protected long numKeysRead; protected Iterator> scannerIterator; - protected org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit split; + protected RangeInputSplit split; + private org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit aiSplit; protected ScannerBase scannerBase; @@ -458,42 +460,42 @@ protected void setupIterators(JobConf job, Scanner scanner, String tableName, Ra * Initialize a scanner over the given input split using this task attempt configuration. */ public void initialize(InputSplit inSplit, JobConf job) throws IOException { - split = (AccumuloInputSplit) inSplit; - log.debug("Initializing input split: " + split.toString()); + aiSplit = (AccumuloInputSplit) inSplit; + log.debug("Initializing input split: " + aiSplit.toString()); - Instance instance = split.getInstance(getClientConfiguration(job)); + Instance instance = aiSplit.getInstance(getClientConfiguration(job)); if (null == instance) { instance = getInstance(job); } - String principal = split.getPrincipal(); + String principal = aiSplit.getPrincipal(); if (null == principal) { principal = getPrincipal(job); } - AuthenticationToken token = split.getToken(); + AuthenticationToken token = aiSplit.getToken(); if (null == token) { token = getAuthenticationToken(job); } - Authorizations authorizations = split.getAuths(); + Authorizations authorizations = aiSplit.getAuths(); if (null == authorizations) { authorizations = getScanAuthorizations(job); } - String table = split.getTableName(); + String table = aiSplit.getTableName(); // in case the table name changed, we can still use the previous name for terms of configuration, // but the scanner will use the table id resolved at job setup time - InputTableConfig tableConfig = getInputTableConfig(job, split.getTableName()); + InputTableConfig tableConfig = getInputTableConfig(job, aiSplit.getTableName()); log.debug("Creating connector with user: " + principal); log.debug("Creating scanner for table: " + table); log.debug("Authorizations are: " + authorizations); - if (split instanceof org.apache.accumulo.core.client.mapreduce.RangeInputSplit) { - org.apache.accumulo.core.client.mapreduce.RangeInputSplit rangeSplit = (org.apache.accumulo.core.client.mapreduce.RangeInputSplit) split; - + if (aiSplit instanceof RangeInputSplit) { + RangeInputSplit rangeSplit = (RangeInputSplit) aiSplit; + split = rangeSplit; Boolean isOffline = rangeSplit.isOffline(); if (null == isOffline) { isOffline = tableConfig.isOfflineScan(); @@ -513,13 +515,13 @@ public void initialize(InputSplit inSplit, JobConf job) throws IOException { try { if (isOffline) { - scanner = new OfflineScanner(instance, new Credentials(principal, token), split.getTableId(), authorizations); + scanner = new OfflineScanner(instance, new Credentials(principal, token), aiSplit.getTableId(), authorizations); } else if (instance instanceof MockInstance) { - scanner = instance.getConnector(principal, token).createScanner(split.getTableName(), authorizations); + scanner = instance.getConnector(principal, token).createScanner(aiSplit.getTableName(), authorizations); } else { ClientConfiguration clientConf = getClientConfiguration(job); ClientContext context = new ClientContext(instance, new Credentials(principal, token), clientConf); - scanner = new ScannerImpl(context, split.getTableId(), authorizations); + scanner = new ScannerImpl(context, aiSplit.getTableId(), authorizations); } if (isIsolated) { log.info("Creating isolated scanner"); @@ -529,7 +531,7 @@ public void initialize(InputSplit inSplit, JobConf job) throws IOException { log.info("Using local iterators"); scanner = new ClientSideIteratorScanner(scanner); } - setupIterators(job, scanner, split.getTableName(), split); + setupIterators(job, scanner, aiSplit.getTableName(), aiSplit); } catch (Exception e) { throw new IOException(e); } @@ -537,15 +539,15 @@ public void initialize(InputSplit inSplit, JobConf job) throws IOException { scanner.setRange(rangeSplit.getRange()); scannerBase = scanner; - } else if (split instanceof BatchInputSplit) { + } else if (aiSplit instanceof BatchInputSplit) { BatchScanner scanner; - BatchInputSplit multiRangeSplit = (BatchInputSplit) split; + BatchInputSplit multiRangeSplit = (BatchInputSplit) aiSplit; try{ // Note: BatchScanner will use at most one thread per tablet, currently BatchInputSplit will not span tablets int scanThreads = 1; - scanner = instance.getConnector(principal, token).createBatchScanner(split.getTableName(), authorizations, scanThreads); - setupIterators(job, scanner, split.getTableName(), split); + scanner = instance.getConnector(principal, token).createBatchScanner(aiSplit.getTableName(), authorizations, scanThreads); + setupIterators(job, scanner, aiSplit.getTableName(), aiSplit); } catch (Exception e) { throw new IOException(e); } @@ -554,10 +556,10 @@ public void initialize(InputSplit inSplit, JobConf job) throws IOException { scannerBase = scanner; } else { - throw new IllegalArgumentException("Can not initialize from " + split.getClass().toString()); + throw new IllegalArgumentException("Can not initialize from " + aiSplit.getClass().toString()); } - Collection> columns = split.getFetchedColumns(); + Collection> columns = aiSplit.getFetchedColumns(); if (null == columns) { columns = tableConfig.getFetchedColumns(); } @@ -593,7 +595,7 @@ public long getPos() throws IOException { public float getProgress() throws IOException { if (numKeysRead > 0 && currentKey == null) return 1.0f; - return split.getProgress(currentKey); + return aiSplit.getProgress(currentKey); } protected Key currentKey = null; @@ -721,7 +723,7 @@ public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { clippedRanges.add(ke.clip(r)); BatchInputSplit split = new BatchInputSplit(tableName, tableId, clippedRanges, new String[] {location}); - AccumuloInputSplit.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); + SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); splits.add(split); } else { @@ -730,7 +732,7 @@ public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { if (autoAdjust) { // divide ranges into smaller ranges, based on the tablets RangeInputSplit split = new RangeInputSplit(tableName, tableId, ke.clip(r), new String[] {location}); - AccumuloInputSplit.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); + SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); split.setOffline(tableConfig.isOfflineScan()); split.setIsolatedScan(tableConfig.shouldUseIsolatedScanners()); split.setUsesLocalIterators(tableConfig.shouldUseLocalIterators()); @@ -752,7 +754,7 @@ public InputSplit[] getSplits(JobConf job, int numSplits) throws IOException { if (!autoAdjust) for (Map.Entry> entry : splitsToAdd.entrySet()) { RangeInputSplit split = new RangeInputSplit(tableName, tableId, entry.getKey(), entry.getValue().toArray(new String[0])); - AccumuloInputSplit.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); + SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); split.setOffline(tableConfig.isOfflineScan()); split.setIsolatedScan(tableConfig.shouldUseIsolatedScanners()); split.setUsesLocalIterators(tableConfig.shouldUseLocalIterators()); diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java index c7a304cbd97..d402bb01c69 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java @@ -29,13 +29,14 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.ClientSideIteratorScanner; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.IsolatedScanner; +import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.Scanner; -import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.ScannerBase; import org.apache.accumulo.core.client.TableDeletedException; import org.apache.accumulo.core.client.TableNotFoundException; @@ -52,6 +53,7 @@ import org.apache.accumulo.core.client.impl.TabletLocator; import org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit; import org.apache.accumulo.core.client.mapreduce.impl.BatchInputSplit; +import org.apache.accumulo.core.client.mapreduce.impl.SplitUtils; import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase; import org.apache.accumulo.core.client.mapreduce.lib.impl.InputConfigurator; import org.apache.accumulo.core.client.mock.MockInstance; @@ -67,7 +69,6 @@ import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.util.Pair; import org.apache.accumulo.core.util.UtilWaitThread; -import org.apache.accumulo.core.client.IteratorSetting; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.InputFormat; @@ -425,7 +426,8 @@ protected abstract static class AbstractRecordReader extends RecordReader> scannerIterator; protected ScannerBase scannerBase; - protected AccumuloInputSplit split; + protected RangeInputSplit split; + private AccumuloInputSplit aiSplit; /** * Extracts Iterators settings from the context to be used by RecordReader. @@ -489,41 +491,42 @@ protected void setupIterators(TaskAttemptContext context, Scanner scanner, Strin @Override public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IOException { - split = (AccumuloInputSplit) inSplit; - log.debug("Initializing input split: " + split.toString()); + aiSplit = (AccumuloInputSplit) inSplit; + log.debug("Initializing input split: " + aiSplit.toString()); - Instance instance = split.getInstance(getClientConfiguration(attempt)); + Instance instance = aiSplit.getInstance(getClientConfiguration(attempt)); if (null == instance) { instance = getInstance(attempt); } - String principal = split.getPrincipal(); + String principal = aiSplit.getPrincipal(); if (null == principal) { principal = getPrincipal(attempt); } - AuthenticationToken token = split.getToken(); + AuthenticationToken token = aiSplit.getToken(); if (null == token) { token = getAuthenticationToken(attempt); } - Authorizations authorizations = split.getAuths(); + Authorizations authorizations = aiSplit.getAuths(); if (null == authorizations) { authorizations = getScanAuthorizations(attempt); } - String table = split.getTableName(); + String table = aiSplit.getTableName(); // in case the table name changed, we can still use the previous name for terms of configuration, // but the scanner will use the table id resolved at job setup time - InputTableConfig tableConfig = getInputTableConfig(attempt, split.getTableName()); + InputTableConfig tableConfig = getInputTableConfig(attempt, aiSplit.getTableName()); log.debug("Creating connector with user: " + principal); log.debug("Creating scanner for table: " + table); log.debug("Authorizations are: " + authorizations); - if (split instanceof RangeInputSplit) { - RangeInputSplit rangeSplit = (RangeInputSplit) split; + if (aiSplit instanceof RangeInputSplit) { + RangeInputSplit rangeSplit = (RangeInputSplit) aiSplit; + split = rangeSplit; Scanner scanner; Boolean isOffline = rangeSplit.isOffline(); @@ -543,13 +546,13 @@ public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IO try { if (isOffline) { - scanner = new OfflineScanner(instance, new Credentials(principal, token), split.getTableId(), authorizations); + scanner = new OfflineScanner(instance, new Credentials(principal, token), aiSplit.getTableId(), authorizations); } else if (instance instanceof MockInstance) { - scanner = instance.getConnector(principal, token).createScanner(split.getTableName(), authorizations); + scanner = instance.getConnector(principal, token).createScanner(aiSplit.getTableName(), authorizations); } else { ClientConfiguration clientConf = getClientConfiguration(attempt); ClientContext context = new ClientContext(instance, new Credentials(principal, token), clientConf); - scanner = new ScannerImpl(context, split.getTableId(), authorizations); + scanner = new ScannerImpl(context, aiSplit.getTableId(), authorizations); } if (isIsolated) { log.info("Creating isolated scanner"); @@ -560,7 +563,7 @@ public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IO scanner = new ClientSideIteratorScanner(scanner); } - setupIterators(attempt, scanner, split.getTableName(), split); + setupIterators(attempt, scanner, aiSplit.getTableName(), aiSplit); } catch (Exception e) { throw new IOException(e); } @@ -568,16 +571,17 @@ public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IO scanner.setRange(rangeSplit.getRange()); scannerBase = scanner; - } else if (split instanceof BatchInputSplit) { - BatchInputSplit batchSplit = (BatchInputSplit) split; + } else if (aiSplit instanceof BatchInputSplit) { + BatchInputSplit batchSplit = (BatchInputSplit) aiSplit; BatchScanner scanner; try{ // Note: BatchScanner will use at most one thread per tablet, currently BatchInputSplit will not span tablets int scanThreads = 1; - scanner = instance.getConnector(principal, token).createBatchScanner(split.getTableName(), authorizations, scanThreads); - setupIterators(attempt, scanner, split.getTableName(), split); + scanner = instance.getConnector(principal, token).createBatchScanner(aiSplit.getTableName(), authorizations, scanThreads); + setupIterators(attempt, scanner, aiSplit.getTableName(), aiSplit); } catch (Exception e) { + e.printStackTrace(); throw new IOException(e); } @@ -585,7 +589,7 @@ public void initialize(InputSplit inSplit, TaskAttemptContext attempt) throws IO scannerBase = scanner; } - Collection> columns = split.getFetchedColumns(); + Collection> columns = aiSplit.getFetchedColumns(); if (null == columns) { columns = tableConfig.getFetchedColumns(); } @@ -616,7 +620,7 @@ public void close() { public float getProgress() throws IOException { if (numKeysRead > 0 && currentKey == null) return 1.0f; - return split.getProgress(currentKey); + return aiSplit.getProgress(currentKey); } /** @@ -767,7 +771,7 @@ public List getSplits(JobContext context) throws IOException { for(Range r: extentRanges.getValue()) clippedRanges.add(ke.clip(r)); BatchInputSplit split = new BatchInputSplit(tableName, tableId, clippedRanges, new String[] {location}); - AccumuloInputSplit.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); + SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); splits.add(split); } else { @@ -776,7 +780,7 @@ public List getSplits(JobContext context) throws IOException { if (autoAdjust) { // divide ranges into smaller ranges, based on the tablets RangeInputSplit split = new RangeInputSplit(tableName, tableId, ke.clip(r), new String[] {location}); - AccumuloInputSplit.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); + SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); split.setOffline(tableConfig.isOfflineScan()); split.setIsolatedScan(tableConfig.shouldUseIsolatedScanners()); split.setUsesLocalIterators(tableConfig.shouldUseLocalIterators()); @@ -798,7 +802,7 @@ public List getSplits(JobContext context) throws IOException { if (!autoAdjust) for (Map.Entry> entry : splitsToAdd.entrySet()) { RangeInputSplit split = new RangeInputSplit(tableName, tableId, entry.getKey(), entry.getValue().toArray(new String[0])); - AccumuloInputSplit.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); + SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel); split.setOffline(tableConfig.isOfflineScan()); split.setIsolatedScan(tableConfig.shouldUseIsolatedScanners()); split.setUsesLocalIterators(tableConfig.shouldUseLocalIterators()); diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java index 6c870a0e017..985119206c4 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java @@ -19,9 +19,9 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -import java.util.Arrays; import org.apache.accumulo.core.client.mapreduce.impl.AccumuloInputSplit; +import org.apache.accumulo.core.client.mapreduce.impl.SplitUtils; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; @@ -47,6 +47,7 @@ protected RangeInputSplit(String table, String tableId, Range range, String[] lo this.range = range; } + @Override public float getProgress(Key currentKey) { if (currentKey == null) return 0f; @@ -55,13 +56,13 @@ public float getProgress(Key currentKey) { if (range.getStartKey() != null && range.getEndKey() != null) { if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW) != 0) { // just look at the row progress - return getProgress(range.getStartKey().getRowData(), range.getEndKey().getRowData(), currentKey.getRowData()); + return SplitUtils.getProgress(range.getStartKey().getRowData(), range.getEndKey().getRowData(), currentKey.getRowData()); } else if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW_COLFAM) != 0) { // just look at the column family progress - return getProgress(range.getStartKey().getColumnFamilyData(), range.getEndKey().getColumnFamilyData(), currentKey.getColumnFamilyData()); + return SplitUtils.getProgress(range.getStartKey().getColumnFamilyData(), range.getEndKey().getColumnFamilyData(), currentKey.getColumnFamilyData()); } else if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW_COLFAM_COLQUAL) != 0) { // just look at the column qualifier progress - return getProgress(range.getStartKey().getColumnQualifierData(), range.getEndKey().getColumnQualifierData(), currentKey.getColumnQualifierData()); + return SplitUtils.getProgress(range.getStartKey().getColumnQualifierData(), range.getEndKey().getColumnQualifierData(), currentKey.getColumnQualifierData()); } } } @@ -124,23 +125,10 @@ public String toString() { StringBuilder sb = new StringBuilder(256); sb.append("RangeInputSplit:"); sb.append(" Range: ").append(range); - sb.append(" Locations: ").append(Arrays.asList(locations)); - sb.append(" Table: ").append(tableName); - sb.append(" TableID: ").append(tableId); - sb.append(" InstanceName: ").append(instanceName); - sb.append(" zooKeepers: ").append(zooKeepers); - sb.append(" principal: ").append(principal); - sb.append(" tokenSource: ").append(tokenSource); - sb.append(" authenticationToken: ").append(token); - sb.append(" authenticationTokenFile: ").append(tokenFile); - sb.append(" Authorizations: ").append(auths); + sb.append(super.toString()); sb.append(" offlineScan: ").append(offline); - sb.append(" mockInstance: ").append(mockInstance); sb.append(" isolatedScan: ").append(isolatedScan); sb.append(" localIterators: ").append(localIterators); - sb.append(" fetchColumns: ").append(fetchedColumns); - sb.append(" iterators: ").append(iterators); - sb.append(" logLevel: ").append(level); return sb.toString(); } diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/AccumuloInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/AccumuloInputSplit.java index 94d00262bf1..7f839367159 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/AccumuloInputSplit.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/AccumuloInputSplit.java @@ -21,7 +21,6 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; -import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -33,18 +32,17 @@ import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.ZooKeeperInstance; -import org.apache.accumulo.core.client.mapreduce.InputTableConfig; import org.apache.accumulo.core.client.mapreduce.lib.impl.ConfiguratorBase.TokenSource; import org.apache.accumulo.core.client.mapreduce.lib.impl.InputConfigurator; import org.apache.accumulo.core.client.mock.MockInstance; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer; import org.apache.accumulo.core.data.ByteSequence; +import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.util.Base64; import org.apache.accumulo.core.util.Pair; -import org.apache.accumulo.core.data.Key; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Writable; import org.apache.hadoop.mapreduce.InputSplit; @@ -58,16 +56,16 @@ * @see org.apache.accumulo.core.client.mapreduce.impl.BatchInputSplit */ public abstract class AccumuloInputSplit extends InputSplit implements Writable { - protected String[] locations; - protected String tableId, tableName, instanceName, zooKeepers, principal; - protected TokenSource tokenSource; - protected String tokenFile; - protected AuthenticationToken token; - protected Boolean mockInstance; - protected Authorizations auths; - protected Set> fetchedColumns; - protected List iterators; - protected Level level; + private String[] locations; + private String tableId, tableName, instanceName, zooKeepers, principal; + private TokenSource tokenSource; + private String tokenFile; + private AuthenticationToken token; + private Boolean mockInstance; + private Authorizations auths; + private Set> fetchedColumns; + private List iterators; + private Level level; public abstract float getProgress(Key currentKey); @@ -89,26 +87,7 @@ protected AccumuloInputSplit(String table, String tableId, String[] locations) { this.tableId = tableId; } - /** - * Central place to set common split configuration not handled by split constructors. - * The intention is to make it harder to miss optional setters in future refactor. - */ - public static void updateSplit(AccumuloInputSplit split, Instance instance, InputTableConfig tableConfig, - String principal, AuthenticationToken token, Authorizations auths, Level logLevel) { - split.setInstanceName(instance.getInstanceName()); - split.setZooKeepers(instance.getZooKeepers()); - split.setMockInstance(instance instanceof MockInstance); - - split.setPrincipal(principal); - split.setToken(token); - split.setAuths(auths); - - split.setFetchedColumns(tableConfig.getFetchedColumns()); - split.setIterators(tableConfig.getIterators()); - split.setLogLevel(logLevel); - } - - private static byte[] extractBytes(ByteSequence seq, int numBytes) { + static byte[] extractBytes(ByteSequence seq, int numBytes) { byte[] bytes = new byte[numBytes + 1]; bytes[0] = 0; for (int i = 0; i < numBytes; i++) { @@ -120,14 +99,6 @@ private static byte[] extractBytes(ByteSequence seq, int numBytes) { return bytes; } - public static float getProgress(ByteSequence start, ByteSequence end, ByteSequence position) { - int maxDepth = Math.min(Math.max(end.length(), start.length()), position.length()); - BigInteger startBI = new BigInteger(extractBytes(start, maxDepth)); - BigInteger endBI = new BigInteger(extractBytes(end, maxDepth)); - BigInteger positionBI = new BigInteger(extractBytes(position, maxDepth)); - return (float) (positionBI.subtract(startBI).doubleValue() / endBI.subtract(startBI).doubleValue()); - } - public long getRangeLength(Range range) throws IOException { Text startRow = range.isInfiniteStartKey() ? new Text(new byte[] {Byte.MIN_VALUE}) : range.getStartKey().getRow(); Text stopRow = range.isInfiniteStopKey() ? new Text(new byte[] {Byte.MAX_VALUE}) : range.getEndKey().getRow(); @@ -442,4 +413,24 @@ public Level getLogLevel() { public void setLogLevel(Level level) { this.level = level; } + + @Override + public String toString(){ + StringBuilder sb = new StringBuilder(256); + sb.append(" Locations: ").append(Arrays.asList(locations)); + sb.append(" Table: ").append(tableName); + sb.append(" TableID: ").append(tableId); + sb.append(" InstanceName: ").append(instanceName); + sb.append(" zooKeepers: ").append(zooKeepers); + sb.append(" principal: ").append(principal); + sb.append(" tokenSource: ").append(tokenSource); + sb.append(" authenticationToken: ").append(token); + sb.append(" authenticationTokenFile: ").append(tokenFile); + sb.append(" Authorizations: ").append(auths); + sb.append(" mockInstance: ").append(mockInstance); + sb.append(" fetchColumns: ").append(fetchedColumns); + sb.append(" iterators: ").append(iterators); + sb.append(" logLevel: ").append(level); + return sb.toString(); + } } diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java index 269622a767c..24b9ef3a9ed 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java @@ -53,6 +53,7 @@ public BatchInputSplit(String table, String tableId, Collection ranges, S /** * Save progress on each call to this function, implied by value of currentKey, and return average ranges in the split */ + @Override public float getProgress(Key currentKey) { if (null == rangeProgress) rangeProgress = new float[ranges.size()]; @@ -70,13 +71,13 @@ public float getProgress(Key currentKey) { if (range.getStartKey() != null && range.getEndKey() != null) { if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW) != 0) { // just look at the row progress - rangeProgress[i] = getProgress(range.getStartKey().getRowData(), range.getEndKey().getRowData(), currentKey.getRowData()); + rangeProgress[i] = SplitUtils.getProgress(range.getStartKey().getRowData(), range.getEndKey().getRowData(), currentKey.getRowData()); } else if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW_COLFAM) != 0) { // just look at the column family progress - rangeProgress[i] = getProgress(range.getStartKey().getColumnFamilyData(), range.getEndKey().getColumnFamilyData(), currentKey.getColumnFamilyData()); + rangeProgress[i] = SplitUtils.getProgress(range.getStartKey().getColumnFamilyData(), range.getEndKey().getColumnFamilyData(), currentKey.getColumnFamilyData()); } else if (range.getStartKey().compareTo(range.getEndKey(), PartialKey.ROW_COLFAM_COLQUAL) != 0) { // just look at the column qualifier progress - rangeProgress[i] = getProgress(range.getStartKey().getColumnQualifierData(), range.getEndKey().getColumnQualifierData(), currentKey.getColumnQualifierData()); + rangeProgress[i] = SplitUtils.getProgress(range.getStartKey().getColumnQualifierData(), range.getEndKey().getColumnQualifierData(), currentKey.getColumnQualifierData()); } } total += rangeProgress[i]; @@ -126,19 +127,7 @@ public String toString() { StringBuilder sb = new StringBuilder(256); sb.append("BatchInputSplit:"); sb.append(" Ranges: ").append(Arrays.asList(ranges)); - sb.append(" Location: ").append(Arrays.asList(locations)); - sb.append(" Table: ").append(tableName); - sb.append(" TableID: ").append(tableId); - sb.append(" InstanceName: ").append(instanceName); - sb.append(" zooKeepers: ").append(zooKeepers); - sb.append(" principal: ").append(principal); - sb.append(" tokenSource: ").append(tokenSource); - sb.append(" authenticationToken: ").append(token); - sb.append(" authenticationTokenFile: ").append(tokenFile); - sb.append(" Authorizations: ").append(auths); - sb.append(" fetchColumns: ").append(fetchedColumns); - sb.append(" iterators: ").append(iterators); - sb.append(" logLevel: ").append(level); + sb.append(super.toString()); return sb.toString(); } diff --git a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java new file mode 100644 index 00000000000..0aee665f5f0 --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/SplitUtils.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.accumulo.core.client.mapreduce.impl; + +import java.math.BigInteger; + +import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.mapreduce.InputTableConfig; +import org.apache.accumulo.core.client.mock.MockInstance; +import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; +import org.apache.accumulo.core.data.ByteSequence; +import org.apache.accumulo.core.security.Authorizations; +import org.apache.log4j.Level; + +public class SplitUtils { + + /** + * Central place to set common split configuration not handled by split constructors. + * The intention is to make it harder to miss optional setters in future refactor. + */ + public static void updateSplit(AccumuloInputSplit split, Instance instance, InputTableConfig tableConfig, + String principal, AuthenticationToken token, Authorizations auths, Level logLevel) { + split.setInstanceName(instance.getInstanceName()); + split.setZooKeepers(instance.getZooKeepers()); + split.setMockInstance(instance instanceof MockInstance); + + split.setPrincipal(principal); + split.setToken(token); + split.setAuths(auths); + + split.setFetchedColumns(tableConfig.getFetchedColumns()); + split.setIterators(tableConfig.getIterators()); + split.setLogLevel(logLevel); + } + + public static float getProgress(ByteSequence start, ByteSequence end, ByteSequence position) { + int maxDepth = Math.min(Math.max(end.length(), start.length()), position.length()); + BigInteger startBI = new BigInteger(AccumuloInputSplit.extractBytes(start, maxDepth)); + BigInteger endBI = new BigInteger(AccumuloInputSplit.extractBytes(end, maxDepth)); + BigInteger positionBI = new BigInteger(AccumuloInputSplit.extractBytes(position, maxDepth)); + return (float) (positionBI.subtract(startBI).doubleValue() / endBI.subtract(startBI).doubleValue()); + } + +}