You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2018/04/06 09:53:08 UTC
[accumulo] 02/04: Merge commit
'f4f43febbc3e68013d8a1bcd46d8b44275e2e55e'
This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit e113e2f353b4e8eb9d7ac4d4cb6c3cf4892b1836
Merge: 19dc538 f4f43fe
Author: Christopher Tubbs <ct...@apache.org>
AuthorDate: Fri Apr 6 01:19:55 2018 -0400
Merge commit 'f4f43febbc3e68013d8a1bcd46d8b44275e2e55e'
.../java/org/apache/accumulo/core/Constants.java | 3 +-
.../accumulo/core/bloomfilter/BloomFilter.java | 33 +-
.../core/bloomfilter/DynamicBloomFilter.java | 46 +-
.../apache/accumulo/core/bloomfilter/Filter.java | 5 +-
.../apache/accumulo/core/cli/BatchScannerOpts.java | 3 +-
.../apache/accumulo/core/cli/BatchWriterOpts.java | 12 +-
.../org/apache/accumulo/core/cli/ClientOpts.java | 38 +-
.../core/cli/MapReduceClientOnRequiredTable.java | 3 +-
.../accumulo/core/cli/MapReduceClientOpts.java | 11 +-
.../org/apache/accumulo/core/cli/ScannerOpts.java | 3 +-
.../core/client/AccumuloSecurityException.java | 12 +-
.../apache/accumulo/core/client/BatchScanner.java | 26 +-
.../apache/accumulo/core/client/BatchWriter.java | 15 +-
.../accumulo/core/client/BatchWriterConfig.java | 52 +-
.../accumulo/core/client/ClientConfiguration.java | 81 ++-
.../core/client/ClientSideIteratorScanner.java | 40 +-
.../accumulo/core/client/ConditionalWriter.java | 30 +-
.../core/client/ConditionalWriterConfig.java | 25 +-
.../org/apache/accumulo/core/client/Connector.java | 141 ++--
.../apache/accumulo/core/client/Durability.java | 6 +-
.../org/apache/accumulo/core/client/Instance.java | 28 +-
.../accumulo/core/client/IsolatedScanner.java | 16 +-
.../accumulo/core/client/IteratorSetting.java | 54 +-
.../core/client/MultiTableBatchWriter.java | 8 +-
.../core/client/MutationsRejectedException.java | 11 +-
.../core/client/NamespaceExistsException.java | 11 +-
.../core/client/NamespaceNotEmptyException.java | 11 +-
.../core/client/NamespaceNotFoundException.java | 11 +-
.../apache/accumulo/core/client/RowIterator.java | 11 +-
.../core/client/SampleNotPresentException.java | 3 +-
.../org/apache/accumulo/core/client/Scanner.java | 25 +-
.../apache/accumulo/core/client/ScannerBase.java | 90 ++-
.../core/client/TableDeletedException.java | 3 +-
.../accumulo/core/client/TableExistsException.java | 8 +-
.../core/client/TableNotFoundException.java | 14 +-
.../accumulo/core/client/TimedOutException.java | 3 +-
.../accumulo/core/client/ZooKeeperInstance.java | 69 +-
.../core/client/admin/ActiveCompaction.java | 3 +-
.../core/client/admin/CompactionConfig.java | 26 +-
.../client/admin/CompactionStrategyConfig.java | 14 +-
.../core/client/admin/DelegationTokenConfig.java | 10 +-
.../apache/accumulo/core/client/admin/FindMax.java | 15 +-
.../core/client/admin/InstanceOperations.java | 35 +-
.../accumulo/core/client/admin/Locations.java | 12 +-
.../core/client/admin/NamespaceOperations.java | 82 ++-
.../core/client/admin/NewTableConfiguration.java | 48 +-
.../core/client/admin/ReplicationOperations.java | 34 +-
.../core/client/admin/SecurityOperations.java | 76 +-
.../core/client/admin/SummaryRetriever.java | 40 +-
.../core/client/admin/TableOperations.java | 316 +++++----
.../accumulo/core/client/admin/TimeType.java | 7 +-
.../accumulo/core/client/impl/AbstractId.java | 6 +-
.../AcceptableThriftTableOperationException.java | 6 +-
.../core/client/impl/ActiveCompactionImpl.java | 6 +-
.../accumulo/core/client/impl/ActiveScanImpl.java | 4 +-
.../client/impl/AuthenticationTokenIdentifier.java | 3 +-
.../core/client/impl/BaseIteratorEnvironment.java | 8 +-
.../core/client/impl/ClientConfConverter.java | 9 +-
.../accumulo/core/client/impl/ClientContext.java | 83 ++-
.../core/client/impl/ConditionalWriterImpl.java | 77 +-
.../core/client/impl/ConnectionInfoFactory.java | 3 +-
.../accumulo/core/client/impl/ConnectorImpl.java | 88 ++-
.../accumulo/core/client/impl/Credentials.java | 67 +-
.../core/client/impl/DelegationTokenImpl.java | 21 +-
.../core/client/impl/InstanceOperationsImpl.java | 61 +-
.../accumulo/core/client/impl/MasterClient.java | 32 +-
.../client/impl/MultiTableBatchWriterImpl.java | 18 +-
.../accumulo/core/client/impl/Namespace.java | 13 +-
.../client/impl/NamespaceOperationsHelper.java | 80 ++-
.../core/client/impl/NamespaceOperationsImpl.java | 78 +-
.../accumulo/core/client/impl/Namespaces.java | 33 +-
.../accumulo/core/client/impl/OfflineIterator.java | 66 +-
.../accumulo/core/client/impl/OfflineScanner.java | 3 +-
.../core/client/impl/ReplicationClient.java | 44 +-
.../client/impl/ReplicationOperationsImpl.java | 32 +-
.../core/client/impl/RootTabletLocator.java | 27 +-
.../accumulo/core/client/impl/ScannerImpl.java | 13 +-
.../accumulo/core/client/impl/ScannerIterator.java | 17 +-
.../accumulo/core/client/impl/ScannerOptions.java | 3 +-
.../core/client/impl/SecurityOperationsImpl.java | 128 ++--
.../accumulo/core/client/impl/ServerClient.java | 52 +-
.../core/client/impl/SyncingTabletLocator.java | 17 +-
.../apache/accumulo/core/client/impl/Table.java | 11 +-
.../apache/accumulo/core/client/impl/TableMap.java | 3 +-
.../core/client/impl/TableOperationsHelper.java | 80 ++-
.../core/client/impl/TableOperationsImpl.java | 471 ++++++++-----
.../apache/accumulo/core/client/impl/Tables.java | 65 +-
.../accumulo/core/client/impl/TabletLocator.java | 28 +-
.../core/client/impl/TabletLocatorImpl.java | 141 ++--
.../core/client/impl/TabletServerBatchDeleter.java | 9 +-
.../core/client/impl/TabletServerBatchReader.java | 15 +-
.../impl/TabletServerBatchReaderIterator.java | 139 ++--
.../core/client/impl/TabletServerBatchWriter.java | 127 ++--
.../accumulo/core/client/impl/TabletType.java | 3 +-
.../accumulo/core/client/impl/ThriftScanner.java | 129 ++--
.../core/client/impl/ThriftTransportKey.java | 6 +-
.../core/client/impl/ThriftTransportPool.java | 45 +-
.../core/client/impl/TimeoutTabletLocator.java | 15 +-
.../accumulo/core/client/impl/Translator.java | 15 +-
.../apache/accumulo/core/client/impl/Writer.java | 12 +-
.../core/client/lexicoder/AbstractEncoder.java | 14 +-
.../core/client/lexicoder/BigIntegerLexicoder.java | 6 +-
.../core/client/lexicoder/BytesLexicoder.java | 10 +-
.../core/client/lexicoder/DateLexicoder.java | 3 +-
.../core/client/lexicoder/DoubleLexicoder.java | 3 +-
.../accumulo/core/client/lexicoder/Encoder.java | 3 +-
.../core/client/lexicoder/FloatLexicoder.java | 3 +-
.../core/client/lexicoder/IntegerLexicoder.java | 7 +-
.../accumulo/core/client/lexicoder/Lexicoder.java | 4 +-
.../core/client/lexicoder/ListLexicoder.java | 6 +-
.../core/client/lexicoder/LongLexicoder.java | 4 +-
.../core/client/lexicoder/PairLexicoder.java | 35 +-
.../core/client/lexicoder/ReverseLexicoder.java | 7 +-
.../core/client/lexicoder/StringLexicoder.java | 7 +-
.../core/client/lexicoder/TextLexicoder.java | 7 +-
.../core/client/lexicoder/UIntegerLexicoder.java | 8 +-
.../core/client/lexicoder/ULongLexicoder.java | 8 +-
.../core/client/lexicoder/UUIDLexicoder.java | 7 +-
.../lexicoder/impl/FixedByteArrayOutputStream.java | 3 +-
.../core/client/mapred/AbstractInputFormat.java | 131 ++--
.../client/mapred/AccumuloFileOutputFormat.java | 53 +-
.../core/client/mapred/AccumuloInputFormat.java | 10 +-
.../mapred/AccumuloMultiTableInputFormat.java | 8 +-
.../core/client/mapred/AccumuloOutputFormat.java | 83 ++-
.../core/client/mapred/AccumuloRowInputFormat.java | 12 +-
.../core/client/mapred/InputFormatBase.java | 94 ++-
.../core/client/mapred/RangeInputSplit.java | 3 +-
.../core/client/mapred/impl/BatchInputSplit.java | 9 +-
.../core/client/mapreduce/AbstractInputFormat.java | 145 ++--
.../client/mapreduce/AccumuloFileOutputFormat.java | 47 +-
.../core/client/mapreduce/AccumuloInputFormat.java | 10 +-
.../mapreduce/AccumuloMultiTableInputFormat.java | 11 +-
.../client/mapreduce/AccumuloOutputFormat.java | 89 ++-
.../client/mapreduce/AccumuloRowInputFormat.java | 13 +-
.../core/client/mapreduce/InputFormatBase.java | 97 ++-
.../core/client/mapreduce/InputTableConfig.java | 58 +-
.../core/client/mapreduce/RangeInputSplit.java | 21 +-
.../client/mapreduce/impl/BatchInputSplit.java | 30 +-
.../client/mapreduce/impl/DelegationTokenStub.java | 3 +-
.../core/client/mapreduce/impl/SplitUtils.java | 16 +-
.../mapreduce/lib/impl/ConfiguratorBase.java | 136 ++--
.../mapreduce/lib/impl/FileOutputConfigurator.java | 86 ++-
.../mapreduce/lib/impl/InputConfigurator.java | 231 ++++--
.../mapreduce/lib/impl/OutputConfigurator.java | 36 +-
.../client/mapreduce/lib/impl/package-info.java | 27 +-
.../lib/partition/KeyRangePartitioner.java | 3 +-
.../mapreduce/lib/partition/RangePartitioner.java | 9 +-
.../accumulo/core/client/mock/MockAccumulo.java | 15 +-
.../core/client/mock/MockBatchDeleter.java | 9 +-
.../accumulo/core/client/mock/MockConnector.java | 49 +-
.../accumulo/core/client/mock/MockInstance.java | 25 +-
.../core/client/mock/MockInstanceOperations.java | 18 +-
.../client/mock/MockMultiTableBatchWriter.java | 3 +-
.../core/client/mock/MockNamespaceOperations.java | 25 +-
.../accumulo/core/client/mock/MockScannerBase.java | 14 +-
.../core/client/mock/MockSecurityOperations.java | 54 +-
.../accumulo/core/client/mock/MockTable.java | 14 +-
.../core/client/mock/MockTableOperations.java | 160 +++--
.../core/client/mock/impl/MockTabletLocator.java | 12 +-
.../accumulo/core/client/mock/package-info.java | 1 -
.../client/replication/PeerExistsException.java | 3 +-
.../apache/accumulo/core/client/rfile/RFile.java | 129 ++--
.../accumulo/core/client/rfile/RFileScanner.java | 35 +-
.../core/client/rfile/RFileScannerBuilder.java | 6 +-
.../accumulo/core/client/rfile/RFileSource.java | 4 +-
.../core/client/rfile/RFileSummariesRetriever.java | 6 +-
.../accumulo/core/client/rfile/RFileWriter.java | 40 +-
.../core/client/rfile/RFileWriterBuilder.java | 19 +-
.../core/client/sample/AbstractHashSampler.java | 13 +-
.../core/client/sample/RowColumnSampler.java | 15 +-
.../accumulo/core/client/sample/RowSampler.java | 10 +-
.../accumulo/core/client/sample/Sampler.java | 30 +-
.../security/tokens/AuthenticationToken.java | 24 +-
.../security/tokens/CredentialProviderToken.java | 24 +-
.../client/security/tokens/DelegationToken.java | 13 +-
.../core/client/security/tokens/KerberosToken.java | 28 +-
.../core/client/security/tokens/PasswordToken.java | 21 +-
.../core/client/summary/CounterSummary.java | 24 +-
.../core/client/summary/CountingSummarizer.java | 75 +-
.../accumulo/core/client/summary/Summarizer.java | 43 +-
.../client/summary/SummarizerConfiguration.java | 36 +-
.../accumulo/core/client/summary/Summary.java | 55 +-
.../summary/summarizers/DeletesSummarizer.java | 8 +-
.../summary/summarizers/EntryLengthSummarizer.java | 22 +-
.../summary/summarizers/FamilySummarizer.java | 8 +-
.../summary/summarizers/VisibilitySummarizer.java | 8 +-
.../accumulo/core/conf/AccumuloConfiguration.java | 45 +-
.../accumulo/core/conf/CliConfiguration.java | 3 +-
.../accumulo/core/conf/ClientConfigGenerate.java | 29 +-
.../apache/accumulo/core/conf/ClientProperty.java | 43 +-
.../accumulo/core/conf/ConfigSanityCheck.java | 55 +-
.../accumulo/core/conf/ConfigurationCopy.java | 3 +-
.../accumulo/core/conf/ConfigurationDocGen.java | 33 +-
.../core/conf/ConfigurationTypeHelper.java | 46 +-
.../core/conf/CredentialProviderFactoryShim.java | 100 ++-
.../accumulo/core/conf/DefaultConfiguration.java | 9 +-
.../apache/accumulo/core/conf/Interpolated.java | 9 +-
.../core/conf/ObservableConfiguration.java | 6 +-
.../org/apache/accumulo/core/conf/Property.java | 729 ++++++++++++-------
.../apache/accumulo/core/conf/PropertyType.java | 77 +-
.../org/apache/accumulo/core/conf/Sensitive.java | 3 +-
.../accumulo/core/conf/SiteConfiguration.java | 51 +-
.../accumulo/core/constraints/Constraint.java | 14 +-
.../core/constraints/VisibilityConstraint.java | 3 +-
.../accumulo/core/data/ArrayByteSequence.java | 24 +-
.../apache/accumulo/core/data/ByteSequence.java | 17 +-
.../java/org/apache/accumulo/core/data/Column.java | 10 +-
.../apache/accumulo/core/data/ColumnUpdate.java | 20 +-
.../org/apache/accumulo/core/data/Condition.java | 55 +-
.../accumulo/core/data/ConditionalMutation.java | 6 +-
.../core/data/ConstraintViolationSummary.java | 12 +-
.../java/org/apache/accumulo/core/data/Key.java | 322 +++++----
.../org/apache/accumulo/core/data/KeyBuilder.java | 47 +-
.../org/apache/accumulo/core/data/Mutation.java | 237 ++++---
.../org/apache/accumulo/core/data/PartialKey.java | 6 +-
.../java/org/apache/accumulo/core/data/Range.java | 180 +++--
.../org/apache/accumulo/core/data/TabletId.java | 3 +-
.../java/org/apache/accumulo/core/data/Value.java | 32 +-
.../accumulo/core/data/impl/ComparableBytes.java | 3 +-
.../apache/accumulo/core/data/impl/KeyExtent.java | 82 ++-
.../accumulo/core/file/BloomFilterLayer.java | 71 +-
.../accumulo/core/file/DispatchingFileFactory.java | 14 +-
.../apache/accumulo/core/file/FileOperations.java | 129 ++--
.../accumulo/core/file/blockfile/ABlockReader.java | 3 +-
.../core/file/blockfile/BlockFileReader.java | 3 +-
.../core/file/blockfile/BlockFileWriter.java | 3 +-
.../core/file/blockfile/cache/BlockCache.java | 13 +-
.../file/blockfile/cache/BlockCacheManager.java | 39 +-
.../core/file/blockfile/cache/CacheEntry.java | 7 +-
.../cache/impl/BlockCacheConfiguration.java | 3 +-
.../cache/impl/BlockCacheManagerFactory.java | 21 +-
.../core/file/blockfile/cache/impl/ClassSize.java | 18 +-
.../core/file/blockfile/cache/lru/CachedBlock.java | 16 +-
.../file/blockfile/cache/lru/CachedBlockQueue.java | 15 +-
.../core/file/blockfile/cache/lru/HeapSize.java | 9 +-
.../file/blockfile/cache/lru/LruBlockCache.java | 110 +--
.../cache/lru/LruBlockCacheConfiguration.java | 32 +-
.../cache/lru/SynchronousLoadingBlockCache.java | 3 +-
.../blockfile/cache/tinylfu/TinyLfuBlockCache.java | 29 +-
.../file/blockfile/impl/CachableBlockFile.java | 96 ++-
.../impl/SeekableByteArrayInputStream.java | 9 +-
.../file/keyfunctor/ColumnQualifierFunctor.java | 3 +-
.../accumulo/core/file/keyfunctor/RowFunctor.java | 3 +-
.../accumulo/core/file/map/MapFileOperations.java | 19 +-
.../apache/accumulo/core/file/map/MapFileUtil.java | 6 +-
.../accumulo/core/file/rfile/BlockIndex.java | 21 +-
.../accumulo/core/file/rfile/CreateEmpty.java | 15 +-
.../accumulo/core/file/rfile/IndexIterator.java | 6 +-
.../accumulo/core/file/rfile/KeyShortener.java | 22 +-
.../accumulo/core/file/rfile/MetricsGatherer.java | 10 +-
.../core/file/rfile/MultiIndexIterator.java | 6 +-
.../accumulo/core/file/rfile/MultiLevelIndex.java | 58 +-
.../apache/accumulo/core/file/rfile/PrintInfo.java | 28 +-
.../org/apache/accumulo/core/file/rfile/RFile.java | 233 ++++--
.../accumulo/core/file/rfile/RFileOperations.java | 22 +-
.../accumulo/core/file/rfile/RelativeKey.java | 33 +-
.../accumulo/core/file/rfile/RollingStats.java | 15 +-
.../accumulo/core/file/rfile/SplitLarge.java | 15 +-
.../core/file/rfile/VisMetricsGatherer.java | 19 +-
.../accumulo/core/file/rfile/VisibilityMetric.java | 10 +-
.../accumulo/core/file/rfile/bcfile/BCFile.java | 183 +++--
.../core/file/rfile/bcfile/Compression.java | 134 ++--
.../accumulo/core/file/rfile/bcfile/PrintInfo.java | 15 +-
.../core/file/rfile/bcfile/RawComparable.java | 10 +-
.../rfile/bcfile/SimpleBufferedOutputStream.java | 3 +-
.../accumulo/core/file/rfile/bcfile/Utils.java | 67 +-
.../file/streams/BoundedRangeFileInputStream.java | 11 +-
.../file/streams/PositionedDataOutputStream.java | 6 +-
.../core/file/streams/PositionedOutput.java | 3 +-
.../core/file/streams/PositionedOutputs.java | 8 +-
.../core/file/streams/RateLimitedInputStream.java | 3 +-
.../core/file/streams/SeekableDataInputStream.java | 3 +-
.../core/iterators/AggregatingIterator.java | 30 +-
.../core/iterators/ColumnFamilyCounter.java | 9 +-
.../apache/accumulo/core/iterators/Combiner.java | 125 ++--
.../accumulo/core/iterators/DebugIterator.java | 10 +-
.../apache/accumulo/core/iterators/DevNull.java | 10 +-
.../core/iterators/FamilyIntersectingIterator.java | 3 +-
.../org/apache/accumulo/core/iterators/Filter.java | 25 +-
.../core/iterators/FirstEntryInRowIterator.java | 16 +-
.../core/iterators/IntersectingIterator.java | 6 +-
.../accumulo/core/iterators/IteratorAdapter.java | 3 +-
.../core/iterators/IteratorEnvironment.java | 14 +-
.../accumulo/core/iterators/IteratorUtil.java | 126 ++--
.../accumulo/core/iterators/LongCombiner.java | 61 +-
.../accumulo/core/iterators/OptionDescriber.java | 36 +-
.../apache/accumulo/core/iterators/OrIterator.java | 52 +-
.../core/iterators/RowDeletingIterator.java | 6 +-
.../accumulo/core/iterators/ServerFilter.java | 15 +-
.../core/iterators/ServerSkippingIterator.java | 10 +-
.../core/iterators/ServerWrappingIterator.java | 17 +-
.../accumulo/core/iterators/SkippingIterator.java | 10 +-
.../accumulo/core/iterators/SortedKeyIterator.java | 4 +-
.../core/iterators/SortedKeyValueIterator.java | 89 ++-
.../accumulo/core/iterators/SortedMapIterator.java | 13 +-
.../core/iterators/SynchronizedServerFilter.java | 12 +-
.../core/iterators/TypedValueCombiner.java | 38 +-
.../core/iterators/VersioningIterator.java | 3 +-
.../accumulo/core/iterators/WholeRowIterator.java | 3 +-
.../accumulo/core/iterators/WrappingIterator.java | 22 +-
.../accumulo/core/iterators/YieldCallback.java | 5 +-
.../core/iterators/YieldingKeyValueIterator.java | 12 +-
.../core/iterators/aggregation/LongSummation.java | 15 +-
.../iterators/aggregation/NumArraySummation.java | 3 +-
.../core/iterators/aggregation/NumSummation.java | 3 +-
.../core/iterators/aggregation/StringMax.java | 4 +-
.../core/iterators/aggregation/StringMin.java | 4 +-
.../iterators/aggregation/StringSummation.java | 3 +-
.../aggregation/conf/AggregatorConfiguration.java | 3 +-
.../iterators/aggregation/conf/AggregatorSet.java | 6 +-
.../accumulo/core/iterators/conf/ColumnSet.java | 6 +-
.../core/iterators/conf/ColumnToClassMapping.java | 12 +-
.../accumulo/core/iterators/conf/ColumnUtil.java | 9 +-
.../iterators/conf/PerColumnIteratorConfig.java | 6 +-
.../system/ColumnFamilySkippingIterator.java | 12 +-
.../iterators/system/ColumnQualifierFilter.java | 6 +-
.../core/iterators/system/CountingIterator.java | 3 +-
.../core/iterators/system/DeletingIterator.java | 15 +-
.../core/iterators/system/EmptyIterator.java | 6 +-
.../core/iterators/system/HeapIterator.java | 4 +-
.../iterators/system/LocalityGroupIterator.java | 43 +-
.../core/iterators/system/MapFileIterator.java | 9 +-
.../core/iterators/system/MultiIterator.java | 9 +-
.../iterators/system/SequenceFileIterator.java | 6 +-
.../iterators/system/SourceSwitchingIterator.java | 50 +-
.../core/iterators/system/StatsIterator.java | 6 +-
.../iterators/system/SynchronizedIterator.java | 14 +-
.../core/iterators/system/TimeSettingIterator.java | 6 +-
.../core/iterators/system/VisibilityFilter.java | 16 +-
.../accumulo/core/iterators/user/AgeOffFilter.java | 18 +-
.../core/iterators/user/BigDecimalCombiner.java | 12 +-
.../core/iterators/user/CfCqSliceFilter.java | 13 +-
.../core/iterators/user/CfCqSliceOpts.java | 18 +-
.../iterators/user/CfCqSliceSeekingFilter.java | 27 +-
.../core/iterators/user/ColumnAgeOffFilter.java | 17 +-
.../core/iterators/user/ColumnSliceFilter.java | 22 +-
.../accumulo/core/iterators/user/GrepIterator.java | 9 +-
.../core/iterators/user/IndexedDocIterator.java | 35 +-
.../core/iterators/user/IntersectingIterator.java | 100 ++-
.../core/iterators/user/LargeRowFilter.java | 46 +-
.../accumulo/core/iterators/user/MaxCombiner.java | 3 +-
.../accumulo/core/iterators/user/MinCombiner.java | 3 +-
.../accumulo/core/iterators/user/RegExFilter.java | 26 +-
.../core/iterators/user/RowDeletingIterator.java | 45 +-
.../core/iterators/user/RowEncodingIterator.java | 58 +-
.../accumulo/core/iterators/user/RowFilter.java | 44 +-
.../core/iterators/user/SeekingFilter.java | 47 +-
.../core/iterators/user/SummingArrayCombiner.java | 26 +-
.../core/iterators/user/SummingCombiner.java | 3 +-
.../core/iterators/user/TimestampFilter.java | 15 +-
.../core/iterators/user/TransformingIterator.java | 222 +++---
.../core/iterators/user/VersioningIterator.java | 19 +-
.../core/iterators/user/VisibilityFilter.java | 12 +-
.../iterators/user/WholeColumnFamilyIterator.java | 52 +-
.../core/iterators/user/WholeRowIterator.java | 27 +-
.../core/metadata/MetadataLocationObtainer.java | 54 +-
.../accumulo/core/metadata/MetadataServicer.java | 9 +-
.../apache/accumulo/core/metadata/RootTable.java | 3 +-
.../core/metadata/ServicerForRootTable.java | 3 +-
.../core/metadata/TableMetadataServicer.java | 26 +-
.../core/metadata/schema/MetadataScanner.java | 12 +-
.../core/metadata/schema/MetadataSchema.java | 42 +-
.../core/metadata/schema/TabletMetadata.java | 36 +-
.../replication/AccumuloReplicationReplayer.java | 7 +-
.../core/replication/ReplicationSchema.java | 26 +-
.../core/replication/ReplicationTable.java | 9 +-
.../core/replication/ReplicationTarget.java | 10 +-
.../apache/accumulo/core/rpc/FilterTransport.java | 3 +-
.../rpc/ProtocolOverridingSSLSocketFactory.java | 24 +-
.../core/rpc/SaslClientDigestCallbackHandler.java | 5 +-
.../accumulo/core/rpc/SaslConnectionParams.java | 15 +-
.../core/rpc/SaslDigestCallbackHandler.java | 6 +-
.../accumulo/core/rpc/SslConnectionParams.java | 19 +-
.../apache/accumulo/core/rpc/TBufferedSocket.java | 3 +-
.../accumulo/core/rpc/TServiceClientWrapper.java | 5 +-
.../accumulo/core/rpc/TTimeoutTransport.java | 21 +-
.../org/apache/accumulo/core/rpc/ThriftUtil.java | 142 ++--
.../accumulo/core/rpc/TraceProtocolFactory.java | 3 +-
.../accumulo/core/rpc/UGIAssumingTransport.java | 6 +-
.../core/sample/impl/SamplerConfigurationImpl.java | 9 +-
.../accumulo/core/sample/impl/SamplerFactory.java | 12 +-
.../accumulo/core/security/Authorizations.java | 24 +-
.../accumulo/core/security/ColumnVisibility.java | 86 ++-
.../core/security/NamespacePermission.java | 3 +-
.../accumulo/core/security/SystemPermission.java | 3 +-
.../accumulo/core/security/TablePermission.java | 3 +-
.../core/security/VisibilityEvaluator.java | 29 +-
.../core/security/VisibilityParseException.java | 3 +-
.../core/security/crypto/BlockedInputStream.java | 10 +-
.../core/security/crypto/BlockedOutputStream.java | 12 +-
.../CachingHDFSSecretKeyEncryptionStrategy.java | 46 +-
.../core/security/crypto/CryptoModule.java | 90 ++-
.../core/security/crypto/CryptoModuleFactory.java | 70 +-
.../security/crypto/CryptoModuleParameters.java | 255 ++++---
.../core/security/crypto/DefaultCryptoModule.java | 164 +++--
.../security/crypto/DefaultCryptoModuleUtils.java | 20 +-
.../NonCachingSecretKeyEncryptionStrategy.java | 32 +-
.../security/crypto/RFileCipherOutputStream.java | 25 +-
.../org/apache/accumulo/core/summary/Gatherer.java | 118 +++-
.../core/summary/SummarizerConfigurationUtil.java | 6 +-
.../accumulo/core/summary/SummarizerFactory.java | 9 +-
.../accumulo/core/summary/SummaryCollection.java | 12 +-
.../accumulo/core/summary/SummaryReader.java | 41 +-
.../accumulo/core/summary/SummarySerializer.java | 39 +-
.../accumulo/core/summary/SummaryWriter.java | 21 +-
.../apache/accumulo/core/trace/CountSampler.java | 3 +-
.../accumulo/core/trace/DistributedTrace.java | 39 +-
.../accumulo/core/trace/ProbabilitySampler.java | 3 +-
.../java/org/apache/accumulo/core/trace/Span.java | 3 +-
.../java/org/apache/accumulo/core/trace/Trace.java | 3 +-
.../accumulo/core/trace/wrappers/TraceWrap.java | 11 +-
.../org/apache/accumulo/core/util/AddressUtil.java | 6 +-
.../apache/accumulo/core/util/ByteBufferUtil.java | 12 +-
.../accumulo/core/util/CancelFlagFuture.java | 6 +-
.../org/apache/accumulo/core/util/Classpath.java | 3 +-
.../org/apache/accumulo/core/util/CleanUp.java | 11 +-
.../apache/accumulo/core/util/ComparablePair.java | 3 +-
.../accumulo/core/util/CompletableFutureUtil.java | 6 +-
.../org/apache/accumulo/core/util/CreateToken.java | 23 +-
.../apache/accumulo/core/util/DeprecationUtil.java | 13 +-
.../org/apache/accumulo/core/util/FastFormat.java | 6 +-
.../org/apache/accumulo/core/util/HostAndPort.java | 46 +-
.../accumulo/core/util/LocalityGroupUtil.java | 41 +-
.../java/org/apache/accumulo/core/util/Merge.java | 33 +-
.../org/apache/accumulo/core/util/OpTimer.java | 14 +-
.../apache/accumulo/core/util/PeekingIterator.java | 3 +-
.../accumulo/core/util/PreAllocatedArray.java | 5 +-
.../apache/accumulo/core/util/ServerServices.java | 3 +-
.../accumulo/core/util/SimpleThreadPool.java | 3 +-
.../accumulo/core/util/ThriftMessageUtil.java | 13 +-
.../accumulo/core/util/UnsynchronizedBuffer.java | 26 +-
.../org/apache/accumulo/core/util/Validator.java | 15 +-
.../accumulo/core/util/format/BinaryFormatter.java | 12 +-
.../core/util/format/DateFormatSupplier.java | 19 +-
.../core/util/format/DateStringFormatter.java | 17 +-
.../core/util/format/DefaultFormatter.java | 9 +-
.../accumulo/core/util/format/FormatterConfig.java | 5 +-
.../core/util/format/FormatterFactory.java | 6 +-
.../accumulo/core/util/format/HexFormatter.java | 3 +-
.../format/ShardedTableDistributionFormatter.java | 7 +-
.../util/format/StatisticsDisplayFormatter.java | 5 +-
.../core/util/interpret/HexScanInterpreter.java | 5 +-
.../core/util/interpret/ScanInterpreter.java | 3 +-
.../core/util/ratelimit/GuavaRateLimiter.java | 9 +-
.../util/ratelimit/SharedRateLimiterFactory.java | 22 +-
.../accumulo/core/volume/NonConfiguredVolume.java | 21 +-
.../org/apache/accumulo/core/volume/Volume.java | 6 +-
.../accumulo/core/volume/VolumeConfiguration.java | 21 +-
.../apache/accumulo/core/volume/VolumeImpl.java | 12 +-
.../apache/accumulo/core/zookeeper/ZooUtil.java | 16 +-
.../core/client/BatchWriterConfigTest.java | 6 +-
.../core/client/ClientConfigurationTest.java | 9 +-
.../accumulo/core/client/IteratorSettingTest.java | 6 +-
.../core/client/ZooKeeperInstanceTest.java | 21 +-
.../client/admin/DelegationTokenConfigTest.java | 6 +-
.../core/client/impl/ClientContextTest.java | 15 +-
.../accumulo/core/client/impl/NamespaceTest.java | 3 +-
.../core/client/impl/ScannerOptionsTest.java | 3 +-
.../client/impl/TableOperationsHelperTest.java | 157 +++--
.../core/client/impl/TableOperationsImplTest.java | 3 +-
.../accumulo/core/client/impl/TableTest.java | 3 +-
.../core/client/impl/TabletLocatorImplTest.java | 264 ++++---
.../core/client/impl/ThriftScannerTest.java | 6 +-
.../core/client/impl/ThriftTransportKeyTest.java | 89 +--
.../client/lexicoder/BigIntegerLexicoderTest.java | 19 +-
.../core/client/lexicoder/DoubleLexicoderTest.java | 10 +-
.../core/client/lexicoder/FloatLexicoderTest.java | 9 +-
.../client/lexicoder/IntegerLexicoderTest.java | 4 +-
.../core/client/lexicoder/LexicoderTest.java | 3 +-
.../core/client/lexicoder/LongLexicoderTest.java | 8 +-
.../core/client/lexicoder/PairLexicoderTest.java | 21 +-
.../client/lexicoder/ReverseLexicoderTest.java | 11 +-
.../core/client/lexicoder/ULongLexicoderTest.java | 31 +-
.../core/client/lexicoder/UUIDLexicoderTest.java | 4 +-
.../lexicoder/impl/AbstractLexicoderTest.java | 5 +-
.../mapred/AccumuloFileOutputFormatTest.java | 18 +-
.../client/mapred/AccumuloInputFormatTest.java | 38 +-
.../mapred/AccumuloMultiTableInputFormatTest.java | 9 +-
.../client/mapred/AccumuloOutputFormatTest.java | 6 +-
.../core/client/mapred/RangeInputSplitTest.java | 9 +-
.../mapreduce/AccumuloFileOutputFormatTest.java | 21 +-
.../client/mapreduce/AccumuloInputFormatTest.java | 38 +-
.../AccumuloMultiTableInputFormatTest.java | 3 +-
.../client/mapreduce/AccumuloOutputFormatTest.java | 6 +-
.../core/client/mapreduce/RangeInputSplitTest.java | 9 +-
.../client/mapreduce/impl/BatchInputSplitTest.java | 9 +-
.../mapreduce/lib/impl/ConfiguratorBaseTest.java | 42 +-
.../lib/partition/RangePartitionerTest.java | 9 +-
.../core/client/mock/MockConnectorTest.java | 26 +-
.../core/client/mock/MockNamespacesTest.java | 25 +-
.../accumulo/core/client/mock/MockScannerTest.java | 6 +-
.../core/client/mock/MockTableOperationsTest.java | 34 +-
.../core/client/mock/TestBatchScanner821.java | 3 +-
.../accumulo/core/client/rfile/RFileTest.java | 134 ++--
.../client/security/SecurityErrorCodeTest.java | 3 +-
.../security/tokens/DelegationTokenImplTest.java | 21 +-
.../client/security/tokens/KerberosTokenTest.java | 3 +-
.../client/summary/CountingSummarizerTest.java | 13 +-
.../summarizers/EntryLengthSummarizersTest.java | 91 ++-
.../core/conf/AccumuloConfigurationTest.java | 6 +-
.../accumulo/core/conf/ConfigSanityCheckTest.java | 30 +-
.../core/conf/ConfigurationTypeHelperTest.java | 10 +-
.../conf/CredentialProviderFactoryShimTest.java | 38 +-
.../core/conf/DefaultConfigurationTest.java | 3 +-
.../apache/accumulo/core/conf/PropertyTest.java | 35 +-
.../accumulo/core/conf/PropertyTypeTest.java | 37 +-
.../accumulo/core/conf/SiteConfigurationTest.java | 15 +-
.../constraints/DefaultKeySizeConstraintTest.java | 16 +-
.../accumulo/core/data/ArrayByteSequenceTest.java | 3 +-
.../apache/accumulo/core/data/ConditionTest.java | 12 +-
.../core/data/ConstraintViolationSummaryTest.java | 10 +-
.../apache/accumulo/core/data/KeyBuilderTest.java | 47 +-
.../apache/accumulo/core/data/KeyExtentTest.java | 3 +-
.../org/apache/accumulo/core/data/KeyTest.java | 12 +-
.../apache/accumulo/core/data/MutationTest.java | 39 +-
.../org/apache/accumulo/core/data/OldMutation.java | 84 ++-
.../org/apache/accumulo/core/data/RangeTest.java | 123 ++--
.../core/file/BloomFilterLayerLookupTest.java | 12 +-
.../accumulo/core/file/FileOperationsTest.java | 3 +-
.../blockfile/cache/BlockCacheManagerTest.java | 12 +-
.../file/blockfile/cache/TestCachedBlockQueue.java | 16 +-
.../file/blockfile/cache/TestLruBlockCache.java | 63 +-
.../accumulo/core/file/rfile/BlockIndexTest.java | 15 +-
.../core/file/rfile/CreateCompatTestFile.java | 22 +-
.../accumulo/core/file/rfile/KeyShortenerTest.java | 78 +-
.../core/file/rfile/MultiLevelIndexTest.java | 6 +-
.../core/file/rfile/MultiThreadedRFileTest.java | 56 +-
.../accumulo/core/file/rfile/RFileMetricsTest.java | 9 +-
.../apache/accumulo/core/file/rfile/RFileTest.java | 295 +++++---
.../accumulo/core/file/rfile/RelativeKeyTest.java | 24 +-
.../core/file/rfile/RolllingStatsTest.java | 4 +-
.../core/file/rfile/bcfile/CompressionTest.java | 21 +-
.../file/streams/RateLimitedInputStreamTest.java | 12 +-
.../file/streams/RateLimitedOutputStreamTest.java | 3 +-
.../core/iterators/AggregatingIteratorTest.java | 9 +-
.../core/iterators/DefaultIteratorEnvironment.java | 3 +-
.../iterators/FirstEntryInRowIteratorTest.java | 15 +-
.../core/iterators/FirstEntryInRowTest.java | 9 +-
.../accumulo/core/iterators/IteratorUtilTest.java | 74 +-
.../conf/AggregatorConfigurationTest.java | 16 +-
.../system/ColumnFamilySkippingIteratorTest.java | 16 +-
.../core/iterators/system/ColumnFilterTest.java | 6 +-
.../iterators/system/DeletingIteratorTest.java | 3 +-
.../core/iterators/system/MultiIteratorTest.java | 20 +-
.../system/SourceSwitchingIteratorTest.java | 28 +-
.../iterators/system/TimeSettingIteratorTest.java | 21 +-
.../iterators/system/VisibilityFilterTest.java | 6 +-
.../core/iterators/user/ColumnSliceFilterTest.java | 3 +-
.../accumulo/core/iterators/user/CombinerTest.java | 59 +-
.../accumulo/core/iterators/user/FilterTest.java | 27 +-
.../core/iterators/user/GrepIteratorTest.java | 3 +-
.../iterators/user/IndexedDocIteratorTest.java | 39 +-
.../iterators/user/IntersectingIteratorTest.java | 39 +-
.../core/iterators/user/LargeRowFilterTest.java | 27 +-
.../iterators/user/RowDeletingIteratorTest.java | 6 +-
.../iterators/user/RowEncodingIteratorTest.java | 9 +-
.../core/iterators/user/RowFilterTest.java | 12 +-
.../core/iterators/user/TestCfCqSlice.java | 81 ++-
.../iterators/user/TransformingIteratorTest.java | 102 ++-
.../iterators/user/VersioningIteratorTest.java | 3 +-
.../core/iterators/user/VisibilityFilterTest.java | 14 +-
.../user/WholeColumnFamilyIteratorTest.java | 51 +-
.../core/iterators/user/WholeRowIteratorTest.java | 42 +-
.../core/metadata/MetadataServicerTest.java | 3 +-
.../ReplicationConfigurationUtilTest.java | 18 +-
.../rpc/SaslClientDigestCallbackHandlerTest.java | 5 +-
.../core/rpc/SaslConnectionParamsTest.java | 121 ++--
.../accumulo/core/rpc/TTimeoutTransportTest.java | 10 +-
.../AuthenticationTokenIdentifierTest.java | 6 +-
.../core/security/AuthenticationTokenTest.java | 6 +-
.../accumulo/core/security/AuthorizationsTest.java | 3 +-
.../core/security/ColumnVisibilityTest.java | 6 +-
.../accumulo/core/security/CredentialsTest.java | 19 +-
.../core/security/NamespacePermissionsTest.java | 3 +-
.../core/security/VisibilityConstraintTest.java | 3 +-
.../core/security/VisibilityEvaluatorTest.java | 33 +-
.../core/security/crypto/BlockedIOStreamTest.java | 3 +-
.../accumulo/core/security/crypto/CryptoTest.java | 94 ++-
.../accumulo/core/util/ByteBufferUtilTest.java | 6 +-
.../core/util/CompletableFutureUtilTest.java | 6 +-
.../accumulo/core/util/LocalityGroupUtilTest.java | 3 +-
.../org/apache/accumulo/core/util/MergeTest.java | 12 +-
.../org/apache/accumulo/core/util/OpTimerTest.java | 15 +-
.../org/apache/accumulo/core/util/PairTest.java | 3 +-
.../apache/accumulo/core/util/PartitionerTest.java | 3 +-
.../accumulo/core/util/PreAllocatedArrayTest.java | 3 +-
.../core/util/format/DateFormatSupplierTest.java | 6 +-
.../core/util/format/DefaultFormatterTest.java | 9 +-
.../core/util/format/FormatterFactoryTest.java | 3 +-
.../apache/accumulo/fate/AcceptableException.java | 12 +-
.../java/org/apache/accumulo/fate/AdminUtil.java | 56 +-
.../java/org/apache/accumulo/fate/AgeOffStore.java | 6 +-
.../main/java/org/apache/accumulo/fate/Fate.java | 21 +-
.../org/apache/accumulo/fate/ReadOnlyRepo.java | 4 +-
.../org/apache/accumulo/fate/ReadOnlyStore.java | 6 +-
.../org/apache/accumulo/fate/ReadOnlyTStore.java | 19 +-
.../main/java/org/apache/accumulo/fate/TStore.java | 7 +-
.../java/org/apache/accumulo/fate/ZooStore.java | 27 +-
.../org/apache/accumulo/fate/util/AddressUtil.java | 24 +-
.../apache/accumulo/fate/util/LoggingRunnable.java | 9 +-
.../java/org/apache/accumulo/fate/util/Retry.java | 47 +-
.../apache/accumulo/fate/util/UtilWaitThread.java | 8 +-
.../fate/zookeeper/DistributedReadWriteLock.java | 20 +-
.../apache/accumulo/fate/zookeeper/IZooReader.java | 9 +-
.../accumulo/fate/zookeeper/IZooReaderWriter.java | 24 +-
.../apache/accumulo/fate/zookeeper/ZooCache.java | 63 +-
.../accumulo/fate/zookeeper/ZooCacheFactory.java | 7 +-
.../apache/accumulo/fate/zookeeper/ZooLock.java | 49 +-
.../accumulo/fate/zookeeper/ZooQueueLock.java | 3 +-
.../apache/accumulo/fate/zookeeper/ZooReader.java | 42 +-
.../accumulo/fate/zookeeper/ZooReaderWriter.java | 43 +-
.../accumulo/fate/zookeeper/ZooReservation.java | 12 +-
.../apache/accumulo/fate/zookeeper/ZooSession.java | 18 +-
.../apache/accumulo/fate/zookeeper/ZooUtil.java | 72 +-
.../org/apache/accumulo/fate/AgeOffStoreTest.java | 12 +-
.../apache/accumulo/fate/ReadOnlyStoreTest.java | 6 +-
.../java/org/apache/accumulo/fate/SimpleStore.java | 6 +-
.../apache/accumulo/fate/util/AddressUtilTest.java | 15 +-
.../org/apache/accumulo/fate/util/RetryTest.java | 29 +-
.../accumulo/fate/zookeeper/ZooCacheTest.java | 24 +-
.../zookeeper/ZooKeeperConnectionInfoTest.java | 7 +-
.../fate/zookeeper/ZooReaderWriterTest.java | 17 +-
.../iteratortest/IteratorTestCaseFinder.java | 9 +-
.../accumulo/iteratortest/IteratorTestInput.java | 26 +-
.../accumulo/iteratortest/IteratorTestOutput.java | 11 +-
.../accumulo/iteratortest/IteratorTestReport.java | 6 +-
.../accumulo/iteratortest/IteratorTestRunner.java | 14 +-
.../accumulo/iteratortest/IteratorTestUtil.java | 3 +-
.../iteratortest/SimpleKVReusingIterator.java | 9 +-
.../environments/SimpleIteratorEnvironment.java | 3 +-
.../junit4/BaseJUnit4IteratorTest.java | 12 +-
.../testcases/InstantiationTestCase.java | 3 +-
.../testcases/IsolatedDeepCopiesTestCase.java | 24 +-
.../iteratortest/testcases/IteratorTestCase.java | 7 +-
.../testcases/MultipleHasTopCalls.java | 13 +-
.../testcases/OutputVerifyingTestCase.java | 3 +-
.../iteratortest/testcases/ReSeekTestCase.java | 20 +-
.../iteratortest/testcases/YieldingTestCase.java | 24 +-
.../iteratortest/framework/JUnitFrameworkTest.java | 3 +-
.../maven/plugin/AbstractAccumuloMojo.java | 6 +-
.../apache/accumulo/maven/plugin/StartMojo.java | 24 +-
.../org/apache/accumulo/maven/plugin/StopMojo.java | 6 +-
.../apache/accumulo/cluster/AccumuloCluster.java | 6 +-
.../apache/accumulo/cluster/ClusterControl.java | 9 +-
.../org/apache/accumulo/cluster/ClusterUser.java | 6 +-
.../org/apache/accumulo/cluster/ClusterUsers.java | 3 +-
.../org/apache/accumulo/cluster/RemoteShell.java | 12 +-
.../accumulo/cluster/RemoteShellOptions.java | 5 +-
.../standalone/StandaloneAccumuloCluster.java | 23 +-
.../standalone/StandaloneClusterControl.java | 54 +-
.../apache/accumulo/minicluster/MemoryUnit.java | 5 +-
.../accumulo/minicluster/MiniAccumuloCluster.java | 18 +-
.../accumulo/minicluster/MiniAccumuloConfig.java | 18 +-
.../accumulo/minicluster/MiniAccumuloInstance.java | 7 +-
.../accumulo/minicluster/MiniAccumuloRunner.java | 64 +-
.../apache/accumulo/minicluster/ServerType.java | 7 +-
.../impl/MiniAccumuloClusterControl.java | 16 +-
.../minicluster/impl/MiniAccumuloClusterImpl.java | 128 ++--
.../minicluster/impl/MiniAccumuloConfigImpl.java | 76 +-
.../minicluster/impl/ProcessReference.java | 3 +-
.../minicluster/impl/ZooKeeperBindException.java | 3 +-
.../standalone/StandaloneAccumuloClusterTest.java | 6 +-
.../standalone/StandaloneClusterControlTest.java | 15 +-
.../MiniAccumuloClusterExistingZooKeepersTest.java | 13 +-
.../MiniAccumuloClusterStartStopTest.java | 3 +-
.../minicluster/MiniAccumuloClusterTest.java | 20 +-
.../minicluster/impl/CleanShutdownMacTest.java | 6 +-
.../impl/MiniAccumuloClusterImplTest.java | 18 +-
.../impl/MiniAccumuloConfigImplTest.java | 15 +-
.../main/java/org/apache/accumulo/proxy/Proxy.java | 59 +-
.../org/apache/accumulo/proxy/ProxyServer.java | 769 +++++++++++++-------
.../main/java/org/apache/accumulo/proxy/Util.java | 15 +-
.../org/apache/accumulo/proxy/ProxyServerTest.java | 6 +-
.../java/org/apache/accumulo/server/Accumulo.java | 67 +-
.../accumulo/server/AccumuloServerContext.java | 27 +-
.../accumulo/server/GarbageCollectionLogger.java | 9 +-
.../accumulo/server/HighlyAvailableService.java | 4 +-
.../apache/accumulo/server/ServerConstants.java | 44 +-
.../accumulo/server/client/BulkImporter.java | 170 +++--
.../server/client/ClientServiceHandler.java | 181 +++--
.../accumulo/server/client/HdfsZooInstance.java | 27 +-
.../accumulo/server/conf/NamespaceConfWatcher.java | 13 +-
.../server/conf/NamespaceConfiguration.java | 12 +-
.../server/conf/ServerConfigurationFactory.java | 18 +-
.../accumulo/server/conf/TableConfWatcher.java | 13 +-
.../accumulo/server/conf/TableConfiguration.java | 15 +-
.../server/conf/ZooCachePropertyAccessor.java | 15 +-
.../accumulo/server/conf/ZooConfiguration.java | 6 +-
.../server/conf/ZooConfigurationFactory.java | 15 +-
.../server/constraints/MetadataConstraints.java | 60 +-
.../accumulo/server/data/ServerColumnUpdate.java | 3 +-
.../accumulo/server/data/ServerMutation.java | 6 +-
.../org/apache/accumulo/server/fs/FileRef.java | 8 +-
.../accumulo/server/fs/PerTableVolumeChooser.java | 66 +-
.../accumulo/server/fs/PreferredVolumeChooser.java | 61 +-
.../accumulo/server/fs/RandomVolumeChooser.java | 3 +-
.../org/apache/accumulo/server/fs/ViewFSUtils.java | 6 +-
.../apache/accumulo/server/fs/VolumeChooser.java | 12 +-
.../apache/accumulo/server/fs/VolumeManager.java | 18 +-
.../accumulo/server/fs/VolumeManagerImpl.java | 64 +-
.../org/apache/accumulo/server/fs/VolumeUtil.java | 56 +-
.../apache/accumulo/server/init/Initialize.java | 346 +++++----
.../server/iterators/MetadataBulkLoadFilter.java | 3 +-
.../apache/accumulo/server/log/SortedLogState.java | 5 +-
.../accumulo/server/log/WalStateManager.java | 6 +-
.../accumulo/server/master/LiveTServerSet.java | 81 ++-
.../master/balancer/ChaoticLoadBalancer.java | 22 +-
.../master/balancer/DefaultLoadBalancer.java | 33 +-
.../server/master/balancer/GroupBalancer.java | 93 ++-
.../balancer/HostRegexTableLoadBalancer.java | 130 ++--
.../server/master/balancer/RegexGroupBalancer.java | 35 +-
.../server/master/balancer/TableLoadBalancer.java | 25 +-
.../server/master/balancer/TabletBalancer.java | 86 ++-
.../server/master/recovery/HadoopLogCloser.java | 3 +-
.../accumulo/server/master/state/CurrentState.java | 3 +-
.../accumulo/server/master/state/MergeInfo.java | 3 +-
.../accumulo/server/master/state/MergeState.java | 6 +-
.../server/master/state/MetaDataStateStore.java | 21 +-
.../server/master/state/MetaDataTableScanner.java | 20 +-
.../server/master/state/RootTabletStateStore.java | 3 +-
.../server/master/state/TServerInstance.java | 6 +-
.../server/master/state/TabletLocationState.java | 26 +-
.../master/state/TabletStateChangeIterator.java | 15 +-
.../server/master/state/TabletStateStore.java | 46 +-
.../server/master/state/ZooTabletStateStore.java | 21 +-
.../master/tableOps/UserCompactionConfig.java | 3 +-
.../server/metrics/AbstractMetricsImpl.java | 16 +-
.../server/metrics/MetricsConfiguration.java | 15 +-
.../server/metrics/MetricsSystemHelper.java | 3 +-
.../accumulo/server/metrics/ThriftMetrics.java | 3 +-
.../accumulo/server/monitor/DedupedLogEvent.java | 6 +-
.../apache/accumulo/server/monitor/LogService.java | 6 +-
.../accumulo/server/problems/ProblemReport.java | 27 +-
.../server/problems/ProblemReportingIterator.java | 19 +-
.../accumulo/server/problems/ProblemReports.java | 33 +-
.../DistributedWorkQueueWorkAssignerHelper.java | 22 +-
.../replication/PrintReplicationRecords.java | 6 +-
.../accumulo/server/replication/ReplicaSystem.java | 6 +-
.../server/replication/ReplicaSystemFactory.java | 15 +-
.../server/replication/ReplicaSystemHelper.java | 10 +-
.../server/replication/ReplicationUtil.java | 33 +-
.../server/replication/StatusCombiner.java | 20 +-
.../server/replication/StatusFormatter.java | 10 +-
.../accumulo/server/replication/StatusUtil.java | 15 +-
.../replication/ZooKeeperInitialization.java | 6 +-
.../server/rpc/ClientInfoProcessorFactory.java | 3 +-
.../server/rpc/CustomNonBlockingServer.java | 25 +-
.../HighlyAvailableServiceInvocationHandler.java | 8 +-
.../server/rpc/HighlyAvailableServiceWrapper.java | 11 +-
.../org/apache/accumulo/server/rpc/RpcWrapper.java | 30 +-
.../server/rpc/SaslServerConnectionParams.java | 9 +-
.../rpc/SaslServerDigestCallbackHandler.java | 12 +-
.../rpc/TCredentialsUpdatingInvocationHandler.java | 67 +-
.../server/rpc/TCredentialsUpdatingWrapper.java | 13 +-
.../apache/accumulo/server/rpc/TServerUtils.java | 275 +++++---
.../accumulo/server/rpc/ThriftServerType.java | 10 +-
.../apache/accumulo/server/rpc/TimedProcessor.java | 6 +-
.../accumulo/server/rpc/UGIAssumingProcessor.java | 6 +-
.../server/security/AuditedSecurityOperation.java | 177 +++--
.../server/security/SecurityOperation.java | 391 ++++++----
.../accumulo/server/security/SecurityUtil.java | 36 +-
.../server/security/SystemCredentials.java | 15 +-
.../server/security/UserImpersonation.java | 27 +-
.../security/delegation/AuthenticationKey.java | 12 +-
.../delegation/AuthenticationTokenKeyManager.java | 21 +-
.../AuthenticationTokenSecretManager.java | 36 +-
.../ZooAuthenticationKeyDistributor.java | 36 +-
.../delegation/ZooAuthenticationKeyWatcher.java | 24 +-
.../server/security/handler/Authenticator.java | 11 +-
.../server/security/handler/Authorizor.java | 14 +-
.../security/handler/InsecureAuthenticator.java | 14 +-
.../security/handler/InsecurePermHandler.java | 54 +-
.../security/handler/KerberosAuthenticator.java | 30 +-
.../security/handler/KerberosAuthorizor.java | 24 +-
.../handler/KerberosPermissionHandler.java | 91 ++-
.../server/security/handler/PermissionHandler.java | 62 +-
.../server/security/handler/ZKAuthenticator.java | 29 +-
.../server/security/handler/ZKAuthorizor.java | 19 +-
.../server/security/handler/ZKPermHandler.java | 135 ++--
.../server/security/handler/ZKSecurityTool.java | 16 +-
.../accumulo/server/tables/TableManager.java | 160 +++--
.../server/tablets/UniqueNameAllocator.java | 26 +-
.../tabletserver/LargestFirstMemoryManager.java | 37 +-
.../server/tabletserver/MemoryManager.java | 14 +-
.../accumulo/server/util/AccumuloStatus.java | 3 +-
.../org/apache/accumulo/server/util/Admin.java | 96 ++-
.../apache/accumulo/server/util/ChangeSecret.java | 28 +-
.../server/util/CheckForMetadataProblems.java | 21 +-
.../accumulo/server/util/CleanZookeeper.java | 10 +-
.../apache/accumulo/server/util/DefaultMap.java | 3 +-
.../apache/accumulo/server/util/DumpZookeeper.java | 12 +-
.../accumulo/server/util/FileSystemMonitor.java | 6 +-
.../org/apache/accumulo/server/util/FileUtil.java | 146 ++--
.../accumulo/server/util/FindOfflineTablets.java | 21 +-
.../apache/accumulo/server/util/ListInstances.java | 23 +-
.../accumulo/server/util/ListVolumesUsed.java | 15 +-
.../apache/accumulo/server/util/LocalityCheck.java | 9 +-
.../accumulo/server/util/LoginProperties.java | 12 +-
.../accumulo/server/util/MasterMetadataUtil.java | 95 ++-
.../accumulo/server/util/MetadataTableUtil.java | 285 +++++---
.../accumulo/server/util/NamespacePropUtil.java | 21 +-
.../apache/accumulo/server/util/RandomWriter.java | 6 +-
.../accumulo/server/util/RandomizeVolumes.java | 14 +-
.../server/util/RemoveEntriesForMissingFiles.java | 17 +-
.../accumulo/server/util/ReplicationTableUtil.java | 30 +-
.../accumulo/server/util/RestoreZookeeper.java | 6 +-
.../accumulo/server/util/SendLogToChainsaw.java | 30 +-
.../accumulo/server/util/SystemPropUtil.java | 27 +-
.../accumulo/server/util/TableDiskUsage.java | 14 +-
.../apache/accumulo/server/util/TableInfoUtil.java | 3 +-
.../apache/accumulo/server/util/TablePropUtil.java | 18 +-
.../accumulo/server/util/TabletIterator.java | 32 +-
.../accumulo/server/util/TabletServerLocks.java | 3 +-
.../server/util/VerifyTabletAssignments.java | 22 +-
.../apache/accumulo/server/util/ZooKeeperMain.java | 12 +-
.../org/apache/accumulo/server/util/ZooZap.java | 6 +-
.../server/util/time/BaseRelativeTime.java | 3 +-
.../accumulo/server/util/time/SimpleTimer.java | 21 +-
.../server/zookeeper/DistributedWorkQueue.java | 21 +-
.../server/zookeeper/TransactionWatcher.java | 21 +-
.../apache/accumulo/server/zookeeper/ZooLock.java | 3 +-
.../accumulo/server/zookeeper/ZooQueueLock.java | 3 +-
.../accumulo/server/zookeeper/ZooReaderWriter.java | 3 +-
.../server/zookeeper/ZooReaderWriterFactory.java | 6 +-
.../accumulo/server/AccumuloServerContextTest.java | 42 +-
.../org/apache/accumulo/server/AccumuloTest.java | 6 +-
.../accumulo/server/ServerConstantsTest.java | 51 +-
.../org/apache/accumulo/server/ServerOptsTest.java | 3 +-
.../accumulo/server/client/BulkImporterTest.java | 52 +-
.../server/conf/NamespaceConfigurationTest.java | 27 +-
.../conf/ServerConfigurationFactoryTest.java | 3 +-
.../server/conf/TableConfigurationTest.java | 24 +-
.../constraints/MetadataConstraintsTest.java | 72 +-
.../org/apache/accumulo/server/fs/FileRefTest.java | 72 +-
.../apache/accumulo/server/fs/FileTypeTest.java | 75 +-
.../server/fs/PerTableVolumeChooserTest.java | 33 +-
.../server/fs/PreferredVolumeChooserTest.java | 33 +-
.../apache/accumulo/server/fs/ViewFSUtilsTest.java | 41 +-
.../accumulo/server/fs/VolumeManagerImplTest.java | 12 +-
.../apache/accumulo/server/fs/VolumeUtilTest.java | 153 ++--
.../accumulo/server/init/InitializeTest.java | 12 +-
.../iterators/MetadataBulkLoadFilterTest.java | 6 +-
.../accumulo/server/master/LiveTServerSetTest.java | 6 +-
.../BaseHostRegexTableLoadBalancerTest.java | 96 ++-
.../master/balancer/ChaoticLoadBalancerTest.java | 18 +-
.../master/balancer/DefaultLoadBalancerTest.java | 29 +-
.../server/master/balancer/GroupBalancerTest.java | 45 +-
...tRegexTableLoadBalancerReconfigurationTest.java | 24 +-
.../balancer/HostRegexTableLoadBalancerTest.java | 80 ++-
.../master/balancer/TableLoadBalancerTest.java | 29 +-
.../server/master/state/MergeInfoTest.java | 3 +-
.../server/problems/ProblemReportTest.java | 36 +-
.../server/replication/ReplicationUtilTest.java | 6 +-
.../server/replication/StatusCombinerTest.java | 114 ++-
.../server/replication/StatusUtilTest.java | 15 +-
.../replication/ZooKeeperInitializationTest.java | 12 +-
.../server/rpc/SaslDigestCallbackHandlerTest.java | 15 +-
.../server/rpc/SaslServerConnectionParamsTest.java | 3 +-
.../TCredentialsUpdatingInvocationHandlerTest.java | 63 +-
.../accumulo/server/rpc/ThriftServerTypeTest.java | 3 +-
.../server/security/SystemCredentialsTest.java | 27 +-
.../server/security/UserImpersonationTest.java | 18 +-
.../security/delegation/AuthenticationKeyTest.java | 9 +-
.../AuthenticationTokenKeyManagerTest.java | 32 +-
.../AuthenticationTokenSecretManagerTest.java | 99 ++-
.../ZooAuthenticationKeyDistributorTest.java | 70 +-
.../ZooAuthenticationKeyWatcherTest.java | 68 +-
.../security/handler/ZKAuthenticatorTest.java | 6 +-
.../IllegalTableTransitionExceptionTest.java | 6 +-
.../org/apache/accumulo/server/util/AdminTest.java | 23 +-
.../accumulo/server/util/DefaultMapTest.java | 3 +-
.../server/util/FileSystemMonitorTest.java | 33 +-
.../apache/accumulo/server/util/FileUtilTest.java | 15 +-
.../server/util/ReplicationTableUtilTest.java | 21 +-
.../accumulo/server/util/TServerUtilsTest.java | 47 +-
.../server/util/time/BaseRelativeTimeTest.java | 3 +-
.../accumulo/gc/GarbageCollectWriteAheadLogs.java | 43 +-
.../accumulo/gc/GarbageCollectionAlgorithm.java | 60 +-
.../accumulo/gc/GarbageCollectionEnvironment.java | 37 +-
.../apache/accumulo/gc/SimpleGarbageCollector.java | 108 ++-
.../replication/CloseWriteAheadLogReferences.java | 30 +-
.../gc/GarbageCollectWriteAheadLogsTest.java | 60 +-
.../apache/accumulo/gc/GarbageCollectionTest.java | 47 +-
.../accumulo/gc/SimpleGarbageCollectorTest.java | 30 +-
.../apache/accumulo/master/FateServiceHandler.java | 248 ++++---
.../java/org/apache/accumulo/master/Master.java | 298 +++++---
.../master/MasterClientServiceHandler.java | 150 ++--
.../org/apache/accumulo/master/MasterTime.java | 21 +-
.../apache/accumulo/master/TabletGroupWatcher.java | 145 ++--
.../master/metrics/Metrics2ReplicationMetrics.java | 23 +-
.../master/metrics/ReplicationMetrics.java | 4 +-
.../master/metrics/ReplicationMetricsMBean.java | 14 +-
.../accumulo/master/recovery/RecoveryManager.java | 35 +-
.../DistributedWorkQueueWorkAssigner.java | 31 +-
.../master/replication/FinishedWorkUpdater.java | 32 +-
.../replication/MasterReplicationCoordinator.java | 23 +-
.../RemoveCompleteReplicationRecords.java | 30 +-
.../master/replication/ReplicationDriver.java | 6 +-
.../master/replication/SequentialWorkAssigner.java | 30 +-
.../accumulo/master/replication/StatusMaker.java | 34 +-
.../master/replication/UnorderedWorkAssigner.java | 26 +-
.../accumulo/master/replication/WorkMaker.java | 9 +-
.../apache/accumulo/master/state/MergeStats.java | 51 +-
.../apache/accumulo/master/state/SetGoalState.java | 8 +-
.../accumulo/master/tableOps/BulkImport.java | 35 +-
.../master/tableOps/CancelCompactions.java | 7 +-
.../accumulo/master/tableOps/ChangeTableState.java | 6 +-
.../apache/accumulo/master/tableOps/ChooseDir.java | 6 +-
.../apache/accumulo/master/tableOps/CleanUp.java | 27 +-
.../master/tableOps/CleanUpBulkImport.java | 3 +-
.../accumulo/master/tableOps/CloneMetadata.java | 14 +-
.../accumulo/master/tableOps/ClonePermissions.java | 9 +-
.../accumulo/master/tableOps/CloneTable.java | 10 +-
.../accumulo/master/tableOps/CloneZookeeper.java | 9 +-
.../accumulo/master/tableOps/CompactRange.java | 35 +-
.../accumulo/master/tableOps/CompactionDriver.java | 26 +-
.../accumulo/master/tableOps/CopyFailed.java | 16 +-
.../accumulo/master/tableOps/CreateImportDir.java | 3 +-
.../accumulo/master/tableOps/CreateNamespace.java | 3 +-
.../accumulo/master/tableOps/CreateTable.java | 3 +-
.../accumulo/master/tableOps/DeleteTable.java | 3 +-
.../accumulo/master/tableOps/ExportTable.java | 3 +-
.../accumulo/master/tableOps/FinishCloneTable.java | 9 +-
.../master/tableOps/FinishCreateNamespace.java | 3 +-
.../master/tableOps/FinishCreateTable.java | 3 +-
.../master/tableOps/FinishImportTable.java | 3 +-
.../master/tableOps/ImportPopulateZookeeper.java | 16 +-
.../master/tableOps/ImportSetupPermissions.java | 6 +-
.../accumulo/master/tableOps/ImportTable.java | 9 +-
.../apache/accumulo/master/tableOps/LoadFiles.java | 23 +-
.../master/tableOps/MapImportFileNames.java | 5 +-
.../master/tableOps/MoveExportedFiles.java | 10 +-
.../accumulo/master/tableOps/PopulateMetadata.java | 6 +-
.../master/tableOps/PopulateMetadataTable.java | 48 +-
.../master/tableOps/PopulateZookeeper.java | 6 +-
.../tableOps/PopulateZookeeperWithNamespace.java | 12 +-
.../accumulo/master/tableOps/RenameNamespace.java | 10 +-
.../accumulo/master/tableOps/RenameTable.java | 21 +-
.../master/tableOps/SetupNamespacePermissions.java | 3 +-
.../accumulo/master/tableOps/SetupPermissions.java | 6 +-
.../accumulo/master/tableOps/TableRangeOp.java | 13 +-
.../accumulo/master/tableOps/TableRangeOpWait.java | 18 +-
.../org/apache/accumulo/master/tableOps/Utils.java | 65 +-
.../accumulo/master/tableOps/WriteExportFiles.java | 64 +-
.../master/tserverOps/ShutdownTServer.java | 6 +-
.../org/apache/accumulo/master/util/FateAdmin.java | 4 +-
.../accumulo/master/util/TableValidators.java | 11 +-
.../metrics/Metrics2ReplicationMetricsTest.java | 3 +-
...DistributedWorkQueueWorkAssignerHelperTest.java | 3 +-
.../replication/SequentialWorkAssignerTest.java | 26 +-
.../replication/UnorderedWorkAssignerTest.java | 20 +-
.../accumulo/master/replication/WorkMakerTest.java | 6 +-
.../master/state/RootTabletStateStoreTest.java | 3 +-
.../accumulo/master/tableOps/ImportTableTest.java | 9 +-
.../apache/accumulo/monitor/EmbeddedWebServer.java | 9 +-
.../java/org/apache/accumulo/monitor/Monitor.java | 100 ++-
.../apache/accumulo/monitor/ZooKeeperStatus.java | 6 +-
.../apache/accumulo/monitor/rest/XMLResource.java | 3 +-
.../rest/bulkImports/BulkImportResource.java | 10 +-
.../TabletServerBulkImportInformation.java | 3 +-
.../accumulo/monitor/rest/logs/LogResource.java | 7 +-
.../monitor/rest/master/MasterInformation.java | 11 +-
.../monitor/rest/master/MasterResource.java | 23 +-
.../rest/problems/ProblemDetailInformation.java | 3 +-
.../rest/problems/ProblemSummaryInformation.java | 3 +-
.../monitor/rest/problems/ProblemsResource.java | 43 +-
.../rest/replication/ReplicationInformation.java | 3 +-
.../rest/replication/ReplicationResource.java | 18 +-
.../rest/statistics/StatisticsResource.java | 3 +-
.../monitor/rest/status/StatusInformation.java | 3 +-
.../monitor/rest/status/StatusResource.java | 8 +-
.../monitor/rest/tables/TableInformation.java | 3 +-
.../monitor/rest/tables/TablesResource.java | 18 +-
.../monitor/rest/trace/TraceInformation.java | 3 +-
.../monitor/rest/trace/TracesResource.java | 31 +-
.../rest/tservers/AllTimeTabletResults.java | 4 +-
.../monitor/rest/tservers/CurrentOperations.java | 5 +-
.../rest/tservers/CurrentTabletResults.java | 3 +-
.../accumulo/monitor/rest/tservers/ServerStat.java | 6 +-
.../tservers/TabletServerDetailInformation.java | 3 +-
.../rest/tservers/TabletServerResource.java | 89 ++-
.../monitor/rest/tservers/TabletServerSummary.java | 3 +-
.../tservers/TabletServerWithTableInformation.java | 3 +-
.../monitor/util/AccumuloMonitorAppender.java | 21 +-
.../org/apache/accumulo/monitor/view/WebViews.java | 36 +-
.../accumulo/monitor/ShowTraceLinkTypeTest.java | 3 +-
.../accumulo/monitor/ZooKeeperStatusTest.java | 3 +-
.../org/apache/accumulo/monitor/it/WebViewsIT.java | 32 +-
.../rest/tservers/TabletServerInformationTest.java | 6 +-
.../monitor/util/AccumuloMonitorAppenderTest.java | 15 +-
.../monitor/util/ParameterValidatorTest.java | 9 +-
.../apache/accumulo/tracer/AsyncSpanReceiver.java | 9 +-
.../apache/accumulo/tracer/SendSpansViaThrift.java | 3 +-
.../java/org/apache/accumulo/tracer/SpanTree.java | 3 +-
.../java/org/apache/accumulo/tracer/TraceDump.java | 19 +-
.../org/apache/accumulo/tracer/TraceFormatter.java | 6 +-
.../org/apache/accumulo/tracer/TraceServer.java | 85 ++-
.../apache/accumulo/tracer/TraceTableStats.java | 17 +-
.../org/apache/accumulo/tracer/ZooTraceClient.java | 6 +-
.../accumulo/tracer/AsyncSpanReceiverTest.java | 9 +-
.../org/apache/accumulo/tracer/TracerTest.java | 16 +-
.../apache/accumulo/tracer/ZooTraceClientTest.java | 12 +-
.../accumulo/tserver/ActiveAssignmentRunnable.java | 9 +-
.../apache/accumulo/tserver/CompactionQueue.java | 6 +-
.../accumulo/tserver/ConditionCheckerContext.java | 30 +-
.../accumulo/tserver/ConditionalMutationSet.java | 15 +-
.../org/apache/accumulo/tserver/FileManager.java | 60 +-
.../org/apache/accumulo/tserver/InMemoryMap.java | 69 +-
.../java/org/apache/accumulo/tserver/MemKey.java | 3 +-
.../accumulo/tserver/MemKeyConversionIterator.java | 3 +-
.../java/org/apache/accumulo/tserver/MemValue.java | 3 +-
.../org/apache/accumulo/tserver/NativeMap.java | 92 ++-
.../java/org/apache/accumulo/tserver/RowLocks.java | 6 +-
.../tserver/TConstraintViolationException.java | 3 +-
.../tserver/TabletIteratorEnvironment.java | 29 +-
.../org/apache/accumulo/tserver/TabletServer.java | 785 ++++++++++++++-------
.../tserver/TabletServerResourceManager.java | 119 ++--
.../accumulo/tserver/TservConstraintEnv.java | 4 +-
.../org/apache/accumulo/tserver/WriteTracker.java | 7 +-
.../tserver/compaction/CompactionPlan.java | 7 +-
.../tserver/compaction/CompactionStrategy.java | 49 +-
.../compaction/DefaultCompactionStrategy.java | 3 +-
.../compaction/EverythingCompactionStrategy.java | 3 +-
.../tserver/compaction/MajorCompactionReason.java | 5 +-
.../tserver/compaction/MajorCompactionRequest.java | 62 +-
.../compaction/TwoTierCompactionStrategy.java | 27 +-
.../strategies/ConfigurableCompactionStrategy.java | 46 +-
.../TooManyDeletesCompactionStrategy.java | 69 +-
.../tserver/constraints/ConstraintChecker.java | 15 +-
.../tserver/data/ServerConditionalMutation.java | 3 +-
.../org/apache/accumulo/tserver/log/DfsLogger.java | 95 ++-
.../org/apache/accumulo/tserver/log/LogSorter.java | 18 +-
.../apache/accumulo/tserver/log/MultiReader.java | 8 +-
.../accumulo/tserver/log/SortedLogRecovery.java | 38 +-
.../accumulo/tserver/log/TabletServerLogger.java | 69 +-
.../apache/accumulo/tserver/logger/LogEvents.java | 7 +-
.../apache/accumulo/tserver/logger/LogFileKey.java | 6 +-
.../accumulo/tserver/logger/LogFileValue.java | 8 +-
.../apache/accumulo/tserver/logger/LogReader.java | 6 +-
.../tserver/mastermessage/MasterMessage.java | 3 +-
.../tserver/mastermessage/SplitReportMessage.java | 6 +-
.../tserver/mastermessage/TabletStatusMessage.java | 3 +-
.../metrics/Metrics2TabletServerMetrics.java | 46 +-
.../metrics/Metrics2TabletServerMinCMetrics.java | 6 +-
.../metrics/Metrics2TabletServerScanMetrics.java | 6 +-
.../metrics/Metrics2TabletServerUpdateMetrics.java | 30 +-
.../tserver/metrics/TabletServerMBeanImpl.java | 4 +-
.../metrics/TabletServerMetricsFactory.java | 3 +-
.../tserver/metrics/TabletServerMinCMetrics.java | 10 +-
.../tserver/metrics/TabletServerScanMetrics.java | 10 +-
.../tserver/metrics/TabletServerUpdateMetrics.java | 11 +-
.../tserver/replication/AccumuloReplicaSystem.java | 211 ++++--
.../BatchWriterReplicationReplayer.java | 41 +-
.../tserver/replication/ReplicationProcessor.java | 21 +-
.../replication/ReplicationServicerHandler.java | 23 +-
.../tserver/replication/ReplicationWorker.java | 9 +-
.../apache/accumulo/tserver/scan/LookupTask.java | 24 +-
.../accumulo/tserver/scan/NextBatchTask.java | 17 +-
.../org/apache/accumulo/tserver/scan/ScanTask.java | 9 +-
.../tserver/session/ConditionalSession.java | 3 +-
.../accumulo/tserver/session/MultiScanSession.java | 6 +-
.../accumulo/tserver/session/ScanSession.java | 5 +-
.../accumulo/tserver/session/SessionManager.java | 32 +-
.../tserver/tablet/BulkImportCacheCleaner.java | 3 +-
.../accumulo/tserver/tablet/CompactionInfo.java | 9 +-
.../accumulo/tserver/tablet/CompactionRunner.java | 3 +-
.../accumulo/tserver/tablet/CompactionWatcher.java | 14 +-
.../apache/accumulo/tserver/tablet/Compactor.java | 50 +-
.../accumulo/tserver/tablet/CountingIterator.java | 3 +-
.../accumulo/tserver/tablet/DatafileManager.java | 115 ++-
.../tserver/tablet/MinorCompactionTask.java | 23 +-
.../accumulo/tserver/tablet/MinorCompactor.java | 68 +-
.../apache/accumulo/tserver/tablet/RootFiles.java | 30 +-
.../accumulo/tserver/tablet/ScanDataSource.java | 70 +-
.../accumulo/tserver/tablet/ScanOptions.java | 6 +-
.../apache/accumulo/tserver/tablet/Scanner.java | 22 +-
.../org/apache/accumulo/tserver/tablet/Tablet.java | 549 ++++++++------
.../apache/accumulo/tserver/tablet/TabletData.java | 13 +-
.../accumulo/tserver/tablet/TabletMemory.java | 3 +-
.../accumulo/tserver/CheckTabletMetadataTest.java | 24 +-
.../apache/accumulo/tserver/InMemoryMapTest.java | 55 +-
.../tserver/LargestFirstMemoryManagerTest.java | 85 ++-
.../tserver/TabletServerSyncCheckTest.java | 12 +-
.../accumulo/tserver/TservConstraintEnvTest.java | 9 +-
.../compaction/DefaultCompactionStrategyTest.java | 24 +-
.../SizeLimitCompactionStrategyTest.java | 12 +-
.../compaction/TwoTierCompactionStrategyTest.java | 19 +-
.../ConfigurableCompactionStrategyTest.java | 15 +-
.../accumulo/tserver/log/MultiReaderTest.java | 8 +-
.../tserver/log/SortedLogRecoveryTest.java | 215 ++++--
.../tserver/log/TestUpgradePathForWALogs.java | 16 +-
.../accumulo/tserver/logger/LogFileTest.java | 11 +-
.../replication/AccumuloReplicaSystemTest.java | 74 +-
.../BatchWriterReplicationReplayerTest.java | 6 +-
.../replication/ReplicationProcessorTest.java | 6 +-
.../tserver/tablet/DatafileManagerTest.java | 27 +-
.../accumulo/tserver/tablet/RootFilesTest.java | 12 +-
.../apache/accumulo/tserver/tablet/TabletTest.java | 9 +-
.../main/java/org/apache/accumulo/shell/Shell.java | 249 ++++---
.../org/apache/accumulo/shell/ShellCompletor.java | 3 +-
.../org/apache/accumulo/shell/ShellOptionsJC.java | 64 +-
.../java/org/apache/accumulo/shell/ShellUtil.java | 5 +-
.../accumulo/shell/commands/AboutCommand.java | 3 +-
.../shell/commands/ActiveCompactionIterator.java | 15 +-
.../shell/commands/ActiveScanIterator.java | 15 +-
.../accumulo/shell/commands/AddAuthsCommand.java | 12 +-
.../accumulo/shell/commands/AddSplitsCommand.java | 9 +-
.../shell/commands/AuthenticateCommand.java | 9 +-
.../shell/commands/BulkImportListIterator.java | 3 +-
.../accumulo/shell/commands/ClearCommand.java | 3 +-
.../accumulo/shell/commands/CloneTableCommand.java | 20 +-
.../accumulo/shell/commands/CompactCommand.java | 53 +-
.../accumulo/shell/commands/ConfigCommand.java | 76 +-
.../accumulo/shell/commands/ConstraintCommand.java | 40 +-
.../shell/commands/CreateNamespaceCommand.java | 12 +-
.../shell/commands/CreateTableCommand.java | 79 ++-
.../accumulo/shell/commands/CreateUserCommand.java | 11 +-
.../apache/accumulo/shell/commands/DUCommand.java | 19 +-
.../accumulo/shell/commands/DebugCommand.java | 12 +-
.../shell/commands/DeleteAuthsCommand.java | 9 +-
.../accumulo/shell/commands/DeleteCommand.java | 8 +-
.../accumulo/shell/commands/DeleteIterCommand.java | 27 +-
.../accumulo/shell/commands/DeleteManyCommand.java | 14 +-
.../shell/commands/DeleteNamespaceCommand.java | 12 +-
.../accumulo/shell/commands/DeleteRowsCommand.java | 9 +-
.../shell/commands/DeleteScanIterCommand.java | 15 +-
.../shell/commands/DeleteShellIterCommand.java | 6 +-
.../shell/commands/DeleteTableCommand.java | 3 +-
.../accumulo/shell/commands/DropUserCommand.java | 12 +-
.../accumulo/shell/commands/EGrepCommand.java | 9 +-
.../accumulo/shell/commands/ExecfileCommand.java | 6 +-
.../shell/commands/ExportTableCommand.java | 8 +-
.../accumulo/shell/commands/FateCommand.java | 28 +-
.../accumulo/shell/commands/FlushCommand.java | 6 +-
.../accumulo/shell/commands/FormatterCommand.java | 19 +-
.../accumulo/shell/commands/GetAuthsCommand.java | 6 +-
.../accumulo/shell/commands/GetGroupsCommand.java | 9 +-
.../accumulo/shell/commands/GetSplitsCommand.java | 33 +-
.../accumulo/shell/commands/GrantCommand.java | 37 +-
.../accumulo/shell/commands/GrepCommand.java | 12 +-
.../accumulo/shell/commands/HelpCommand.java | 21 +-
.../accumulo/shell/commands/HiddenCommand.java | 13 +-
.../accumulo/shell/commands/HistoryCommand.java | 6 +-
.../shell/commands/ImportDirectoryCommand.java | 7 +-
.../shell/commands/ImportTableCommand.java | 5 +-
.../accumulo/shell/commands/InsertCommand.java | 17 +-
.../shell/commands/InterpreterCommand.java | 6 +-
.../accumulo/shell/commands/ListBulkCommand.java | 6 +-
.../shell/commands/ListCompactionsCommand.java | 3 +-
.../accumulo/shell/commands/ListIterCommand.java | 39 +-
.../accumulo/shell/commands/ListScansCommand.java | 3 +-
.../shell/commands/ListShellIterCommand.java | 12 +-
.../accumulo/shell/commands/MaxRowCommand.java | 7 +-
.../accumulo/shell/commands/MergeCommand.java | 15 +-
.../commands/NamespacePermissionsCommand.java | 3 +-
.../accumulo/shell/commands/NamespacesCommand.java | 9 +-
.../accumulo/shell/commands/NoTableCommand.java | 3 +-
.../accumulo/shell/commands/OfflineCommand.java | 6 +-
.../accumulo/shell/commands/OnlineCommand.java | 6 +-
.../apache/accumulo/shell/commands/OptUtil.java | 16 +-
.../accumulo/shell/commands/PasswdCommand.java | 15 +-
.../accumulo/shell/commands/PingCommand.java | 3 +-
.../shell/commands/QuotedStringTokenizer.java | 13 +-
.../shell/commands/RenameNamespaceCommand.java | 8 +-
.../shell/commands/RenameTableCommand.java | 8 +-
.../accumulo/shell/commands/RevokeCommand.java | 37 +-
.../accumulo/shell/commands/ScanCommand.java | 130 ++--
.../accumulo/shell/commands/ScriptCommand.java | 6 +-
.../accumulo/shell/commands/SetAuthsCommand.java | 12 +-
.../accumulo/shell/commands/SetGroupsCommand.java | 3 +-
.../accumulo/shell/commands/SetIterCommand.java | 98 ++-
.../shell/commands/SetScanIterCommand.java | 18 +-
.../shell/commands/SetShellIterCommand.java | 11 +-
.../commands/ShellPluginConfigurationCommand.java | 40 +-
.../accumulo/shell/commands/SleepCommand.java | 3 +-
.../accumulo/shell/commands/SummariesCommand.java | 10 +-
.../shell/commands/SystemPermissionsCommand.java | 3 +-
.../accumulo/shell/commands/TableCommand.java | 7 +-
.../accumulo/shell/commands/TableOperation.java | 21 +-
.../shell/commands/TablePermissionsCommand.java | 3 +-
.../accumulo/shell/commands/TablesCommand.java | 14 +-
.../accumulo/shell/commands/TraceCommand.java | 15 +-
.../accumulo/shell/commands/UserCommand.java | 6 +-
.../shell/commands/UserPermissionsCommand.java | 12 +-
.../accumulo/shell/commands/UsersCommand.java | 3 +-
.../accumulo/shell/commands/WhoAmICommand.java | 3 +-
.../accumulo/shell/format/DeleterFormatter.java | 9 +-
.../org/apache/accumulo/shell/mock/MockShell.java | 8 +-
.../org/apache/accumulo/shell/ShellConfigTest.java | 6 +-
.../accumulo/shell/ShellSetInstanceTest.java | 18 +-
.../java/org/apache/accumulo/shell/ShellTest.java | 43 +-
.../org/apache/accumulo/shell/ShellUtilTest.java | 6 +-
.../shell/commands/CompactCommandTest.java | 3 +-
.../shell/commands/DeleteAuthsCommandTest.java | 9 +-
.../shell/commands/DeleteManyCommandTest.java | 3 +-
.../shell/commands/DeleteRowsCommandTest.java | 3 +-
.../shell/commands/DeleteTableCommandTest.java | 3 +-
.../accumulo/shell/commands/FlushCommandTest.java | 3 +-
.../shell/commands/HistoryCommandTest.java | 6 +-
.../accumulo/shell/commands/MergeCommandTest.java | 3 +-
.../accumulo/shell/commands/ScanCommandTest.java | 3 +-
.../shell/commands/SetIterCommandTest.java | 24 +-
.../shell/format/DeleterFormatterTest.java | 18 +-
.../main/java/org/apache/accumulo/start/Main.java | 57 +-
.../java/org/apache/accumulo/start/TestMain.java | 5 +-
.../start/classloader/AccumuloClassLoader.java | 38 +-
.../vfs/AccumuloReloadingVFSClassLoader.java | 17 +-
.../classloader/vfs/AccumuloVFSClassLoader.java | 54 +-
.../start/classloader/vfs/ContextManager.java | 9 +-
.../vfs/PostDelegatingVFSClassLoader.java | 6 +-
.../classloader/vfs/UniqueFileReplicator.java | 3 +-
.../accumulo/start/spi/KeywordExecutable.java | 18 +-
.../test/categories/MiniClusterOnlyTests.java | 3 +-
.../accumulo/test/categories/MonitorTests.java | 3 +-
.../accumulo/test/categories/PerformanceTests.java | 8 +-
.../categories/StandaloneCapableClusterTests.java | 4 +-
.../accumulo/test/categories/SunnyDayTests.java | 4 +-
.../accumulo/test/categories/package-info.java | 1 -
.../classloader/vfs/AccumuloClasspathTest.java | 6 +-
.../vfs/AccumuloReloadingVFSClassLoaderTest.java | 76 +-
.../vfs/AccumuloVFSClassLoaderTest.java | 33 +-
.../start/classloader/vfs/ContextManagerTest.java | 12 +-
.../accumulo/start/test/AccumuloDFSBase.java | 10 +-
.../accumulo/harness/AccumuloClusterHarness.java | 74 +-
.../apache/accumulo/harness/AccumuloITBase.java | 28 +-
.../harness/MiniClusterConfigurationCallback.java | 3 +-
.../accumulo/harness/MiniClusterHarness.java | 108 ++-
.../accumulo/harness/SharedMiniClusterBase.java | 55 +-
.../org/apache/accumulo/harness/TestingKdc.java | 9 +-
.../conf/AccumuloClusterPropertyConfiguration.java | 18 +-
.../conf/AccumuloMiniClusterConfiguration.java | 6 +-
.../StandaloneAccumuloClusterConfiguration.java | 54 +-
.../accumulo/test/ArbitraryTablePropertiesIT.java | 12 +-
.../org/apache/accumulo/test/AuditMessageIT.java | 234 +++---
.../accumulo/test/BadDeleteMarkersCreatedIT.java | 6 +-
.../accumulo/test/BatchWriterInTabletServerIT.java | 19 +-
.../apache/accumulo/test/BatchWriterIterator.java | 50 +-
.../accumulo/test/BulkImportMonitoringIT.java | 10 +-
.../accumulo/test/BulkImportSequentialRowsIT.java | 12 +-
.../java/org/apache/accumulo/test/CleanWalIT.java | 6 +-
.../apache/accumulo/test/ClientSideIteratorIT.java | 9 +-
.../java/org/apache/accumulo/test/CloneIT.java | 30 +-
.../accumulo/test/CompactionRateLimitingIT.java | 10 +-
.../apache/accumulo/test/ConditionalWriterIT.java | 311 +++++---
.../test/ConfigurableMajorCompactionIT.java | 3 +-
.../org/apache/accumulo/test/CreateRFiles.java | 11 +-
.../apache/accumulo/test/CreateRandomRFile.java | 3 +-
.../accumulo/test/DetectDeadTabletServersIT.java | 3 +-
.../org/apache/accumulo/test/DumpConfigIT.java | 10 +-
.../accumulo/test/EstimateInMemMapOverhead.java | 6 +-
.../org/apache/accumulo/test/ExistingMacIT.java | 22 +-
.../accumulo/test/FaultyConditionalWriter.java | 6 +-
.../org/apache/accumulo/test/FileArchiveIT.java | 33 +-
.../java/org/apache/accumulo/test/FindMaxIT.java | 30 +-
.../apache/accumulo/test/GarbageCollectWALIT.java | 3 +-
.../accumulo/test/GenerateSequentialRFile.java | 6 +-
.../apache/accumulo/test/GetFileInfoBulkIT.java | 7 +-
.../org/apache/accumulo/test/GetMasterStats.java | 3 +-
.../org/apache/accumulo/test/HardListIterator.java | 30 +-
.../org/apache/accumulo/test/IMMLGBenchmark.java | 19 +-
.../org/apache/accumulo/test/ImportExportIT.java | 30 +-
.../org/apache/accumulo/test/InMemoryMapIT.java | 81 ++-
.../accumulo/test/InMemoryMapMemoryUsageTest.java | 3 +-
.../accumulo/test/InterruptibleScannersIT.java | 6 +-
.../accumulo/test/IsolationAndDeepCopyIT.java | 9 +-
.../apache/accumulo/test/KeyValueEqualityIT.java | 10 +-
.../org/apache/accumulo/test/LargeSplitRowIT.java | 48 +-
.../java/org/apache/accumulo/test/LocatorIT.java | 16 +-
.../java/org/apache/accumulo/test/ManySplitIT.java | 3 +-
.../test/MasterRepairsDualAssignmentIT.java | 6 +-
.../org/apache/accumulo/test/MemoryUsageTest.java | 8 +-
.../accumulo/test/MetaConstraintRetryIT.java | 3 +-
.../apache/accumulo/test/MetaGetsReadersIT.java | 3 +-
.../java/org/apache/accumulo/test/MetaSplitIT.java | 9 +-
.../test/MissingWalHeaderCompletesRecoveryIT.java | 33 +-
.../accumulo/test/MultiTableBatchWriterIT.java | 12 +-
.../apache/accumulo/test/MultiTableRecoveryIT.java | 3 +-
.../org/apache/accumulo/test/NamespacesIT.java | 155 ++--
.../accumulo/test/NativeMapConcurrencyTest.java | 9 +-
.../accumulo/test/NativeMapPerformanceTest.java | 18 +-
.../apache/accumulo/test/NativeMapStressTest.java | 29 +-
.../accumulo/test/NewTableConfigurationIT.java | 217 ++++--
.../org/apache/accumulo/test/NullBatchWriter.java | 3 +-
.../org/apache/accumulo/test/OrIteratorIT.java | 21 +-
.../apache/accumulo/test/QueryMetadataTable.java | 6 +-
.../accumulo/test/RewriteTabletDirectoriesIT.java | 24 +-
.../java/org/apache/accumulo/test/SampleIT.java | 56 +-
.../org/apache/accumulo/test/ShellConfigIT.java | 21 +-
.../org/apache/accumulo/test/ShellServerIT.java | 235 +++---
.../org/apache/accumulo/test/SplitRecoveryIT.java | 9 +-
.../accumulo/test/TableConfigurationUpdateIT.java | 13 +-
.../apache/accumulo/test/TableOperationsIT.java | 50 +-
.../org/apache/accumulo/test/TestBinaryRows.java | 37 +-
.../java/org/apache/accumulo/test/TestIngest.java | 43 +-
.../apache/accumulo/test/TestMultiTableIngest.java | 9 +-
.../apache/accumulo/test/TestRandomDeletes.java | 19 +-
.../apache/accumulo/test/TextMemoryUsageTest.java | 4 +-
.../ThriftServerBindsBeforeZooKeeperLockIT.java | 30 +-
.../org/apache/accumulo/test/TotalQueuedIT.java | 17 +-
.../test/TracerRecoversAfterOfflineTableIT.java | 3 +-
.../apache/accumulo/test/TransportCachingIT.java | 9 +-
.../java/org/apache/accumulo/test/UnusedWALIT.java | 9 +-
.../accumulo/test/UserCompactionStrategyIT.java | 57 +-
.../java/org/apache/accumulo/test/UsersIT.java | 9 +-
.../org/apache/accumulo/test/VerifyIngest.java | 39 +-
.../accumulo/test/VerifySerialRecoveryIT.java | 3 +-
.../accumulo/test/VolumeChooserFailureIT.java | 27 +-
.../org/apache/accumulo/test/VolumeChooserIT.java | 105 ++-
.../java/org/apache/accumulo/test/VolumeIT.java | 71 +-
.../org/apache/accumulo/test/WaitForBalanceIT.java | 9 +-
.../org/apache/accumulo/test/WrongTabletTest.java | 5 +-
.../org/apache/accumulo/test/YieldScannersIT.java | 30 +-
.../test/constraints/NumericValueConstraint.java | 3 +-
.../accumulo/test/functional/AddSplitIT.java | 3 +-
.../accumulo/test/functional/AuthsIterator.java | 3 +-
.../accumulo/test/functional/BackupMasterIT.java | 3 +-
.../test/functional/BadIteratorMincIT.java | 3 +-
.../functional/BalanceAfterCommsFailureIT.java | 16 +-
.../BalanceInPresenceOfOfflineTableIT.java | 19 +-
.../accumulo/test/functional/BatchScanSplitIT.java | 9 +-
.../test/functional/BatchWriterFlushIT.java | 15 +-
.../accumulo/test/functional/BigRootTabletIT.java | 9 +-
.../accumulo/test/functional/BloomFilterIT.java | 30 +-
.../accumulo/test/functional/BulkFileIT.java | 18 +-
.../apache/accumulo/test/functional/BulkIT.java | 11 +-
.../test/functional/BulkSplitOptimizationIT.java | 9 +-
.../test/functional/ChaoticBalancerIT.java | 6 +-
.../accumulo/test/functional/ClassLoaderIT.java | 9 +-
.../apache/accumulo/test/functional/CleanUpIT.java | 14 +-
.../accumulo/test/functional/CloneTestIT.java | 26 +-
.../accumulo/test/functional/CombinerIT.java | 3 +-
.../accumulo/test/functional/CompactionIT.java | 3 +-
.../accumulo/test/functional/ConcurrencyIT.java | 8 +-
.../test/functional/ConcurrentDeleteTableIT.java | 3 +-
.../test/functional/ConfigurableCompactionIT.java | 21 +-
.../test/functional/ConfigurableMacBase.java | 39 +-
.../accumulo/test/functional/ConnectorIT.java | 6 +-
.../accumulo/test/functional/ConstraintIT.java | 63 +-
.../accumulo/test/functional/CreateAndUseIT.java | 3 +-
.../accumulo/test/functional/CredentialsIT.java | 6 +-
.../test/functional/DeleteEverythingIT.java | 6 +-
.../apache/accumulo/test/functional/DeleteIT.java | 15 +-
.../accumulo/test/functional/DeleteRowsIT.java | 10 +-
.../accumulo/test/functional/DropModIter.java | 6 +-
.../accumulo/test/functional/DurabilityIT.java | 3 +-
.../test/functional/DynamicThreadPoolsIT.java | 3 +-
.../test/functional/FunctionalTestUtils.java | 36 +-
.../test/functional/GarbageCollectorIT.java | 18 +-
.../test/functional/HalfDeadTServerIT.java | 16 +-
.../accumulo/test/functional/KerberosIT.java | 222 +++---
.../accumulo/test/functional/KerberosProxyIT.java | 172 +++--
.../test/functional/KerberosRenewalIT.java | 44 +-
.../accumulo/test/functional/LargeRowIT.java | 18 +-
.../test/functional/LateLastContactIT.java | 3 +-
.../accumulo/test/functional/LogicalTimeIT.java | 62 +-
.../accumulo/test/functional/MapReduceIT.java | 13 +-
.../test/functional/MasterAssignmentIT.java | 6 +-
.../apache/accumulo/test/functional/MaxOpenIT.java | 9 +-
.../apache/accumulo/test/functional/MergeIT.java | 64 +-
.../test/functional/MetadataMaxFilesIT.java | 3 +-
.../accumulo/test/functional/MetadataSplitIT.java | 3 +-
.../accumulo/test/functional/MonitorSslIT.java | 30 +-
.../accumulo/test/functional/NativeMapIT.java | 47 +-
.../accumulo/test/functional/PermissionsIT.java | 188 +++--
.../accumulo/test/functional/ReadWriteIT.java | 96 ++-
.../test/functional/RecoveryWithEmptyRFileIT.java | 14 +-
.../test/functional/RegexGroupBalanceIT.java | 23 +-
.../apache/accumulo/test/functional/RestartIT.java | 37 +-
.../accumulo/test/functional/RestartStressIT.java | 8 +-
.../apache/accumulo/test/functional/ScanIdIT.java | 53 +-
.../accumulo/test/functional/ScanIteratorIT.java | 40 +-
.../accumulo/test/functional/ScanRangeIT.java | 18 +-
.../test/functional/ScanSessionTimeOutIT.java | 3 +-
.../accumulo/test/functional/ScannerContextIT.java | 27 +-
.../apache/accumulo/test/functional/ScannerIT.java | 6 +-
.../test/functional/SessionBlockVerifyIT.java | 18 +-
.../test/functional/SessionDurabilityIT.java | 3 +-
.../accumulo/test/functional/ShutdownIT.java | 28 +-
.../test/functional/SimpleBalancerFairnessIT.java | 10 +-
.../accumulo/test/functional/SlowIterator.java | 6 +-
.../test/functional/SparseColumnFamilyIT.java | 3 +-
.../apache/accumulo/test/functional/SplitIT.java | 16 +-
.../accumulo/test/functional/SplitRecoveryIT.java | 76 +-
.../org/apache/accumulo/test/functional/SslIT.java | 13 +-
.../apache/accumulo/test/functional/SummaryIT.java | 166 +++--
.../test/functional/TableChangeStateIT.java | 93 ++-
.../apache/accumulo/test/functional/TabletIT.java | 6 +-
.../functional/TabletStateChangeIteratorIT.java | 76 +-
.../apache/accumulo/test/functional/TimeoutIT.java | 3 +-
.../accumulo/test/functional/TooManyDeletesIT.java | 15 +-
.../accumulo/test/functional/VisibilityIT.java | 33 +-
.../accumulo/test/functional/WALSunnyDayIT.java | 24 +-
.../test/functional/WatchTheWatchCountIT.java | 7 +-
.../accumulo/test/functional/WriteLotsIT.java | 3 +-
.../accumulo/test/functional/YieldingIterator.java | 27 +-
.../accumulo/test/functional/ZombieTServer.java | 26 +-
.../accumulo/test/functional/ZooCacheIT.java | 6 +-
.../CloseWriteAheadLogReferencesIT.java | 45 +-
.../test/mapred/AccumuloFileOutputFormatIT.java | 21 +-
.../test/mapred/AccumuloInputFormatIT.java | 19 +-
.../mapred/AccumuloMultiTableInputFormatIT.java | 9 +-
.../test/mapred/AccumuloOutputFormatIT.java | 15 +-
.../test/mapred/AccumuloRowInputFormatIT.java | 18 +-
.../apache/accumulo/test/mapred/TokenFileIT.java | 12 +-
.../test/mapreduce/AccumuloFileOutputFormatIT.java | 33 +-
.../test/mapreduce/AccumuloInputFormatIT.java | 81 ++-
.../mapreduce/AccumuloMultiTableInputFormatIT.java | 12 +-
.../test/mapreduce/AccumuloOutputFormatIT.java | 9 +-
.../test/mapreduce/AccumuloRowInputFormatIT.java | 21 +-
.../apache/accumulo/test/mapreduce/RowHash.java | 3 +-
.../accumulo/test/mapreduce/TokenFileIT.java | 12 +-
.../apache/accumulo/test/master/MergeStateIT.java | 32 +-
.../accumulo/test/master/SuspendedTabletsIT.java | 47 +-
.../test/mrit/IntegrationTestMapReduce.java | 19 +-
.../test/performance/ContinuousIngest.java | 41 +-
.../accumulo/test/performance/ContinuousOpts.java | 15 +-
.../accumulo/test/performance/NullTserver.java | 110 ++-
.../test/performance/RollWALPerformanceIT.java | 5 +-
.../performance/metadata/FastBulkImportIT.java | 3 +-
.../metadata/MetadataBatchScanTest.java | 19 +-
.../test/performance/scan/CollectTabletStats.java | 84 ++-
.../accumulo/test/proxy/ProxyDurabilityIT.java | 9 +-
.../accumulo/test/proxy/SimpleProxyBase.java | 525 +++++++++-----
.../accumulo/test/proxy/TestProxyClient.java | 17 +-
.../test/proxy/TestProxyInstanceOperations.java | 10 +-
.../test/proxy/TestProxyNamespaceOperations.java | 39 +-
.../accumulo/test/proxy/TestProxyReadWrite.java | 54 +-
.../test/proxy/TestProxySecurityOperations.java | 26 +-
.../test/proxy/TestProxyTableOperations.java | 24 +-
.../test/replication/CyclicReplicationIT.java | 88 ++-
.../test/replication/FinishedWorkUpdaterIT.java | 30 +-
...GarbageCollectorCommunicatesWithTServersIT.java | 82 ++-
.../test/replication/KerberosReplicationIT.java | 32 +-
.../test/replication/MockReplicaSystem.java | 19 +-
.../replication/MultiInstanceReplicationIT.java | 194 +++--
.../replication/MultiTserverReplicationIT.java | 9 +-
.../RemoveCompleteReplicationRecordsIT.java | 45 +-
.../accumulo/test/replication/ReplicationIT.java | 255 ++++---
.../replication/ReplicationOperationsImplIT.java | 45 +-
.../test/replication/SequentialWorkAssignerIT.java | 75 +-
.../test/replication/StatusCombinerMacIT.java | 15 +-
.../accumulo/test/replication/StatusMakerIT.java | 47 +-
.../test/replication/UnorderedWorkAssignerIT.java | 38 +-
.../UnorderedWorkAssignerReplicationIT.java | 194 +++--
.../UnusedWalDoesntCloseReplicationStatusIT.java | 27 +-
.../accumulo/test/replication/WorkMakerIT.java | 39 +-
.../java/org/apache/accumulo/test/rpc/Mocket.java | 5 +-
.../test/rpc/SimpleThriftServiceRunner.java | 3 +-
.../apache/accumulo/test/rpc/ThriftBehaviorIT.java | 15 +-
.../test/server/security/SystemCredentialsIT.java | 39 +-
.../apache/accumulo/test/start/KeywordStartIT.java | 18 +-
.../org/apache/accumulo/test/util/CertUtils.java | 99 ++-
.../accumulo/test/util/SerializationUtil.java | 17 +-
.../constraints/AlphaNumKeyConstraintTest.java | 13 +-
.../constraints/NumericValueConstraintTest.java | 6 +-
.../accumulo/test/fate/zookeeper/ZooLockTest.java | 36 +-
.../test/functional/ValueReversingIterator.java | 6 +-
.../accumulo/test/iterator/AgeOffFilterTest.java | 9 +-
.../test/iterator/CfCqSliceFilterTest.java | 6 +-
.../apache/accumulo/test/iterator/RegExTest.java | 9 +-
.../test/iterator/SummingCombinerTest.java | 6 +-
.../test/iterator/WholeRowIteratorTest.java | 6 +-
.../apache/accumulo/test/util/CertUtilsTest.java | 24 +-
1463 files changed, 29363 insertions(+), 16189 deletions(-)
diff --cc core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
index f256a92,b1d3150..046552f
--- a/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
+++ b/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
@@@ -226,29 -231,33 +232,30 @@@ public class ClientOpts extends Help
}
/**
- * Automatically update the options to use a KerberosToken when SASL is enabled for RPCs. Don't overwrite the options if the user has provided something
- * specifically.
+ * Automatically update the options to use a KerberosToken when SASL is enabled for RPCs. Don't
+ * overwrite the options if the user has provided something specifically.
*/
- public void updateKerberosCredentials() {
- ClientConfiguration clientConfig;
- try {
- if (clientConfigFile == null)
- clientConfig = ClientConfiguration.loadDefault();
- else
- clientConfig = ClientConfiguration.fromFile(new File(clientConfigFile));
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
+ public void updateKerberosCredentials(String clientConfigFile) {
+ boolean saslEnabled = false;
+ if (clientConfigFile != null) {
+ saslEnabled = Connector.builder().usingProperties(clientConfigFile).info().saslEnabled();
}
- updateKerberosCredentials(clientConfig);
+ updateKerberosCredentials(saslEnabled);
+ }
+
+ public void updateKerberosCredentials() {
+ updateKerberosCredentials(true);
}
/**
- * Automatically update the options to use a KerberosToken when SASL is enabled for RPCs. Don't overwrite the options if the user has provided something
- * specifically.
+ * Automatically update the options to use a KerberosToken when SASL is enabled for RPCs. Don't
+ * overwrite the options if the user has provided something specifically.
*/
- public void updateKerberosCredentials(ClientConfiguration clientConfig) {
- final boolean clientConfSaslEnabled = Boolean
- .parseBoolean(clientConfig.get(ClientProperty.INSTANCE_RPC_SASL_ENABLED));
- if ((saslEnabled || clientConfSaslEnabled) && null == tokenClassName) {
+ public void updateKerberosCredentials(boolean clientSaslEnabled) {
+ if ((saslEnabled || clientSaslEnabled) && null == tokenClassName) {
tokenClassName = KerberosToken.CLASS_NAME;
- // ACCUMULO-3701 We need to ensure we're logged in before parseArgs returns as the MapReduce Job is going to make a copy of the current user (UGI)
+ // ACCUMULO-3701 We need to ensure we're logged in before parseArgs returns as the MapReduce
+ // Job is going to make a copy of the current user (UGI)
// when it is instantiated.
if (null != keytabPath) {
File keytab = new File(keytabPath);
diff --cc core/src/main/java/org/apache/accumulo/core/client/BatchWriterConfig.java
index 3da6459,f2ec775..cc6c082
--- a/core/src/main/java/org/apache/accumulo/core/client/BatchWriterConfig.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/BatchWriterConfig.java
@@@ -50,11 -50,12 +50,13 @@@ public class BatchWriterConfig implemen
private Integer maxWriteThreads = null;
private Durability durability = Durability.DEFAULT;
+ private boolean isDurabilitySet = false;
/**
- * Sets the maximum memory to batch before writing. The smaller this value, the more frequently the {@link BatchWriter} will write.<br>
- * If set to a value smaller than a single mutation, then it will {@link BatchWriter#flush()} after each added mutation. Must be non-negative.
+ * Sets the maximum memory to batch before writing. The smaller this value, the more frequently
+ * the {@link BatchWriter} will write.<br>
+ * If set to a value smaller than a single mutation, then it will {@link BatchWriter#flush()}
+ * after each added mutation. Must be non-negative.
*
* <p>
* <b>Default:</b> 50M
@@@ -311,34 -319,6 +321,35 @@@
return false;
}
+ private static <T> T merge(T o1, T o2) {
+ if (o1 != null)
+ return o1;
+ return o2;
+ }
+
+ /**
- * Merge this BatchWriterConfig with another. If config is set in both, preference will be given to this config.
++ * Merge this BatchWriterConfig with another. If config is set in both, preference will be given
++ * to this config.
+ *
+ * @param other
+ * Another BatchWriterConfig
+ * @return Merged BatchWriterConfig
+ * @since 2.0.0
+ */
+ public BatchWriterConfig merge(BatchWriterConfig other) {
+ BatchWriterConfig result = new BatchWriterConfig();
+ result.maxMemory = merge(this.maxMemory, other.maxMemory);
+ result.maxLatency = merge(this.maxLatency, other.maxLatency);
+ result.timeout = merge(this.timeout, other.timeout);
+ result.maxWriteThreads = merge(this.maxWriteThreads, other.maxWriteThreads);
+ if (this.isDurabilitySet) {
+ result.durability = this.durability;
+ } else if (other.isDurabilitySet) {
+ result.durability = other.durability;
+ }
+ return result;
+ }
+
@Override
public int hashCode() {
HashCodeBuilder hcb = new HashCodeBuilder();
diff --cc core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
index f3e2fb8,09c9e8b..fabe239
--- a/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ClientConfiguration.java
@@@ -41,12 -53,12 +41,13 @@@ import org.slf4j.Logger
import org.slf4j.LoggerFactory;
/**
- * Contains a list of property keys recognized by the Accumulo client and convenience methods for setting them.
+ * Contains a list of property keys recognized by the Accumulo client and convenience methods for
+ * setting them.
*
* @since 1.6.0
+ * @deprecated since 2.0.0, replaced {@link Connector#builder()}
*/
-public class ClientConfiguration extends CompositeConfiguration {
+public class ClientConfiguration {
private static final Logger log = LoggerFactory.getLogger(ClientConfiguration.class);
public static final String USER_ACCUMULO_DIR_NAME = ".accumulo";
@@@ -224,7 -322,7 +231,8 @@@
}
// We couldn't find the client configuration anywhere
if (configs.isEmpty()) {
- log.debug("Found no client.conf in default paths. Using default client configuration values.");
- log.warn("Found no client.conf in default paths. Using default client configuration values.");
++ log.debug(
++ "Found no client.conf in default paths. Using default client configuration values.");
}
return new ClientConfiguration(configs);
}
@@@ -235,9 -333,10 +243,10 @@@
try {
propConfig.load(new StringReader(serializedConfig));
} catch (ConfigurationException e) {
- throw new IllegalArgumentException("Error deserializing client configuration: " + serializedConfig, e);
+ throw new IllegalArgumentException(
+ "Error deserializing client configuration: " + serializedConfig, e);
}
- return new ClientConfiguration(propConfig);
+ return new ClientConfiguration(Collections.singletonList(propConfig));
}
/**
@@@ -267,13 -367,18 +277,15 @@@
} else {
// if $ACCUMULO_CLIENT_CONF_PATH env isn't set, priority from top to bottom is:
// ~/.accumulo/config
- // $ACCUMULO_CONF_DIR/client.conf -OR- $ACCUMULO_HOME/conf/client.conf (depending on whether
- // $ACCUMULO_CONF_DIR is set)
+ // $ACCUMULO_CONF_DIR/client.conf
// /etc/accumulo/client.conf
+ // /etc/accumulo/conf/client.conf
clientConfPaths = new LinkedList<>();
- clientConfPaths.add(System.getProperty("user.home") + File.separator + USER_ACCUMULO_DIR_NAME + File.separator + USER_CONF_FILENAME);
+ clientConfPaths.add(System.getProperty("user.home") + File.separator + USER_ACCUMULO_DIR_NAME
+ + File.separator + USER_CONF_FILENAME);
if (System.getenv("ACCUMULO_CONF_DIR") != null) {
- clientConfPaths.add(System.getenv("ACCUMULO_CONF_DIR") + File.separator + GLOBAL_CONF_FILENAME);
+ clientConfPaths
+ .add(System.getenv("ACCUMULO_CONF_DIR") + File.separator + GLOBAL_CONF_FILENAME);
- } else if (System.getenv("ACCUMULO_HOME") != null) {
- clientConfPaths.add(System.getenv("ACCUMULO_HOME") + File.separator + "conf"
- + File.separator + GLOBAL_CONF_FILENAME);
}
clientConfPaths.add("/etc/accumulo/" + GLOBAL_CONF_FILENAME);
clientConfPaths.add("/etc/accumulo/conf/" + GLOBAL_CONF_FILENAME);
@@@ -498,11 -611,527 +518,12 @@@
* @since 1.7.0
*/
public ClientConfiguration withSasl(boolean saslEnabled, String kerberosServerPrimary) {
- return withSasl(saslEnabled).with(ClientProperty.KERBEROS_SERVER_PRIMARY, kerberosServerPrimary);
+ return withSasl(saslEnabled).with(ClientProperty.KERBEROS_SERVER_PRIMARY,
+ kerberosServerPrimary);
}
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Configuration getConfiguration(int index) {
- return super.getConfiguration(index);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Configuration getSource(String key) {
- return super.getSource(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void removeConfiguration(Configuration config) {
- super.removeConfiguration(config);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void addConfiguration(Configuration config) {
- super.addConfiguration(config);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Configuration getInMemoryConfiguration() {
- return super.getInMemoryConfiguration();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Log getLogger() {
- return super.getLogger();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Configuration subset(String prefix) {
- return super.subset(prefix);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Configuration interpolatedConfiguration() {
- return super.interpolatedConfiguration();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void setLogger(Log log) {
- super.setLogger(log);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public ConfigurationInterpolator getInterpolator() {
- return super.getInterpolator();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public synchronized StrSubstitutor getSubstitutor() {
- return super.getSubstitutor();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void append(Configuration c) {
- super.append(c);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void copy(Configuration c) {
- super.copy(c);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void addConfigurationListener(ConfigurationListener l) {
- super.addConfigurationListener(l);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public boolean removeConfigurationListener(ConfigurationListener l) {
- return super.removeConfigurationListener(l);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public boolean removeErrorListener(ConfigurationErrorListener l) {
- return super.removeErrorListener(l);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void addErrorListener(ConfigurationErrorListener l) {
- super.addErrorListener(l);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void addErrorLogListener() {
- super.addErrorLogListener();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void addProperty(String key, Object value) {
- super.addProperty(key, value);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- protected void addPropertyDirect(String key, Object token) {
- super.addPropertyDirect(key, token);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void clear() {
- super.clear();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void clearConfigurationListeners() {
- super.clearConfigurationListeners();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void clearErrorListeners() {
- super.clearErrorListeners();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public void clearProperty(String key) {
- super.clearProperty(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- protected void clearPropertyDirect(String key) {
- super.clearPropertyDirect(key);
- }
-
- @Override
public boolean containsKey(String key) {
- return super.containsKey(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- protected ConfigurationErrorEvent createErrorEvent(int type, String propName, Object propValue,
- Throwable ex) {
- return super.createErrorEvent(type, propName, propValue, ex);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- protected ConfigurationEvent createEvent(int type, String propName, Object propValue,
- boolean before) {
- return super.createEvent(type, propName, propValue, before);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- protected ConfigurationInterpolator createInterpolator() {
- return super.createInterpolator();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- protected void fireError(int type, String propName, Object propValue, Throwable ex) {
- super.fireError(type, propName, propValue, ex);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- protected void fireEvent(int type, String propName, Object propValue, boolean before) {
- super.fireEvent(type, propName, propValue, before);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public BigDecimal getBigDecimal(String key) {
- return super.getBigDecimal(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public BigDecimal getBigDecimal(String key, BigDecimal defaultValue) {
- return super.getBigDecimal(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public BigInteger getBigInteger(String key) {
- return super.getBigInteger(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public BigInteger getBigInteger(String key, BigInteger defaultValue) {
- return super.getBigInteger(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public boolean getBoolean(String key) {
- return super.getBoolean(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public boolean getBoolean(String key, boolean defaultValue) {
- return super.getBoolean(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Boolean getBoolean(String key, Boolean defaultValue) {
- return super.getBoolean(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public byte getByte(String key) {
- return super.getByte(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public byte getByte(String key, byte defaultValue) {
- return super.getByte(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Byte getByte(String key, Byte defaultValue) {
- return super.getByte(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @SuppressWarnings("rawtypes")
- @Override
- public Collection getConfigurationListeners() {
- return super.getConfigurationListeners();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public double getDouble(String key) {
- return super.getDouble(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Double getDouble(String key, Double defaultValue) {
- return super.getDouble(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public double getDouble(String key, double defaultValue) {
- return super.getDouble(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @SuppressWarnings("rawtypes")
- @Override
- public Collection getErrorListeners() {
- return super.getErrorListeners();
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public float getFloat(String key) {
- return super.getFloat(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Float getFloat(String key, Float defaultValue) {
- return super.getFloat(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public float getFloat(String key, float defaultValue) {
- return super.getFloat(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public int getInt(String key) {
- return super.getInt(key);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public int getInt(String key, int defaultValue) {
- return super.getInt(key, defaultValue);
- }
-
- /**
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API
- */
- @Deprecated
- @Override
- public Integer getInteger(String key, Integer defaultValue) {
- return super.getInteger(key, defaultValue);
+ return compositeConfig.containsKey(key);
}
@SuppressWarnings("unchecked")
diff --cc core/src/main/java/org/apache/accumulo/core/client/Connector.java
index 5829ce8,585ba37..cf5661b
--- a/core/src/main/java/org/apache/accumulo/core/client/Connector.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/Connector.java
@@@ -74,14 -75,16 +79,17 @@@ public abstract class Connector
* @return BatchDeleter object for configuring and deleting
* @throws TableNotFoundException
* when the specified table doesn't exist
- * @deprecated since 1.5.0; Use {@link #createBatchDeleter(String, Authorizations, int, BatchWriterConfig)} instead.
+ * @deprecated since 1.5.0; Use
+ * {@link #createBatchDeleter(String, Authorizations, int, BatchWriterConfig)}
+ * instead.
*/
@Deprecated
- public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, long maxMemory, long maxLatency,
- int maxWriteThreads) throws TableNotFoundException;
+ public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations,
+ int numQueryThreads, long maxMemory, long maxLatency, int maxWriteThreads)
+ throws TableNotFoundException;
/**
+ * Factory method to create BatchDeleter
*
* @param tableName
* the name of the table to query and delete from
@@@ -92,34 -96,15 +101,37 @@@
* @param numQueryThreads
* the number of concurrent threads to spawn for querying
* @param config
- * configuration used to create batch writer. This config takes precedence. Any unset values will be merged with config set when the Connector was
- * created. If no config was set during Connector creation, BatchWriterConfig defaults will be used.
- * configuration used to create batch writer
++ * configuration used to create batch writer. This config takes precedence. Any unset
++ * values will be merged with config set when the Connector was created. If no config was
++ * set during Connector creation, BatchWriterConfig defaults will be used.
* @return BatchDeleter object for configuring and deleting
* @since 1.5.0
*/
- public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
- throws TableNotFoundException;
+ public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations,
+ int numQueryThreads, BatchWriterConfig config) throws TableNotFoundException;
/**
- * Factory method to create BatchDeleter. This method uses BatchWriterConfig set when Connector was created. If none was set, BatchWriterConfig defaults will
- * be used.
++ * Factory method to create BatchDeleter. This method uses BatchWriterConfig set when Connector
++ * was created. If none was set, BatchWriterConfig defaults will be used.
+ *
+ * @param tableName
+ * the name of the table to query and delete from
+ * @param authorizations
- * A set of authorization labels that will be checked against the column visibility of each key in order to filter data. The authorizations passed in
- * must be a subset of the accumulo user's set of authorizations. If the accumulo user has authorizations (A1, A2) and authorizations (A2, A3) are
- * passed, then an exception will be thrown.
++ * A set of authorization labels that will be checked against the column visibility of
++ * each key in order to filter data. The authorizations passed in must be a subset of the
++ * accumulo user's set of authorizations. If the accumulo user has authorizations (A1,
++ * A2) and authorizations (A2, A3) are passed, then an exception will be thrown.
+ * @param numQueryThreads
+ * the number of concurrent threads to spawn for querying
+ * @return BatchDeleter object
+ * @throws TableNotFoundException
+ * if table not found
+ */
- public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException;
++ public abstract BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations,
++ int numQueryThreads) throws TableNotFoundException;
+
+ /**
* Factory method to create a BatchWriter connected to Accumulo.
*
* @param tableName
@@@ -145,30 -132,18 +159,33 @@@
* @param tableName
* the name of the table to insert data into
* @param config
- * configuration used to create batch writer. This config will take precedence. Any unset values will merged with config set when the Connector was
- * created. If no config was set during Connector creation, BatchWriterConfig defaults will be used.
- * configuration used to create batch writer
++ * configuration used to create batch writer. This config will take precedence. Any unset
++ * values will merged with config set when the Connector was created. If no config was
++ * set during Connector creation, BatchWriterConfig defaults will be used.
* @return BatchWriter object for configuring and writing data to
* @since 1.5.0
*/
- public abstract BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException;
+ public abstract BatchWriter createBatchWriter(String tableName, BatchWriterConfig config)
+ throws TableNotFoundException;
/**
- * Factory method to create a BatchWriter. This method uses BatchWriterConfig set when Connector was created. If none was set, BatchWriterConfig defaults will
- * be used.
++ * Factory method to create a BatchWriter. This method uses BatchWriterConfig set when Connector
++ * was created. If none was set, BatchWriterConfig defaults will be used.
+ *
+ * @param tableName
+ * the name of the table to insert data into
+ * @return BatchWriter object
+ * @throws TableNotFoundException
+ * if table not found
+ * @since 2.0.0
+ */
+ public abstract BatchWriter createBatchWriter(String tableName) throws TableNotFoundException;
+
+ /**
- * Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch writers can queue data for multiple tables, which is good for
- * ingesting data into multiple tables from the same source
+ * Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch
+ * writers can queue data for multiple tables, which is good for ingesting data into multiple
+ * tables from the same source
*
* @param maxMemory
* size in bytes of the maximum memory to batch before writing
@@@ -181,30 -157,24 +199,35 @@@
* @deprecated since 1.5.0; Use {@link #createMultiTableBatchWriter(BatchWriterConfig)} instead.
*/
@Deprecated
- public abstract MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads);
+ public abstract MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency,
+ int maxWriteThreads);
/**
- * Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch writers can queue data for multiple tables. Also data for
- * multiple tables can be sent to a server in a single batch. Its an efficient way to ingest data into multiple tables from a single process.
+ * Factory method to create a Multi-Table BatchWriter connected to Accumulo. Multi-table batch
+ * writers can queue data for multiple tables. Also data for multiple tables can be sent to a
+ * server in a single batch. Its an efficient way to ingest data into multiple tables from a
+ * single process.
*
* @param config
- * configuration used to create multi-table batch writer. This config will take precedence. Any unset values will merged with config set when the
- * Connector was created. If no config was set during Connector creation, BatchWriterConfig defaults will be used.
- * configuration used to create multi-table batch writer
++ * configuration used to create multi-table batch writer. This config will take
++ * precedence. Any unset values will merged with config set when the Connector was
++ * created. If no config was set during Connector creation, BatchWriterConfig defaults
++ * will be used.
* @return MultiTableBatchWriter object for configuring and writing data to
* @since 1.5.0
*/
public abstract MultiTableBatchWriter createMultiTableBatchWriter(BatchWriterConfig config);
/**
- * Factory method to create a Multi-Table BatchWriter. This method uses BatchWriterConfig set when Connector was created. If none was set, BatchWriterConfig
- * defaults will be used.
++ * Factory method to create a Multi-Table BatchWriter. This method uses BatchWriterConfig set when
++ * Connector was created. If none was set, BatchWriterConfig defaults will be used.
+ *
+ * @return MultiTableBatchWriter object
+ * @since 2.0.0
+ */
+ public abstract MultiTableBatchWriter createMultiTableBatchWriter();
+
+ /**
* Factory method to create a Scanner connected to Accumulo.
*
* @param tableName
@@@ -284,272 -259,4 +312,275 @@@
* @since 1.7.0
*/
public abstract ReplicationOperations replicationOperations();
+
+ /**
+ * Builds ConnectionInfo after all options have been specified
+ *
+ * @since 2.0.0
+ */
+ public interface ConnInfoFactory {
+
+ /**
+ * Builds ConnectionInfo after all options have been specified
+ *
+ * @return ConnectionInfo
+ */
+ ConnectionInfo info();
+ }
+
+ /**
+ * Builds Connector
+ *
+ * @since 2.0.0
+ */
+ public interface ConnectorFactory extends ConnInfoFactory {
+
+ /**
+ * Builds Connector after all options have been specified
+ *
+ * @return Connector
+ */
+ Connector build() throws AccumuloException, AccumuloSecurityException;
+
+ }
+
+ /**
+ * Builder method for setting Accumulo instance and zookeepers
+ *
+ * @since 2.0.0
+ */
+ public interface InstanceArgs {
+ AuthenticationArgs forInstance(String instanceName, String zookeepers);
+ }
+
+ /**
+ * Builder methods for creating Connector using properties
+ *
+ * @since 2.0.0
+ */
+ public interface PropertyOptions extends InstanceArgs {
+
+ /**
- * Build using properties file. An example properties file can be found at conf/accumulo-client.properties in the Accumulo tarball distribution.
++ * Build using properties file. An example properties file can be found at
++ * conf/accumulo-client.properties in the Accumulo tarball distribution.
+ *
+ * @param propertiesFile
+ * Path to properties file
+ * @return this builder
+ */
+ ConnectorFactory usingProperties(String propertiesFile);
+
+ /**
- * Build using Java properties object. A list of available properties can be found in the documentation on the project website (http://accumulo.apache.org)
- * under 'Development' -> 'Client Properties'
++ * Build using Java properties object. A list of available properties can be found in the
++ * documentation on the project website (http://accumulo.apache.org) under 'Development' ->
++ * 'Client Properties'
+ *
+ * @param properties
+ * Properties object
+ * @return this builder
+ */
+ ConnectorFactory usingProperties(Properties properties);
+ }
+
+ public interface ConnectionInfoOptions extends PropertyOptions {
+
+ /**
+ * Build using connection information
+ *
+ * @param connectionInfo
+ * ConnectionInfo object
+ * @return this builder
+ */
+ ConnectorFactory usingConnectionInfo(ConnectionInfo connectionInfo);
+ }
+
+ /**
+ * Build methods for authentication
+ *
+ * @since 2.0.0
+ */
+ public interface AuthenticationArgs {
+
+ /**
+ * Build using password-based credentials
+ *
+ * @param username
+ * User name
+ * @param password
+ * Password
+ * @return this builder
+ */
+ ConnectionOptions usingPassword(String username, CharSequence password);
+
+ /**
+ * Build using Kerberos credentials
+ *
+ * @param principal
+ * Principal
+ * @param keyTabFile
+ * Path to keytab file
+ * @return this builder
+ */
+ ConnectionOptions usingKerberos(String principal, String keyTabFile);
+
+ /**
+ * Build using credentials from a CredentialProvider
+ *
+ * @param username
+ * Accumulo user name
+ * @param name
+ * Alias to extract Accumulo user password from CredentialProvider
+ * @param providerUrls
+ * Comma seperated list of URLs defining CredentialProvider(s)
+ * @return this builder
+ */
+ ConnectionOptions usingProvider(String username, String name, String providerUrls);
+
+ /**
+ * Build using specified credentials
+ *
+ * @param principal
+ * Principal/username
+ * @param token
+ * Authentication token
+ * @return this builder
+ */
+ ConnectionOptions usingToken(String principal, AuthenticationToken token);
+ }
+
+ /**
+ * Build methods for SSL/TLS
+ *
+ * @since 2.0.0
+ */
+ public interface SslOptions extends ConnectorFactory {
+
+ /**
+ * Build with SSL trust store
+ *
+ * @param path
+ * Path to trust store
+ * @return this builder
+ */
+ SslOptions withTruststore(String path);
+
+ /**
+ * Build with SSL trust store
+ *
+ * @param path
+ * Path to trust store
+ * @param password
+ * Password used to encrypt trust store
+ * @param type
+ * Trust store type
+ * @return this builder
+ */
+ SslOptions withTruststore(String path, String password, String type);
+
+ /**
+ * Build with SSL key store
+ *
+ * @param path
+ * Path to SSL key store
+ * @return this builder
+ */
+ SslOptions withKeystore(String path);
+
+ /**
+ * Build with SSL key store
+ *
+ * @param path
+ * Path to keystore
+ * @param password
+ * Password used to encyrpt key store
+ * @param type
+ * Key store type
+ * @return this builder
+ */
+ SslOptions withKeystore(String path, String password, String type);
+
+ /**
+ * Use JSSE system properties to configure SSL
+ *
+ * @return this builder
+ */
+ SslOptions useJsse();
+ }
+
+ /**
+ * Build methods for SASL
+ *
+ * @since 2.0.0
+ */
+ public interface SaslOptions extends ConnectorFactory {
+
+ /**
+ * Build with Kerberos Server Primary
+ *
+ * @param kerberosServerPrimary
+ * Kerberos server primary
+ * @return this builder
+ */
+ SaslOptions withPrimary(String kerberosServerPrimary);
+
+ /**
+ * Build with SASL quality of protection
+ *
+ * @param qualityOfProtection
+ * Quality of protection
+ * @return this builder
+ */
+ SaslOptions withQop(String qualityOfProtection);
+ }
+
+ /**
+ * Build methods for connection options
+ *
+ * @since 2.0.0
+ */
+ public interface ConnectionOptions extends ConnectorFactory {
+
+ /**
+ * Build using Zookeeper timeout
+ *
+ * @param timeout
+ * Zookeeper timeout
+ * @return this builder
+ */
+ ConnectionOptions withZkTimeout(int timeout);
+
+ /**
+ * Build with SSL/TLS options
+ *
+ * @return this builder
+ */
+ SslOptions withSsl();
+
+ /**
+ * Build with SASL options
+ *
+ * @return this builder
+ */
+ SaslOptions withSasl();
+
+ /**
- * Build with BatchWriterConfig defaults for BatchWriter, MultiTableBatchWriter & BatchDeleter
++ * Build with BatchWriterConfig defaults for BatchWriter, MultiTableBatchWriter &
++ * BatchDeleter
+ *
+ * @param batchWriterConfig
+ * BatchWriterConfig
+ * @return this builder
+ */
+ ConnectionOptions withBatchWriterConfig(BatchWriterConfig batchWriterConfig);
+ }
+
+ /**
+ * Creates builder for Connector
+ *
+ * @return this builder
+ * @since 2.0.0
+ */
+ public static ConnectionInfoOptions builder() {
+ return new ConnectorImpl.ConnectorBuilderImpl();
+ }
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/Instance.java
index ff6375b,bbc06e7..3bc0ff4
--- a/core/src/main/java/org/apache/accumulo/core/client/Instance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/Instance.java
@@@ -19,11 -19,14 +19,12 @@@ package org.apache.accumulo.core.client
import java.nio.ByteBuffer;
import java.util.List;
-import org.apache.accumulo.core.client.admin.InstanceOperations;
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;
/**
- * This class represents the information a client needs to know to connect to an instance of accumulo.
+ * This class represents the information a client needs to know to connect to an instance of
+ * accumulo.
*
*/
public interface Instance {
@@@ -115,12 -122,39 +120,14 @@@
* when a generic exception occurs
* @throws AccumuloSecurityException
* when a user's credentials are invalid
- * @deprecated since 1.5, use {@link #getConnector(String, AuthenticationToken)} with {@link PasswordToken}
+ * @deprecated since 1.5, use {@link #getConnector(String, AuthenticationToken)} with
+ * {@link PasswordToken}
*/
@Deprecated
- Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException;
+ Connector getConnector(String user, CharSequence pass)
+ throws AccumuloException, AccumuloSecurityException;
/**
- * Returns the AccumuloConfiguration to use when interacting with this instance.
- *
- * @return the AccumuloConfiguration that specifies properties related to interacting with this
- * instance
- * @deprecated since 1.6.0. This method makes very little sense in the context of the client API
- * and never should have been exposed.
- * @see InstanceOperations#getSystemConfiguration() for client-side reading of the server-side
- * configuration.
- */
- @Deprecated
- AccumuloConfiguration getConfiguration();
-
- /**
- * Set the AccumuloConfiguration to use when interacting with this instance.
- *
- * @param conf
- * accumulo configuration
- * @deprecated since 1.6.0. This method makes very little sense in the context of the client API
- * and never should have been exposed.
- * @see InstanceOperations#setProperty(String, String)
- */
- @Deprecated
- void setConfiguration(AccumuloConfiguration conf);
-
- /**
* Returns a connection to this instance of accumulo.
*
* @param principal
diff --cc core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
index 3bfc284,8bade1c..e3a767f
--- a/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/MutationsRejectedException.java
@@@ -69,14 -139,14 +71,15 @@@ public class MutationsRejectedExceptio
Map<String,Set<SecurityErrorCode>> result = new HashMap<>();
for (Entry<TabletId,Set<SecurityErrorCode>> entry : hashMap.entrySet()) {
+ TabletId tabletId = entry.getKey();
- String tableInfo = Tables.getPrintableTableInfoFromId(instance, Table.ID.of(tabletId.getTableId().toString()));
+ String tableInfo = Tables.getPrintableTableInfoFromId(instance,
- entry.getKey().getTableId().toString());
++ Table.ID.of(tabletId.getTableId().toString()));
if (!result.containsKey(tableInfo)) {
- result.put(tableInfo, new HashSet<SecurityErrorCode>());
+ result.put(tableInfo, new HashSet<>());
}
- result.get(tableInfo).addAll(hashMap.get(entry.getKey()));
+ result.get(tableInfo).addAll(hashMap.get(tabletId));
}
return result.toString();
diff --cc core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
index 892e0bd,201de62..6319562
--- a/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/ZooKeeperInstance.java
@@@ -124,18 -136,41 +133,21 @@@ public class ZooKeeperInstance implemen
*/
@Deprecated
public ZooKeeperInstance(UUID instanceId, String zooKeepers, int sessionTimeout) {
- this(ClientConfiguration.loadDefault().withInstance(instanceId).withZkHosts(zooKeepers).withZkTimeout(sessionTimeout));
+ this(ClientConfiguration.loadDefault().withInstance(instanceId).withZkHosts(zooKeepers)
+ .withZkTimeout(sessionTimeout));
}
- /**
- * @param config
- * Client configuration for specifying connection options. See
- * {@link ClientConfiguration} which extends Configuration with convenience methods
- * specific to Accumulo.
- * @since 1.6.0
- * @deprecated since 1.9.0; will be removed in 2.0.0 to eliminate commons config leakage into
- * Accumulo API; use {@link #ZooKeeperInstance(ClientConfiguration)} instead.
- */
- @Deprecated
- public ZooKeeperInstance(Configuration config) {
- this(config, new ZooCacheFactory());
- }
-
- ZooKeeperInstance(Configuration config, ZooCacheFactory zcf) {
+ ZooKeeperInstance(ClientConfiguration config, ZooCacheFactory zcf) {
checkArgument(config != null, "config is null");
- if (config instanceof ClientConfiguration) {
- this.clientConf = (ClientConfiguration) config;
- } else {
- @SuppressWarnings("deprecation")
- ClientConfiguration cliConf = new ClientConfiguration(config);
- this.clientConf = cliConf;
- }
+ this.clientConf = config;
this.instanceId = clientConf.get(ClientProperty.INSTANCE_ID);
this.instanceName = clientConf.get(ClientProperty.INSTANCE_NAME);
if ((instanceId == null) == (instanceName == null))
- throw new IllegalArgumentException("Expected exactly one of instanceName and instanceId to be set");
+ throw new IllegalArgumentException(
+ "Expected exactly one of instanceName and instanceId to be set");
this.zooKeepers = clientConf.get(ClientProperty.INSTANCE_ZK_HOST);
- this.zooKeepersSessionTimeOut = (int) ConfigurationTypeHelper.getTimeInMillis(clientConf.get(ClientProperty.INSTANCE_ZK_TIMEOUT));
- this.zooKeepersSessionTimeOut = (int) AccumuloConfiguration
++ this.zooKeepersSessionTimeOut = (int) ConfigurationTypeHelper
+ .getTimeInMillis(clientConf.get(ClientProperty.INSTANCE_ZK_TIMEOUT));
zooCache = zcf.getZooCache(zooKeepers, zooKeepersSessionTimeOut);
if (null != instanceName) {
// Validates that the provided instanceName actually exists
diff --cc core/src/main/java/org/apache/accumulo/core/client/admin/NewTableConfiguration.java
index b0dbf4e,7d25a25..aa34f2e
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/NewTableConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/NewTableConfiguration.java
@@@ -19,34 -19,18 +19,34 @@@ package org.apache.accumulo.core.client
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
+import java.util.Arrays;
import java.util.Collections;
+import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.impl.TableOperationsHelper;
import org.apache.accumulo.core.client.sample.SamplerConfiguration;
+import org.apache.accumulo.core.client.summary.Summarizer;
+import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
+import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.iterators.IteratorUtil;
+import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.iterators.user.VersioningIterator;
import org.apache.accumulo.core.sample.impl.SamplerConfigurationImpl;
+import org.apache.accumulo.core.summary.SummarizerConfigurationUtil;
+import org.apache.accumulo.core.util.LocalityGroupUtil;
+import org.apache.hadoop.io.Text;
/**
- * This object stores table creation parameters. Currently includes: {@link TimeType}, whether to include default iterators, and user-specified initial
- * properties
+ * This object stores table creation parameters. Currently includes: {@link TimeType}, whether to
+ * include default iterators, and user-specified initial properties
*
* @since 1.7.0
*/
@@@ -57,15 -41,8 +57,17 @@@ public class NewTableConfiguration
private boolean limitVersion = true;
- private Map<String,String> properties = new HashMap<>();
- private SamplerConfiguration samplerConfiguration;
+ private Map<String,String> properties = Collections.emptyMap();
+ private Map<String,String> samplerProps = Collections.emptyMap();
+ private Map<String,String> summarizerProps = Collections.emptyMap();
+ private Map<String,String> localityProps = Collections.emptyMap();
+ private Map<String,String> iteratorProps = new HashMap<>();
+
- private void checkDisjoint(Map<String,String> props, Map<String,String> derivedProps, String kind) {
- checkArgument(Collections.disjoint(props.keySet(), derivedProps.keySet()), "Properties and derived %s properties are not disjoint", kind);
++ private void checkDisjoint(Map<String,String> props, Map<String,String> derivedProps,
++ String kind) {
++ checkArgument(Collections.disjoint(props.keySet(), derivedProps.keySet()),
++ "Properties and derived %s properties are not disjoint", kind);
+ }
/**
* Configure logical or millisecond time for tables created with this configuration.
@@@ -101,10 -80,10 +104,10 @@@
}
/**
- * Sets additional properties to be applied to tables created with this configuration. Additional calls to this method replace properties set by previous
- * calls.
+ * Sets additional properties to be applied to tables created with this configuration. Additional
- * calls to this method replaces properties set by previous calls.
++ * calls to this method replace properties set by previous calls.
*
- * @param prop
+ * @param props
* additional properties to add to the table when it is created
* @return this
*/
@@@ -145,109 -123,8 +149,117 @@@
*/
public NewTableConfiguration enableSampling(SamplerConfiguration samplerConfiguration) {
requireNonNull(samplerConfiguration);
- Map<String,String> tmp = new SamplerConfigurationImpl(samplerConfiguration).toTablePropertiesMap();
- SamplerConfigurationImpl.checkDisjoint(properties, samplerConfiguration);
- this.samplerConfiguration = samplerConfiguration;
++ Map<String,String> tmp = new SamplerConfigurationImpl(samplerConfiguration)
++ .toTablePropertiesMap();
+ checkDisjoint(properties, tmp, "sampler");
+ this.samplerProps = tmp;
+ return this;
+ }
+
+ /**
+ * Enables creating summary statistics using {@link Summarizer}'s for the new table.
+ *
+ * @since 2.0.0
+ */
+ public NewTableConfiguration enableSummarization(SummarizerConfiguration... configs) {
+ requireNonNull(configs);
- Map<String,String> tmp = SummarizerConfigurationUtil.toTablePropertiesMap(Arrays.asList(configs));
++ Map<String,String> tmp = SummarizerConfigurationUtil
++ .toTablePropertiesMap(Arrays.asList(configs));
+ checkDisjoint(properties, tmp, "summarizer");
+ summarizerProps = tmp;
+ return this;
+ }
+
+ /**
+ * Configures a table's locality groups prior to initial table creation.
+ *
- * Allows locality groups to be set prior to table creation. Additional calls to this method prior to table creation will overwrite previous locality group
- * mappings.
++ * Allows locality groups to be set prior to table creation. Additional calls to this method prior
++ * to table creation will overwrite previous locality group mappings.
+ *
+ * @param groups
+ * mapping of locality group names to column families in the locality group
+ *
+ * @since 2.0.0
+ *
+ * @see TableOperations#setLocalityGroups
+ */
+ public NewTableConfiguration setLocalityGroups(Map<String,Set<Text>> groups) {
+ // ensure locality groups do not overlap
+ LocalityGroupUtil.ensureNonOverlappingGroups(groups);
+ Map<String,String> tmp = new HashMap<>();
+ for (Entry<String,Set<Text>> entry : groups.entrySet()) {
+ Set<Text> colFams = entry.getValue();
+ String value = LocalityGroupUtil.encodeColumnFamilies(colFams);
+ tmp.put(Property.TABLE_LOCALITY_GROUP_PREFIX + entry.getKey(), value);
+ }
- tmp.put(Property.TABLE_LOCALITY_GROUPS.getKey(), groups.keySet().stream().collect(Collectors.joining(",")));
++ tmp.put(Property.TABLE_LOCALITY_GROUPS.getKey(),
++ groups.keySet().stream().collect(Collectors.joining(",")));
+ checkDisjoint(properties, tmp, "locality groups");
+ localityProps = tmp;
return this;
}
+
+ /**
+ * Configure iterator settings for a table prior to its creation.
+ *
- * Additional calls to this method before table creation will overwrite previous iterator settings.
++ * Additional calls to this method before table creation will overwrite previous iterator
++ * settings.
+ *
+ * @param setting
+ * object specifying the properties of the iterator
+ *
+ * @since 2.0.0
+ *
+ * @see TableOperations#attachIterator(String, IteratorSetting)
+ */
+ public NewTableConfiguration attachIterator(IteratorSetting setting) {
+ return attachIterator(setting, EnumSet.allOf(IteratorScope.class));
+ }
+
+ /**
+ * Configure iterator settings for a table prior to its creation.
+ *
+ * @param setting
+ * object specifying the properties of the iterator
+ * @param scopes
+ * enumerated set of iterator scopes
+ *
+ * @since 2.0.0
+ *
+ * @see TableOperations#attachIterator(String, IteratorSetting, EnumSet)
+ */
- public NewTableConfiguration attachIterator(IteratorSetting setting, EnumSet<IteratorScope> scopes) {
++ public NewTableConfiguration attachIterator(IteratorSetting setting,
++ EnumSet<IteratorScope> scopes) {
+ Objects.requireNonNull(setting, "setting cannot be null!");
+ Objects.requireNonNull(scopes, "scopes cannot be null!");
+ try {
+ TableOperationsHelper.checkIteratorConflicts(iteratorProps, setting, scopes);
+ } catch (AccumuloException e) {
- throw new IllegalArgumentException("The specified IteratorSetting conflicts with an iterator already defined on this NewTableConfiguration", e);
++ throw new IllegalArgumentException(
++ "The specified IteratorSetting conflicts with an iterator already defined on this NewTableConfiguration",
++ e);
+ }
+ for (IteratorScope scope : scopes) {
- String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase(), setting.getName());
++ String root = String.format("%s%s.%s", Property.TABLE_ITERATOR_PREFIX,
++ scope.name().toLowerCase(), setting.getName());
+ for (Entry<String,String> prop : setting.getOptions().entrySet()) {
+ iteratorProps.put(root + ".opt." + prop.getKey(), prop.getValue());
+ }
+ iteratorProps.put(root, setting.getPriority() + "," + setting.getIteratorClass());
+ // verify that the iteratorProps assigned and the properties do not share any keys.
+ checkDisjoint(properties, iteratorProps, "iterator");
+ }
+ return this;
+ }
+
+ /**
+ * Verify the provided properties are valid table properties.
+ */
+ private void checkTableProperties(Map<String,String> props) {
+ props.keySet().forEach((key) -> {
+ if (!key.startsWith(Property.TABLE_PREFIX.toString())) {
+ throw new IllegalArgumentException("'" + key + "' is not a valid table property");
+ }
+ });
+ }
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/admin/SummaryRetriever.java
index 8dcf048,0000000..09a43c7
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/SummaryRetriever.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/SummaryRetriever.java
@@@ -1,112 -1,0 +1,122 @@@
+/*
+ * 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.admin;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
+import org.apache.accumulo.core.client.summary.Summary;
+import org.apache.hadoop.io.Text;
+
+/**
+ * This interface allows configuring where and which summary data to retrieve before retrieving it.
+ *
+ * @since 2.0.0
+ */
+public interface SummaryRetriever {
+
+ /**
- * Forces a flush of data in memory to files before summary data is retrieved. Data recently written to Accumulo may be in memory. Summary data is only
- * retrieved from files. Therefore recently written data may not be represented in summaries, unless this options is set to true. This is optional and
- * defaults to false.
++ * Forces a flush of data in memory to files before summary data is retrieved. Data recently
++ * written to Accumulo may be in memory. Summary data is only retrieved from files. Therefore
++ * recently written data may not be represented in summaries, unless this options is set to true.
++ * This is optional and defaults to false.
+ *
+ * @return this
+ */
+ SummaryRetriever flush(boolean shouldFlush);
+
+ /**
+ * The start row is not inclusive. Calling this method is optional.
+ */
+ SummaryRetriever startRow(Text startRow);
+
+ /**
+ * The start row is not inclusive. Calling this method is optional.
+ */
+ SummaryRetriever startRow(CharSequence startRow);
+
+ /**
+ * The end row is inclusive. Calling this method is optional.
+ */
+ SummaryRetriever endRow(Text endRow);
+
+ /**
+ * The end row is inclusive. Calling this method is optional.
+ */
+ SummaryRetriever endRow(CharSequence endRow);
+
+ /**
- * Filters which summary data is retrieved. By default all summary data present is retrieved. If only a subset of summary data is needed, then its best to be
- * selective in order to avoid polluting summary data cache.
++ * Filters which summary data is retrieved. By default all summary data present is retrieved. If
++ * only a subset of summary data is needed, then its best to be selective in order to avoid
++ * polluting summary data cache.
+ *
+ * <p>
- * Each set of summary data is generated using a specific {@link SummarizerConfiguration}. The methods {@link #withConfiguration(Collection)} and
- * {@link #withConfiguration(SummarizerConfiguration...)} allow selecting sets of summary data based on exact {@link SummarizerConfiguration} matches. This
- * method enables less exact matching using regular expressions.
++ * Each set of summary data is generated using a specific {@link SummarizerConfiguration}. The
++ * methods {@link #withConfiguration(Collection)} and
++ * {@link #withConfiguration(SummarizerConfiguration...)} allow selecting sets of summary data
++ * based on exact {@link SummarizerConfiguration} matches. This method enables less exact matching
++ * using regular expressions.
+ *
+ * <p>
- * The regular expression passed to this method is used in the following way on the server side to match {@link SummarizerConfiguration} object. When a
- * {@link SummarizerConfiguration} matches, the summary data generated using that configuration is returned.
++ * The regular expression passed to this method is used in the following way on the server side to
++ * match {@link SummarizerConfiguration} object. When a {@link SummarizerConfiguration} matches,
++ * the summary data generated using that configuration is returned.
+ *
+ * <pre>
+ * <code>
+ * boolean doesConfigurationMatch(SummarizerConfiguration conf, String regex) {
+ * // This is how conf is converted to a String in tablet servers for matching.
+ * // The options are sorted to make writing regular expressions easier.
+ * String confString = conf.getClassName()+" "+new TreeMap<>(conf.getOptions());
+ * return Pattern.compile(regex).matcher(confString).matches();
+ * }
+ * </code>
+ * </pre>
+ */
+ SummaryRetriever withMatchingConfiguration(String regex);
+
+ /**
- * Allows specifying a set of summaries, generated using the specified configs, to retrieve. By default will retrieve all present.
++ * Allows specifying a set of summaries, generated using the specified configs, to retrieve. By
++ * default will retrieve all present.
+ *
+ * <p>
- * Using this method to be more selective may pull less data in to the tablet servers summary cache.
++ * Using this method to be more selective may pull less data in to the tablet servers summary
++ * cache.
+ */
+ SummaryRetriever withConfiguration(SummarizerConfiguration... config);
+
+ /**
- * Allows specifying a set of summaries, generated using the specified configs, to retrieve. By default will retrieve all present.
++ * Allows specifying a set of summaries, generated using the specified configs, to retrieve. By
++ * default will retrieve all present.
+ *
+ * <p>
- * Using this method to be more selective may pull less data in to the tablet servers summary cache.
++ * Using this method to be more selective may pull less data in to the tablet servers summary
++ * cache.
+ */
+ SummaryRetriever withConfiguration(Collection<SummarizerConfiguration> configs);
+
+ /**
+ * @return a map of counter groups to counts
+ */
- List<Summary> retrieve() throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
++ List<Summary> retrieve()
++ throws AccumuloException, AccumuloSecurityException, TableNotFoundException;
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
index f88d28e,7ff76c9..d86e6af
--- a/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
@@@ -140,14 -143,16 +147,16 @@@ public interface TableOperations
* Directory that contains the files copied by distcp from exportTable
* @since 1.5.0
*/
- void importTable(String tableName, String importDir) throws TableExistsException, AccumuloException, AccumuloSecurityException;
+ void importTable(String tableName, String importDir)
+ throws TableExistsException, AccumuloException, AccumuloSecurityException;
/**
- * Exports a table. The tables data is not exported, just table metadata and a list of files to distcp. The table being exported must be offline and stay
- * offline for the duration of distcp. To avoid losing access to a table it can be cloned and the clone taken offline for export.
+ * Exports a table. The tables data is not exported, just table metadata and a list of files to
+ * distcp. The table being exported must be offline and stay offline for the duration of distcp.
+ * To avoid losing access to a table it can be cloned and the clone taken offline for export.
*
* <p>
- * See docs/examples/README.export
+ * See https://github.com/apache/accumulo-examples/blob/master/docs/export.md
*
* @param tableName
* Name of the table to export.
@@@ -811,66 -874,6 +878,75 @@@
* the name of the table
* @since 1.8.0
*/
- SamplerConfiguration getSamplerConfiguration(String tableName) throws TableNotFoundException, AccumuloException, AccumuloSecurityException;
+ SamplerConfiguration getSamplerConfiguration(String tableName)
+ throws TableNotFoundException, AccumuloException, AccumuloSecurityException;
+
+ /**
+ * Entry point for retrieving summaries with optional restrictions.
+ *
+ * <p>
- * In order to retrieve Summaries, the Accumulo user making the request will need the {@link TablePermission#GET_SUMMARIES} table permission.
++ * In order to retrieve Summaries, the Accumulo user making the request will need the
++ * {@link TablePermission#GET_SUMMARIES} table permission.
+ *
+ * <p>
- * Accumulo stores summary data with each file in each tablet. In order to make retrieving it faster there is a per tablet server cache of summary data. When
- * summary data for a file is not present, it will be retrieved using threads on the tserver. The tablet server properties
- * {@code tserver.summary.partition.threads}, {@code tserver.summary.remote.threads}, {@code tserver.summary.retrieval.threads}, and
- * {@code tserver.cache.summary.size} impact the performance of retrieving summaries.
++ * Accumulo stores summary data with each file in each tablet. In order to make retrieving it
++ * faster there is a per tablet server cache of summary data. When summary data for a file is not
++ * present, it will be retrieved using threads on the tserver. The tablet server properties
++ * {@code tserver.summary.partition.threads}, {@code tserver.summary.remote.threads},
++ * {@code tserver.summary.retrieval.threads}, and {@code tserver.cache.summary.size} impact the
++ * performance of retrieving summaries.
+ *
+ * <p>
- * Since summary data is cached, its important to use the summary selection options to only read the needed data into the cache.
++ * Since summary data is cached, its important to use the summary selection options to only read
++ * the needed data into the cache.
+ *
+ * <p>
- * Summary data will be merged on the tablet servers and then in this client process. Therefore it's important that the required summarizers are on the
- * clients classpath.
++ * Summary data will be merged on the tablet servers and then in this client process. Therefore
++ * it's important that the required summarizers are on the clients classpath.
+ *
+ * @since 2.0.0
+ * @see Summarizer
+ */
- SummaryRetriever summaries(String tableName) throws TableNotFoundException, AccumuloException, AccumuloSecurityException;
++ SummaryRetriever summaries(String tableName)
++ throws TableNotFoundException, AccumuloException, AccumuloSecurityException;
+
+ /**
+ * Enables summary generation for this table for future compactions.
+ *
+ * @param tableName
+ * add summarizers to this table
+ * @param summarizers
+ * summarizers to add
+ * @throws IllegalArgumentException
- * When new summarizers have the same property id as each other, or when the same summarizers previously added.
++ * When new summarizers have the same property id as each other, or when the same
++ * summarizers previously added.
+ * @since 2.0.0
+ * @see SummarizerConfiguration#toTableProperties()
+ * @see SummarizerConfiguration#toTableProperties(SummarizerConfiguration...)
+ * @see SummarizerConfiguration#toTableProperties(Collection)
+ */
- void addSummarizers(String tableName, SummarizerConfiguration... summarizers) throws TableNotFoundException, AccumuloException, AccumuloSecurityException;
++ void addSummarizers(String tableName, SummarizerConfiguration... summarizers)
++ throws TableNotFoundException, AccumuloException, AccumuloSecurityException;
+
+ /**
+ * Removes summary generation for this table for the matching summarizers.
+ *
+ * @param tableName
+ * remove summarizers from this table
+ * @param predicate
+ * removes all summarizers whose configuration that matches this predicate
+ * @since 2.0.0
+ */
- void removeSummarizers(String tableName, Predicate<SummarizerConfiguration> predicate) throws AccumuloException, TableNotFoundException,
- AccumuloSecurityException;
++ void removeSummarizers(String tableName, Predicate<SummarizerConfiguration> predicate)
++ throws AccumuloException, TableNotFoundException, AccumuloSecurityException;
+
+ /**
+ * @param tableName
+ * list summarizers for this table
+ * @return the summarizers currently configured for the table
+ * @since 2.0.0
+ * @see SummarizerConfiguration#fromTableProperties(Map)
+ */
- List<SummarizerConfiguration> listSummarizers(String tableName) throws AccumuloException, TableNotFoundException, AccumuloSecurityException;
++ List<SummarizerConfiguration> listSummarizers(String tableName)
++ throws AccumuloException, TableNotFoundException, AccumuloSecurityException;
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/AbstractId.java
index 9bf7341,0000000..8d26cff
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/AbstractId.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/AbstractId.java
@@@ -1,89 -1,0 +1,91 @@@
+/*
+ * 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 java.nio.charset.StandardCharsets.UTF_8;
+import static java.util.Objects.requireNonNull;
+
+import java.io.Serializable;
+import java.util.Objects;
+
+/**
+ * An abstract identifier class for comparing equality of identifiers of the same type.
+ */
+public abstract class AbstractId implements Comparable<AbstractId>, Serializable {
+
+ private static final long serialVersionUID = -155513612834787244L;
+ private final String canonical;
+ private Integer hashCode = null;
+
+ protected AbstractId(final String canonical) {
+ requireNonNull(canonical, "canonical cannot be null");
+ this.canonical = canonical;
+ }
+
+ /**
+ * The canonical ID
+ */
+ public final String canonicalID() {
+ return canonical;
+ }
+
+ public boolean isEmpty() {
+ return canonical.isEmpty();
+ }
+
+ /**
- * AbstractID objects are considered equal if, and only if, they are of the same type and have the same canonical identifier.
++ * AbstractID objects are considered equal if, and only if, they are of the same type and have the
++ * same canonical identifier.
+ */
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
- return obj != null && Objects.equals(getClass(), obj.getClass()) && Objects.equals(canonicalID(), ((AbstractId) obj).canonicalID());
++ return obj != null && Objects.equals(getClass(), obj.getClass())
++ && Objects.equals(canonicalID(), ((AbstractId) obj).canonicalID());
+ }
+
+ @Override
+ public int hashCode() {
+ if (hashCode == null) {
+ hashCode = Objects.hash(canonicalID());
+ }
+ return hashCode;
+ }
+
+ /**
+ * Returns a string of the canonical ID
+ */
+ @Override
+ public String toString() {
+ return canonical;
+ }
+
+ /**
+ * Return a UTF_8 byte[] of the canonical ID.
+ */
+ public final byte[] getUtf8() {
+ return canonical.getBytes(UTF_8);
+ }
+
+ @Override
+ public int compareTo(AbstractId id) {
+ requireNonNull(id, "id cannot be null");
+ return this.canonicalID().compareTo(id.canonicalID());
+ }
+
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java
index 2de50ac,0000000..d5080f0
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ClientConfConverter.java
@@@ -1,101 -1,0 +1,102 @@@
+/*
+ * 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 java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.conf.ClientProperty;
+
+@SuppressWarnings("deprecation")
+public class ClientConfConverter {
+
- private static Map<String, String> confProps = new HashMap<>();
- private static Map<String, String> propsConf = new HashMap<>();
++ private static Map<String,String> confProps = new HashMap<>();
++ private static Map<String,String> propsConf = new HashMap<>();
+
+ static {
+ propsConf.put(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(),
+ ClientConfiguration.ClientProperty.INSTANCE_ZK_HOST.getKey());
+ propsConf.put(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT_SEC.getKey(),
+ ClientConfiguration.ClientProperty.INSTANCE_ZK_TIMEOUT.getKey());
+ propsConf.put(ClientProperty.SSL_ENABLED.getKey(),
+ ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_ENABLED.getKey());
+ propsConf.put(ClientProperty.SSL_KEYSTORE_PATH.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_PATH.getKey());
+ propsConf.put(ClientProperty.SSL_KEYSTORE_TYPE.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_TYPE.getKey());
+ propsConf.put(ClientProperty.SSL_KEYSTORE_PASSWORD.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_KEYSTORE_PASSWORD.getKey());
+ propsConf.put(ClientProperty.SSL_TRUSTSTORE_PATH.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PATH.getKey());
+ propsConf.put(ClientProperty.SSL_TRUSTSTORE_TYPE.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_TYPE.getKey());
+ propsConf.put(ClientProperty.SSL_TRUSTSTORE_PASSWORD.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SSL_TRUSTSTORE_PASSWORD.getKey());
+ propsConf.put(ClientProperty.SSL_USE_JSSE.getKey(),
+ ClientConfiguration.ClientProperty.RPC_USE_JSSE.getKey());
+ propsConf.put(ClientProperty.SASL_ENABLED.getKey(),
+ ClientConfiguration.ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey());
+ propsConf.put(ClientProperty.SASL_QOP.getKey(),
+ ClientConfiguration.ClientProperty.RPC_SASL_QOP.getKey());
+ propsConf.put(ClientProperty.SASL_KERBEROS_SERVER_PRIMARY.getKey(),
+ ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey());
+
- for (Map.Entry<String, String> entry : propsConf.entrySet()) {
++ for (Map.Entry<String,String> entry : propsConf.entrySet()) {
+ confProps.put(entry.getValue(), entry.getKey());
+ }
+ }
+
+ public static ClientConfiguration toClientConf(Properties properties) {
+ ClientConfiguration config = ClientConfiguration.create();
+ for (Object keyObj : properties.keySet()) {
+ String propKey = (String) keyObj;
+ String val = properties.getProperty(propKey);
+ String confKey = propsConf.get(propKey);
+ if (confKey == null) {
+ config.setProperty(propKey, val);
+ } else {
+ config.setProperty(confKey, val);
+ }
+ if (propKey.equals(ClientProperty.SSL_KEYSTORE_PATH.getKey())) {
+ config.setProperty(ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH, "true");
+ }
+ }
+ return config;
+ }
+
+ public static Properties toProperties(ClientConfiguration clientConf) {
+ Properties props = new Properties();
+ Iterator<String> clientConfIter = clientConf.getKeys();
+ while (clientConfIter.hasNext()) {
+ String confKey = clientConfIter.next();
+ String val = clientConf.getString(confKey);
+ String propKey = confProps.get(confKey);
+ if (propKey == null) {
- if (!confKey.equals(ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH.getKey())) {
++ if (!confKey
++ .equals(ClientConfiguration.ClientProperty.INSTANCE_RPC_SSL_CLIENT_AUTH.getKey())) {
+ props.setProperty(confKey, val);
+ }
+ } else {
+ props.setProperty(propKey, val);
+ }
+ }
+ return props;
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ClientContext.java
index b0baff3,0f53992..c07d799
--- 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
@@@ -69,27 -72,13 +73,31 @@@ public class ClientContext
private Supplier<SslConnectionParams> sslSupplier;
private TCredentials rpcCreds;
+ private static <T> Supplier<T> memoizeWithExpiration(Supplier<T> s) {
- //This insanity exists to make modernizer plugin happy. We are living in the future now.
++ // This insanity exists to make modernizer plugin happy. We are living in the future now.
+ return () -> Suppliers.memoizeWithExpiration(() -> s.get(), 100, TimeUnit.MILLISECONDS).get();
+ }
+
+ public ClientContext(ConnectionInfo connectionInfo) {
- this(ConnectionInfoFactory.getInstance(connectionInfo), ConnectionInfoFactory.getCredentials(connectionInfo), ConnectionInfoFactory
- .getClientConfiguration(connectionInfo), ConnectionInfoFactory.getBatchWriterConfig(connectionInfo));
++ this(ConnectionInfoFactory.getInstance(connectionInfo),
++ ConnectionInfoFactory.getCredentials(connectionInfo),
++ ConnectionInfoFactory.getClientConfiguration(connectionInfo),
++ ConnectionInfoFactory.getBatchWriterConfig(connectionInfo));
+ }
+
/**
* Instantiate a client context
*/
public ClientContext(Instance instance, Credentials credentials, ClientConfiguration clientConf) {
+ this(instance, credentials, clientConf, new BatchWriterConfig());
+ }
+
- public ClientContext(Instance instance, Credentials credentials, ClientConfiguration clientConf, BatchWriterConfig batchWriterConfig) {
- this(instance, credentials, convertClientConfig(requireNonNull(clientConf, "clientConf is null")));
++ public ClientContext(Instance instance, Credentials credentials, ClientConfiguration clientConf,
++ BatchWriterConfig batchWriterConfig) {
+ this(instance, credentials,
+ convertClientConfig(requireNonNull(clientConf, "clientConf is null")));
this.clientConf = clientConf;
+ this.batchWriterConfig = batchWriterConfig;
}
/**
@@@ -119,9 -124,9 +129,10 @@@
}
};
- timeoutSupplier = memoizeWithExpiration(() -> getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT));
- timeoutSupplier = Suppliers.memoizeWithExpiration(timeoutSupplier, 100, TimeUnit.MILLISECONDS);
- sslSupplier = Suppliers.memoizeWithExpiration(sslSupplier, 100, TimeUnit.MILLISECONDS);
- saslSupplier = Suppliers.memoizeWithExpiration(saslSupplier, 100, TimeUnit.MILLISECONDS);
++ timeoutSupplier = memoizeWithExpiration(
++ () -> getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT));
+ sslSupplier = memoizeWithExpiration(() -> SslConnectionParams.forClient(getConfiguration()));
+ saslSupplier = memoizeWithExpiration(saslSupplier);
}
@@@ -252,9 -260,10 +270,12 @@@
else {
// Reconstitute the server kerberos property from the client config
if (Property.GENERAL_KERBEROS_PRINCIPAL == property) {
- if (config.containsKey(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey())) {
- if (config.containsKey(ClientProperty.KERBEROS_SERVER_PRIMARY.getKey())) {
++ if (config
++ .containsKey(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey())) {
// Avoid providing a realm since we don't know what it is...
- return config.getString(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey()) + "/_HOST@" + SaslConnectionParams.getDefaultRealm();
- return config.getString(ClientProperty.KERBEROS_SERVER_PRIMARY.getKey()) + "/_HOST@"
- + SaslConnectionParams.getDefaultRealm();
++ return config
++ .getString(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey())
++ + "/_HOST@" + SaslConnectionParams.getDefaultRealm();
}
}
return defaults.get(property);
@@@ -272,13 -281,16 +293,17 @@@
props.put(key, config.getString(key));
}
- // Two client props that don't exist on the server config. Client doesn't need to know about the Kerberos instance from the principle, but servers do
+ // Two client props that don't exist on the server config. Client doesn't need to know about
+ // the Kerberos instance from the principle, but servers do
// Automatically reconstruct the server property when converting a client config.
- if (props.containsKey(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey())) {
- final String serverPrimary = props.remove(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey());
- if (props.containsKey(ClientProperty.KERBEROS_SERVER_PRIMARY.getKey())) {
++ if (props
++ .containsKey(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey())) {
+ final String serverPrimary = props
- .remove(ClientProperty.KERBEROS_SERVER_PRIMARY.getKey());
- if (filter.apply(Property.GENERAL_KERBEROS_PRINCIPAL.getKey())) {
++ .remove(ClientConfiguration.ClientProperty.KERBEROS_SERVER_PRIMARY.getKey());
+ if (filter.test(Property.GENERAL_KERBEROS_PRINCIPAL.getKey())) {
// Use the _HOST expansion. It should be unnecessary in "client land".
- props.put(Property.GENERAL_KERBEROS_PRINCIPAL.getKey(), serverPrimary + "/_HOST@" + SaslConnectionParams.getDefaultRealm());
+ props.put(Property.GENERAL_KERBEROS_PRINCIPAL.getKey(),
+ serverPrimary + "/_HOST@" + SaslConnectionParams.getDefaultRealm());
}
}
@@@ -291,8 -303,9 +316,9 @@@
continue;
}
- if (filter.apply(key)) {
+ if (filter.test(key)) {
- char[] value = CredentialProviderFactoryShim.getValueFromCredentialProvider(hadoopConf, key);
+ char[] value = CredentialProviderFactoryShim
+ .getValueFromCredentialProvider(hadoopConf, key);
if (null != value) {
props.put(key, new String(value));
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ConditionalWriterImpl.java
index 3e74975,6d1dc3d..e4c60c6
--- 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
@@@ -96,11 -97,18 +96,12 @@@ import org.slf4j.LoggerFactory
class ConditionalWriterImpl implements ConditionalWriter {
- private static ThreadPoolExecutor cleanupThreadPool = new ThreadPoolExecutor(1, 1, 3, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), r -> {
- Thread t = new Thread(r, "Conditional Writer Cleanup Thread");
- t.setDaemon(true);
- return t;
- });
- private static class CleanupThreadFactory implements ThreadFactory {
-
- @Override
- public Thread newThread(Runnable r) {
- Thread t = new Thread(r, "Conditional Writer Cleanup Thread ");
- t.setDaemon(true);
- return t;
- }
- }
-
+ private static ThreadPoolExecutor cleanupThreadPool = new ThreadPoolExecutor(1, 1, 3,
- TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new CleanupThreadFactory());
++ TimeUnit.SECONDS, new LinkedBlockingQueue<>(), r -> {
++ Thread t = new Thread(r, "Conditional Writer Cleanup Thread");
++ t.setDaemon(true);
++ return t;
++ });
static {
cleanupThreadPool.allowCoreThreadTimeOut(true);
@@@ -513,8 -526,9 +519,9 @@@
}
}
- TConditionalSession tcs = client.startConditionalUpdate(tinfo, context.rpcCreds(), ByteBufferUtil.toByteBuffers(auths.getAuthorizations()),
- tableId.canonicalID(), DurabilityImpl.toThrift(durability), this.classLoaderContext);
+ TConditionalSession tcs = client.startConditionalUpdate(tinfo, context.rpcCreds(),
- ByteBufferUtil.toByteBuffers(auths.getAuthorizations()), tableId,
++ ByteBufferUtil.toByteBuffers(auths.getAuthorizations()), tableId.canonicalID(),
+ DurabilityImpl.toThrift(durability), this.classLoaderContext);
synchronized (cachedSessionIDs) {
SessionID sid = new SessionID();
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoFactory.java
index c1cb17c,0000000..6420f2f
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoFactory.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectionInfoFactory.java
@@@ -1,85 -1,0 +1,86 @@@
+/*
+ * 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 java.util.concurrent.TimeUnit;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ConnectionInfo;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Durability;
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.conf.ClientProperty;
+
+/**
+ * Creates internal objects using {@link ConnectionInfo}
+ */
+public class ConnectionInfoFactory {
+
+ public static String getString(ConnectionInfo info, ClientProperty property) {
+ return property.getValue(info.getProperties());
+ }
+
+ public static Long getLong(ConnectionInfo info, ClientProperty property) {
+ return property.getLong(info.getProperties());
+ }
+
- public static Connector getConnector(ConnectionInfo info) throws AccumuloSecurityException, AccumuloException {
++ public static Connector getConnector(ConnectionInfo info)
++ throws AccumuloSecurityException, AccumuloException {
+ return new ConnectorImpl(getClientContext(info));
+ }
+
+ public static ClientContext getClientContext(ConnectionInfo info) {
+ return new ClientContext(info);
+ }
+
+ public static Instance getInstance(ConnectionInfo info) {
+ return new ZooKeeperInstance(getClientConfiguration(info));
+ }
+
+ public static Credentials getCredentials(ConnectionInfo info) {
+ return new Credentials(info.getPrincipal(), info.getAuthenticationToken());
+ }
+
+ public static BatchWriterConfig getBatchWriterConfig(ConnectionInfo info) {
+ BatchWriterConfig batchWriterConfig = new BatchWriterConfig();
+ Long maxMemory = getLong(info, ClientProperty.BATCH_WRITER_MAX_MEMORY_BYTES);
+ if (maxMemory != null) {
+ batchWriterConfig.setMaxMemory(maxMemory);
+ }
+ Long maxLatency = getLong(info, ClientProperty.BATCH_WRITER_MAX_LATENCY_SEC);
+ if (maxLatency != null) {
+ batchWriterConfig.setMaxLatency(maxLatency, TimeUnit.SECONDS);
+ }
+ Long timeout = getLong(info, ClientProperty.BATCH_WRITER_MAX_TIMEOUT_SEC);
+ if (timeout != null) {
+ batchWriterConfig.setTimeout(timeout, TimeUnit.SECONDS);
+ }
+ String durability = getString(info, ClientProperty.BATCH_WRITER_DURABILITY);
+ if (!durability.isEmpty()) {
+ batchWriterConfig.setDurability(Durability.valueOf(durability.toUpperCase()));
+ }
+ return batchWriterConfig;
+ }
+
+ public static ClientConfiguration getClientConfiguration(ConnectionInfo info) {
+ return ClientConfConverter.toClientConf(info.getProperties());
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
index 03c719c,ebf4f30..bab089f
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ConnectorImpl.java
@@@ -66,7 -54,8 +66,8 @@@ public class ConnectorImpl extends Conn
private InstanceOperations instanceops = null;
private ReplicationOperations replicationops = null;
- public ConnectorImpl(final ClientContext context) throws AccumuloSecurityException, AccumuloException {
+ public ConnectorImpl(final ClientContext context)
- throws AccumuloException, AccumuloSecurityException {
++ throws AccumuloSecurityException, AccumuloException {
checkArgument(context != null, "Context is null");
checkArgument(context.getCredentials() != null, "Credentials are null");
checkArgument(context.getCredentials().getToken() != null, "Authentication token is null");
@@@ -75,10 -65,11 +77,11 @@@
this.context = context;
- // Skip fail fast for system services; string literal for class name, to avoid dependency on server jar
+ // Skip fail fast for system services; string literal for class name, to avoid dependency on
+ // server jar
final String tokenClassName = context.getCredentials().getToken().getClass().getName();
if (!SYSTEM_TOKEN_NAME.equals(tokenClassName)) {
- ServerClient.execute(context, new ClientExec<ClientService.Client>() {
+ ServerClient.executeVoid(context, new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client iface) throws Exception {
if (!iface.authenticate(Tracer.traceInfo(), context.rpcCreds()))
@@@ -121,16 -117,12 +129,18 @@@
}
@Override
- public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
- throws TableNotFoundException {
+ public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations,
+ int numQueryThreads, BatchWriterConfig config) throws TableNotFoundException {
checkArgument(tableName != null, "tableName is null");
checkArgument(authorizations != null, "authorizations is null");
- return new TabletServerBatchDeleter(context, getTableId(tableName), authorizations, numQueryThreads, config.merge(context.getBatchWriterConfig()));
+ return new TabletServerBatchDeleter(context, getTableId(tableName), authorizations,
- numQueryThreads, config);
++ numQueryThreads, config.merge(context.getBatchWriterConfig()));
+ }
+
+ @Override
- public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException {
++ public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations,
++ int numQueryThreads) throws TableNotFoundException {
+ return createBatchDeleter(tableName, authorizations, numQueryThreads, new BatchWriterConfig());
}
@Deprecated
@@@ -142,18 -136,10 +154,20 @@@
}
@Override
- public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException {
+ public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config)
+ throws TableNotFoundException {
checkArgument(tableName != null, "tableName is null");
- return new BatchWriterImpl(context, getTableId(tableName), config);
+ // we used to allow null inputs for bw config
+ if (config == null) {
+ config = new BatchWriterConfig();
+ }
- return new BatchWriterImpl(context, getTableId(tableName), config.merge(context.getBatchWriterConfig()));
++ return new BatchWriterImpl(context, getTableId(tableName),
++ config.merge(context.getBatchWriterConfig()));
+ }
+
+ @Override
+ public BatchWriter createBatchWriter(String tableName) throws TableNotFoundException {
+ return createBatchWriter(tableName, new BatchWriterConfig());
}
@Deprecated
@@@ -224,222 -208,4 +241,229 @@@
return replicationops;
}
+
- public static class ConnectorBuilderImpl implements InstanceArgs, PropertyOptions, ConnectionInfoOptions, AuthenticationArgs, ConnectionOptions, SslOptions,
- SaslOptions, ConnectorFactory {
++ public static class ConnectorBuilderImpl
++ implements InstanceArgs, PropertyOptions, ConnectionInfoOptions, AuthenticationArgs,
++ ConnectionOptions, SslOptions, SaslOptions, ConnectorFactory {
+
+ private Properties properties = new Properties();
+ private AuthenticationToken token = null;
+
+ @Override
+ public Connector build() throws AccumuloException, AccumuloSecurityException {
+ return ConnectionInfoFactory.getConnector(new ConnectionInfoImpl(properties, token));
+ }
+
+ @Override
+ public ConnectionInfo info() {
+ return new ConnectionInfoImpl(properties, token);
+ }
+
+ @Override
+ public AuthenticationArgs forInstance(String instanceName, String zookeepers) {
+ setProperty(ClientProperty.INSTANCE_NAME, instanceName);
+ setProperty(ClientProperty.INSTANCE_ZOOKEEPERS, zookeepers);
+ return this;
+ }
+
+ @Override
+ public SslOptions withTruststore(String path) {
+ setProperty(ClientProperty.SSL_TRUSTSTORE_PATH, path);
+ return this;
+ }
+
+ @Override
+ public SslOptions withTruststore(String path, String password, String type) {
+ setProperty(ClientProperty.SSL_TRUSTSTORE_PATH, path);
+ setProperty(ClientProperty.SSL_TRUSTSTORE_PASSWORD, password);
+ setProperty(ClientProperty.SSL_TRUSTSTORE_TYPE, type);
+ return this;
+ }
+
+ @Override
+ public SslOptions withKeystore(String path) {
+ setProperty(ClientProperty.SSL_KEYSTORE_PATH, path);
+ return this;
+ }
+
+ @Override
+ public SslOptions withKeystore(String path, String password, String type) {
+ setProperty(ClientProperty.SSL_KEYSTORE_PATH, path);
+ setProperty(ClientProperty.SSL_KEYSTORE_PASSWORD, password);
+ setProperty(ClientProperty.SSL_KEYSTORE_TYPE, type);
+ return this;
+ }
+
+ @Override
+ public SslOptions useJsse() {
+ setProperty(ClientProperty.SSL_USE_JSSE, "true");
+ return this;
+ }
+
+ @Override
+ public ConnectionOptions withZkTimeout(int timeout) {
+ setProperty(ClientProperty.INSTANCE_ZOOKEEPERS_TIMEOUT_SEC, Integer.toString(timeout));
+ return this;
+ }
+
+ @Override
+ public SslOptions withSsl() {
+ setProperty(ClientProperty.SSL_ENABLED, "true");
+ return this;
+ }
+
+ @Override
+ public SaslOptions withSasl() {
+ setProperty(ClientProperty.SASL_ENABLED, "true");
+ return this;
+ }
+
+ @Override
+ public ConnectionOptions withBatchWriterConfig(BatchWriterConfig batchWriterConfig) {
+ setProperty(ClientProperty.BATCH_WRITER_MAX_MEMORY_BYTES, batchWriterConfig.getMaxMemory());
- setProperty(ClientProperty.BATCH_WRITER_MAX_LATENCY_SEC, batchWriterConfig.getMaxLatency(TimeUnit.SECONDS));
- setProperty(ClientProperty.BATCH_WRITER_MAX_TIMEOUT_SEC, batchWriterConfig.getTimeout(TimeUnit.SECONDS));
- setProperty(ClientProperty.BATCH_WRITER_MAX_WRITE_THREADS, batchWriterConfig.getMaxWriteThreads());
- setProperty(ClientProperty.BATCH_WRITER_DURABILITY, batchWriterConfig.getDurability().toString());
++ setProperty(ClientProperty.BATCH_WRITER_MAX_LATENCY_SEC,
++ batchWriterConfig.getMaxLatency(TimeUnit.SECONDS));
++ setProperty(ClientProperty.BATCH_WRITER_MAX_TIMEOUT_SEC,
++ batchWriterConfig.getTimeout(TimeUnit.SECONDS));
++ setProperty(ClientProperty.BATCH_WRITER_MAX_WRITE_THREADS,
++ batchWriterConfig.getMaxWriteThreads());
++ setProperty(ClientProperty.BATCH_WRITER_DURABILITY,
++ batchWriterConfig.getDurability().toString());
+ return this;
+ }
+
+ @Override
+ public SaslOptions withPrimary(String kerberosServerPrimary) {
+ setProperty(ClientProperty.SASL_KERBEROS_SERVER_PRIMARY, kerberosServerPrimary);
+ return this;
+ }
+
+ @Override
+ public SaslOptions withQop(String qualityOfProtection) {
+ setProperty(ClientProperty.SASL_QOP, qualityOfProtection);
+ return this;
+ }
+
+ @Override
+ public ConnectorFactory usingProperties(String configFile) {
+ Properties properties = new Properties();
+ try (InputStream is = new FileInputStream(configFile)) {
+ properties.load(is);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ return usingProperties(properties);
+ }
+
+ @Override
+ public ConnectorFactory usingProperties(Properties properties) {
+ this.properties = properties;
+ String authMethod = ClientProperty.AUTH_METHOD.getValue(properties).toLowerCase();
+ switch (authMethod) {
+ case "password":
+ String password = ClientProperty.AUTH_PASSWORD.getValue(properties);
+ Objects.nonNull(password);
+ this.token = new PasswordToken(password);
+ this.properties.remove(ClientProperty.AUTH_PASSWORD);
+ break;
+ case "kerberos":
+ String principal = ClientProperty.AUTH_USERNAME.getValue(properties);
+ String keytabPath = ClientProperty.AUTH_KERBEROS_KEYTAB_PATH.getValue(properties);
+ Objects.nonNull(principal);
+ Objects.nonNull(keytabPath);
+ try {
+ this.token = new KerberosToken(principal, new File(keytabPath));
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ case "provider":
+ String name = ClientProperty.AUTH_PROVIDER_NAME.getValue(properties);
+ String providerUrls = ClientProperty.AUTH_PROVIDER_URLS.getValue(properties);
+ try {
+ this.token = new CredentialProviderToken(name, providerUrls);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ default:
- throw new IllegalArgumentException("An authentication method (password, kerberos, etc) must be set");
++ throw new IllegalArgumentException(
++ "An authentication method (password, kerberos, etc) must be set");
+ }
+ return this;
+ }
+
+ @Override
+ public ConnectionOptions usingPassword(String username, CharSequence password) {
+ setProperty(ClientProperty.AUTH_METHOD, "password");
+ setProperty(ClientProperty.AUTH_USERNAME, username);
+ this.token = new PasswordToken(password);
+ return this;
+ }
+
+ @Override
+ public ConnectionOptions usingKerberos(String principal, String keyTabFile) {
+ setProperty(ClientProperty.AUTH_METHOD, "kerberos");
+ setProperty(ClientProperty.AUTH_USERNAME, principal);
+ setProperty(ClientProperty.AUTH_KERBEROS_KEYTAB_PATH, keyTabFile);
+ try {
+ this.token = new KerberosToken(principal, new File(keyTabFile));
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ return this;
+ }
+
+ @Override
+ public ConnectionOptions usingProvider(String username, String name, String providerUrls) {
+ setProperty(ClientProperty.AUTH_METHOD, "provider");
+ setProperty(ClientProperty.AUTH_USERNAME, username);
+ setProperty(ClientProperty.AUTH_PROVIDER_NAME, name);
+ setProperty(ClientProperty.AUTH_PROVIDER_URLS, providerUrls);
+ try {
+ this.token = new CredentialProviderToken(name, providerUrls);
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ }
+ return this;
+ }
+
+ @Override
+ public ConnectionOptions usingToken(String principal, AuthenticationToken token) {
+ this.token = token;
+ setProperty(ClientProperty.AUTH_USERNAME, principal);
+ if (token instanceof CredentialProviderToken) {
+ setProperty(ClientProperty.AUTH_METHOD, "provider");
+ CredentialProviderToken cpt = (CredentialProviderToken) token;
+ setProperty(ClientProperty.AUTH_PROVIDER_NAME, cpt.getName());
+ setProperty(ClientProperty.AUTH_PROVIDER_URLS, cpt.getCredentialProviders());
+ } else if (token instanceof PasswordToken) {
+ setProperty(ClientProperty.AUTH_METHOD, "password");
+ } else if (token instanceof KerberosToken) {
+ setProperty(ClientProperty.AUTH_METHOD, "kerberos");
- setProperty(ClientProperty.AUTH_KERBEROS_KEYTAB_PATH, ((KerberosToken) token).getKeytab().getAbsolutePath());
++ setProperty(ClientProperty.AUTH_KERBEROS_KEYTAB_PATH,
++ ((KerberosToken) token).getKeytab().getAbsolutePath());
+ } else {
+ setProperty(ClientProperty.AUTH_METHOD, "unknown");
+ }
+ return this;
+ }
+
+ @Override
+ public ConnectorFactory usingConnectionInfo(ConnectionInfo connectionInfo) {
+ this.properties = connectionInfo.getProperties();
+ this.token = connectionInfo.getAuthenticationToken();
+ return this;
+ }
+
+ public void setProperty(ClientProperty property, String value) {
+ properties.setProperty(property.getKey(), value);
+ }
+
+ public void setProperty(ClientProperty property, Long value) {
+ setProperty(property, Long.toString(value));
+ }
+
+ public void setProperty(ClientProperty property, Integer value) {
+ setProperty(property, Integer.toString(value));
+ }
+ }
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java
index 92d1bd3,a4522a6..0967a91
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Credentials.java
@@@ -28,10 -27,13 +28,12 @@@ import org.apache.accumulo.core.client.
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer;
import org.apache.accumulo.core.security.thrift.TCredentials;
-import org.apache.accumulo.core.util.Base64;
/**
- * A wrapper for internal use. This class carries the instance, principal, and authentication token for use in the public API, in a non-serialized form. This is
- * important, so that the authentication token carried in a {@link Connector} can be destroyed, invalidating future RPC operations from that {@link Connector}.
+ * A wrapper for internal use. This class carries the instance, principal, and authentication token
+ * for use in the public API, in a non-serialized form. This is important, so that the
+ * authentication token carried in a {@link Connector} can be destroyed, invalidating future RPC
+ * operations from that {@link Connector}.
* <p>
* See ACCUMULO-1312
*
@@@ -109,9 -120,13 +120,15 @@@ public class Credentials
* @return serialized form of these credentials
*/
public final String serialize() {
- return (getPrincipal() == null ? "-" : Base64.getEncoder().encodeToString(getPrincipal().getBytes(UTF_8))) + ":"
- + (getToken() == null ? "-" : Base64.getEncoder().encodeToString(getToken().getClass().getName().getBytes(UTF_8))) + ":"
- + (getToken() == null ? "-" : Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(getToken())));
+ return (getPrincipal() == null ? "-"
- : Base64.encodeBase64String(getPrincipal().getBytes(UTF_8)))
++ : Base64.getEncoder().encodeToString(getPrincipal().getBytes(UTF_8)))
+ + ":"
+ + (getToken() == null ? "-"
- : Base64.encodeBase64String(getToken().getClass().getName().getBytes(UTF_8)))
- + ":" + (getToken() == null ? "-"
- : Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(getToken())));
++ : Base64.getEncoder().encodeToString(getToken().getClass().getName().getBytes(UTF_8)))
++ + ":"
++ + (getToken() == null ? "-"
++ : Base64.getEncoder()
++ .encodeToString(AuthenticationTokenSerializer.serialize(getToken())));
}
/**
@@@ -123,11 -139,13 +141,13 @@@
*/
public static final Credentials deserialize(String serializedForm) {
String[] split = serializedForm.split(":", 3);
- String principal = split[0].equals("-") ? null : new String(Base64.getDecoder().decode(split[0]), UTF_8);
- String tokenType = split[1].equals("-") ? null : new String(Base64.getDecoder().decode(split[1]), UTF_8);
+ String principal = split[0].equals("-") ? null
- : new String(Base64.decodeBase64(split[0]), UTF_8);
++ : new String(Base64.getDecoder().decode(split[0]), UTF_8);
+ String tokenType = split[1].equals("-") ? null
- : new String(Base64.decodeBase64(split[1]), UTF_8);
++ : new String(Base64.getDecoder().decode(split[1]), UTF_8);
AuthenticationToken token = null;
if (!split[2].equals("-")) {
- byte[] tokenBytes = Base64.decodeBase64(split[2]);
+ byte[] tokenBytes = Base64.getDecoder().decode(split[2]);
token = AuthenticationTokenSerializer.deserialize(tokenType, tokenBytes);
}
return new Credentials(principal, token);
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/InstanceOperationsImpl.java
index 7eade0d,fab8b98..1ba9e4b
--- 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
@@@ -62,10 -62,11 +62,11 @@@ public class InstanceOperationsImpl imp
}
@Override
- public void setProperty(final String property, final String value) throws AccumuloException, AccumuloSecurityException, IllegalArgumentException {
+ public void setProperty(final String property, final String value)
+ throws AccumuloException, AccumuloSecurityException, IllegalArgumentException {
checkArgument(property != null, "property is null");
checkArgument(value != null, "value is null");
- MasterClient.execute(context, new ClientExec<MasterClientService.Client>() {
+ MasterClient.executeVoid(context, new ClientExec<MasterClientService.Client>() {
@Override
public void execute(MasterClientService.Client client) throws Exception {
client.setSystemProperty(Tracer.traceInfo(), context.rpcCreds(), property, value);
@@@ -74,9 -75,10 +75,10 @@@
}
@Override
- public void removeProperty(final String property) throws AccumuloException, AccumuloSecurityException {
+ public void removeProperty(final String property)
+ throws AccumuloException, AccumuloSecurityException {
checkArgument(property != null, "property is null");
- MasterClient.execute(context, new ClientExec<MasterClientService.Client>() {
+ MasterClient.executeVoid(context, new ClientExec<MasterClientService.Client>() {
@Override
public void execute(MasterClientService.Client client) throws Exception {
client.removeSystemProperty(Tracer.traceInfo(), context.rpcCreds(), property);
@@@ -191,8 -205,13 +205,9 @@@
TTransport transport = null;
try {
transport = ThriftUtil.createTransport(AddressUtil.parseAddress(tserver, false), context);
- TabletClientService.Client client = ThriftUtil.createClient(new TabletClientService.Client.Factory(), transport);
+ TabletClientService.Client client = ThriftUtil
+ .createClient(new TabletClientService.Client.Factory(), transport);
client.getTabletServerStatus(Tracer.traceInfo(), context.rpcCreds());
- } catch (TTransportException e) {
- throw new AccumuloException(e);
- } catch (ThriftSecurityException e) {
- throw new AccumuloException(e);
} catch (TException e) {
throw new AccumuloException(e);
} finally {
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
index c9194b1,39e1f2d..ca05f84
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/MasterClient.java
@@@ -149,9 -148,6 +153,10 @@@ public class MasterClient
default:
throw new AccumuloException(e);
}
+ } catch (ThriftNotActiveServiceException e) {
+ // Let it loop, fetching a new location
- log.debug("Contacted a Master which is no longer active, re-creating the connection to the active Master");
++ log.debug(
++ "Contacted a Master which is no longer active, re-creating the connection to the active Master");
} catch (Exception e) {
throw new AccumuloException(e);
} finally {
@@@ -176,7 -174,8 +183,8 @@@
}
}
- public static void executeVoid(ClientContext context, ClientExec<MasterClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
- public static void execute(ClientContext context, ClientExec<MasterClientService.Client> exec)
++ public static void executeVoid(ClientContext context, ClientExec<MasterClientService.Client> exec)
+ throws AccumuloException, AccumuloSecurityException {
try {
executeGeneric(context, exec);
} catch (TableNotFoundException e) {
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
index 255aa01,e1b2306..e14240b
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/MultiTableBatchWriterImpl.java
@@@ -99,7 -102,8 +102,8 @@@ public class MultiTableBatchWriterImpl
@Override
protected void finalize() {
if (!closed.get()) {
- log.warn("{} not shutdown; did you forget to call close()?", MultiTableBatchWriterImpl.class.getSimpleName());
- log.warn(MultiTableBatchWriterImpl.class.getSimpleName()
- + " not shutdown; did you forget to call close()?");
++ log.warn("{} not shutdown; did you forget to call close()?",
++ MultiTableBatchWriterImpl.class.getSimpleName());
try {
close();
} catch (MutationsRejectedException mre) {
@@@ -137,10 -142,11 +142,11 @@@
}
@Override
- public BatchWriter getBatchWriter(String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+ public BatchWriter getBatchWriter(String tableName)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
checkArgument(tableName != null, "tableName is null");
- String tableId = getId(tableName);
+ Table.ID tableId = getId(tableName);
BatchWriter tbw = tableWriters.get(tableId);
if (tbw == null) {
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
index 56d7073,0000000..db5d838
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespace.java
@@@ -1,64 -1,0 +1,67 @@@
+/*
+ * 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 java.util.concurrent.ExecutionException;
+
+import org.apache.accumulo.core.client.Instance;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+
+public class Namespace {
+ public static final String ACCUMULO = "accumulo";
+ public static final String DEFAULT = "";
+ public static final String SEPARATOR = ".";
+
+ /**
- * Object representing an internal Namespace ID. This class was created to help with type safety. For help obtaining the value of a namespace ID from
- * Zookeeper, see {@link Namespaces#getNamespaceId(Instance, String)}
++ * Object representing an internal Namespace ID. This class was created to help with type safety.
++ * For help obtaining the value of a namespace ID from Zookeeper, see
++ * {@link Namespaces#getNamespaceId(Instance, String)}
+ *
- * Uses an internal cache and private constructor for storing a WeakReference of every Namespace.ID. Therefore, a Namespace.ID can't be instantiated outside
- * this class and is accessed by calling Namespace.ID.{@link #of(String)}.
++ * Uses an internal cache and private constructor for storing a WeakReference of every
++ * Namespace.ID. Therefore, a Namespace.ID can't be instantiated outside this class and is
++ * accessed by calling Namespace.ID.{@link #of(String)}.
+ */
+ public static class ID extends AbstractId {
+ private static final long serialVersionUID = 8931104141709170293L;
+ static final Cache<String,ID> cache = CacheBuilder.newBuilder().weakValues().build();
+
+ public static final ID ACCUMULO = of("+accumulo");
+ public static final ID DEFAULT = of("+default");
+
+ private ID(String canonical) {
+ super(canonical);
+ }
+
+ /**
+ * Get a Namespace.ID object for the provided canonical string.
+ *
+ * @param canonical
+ * Namespace ID string
+ * @return Namespace.ID object
+ */
+ public static Namespace.ID of(final String canonical) {
+ try {
+ return cache.get(canonical, () -> new Namespace.ID(canonical));
+ } catch (ExecutionException e) {
- throw new AssertionError("This should never happen: ID constructor should never return null.");
++ throw new AssertionError(
++ "This should never happen: ID constructor should never return null.");
+ }
+ }
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java
index c0fe567,70c7f9d..e8826c1
--- 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
@@@ -115,7 -117,9 +119,9 @@@ public class NamespaceOperationsImpl ex
checkArgument(namespace != null, "namespace is null");
try {
- doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE, Arrays.asList(ByteBuffer.wrap(namespace.getBytes(UTF_8))), Collections.emptyMap(), namespace);
+ doNamespaceFateOperation(FateOperation.NAMESPACE_CREATE,
- Arrays.asList(ByteBuffer.wrap(namespace.getBytes(UTF_8))),
- Collections.<String,String> emptyMap(), namespace);
++ Arrays.asList(ByteBuffer.wrap(namespace.getBytes(UTF_8))), Collections.emptyMap(),
++ namespace);
} catch (NamespaceNotFoundException e) {
// should not happen
throw new AssertionError(e);
@@@ -123,14 -127,17 +129,16 @@@
}
@Override
- public void delete(String namespace) throws AccumuloException, AccumuloSecurityException, NamespaceNotFoundException, NamespaceNotEmptyException {
+ public void delete(String namespace) throws AccumuloException, AccumuloSecurityException,
+ NamespaceNotFoundException, NamespaceNotEmptyException {
checkArgument(namespace != null, "namespace is null");
- String namespaceId = Namespaces.getNamespaceId(context.getInstance(), namespace);
+ Namespace.ID namespaceId = Namespaces.getNamespaceId(context.getInstance(), namespace);
- if (namespaceId.equals(Namespaces.ACCUMULO_NAMESPACE_ID)
- || namespaceId.equals(Namespaces.DEFAULT_NAMESPACE_ID)) {
+ if (namespaceId.equals(Namespace.ID.ACCUMULO) || namespaceId.equals(Namespace.ID.DEFAULT)) {
Credentials credentials = context.getCredentials();
log.debug("{} attempted to delete the {} namespace", credentials.getPrincipal(), namespaceId);
- throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.UNSUPPORTED_OPERATION);
+ throw new AccumuloSecurityException(credentials.getPrincipal(),
+ SecurityErrorCode.UNSUPPORTED_OPERATION);
}
if (Namespaces.getTableIds(context.getInstance(), namespaceId).size() > 0) {
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
index 2416c5a,9f8ff0d..40e95cf
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java
@@@ -78,113 -74,92 +79,123 @@@ public class Namespaces
}
};
- private static SecurityPermission TABLES_PERMISSION = new SecurityPermission("tablesPermission");
-
- public static final String DEFAULT_NAMESPACE_ID = "+default";
- public static final String DEFAULT_NAMESPACE = "";
- public static final String ACCUMULO_NAMESPACE_ID = "+accumulo";
- public static final String ACCUMULO_NAMESPACE = "accumulo";
-
private static ZooCache getZooCache(Instance instance) {
- return new ZooCacheFactory().getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut());
- SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(TABLES_PERMISSION);
- }
+ return new ZooCacheFactory().getZooCache(instance.getZooKeepers(),
+ instance.getZooKeepersSessionTimeOut());
}
- private static SortedMap<String,String> getMap(Instance instance, boolean nameAsKey) {
+ public static boolean exists(Instance instance, Namespace.ID namespaceId) {
ZooCache zc = getZooCache(instance);
-
List<String> namespaceIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES);
+ return namespaceIds.contains(namespaceId.canonicalID());
+ }
+
- public static List<Table.ID> getTableIds(Instance instance, Namespace.ID namespaceId) throws NamespaceNotFoundException {
++ public static List<Table.ID> getTableIds(Instance instance, Namespace.ID namespaceId)
++ throws NamespaceNotFoundException {
+ String namespace = getNamespaceName(instance, namespaceId);
+ List<Table.ID> tableIds = new LinkedList<>();
+ for (Entry<String,Table.ID> nameToId : Tables.getNameToIdMap(instance).entrySet())
+ if (namespace.equals(Tables.qualify(nameToId.getKey()).getFirst()))
+ tableIds.add(nameToId.getValue());
+ return tableIds;
+ }
- public static List<String> getTableNames(Instance instance, Namespace.ID namespaceId) throws NamespaceNotFoundException {
- TreeMap<String,String> namespaceMap = new TreeMap<>();
++ public static List<String> getTableNames(Instance instance, Namespace.ID namespaceId)
++ throws NamespaceNotFoundException {
+ String namespace = getNamespaceName(instance, namespaceId);
+ List<String> names = new LinkedList<>();
+ for (String name : Tables.getNameToIdMap(instance).keySet())
+ if (namespace.equals(Tables.qualify(name).getFirst()))
+ names.add(name);
+ return names;
+ }
+ /**
- * Gets all the namespaces from ZK. The first arg (t) the BiConsumer accepts is the ID and the second (u) is the namespaceName.
++ * Gets all the namespaces from ZK. The first arg (t) the BiConsumer accepts is the ID and the
++ * second (u) is the namespaceName.
+ */
+ private static void getAllNamespaces(Instance instance, BiConsumer<String,String> biConsumer) {
+ final ZooCache zc = getZooCache(instance);
+ List<String> namespaceIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES);
for (String id : namespaceIds) {
- byte[] path = zc.get(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES + "/" + id + Constants.ZNAMESPACE_NAME);
+ byte[] path = zc.get(
+ ZooUtil.getRoot(instance) + Constants.ZNAMESPACES + "/" + id + Constants.ZNAMESPACE_NAME);
if (path != null) {
- if (nameAsKey)
- namespaceMap.put(new String(path, UTF_8), id);
- else
- namespaceMap.put(id, new String(path, UTF_8));
+ biConsumer.accept(id, new String(path, UTF_8));
}
}
- return namespaceMap;
}
- public static boolean exists(Instance instance, String namespaceId) {
- ZooCache zc = getZooCache(instance);
- List<String> namespaceIds = zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES);
- return namespaceIds.contains(namespaceId);
+ /**
+ * Return sorted map with key = ID, value = namespaceName
+ */
+ public static SortedMap<Namespace.ID,String> getIdToNameMap(Instance instance) {
+ SortedMap<Namespace.ID,String> idMap = new TreeMap<>();
+ getAllNamespaces(instance, (id, name) -> idMap.put(Namespace.ID.of(id), name));
+ return idMap;
}
- public static String getNamespaceId(Instance instance, String namespace)
- throws NamespaceNotFoundException {
- String id = getNameToIdMap(instance).get(namespace);
- if (id == null)
- throw new NamespaceNotFoundException(null, namespace,
- "getNamespaceId() failed to find namespace");
- return id;
+ /**
+ * Return sorted map with key = namespaceName, value = ID
+ */
+ public static SortedMap<String,Namespace.ID> getNameToIdMap(Instance instance) {
+ SortedMap<String,Namespace.ID> nameMap = new TreeMap<>();
+ getAllNamespaces(instance, (id, name) -> nameMap.put(name, Namespace.ID.of(id)));
+ return nameMap;
}
- public static String getNamespaceName(Instance instance, String namespaceId)
+ /**
+ * Look for namespace ID in ZK. Throw NamespaceNotFoundException if not found.
+ */
- public static Namespace.ID getNamespaceId(Instance instance, String namespaceName) throws NamespaceNotFoundException {
++ public static Namespace.ID getNamespaceId(Instance instance, String namespaceName)
+ throws NamespaceNotFoundException {
- String namespaceName = getIdToNameMap(instance).get(namespaceId);
- if (namespaceName == null)
- throw new NamespaceNotFoundException(namespaceId, null,
- "getNamespaceName() failed to find namespace");
- return namespaceName;
- }
-
- public static SortedMap<String,String> getNameToIdMap(Instance instance) {
- return getMap(instance, true);
+ final ArrayList<Namespace.ID> singleId = new ArrayList<>(1);
+ getAllNamespaces(instance, (id, name) -> {
+ if (name.equals(namespaceName))
+ singleId.add(Namespace.ID.of(id));
+ });
+ if (singleId.isEmpty())
- throw new NamespaceNotFoundException(null, namespaceName, "getNamespaceId() failed to find namespace");
++ throw new NamespaceNotFoundException(null, namespaceName,
++ "getNamespaceId() failed to find namespace");
+ return singleId.get(0);
}
- public static SortedMap<String,String> getIdToNameMap(Instance instance) {
- return getMap(instance, false);
+ /**
+ * Look for namespace ID in ZK. Fail quietly by logging and returning null.
+ */
+ public static Namespace.ID lookupNamespaceId(Instance instance, String namespaceName) {
+ Namespace.ID id = null;
+ try {
+ id = getNamespaceId(instance, namespaceName);
+ } catch (NamespaceNotFoundException e) {
+ if (log.isDebugEnabled())
+ log.debug("Failed to find namespace ID from name: " + namespaceName, e);
+ }
+ return id;
}
- public static List<String> getTableIds(Instance instance, String namespaceId)
- throws NamespaceNotFoundException {
- String namespace = getNamespaceName(instance, namespaceId);
- List<String> names = new LinkedList<>();
- for (Entry<String,String> nameToId : Tables.getNameToIdMap(instance).entrySet())
- if (namespace.equals(Tables.qualify(nameToId.getKey()).getFirst()))
- names.add(nameToId.getValue());
- return names;
+ /**
+ * Return true if namespace name exists
+ */
+ public static boolean namespaceNameExists(Instance instance, String namespaceName) {
+ return lookupNamespaceId(instance, namespaceName) != null;
}
- public static List<String> getTableNames(Instance instance, String namespaceId)
+ /**
+ * Look for namespace name in ZK. Throw NamespaceNotFoundException if not found.
+ */
- public static String getNamespaceName(Instance instance, Namespace.ID namespaceId) throws NamespaceNotFoundException {
++ public static String getNamespaceName(Instance instance, Namespace.ID namespaceId)
+ throws NamespaceNotFoundException {
- String namespace = getNamespaceName(instance, namespaceId);
- List<String> names = new LinkedList<>();
- for (String name : Tables.getNameToIdMap(instance).keySet())
- if (namespace.equals(Tables.qualify(name).getFirst()))
- names.add(name);
- return names;
+ String name;
+ ZooCache zc = getZooCache(instance);
- byte[] path = zc.get(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES + "/" + namespaceId.canonicalID() + Constants.ZNAMESPACE_NAME);
++ byte[] path = zc.get(ZooUtil.getRoot(instance) + Constants.ZNAMESPACES + "/"
++ + namespaceId.canonicalID() + Constants.ZNAMESPACE_NAME);
+ if (path != null)
+ name = new String(path, UTF_8);
+ else
- throw new NamespaceNotFoundException(namespaceId.canonicalID(), null, "getNamespaceName() failed to find namespace");
++ throw new NamespaceNotFoundException(namespaceId.canonicalID(), null,
++ "getNamespaceName() failed to find namespace");
+ return name;
}
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
index a6d8720,783ea77..fb926da
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/OfflineIterator.java
@@@ -159,10 -162,11 +162,11 @@@ class OfflineIterator implements Iterat
this.range = range;
if (this.options.fetchedColumns.size() > 0) {
- this.range = range.bound(this.options.fetchedColumns.first(), this.options.fetchedColumns.last());
+ this.range = range.bound(this.options.fetchedColumns.first(),
+ this.options.fetchedColumns.last());
}
- this.tableId = table.toString();
+ this.tableId = Table.ID.of(table.toString());
this.authorizations = authorizations;
this.readers = new ArrayList<>();
@@@ -315,14 -324,11 +324,15 @@@
return new Pair<>(extent, location);
}
- private SortedKeyValueIterator<Key,Value> createIterator(KeyExtent extent, List<String> absFiles) throws TableNotFoundException, AccumuloException,
- IOException {
+ private SortedKeyValueIterator<Key,Value> createIterator(KeyExtent extent, List<String> absFiles)
+ throws TableNotFoundException, AccumuloException, IOException {
// TODO share code w/ tablet - ACCUMULO-1303
- AccumuloConfiguration acuTableConf = AccumuloConfiguration.getTableConfiguration(conn, tableId);
+
+ // possible race condition here, if table is renamed
+ String tableName = Tables.getTableName(conn.getInstance(), tableId);
- AccumuloConfiguration acuTableConf = new ConfigurationCopy(conn.tableOperations().getProperties(tableName));
++ AccumuloConfiguration acuTableConf = new ConfigurationCopy(
++ conn.tableOperations().getProperties(tableName));
Configuration conf = CachedConfiguration.getInstance();
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/OfflineScanner.java
index 8772184,955a8da..f38e886
--- 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
@@@ -41,7 -41,8 +41,8 @@@ public class OfflineScanner extends Sca
private Authorizations authorizations;
private Text tableId;
- public OfflineScanner(Instance instance, Credentials credentials, Table.ID tableId, Authorizations authorizations) {
- public OfflineScanner(Instance instance, Credentials credentials, String tableId,
++ public OfflineScanner(Instance instance, Credentials credentials, Table.ID tableId,
+ Authorizations authorizations) {
checkArgument(instance != null, "instance is null");
checkArgument(credentials != null, "credentials is null");
checkArgument(tableId != null, "tableId is null");
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java
index 7811651,527c02a..9421a97
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ReplicationOperationsImpl.java
@@@ -117,7 -125,8 +125,8 @@@ public class ReplicationOperationsImpl
});
}
- protected Table.ID getTableId(Connector conn, String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- protected String getTableId(Connector conn, String tableName)
++ protected Table.ID getTableId(Connector conn, String tableName)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
TableOperations tops = conn.tableOperations();
if (!conn.tableOperations().exists(tableName)) {
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
index ec0c48c,bc80f55..a588ea3
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ScannerIterator.java
@@@ -66,7 -66,8 +66,8 @@@ public class ScannerIterator implement
private static final List<KeyValue> EMPTY_LIST = Collections.emptyList();
- private static ThreadPoolExecutor readaheadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 3l, TimeUnit.SECONDS, new SynchronousQueue<>(),
+ private static ThreadPoolExecutor readaheadPool = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 3l,
- TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
++ TimeUnit.SECONDS, new SynchronousQueue<>(),
new NamingThreadFactory("Accumulo scanner read ahead thread"));
private class Reader implements Runnable {
@@@ -104,8 -106,8 +106,9 @@@
}
- ScannerIterator(ClientContext context, Table.ID tableId, Authorizations authorizations, Range range, int size, int timeOut, ScannerOptions options,
- boolean isolated, long readaheadThreshold) {
- ScannerIterator(ClientContext context, String tableId, Authorizations authorizations, Range range,
- int size, int timeOut, ScannerOptions options, boolean isolated, long readaheadThreshold) {
++ ScannerIterator(ClientContext context, Table.ID tableId, Authorizations authorizations,
++ Range range, int size, int timeOut, ScannerOptions options, boolean isolated,
++ long readaheadThreshold) {
this.timeOut = timeOut;
this.readaheadThreshold = readaheadThreshold;
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/SecurityOperationsImpl.java
index 781a5d4,71059b1..7573a09
--- 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
@@@ -48,9 -48,10 +48,10 @@@ public class SecurityOperationsImpl imp
private final ClientContext context;
- private void executeVoid(ClientExec<ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
- private void execute(ClientExec<ClientService.Client> exec)
++ private void executeVoid(ClientExec<ClientService.Client> exec)
+ throws AccumuloException, AccumuloSecurityException {
try {
- ServerClient.executeRaw(context, exec);
+ ServerClient.executeRawVoid(context, exec);
} catch (ThriftTableOperationException ttoe) {
// recast missing table
if (ttoe.getType() == TableOperationExceptionType.NOTFOUND)
@@@ -125,9 -131,10 +131,10 @@@
}
@Override
- public void dropLocalUser(final String principal) throws AccumuloException, AccumuloSecurityException {
+ public void dropLocalUser(final String principal)
+ throws AccumuloException, AccumuloSecurityException {
checkArgument(principal != null, "principal is null");
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
client.dropLocalUser(Tracer.traceInfo(), context.rpcCreds(), principal);
@@@ -165,10 -177,11 +177,11 @@@
checkArgument(principal != null, "principal is null");
checkArgument(token != null, "token is null");
final Credentials toChange = new Credentials(principal, token);
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.changeLocalUserPassword(Tracer.traceInfo(), context.rpcCreds(), principal, ByteBuffer.wrap(token.getPassword()));
+ client.changeLocalUserPassword(Tracer.traceInfo(), context.rpcCreds(), principal,
+ ByteBuffer.wrap(token.getPassword()));
}
});
if (context.getCredentials().getPrincipal().equals(principal)) {
@@@ -177,13 -190,15 +190,15 @@@
}
@Override
- public void changeUserAuthorizations(final String principal, final Authorizations authorizations) throws AccumuloException, AccumuloSecurityException {
+ public void changeUserAuthorizations(final String principal, final Authorizations authorizations)
+ throws AccumuloException, AccumuloSecurityException {
checkArgument(principal != null, "principal is null");
checkArgument(authorizations != null, "authorizations is null");
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.changeAuthorizations(Tracer.traceInfo(), context.rpcCreds(), principal, ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
+ client.changeAuthorizations(Tracer.traceInfo(), context.rpcCreds(), principal,
+ ByteBufferUtil.toByteBuffers(authorizations.getAuthorizations()));
}
});
}
@@@ -246,13 -269,15 +269,15 @@@
}
@Override
- public void grantSystemPermission(final String principal, final SystemPermission permission) throws AccumuloException, AccumuloSecurityException {
+ public void grantSystemPermission(final String principal, final SystemPermission permission)
+ throws AccumuloException, AccumuloSecurityException {
checkArgument(principal != null, "principal is null");
checkArgument(permission != null, "permission is null");
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.grantSystemPermission(Tracer.traceInfo(), context.rpcCreds(), principal, permission.getId());
+ client.grantSystemPermission(Tracer.traceInfo(), context.rpcCreds(), principal,
+ permission.getId());
}
});
}
@@@ -264,10 -289,11 +289,11 @@@
checkArgument(table != null, "table is null");
checkArgument(permission != null, "permission is null");
try {
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.grantTablePermission(Tracer.traceInfo(), context.rpcCreds(), principal, table, permission.getId());
+ client.grantTablePermission(Tracer.traceInfo(), context.rpcCreds(), principal, table,
+ permission.getId());
}
});
} catch (AccumuloSecurityException e) {
@@@ -284,22 -311,25 +311,25 @@@
checkArgument(principal != null, "principal is null");
checkArgument(namespace != null, "namespace is null");
checkArgument(permission != null, "permission is null");
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.grantNamespacePermission(Tracer.traceInfo(), context.rpcCreds(), principal, namespace, permission.getId());
+ client.grantNamespacePermission(Tracer.traceInfo(), context.rpcCreds(), principal,
+ namespace, permission.getId());
}
});
}
@Override
- public void revokeSystemPermission(final String principal, final SystemPermission permission) throws AccumuloException, AccumuloSecurityException {
+ public void revokeSystemPermission(final String principal, final SystemPermission permission)
+ throws AccumuloException, AccumuloSecurityException {
checkArgument(principal != null, "principal is null");
checkArgument(permission != null, "permission is null");
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.revokeSystemPermission(Tracer.traceInfo(), context.rpcCreds(), principal, permission.getId());
+ client.revokeSystemPermission(Tracer.traceInfo(), context.rpcCreds(), principal,
+ permission.getId());
}
});
}
@@@ -311,10 -341,11 +341,11 @@@
checkArgument(table != null, "table is null");
checkArgument(permission != null, "permission is null");
try {
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.revokeTablePermission(Tracer.traceInfo(), context.rpcCreds(), principal, table, permission.getId());
+ client.revokeTablePermission(Tracer.traceInfo(), context.rpcCreds(), principal, table,
+ permission.getId());
}
});
} catch (AccumuloSecurityException e) {
@@@ -331,10 -363,11 +363,11 @@@
checkArgument(principal != null, "principal is null");
checkArgument(namespace != null, "namespace is null");
checkArgument(permission != null, "permission is null");
- execute(new ClientExec<ClientService.Client>() {
+ executeVoid(new ClientExec<ClientService.Client>() {
@Override
public void execute(ClientService.Client client) throws Exception {
- client.revokeNamespacePermission(Tracer.traceInfo(), context.rpcCreds(), principal, namespace, permission.getId());
+ client.revokeNamespacePermission(Tracer.traceInfo(), context.rpcCreds(), principal,
+ namespace, permission.getId());
}
});
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
index d21a32e,6e49585..c0edd5a
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
@@@ -48,14 -45,10 +48,16 @@@ import org.slf4j.LoggerFactory
public class ServerClient {
private static final Logger log = LoggerFactory.getLogger(ServerClient.class);
- public static <T> T execute(ClientContext context, ClientExecReturn<T,ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
+ public static <T> T execute(ClientContext context, ClientExecReturn<T,ClientService.Client> exec)
+ throws AccumuloException, AccumuloSecurityException {
+ return execute(context, new ClientService.Client.Factory(), exec);
+ }
+
- public static <CT extends TServiceClient,RT> RT execute(ClientContext context, TServiceClientFactory<CT> factory, ClientExecReturn<RT,CT> exec)
++ public static <CT extends TServiceClient,RT> RT execute(ClientContext context,
++ TServiceClientFactory<CT> factory, ClientExecReturn<RT,CT> exec)
+ throws AccumuloException, AccumuloSecurityException {
try {
- return executeRaw(context, exec);
+ return executeRaw(context, factory, exec);
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (AccumuloException e) {
@@@ -65,9 -58,10 +67,10 @@@
}
}
- public static void executeVoid(ClientContext context, ClientExec<ClientService.Client> exec) throws AccumuloException, AccumuloSecurityException {
- public static void execute(ClientContext context, ClientExec<ClientService.Client> exec)
++ public static void executeVoid(ClientContext context, ClientExec<ClientService.Client> exec)
+ throws AccumuloException, AccumuloSecurityException {
try {
- executeRaw(context, exec);
+ executeRawVoid(context, exec);
} catch (ThriftSecurityException e) {
throw new AccumuloSecurityException(e.user, e.code, e);
} catch (AccumuloException e) {
@@@ -77,17 -71,13 +80,18 @@@
}
}
- public static <T> T executeRaw(ClientContext context, ClientExecReturn<T,ClientService.Client> exec) throws Exception {
+ public static <T> T executeRaw(ClientContext context,
+ ClientExecReturn<T,ClientService.Client> exec) throws Exception {
+ return executeRaw(context, new ClientService.Client.Factory(), exec);
+ }
+
- public static <CT extends TServiceClient,RT> RT executeRaw(ClientContext context, TServiceClientFactory<CT> factory, ClientExecReturn<RT,CT> exec)
- throws Exception {
++ public static <CT extends TServiceClient,RT> RT executeRaw(ClientContext context,
++ TServiceClientFactory<CT> factory, ClientExecReturn<RT,CT> exec) throws Exception {
while (true) {
- ClientService.Client client = null;
+ CT client = null;
String server = null;
try {
- Pair<String,Client> pair = ServerClient.getConnection(context);
+ Pair<String,CT> pair = ServerClient.getConnection(context, factory);
server = pair.getFirst();
client = pair.getSecond();
return exec.execute(client);
@@@ -103,7 -91,8 +107,8 @@@
}
}
- public static void executeRawVoid(ClientContext context, ClientExec<ClientService.Client> exec) throws Exception {
- public static void executeRaw(ClientContext context, ClientExec<ClientService.Client> exec)
++ public static void executeRawVoid(ClientContext context, ClientExec<ClientService.Client> exec)
+ throws Exception {
while (true) {
ClientService.Client client = null;
String server = null;
@@@ -131,21 -119,13 +137,25 @@@
return getConnection(context, true);
}
- public static <CT extends TServiceClient> Pair<String,CT> getConnection(ClientContext context, TServiceClientFactory<CT> factory) throws TTransportException {
++ public static <CT extends TServiceClient> Pair<String,CT> getConnection(ClientContext context,
++ TServiceClientFactory<CT> factory) throws TTransportException {
+ return getConnection(context, factory, true, context.getClientTimeoutInMillis());
+ }
+
- public static Pair<String,ClientService.Client> getConnection(ClientContext context, boolean preferCachedConnections) throws TTransportException {
+ public static Pair<String,ClientService.Client> getConnection(ClientContext context,
+ boolean preferCachedConnections) throws TTransportException {
return getConnection(context, preferCachedConnections, context.getClientTimeoutInMillis());
}
- public static Pair<String,ClientService.Client> getConnection(ClientContext context, boolean preferCachedConnections, long rpcTimeout)
- throws TTransportException {
- return getConnection(context, new ClientService.Client.Factory(), preferCachedConnections, rpcTimeout);
+ public static Pair<String,ClientService.Client> getConnection(ClientContext context,
+ boolean preferCachedConnections, long rpcTimeout) throws TTransportException {
++ return getConnection(context, new ClientService.Client.Factory(), preferCachedConnections,
++ rpcTimeout);
+ }
+
- public static <CT extends TServiceClient> Pair<String,CT> getConnection(ClientContext context, TServiceClientFactory<CT> factory,
- boolean preferCachedConnections, long rpcTimeout) throws TTransportException {
++ public static <CT extends TServiceClient> Pair<String,CT> getConnection(ClientContext context,
++ TServiceClientFactory<CT> factory, boolean preferCachedConnections, long rpcTimeout)
++ throws TTransportException {
checkArgument(context != null, "context is null");
// create list of servers
ArrayList<ThriftTransportKey> servers = new ArrayList<>();
@@@ -165,8 -147,10 +177,9 @@@
boolean opened = false;
try {
- Pair<String,TTransport> pair = ThriftTransportPool.getInstance().getAnyTransport(servers, preferCachedConnections);
+ Pair<String,TTransport> pair = ThriftTransportPool.getInstance().getAnyTransport(servers,
+ preferCachedConnections);
- ClientService.Client client = ThriftUtil.createClient(new ClientService.Client.Factory(),
- pair.getSecond());
+ CT client = ThriftUtil.createClient(factory, pair.getSecond());
opened = true;
warnedAboutTServersBeingDown = false;
return new Pair<>(pair.getFirst(), client);
@@@ -184,8 -168,9 +197,9 @@@
}
}
- public static void close(ClientService.Client client) {
+ public static void close(TServiceClient client) {
- if (client != null && client.getInputProtocol() != null && client.getInputProtocol().getTransport() != null) {
+ if (client != null && client.getInputProtocol() != null
+ && client.getInputProtocol().getTransport() != null) {
ThriftTransportPool.getInstance().returnTransport(client.getInputProtocol().getTransport());
} else {
log.debug("Attempt to close null connection to a server", new Exception());
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
index 15517d9,0000000..23b083b
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Table.java
@@@ -1,63 -1,0 +1,66 @@@
+/*
+ * 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 java.util.concurrent.ExecutionException;
+
+import org.apache.accumulo.core.client.Instance;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+
+public class Table {
+
+ /**
- * Object representing an internal table ID. This class was created to help with type safety. For help obtaining the value of a table ID from Zookeeper, see
++ * Object representing an internal table ID. This class was created to help with type safety. For
++ * help obtaining the value of a table ID from Zookeeper, see
+ * {@link Tables#getTableId(Instance, String)}
+ *
- * Uses an internal cache and private constructor for storing a WeakReference of every Table.ID. Therefore, a Table.ID can't be instantiated outside this
- * class and is accessed by calling Table.ID.{@link #of(String)}.
++ * Uses an internal cache and private constructor for storing a WeakReference of every Table.ID.
++ * Therefore, a Table.ID can't be instantiated outside this class and is accessed by calling
++ * Table.ID.{@link #of(String)}.
+ */
+ public static class ID extends AbstractId {
+ private static final long serialVersionUID = 7399913185860577809L;
+ static final Cache<String,ID> cache = CacheBuilder.newBuilder().weakValues().build();
+
+ public static final ID METADATA = of("!0");
+ public static final ID REPLICATION = of("+rep");
+ public static final ID ROOT = of("+r");
+
+ private ID(final String canonical) {
+ super(canonical);
+ }
+
+ /**
+ * Get a Table.ID object for the provided canonical string.
+ *
+ * @param canonical
+ * table ID string
+ * @return Table.ID object
+ */
+ public static ID of(final String canonical) {
+ try {
+ return cache.get(canonical, () -> new Table.ID(canonical));
+ } catch (ExecutionException e) {
- throw new AssertionError("This should never happen: ID constructor should never return null.");
++ throw new AssertionError(
++ "This should never happen: ID constructor should never return null.");
+ }
+ }
+ }
+
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TableMap.java
index 9f17fde,8bd2db3..027807f
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableMap.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableMap.java
@@@ -75,7 -75,8 +75,8 @@@ public class TableMap
namespaceIdToNameMap.put(namespaceId, namespaceName);
}
} catch (NamespaceNotFoundException e) {
- log.error("Table (" + tableIdStr + ") contains reference to namespace (" + namespaceId + ") that doesn't exist", e);
- log.error("Table (" + tableId + ") contains reference to namespace (" + namespaceId
++ log.error("Table (" + tableIdStr + ") contains reference to namespace (" + namespaceId
+ + ") that doesn't exist", e);
continue;
}
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
index 357cab4,baf53ef..755cb09
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsHelper.java
@@@ -120,7 -126,10 +126,8 @@@ public abstract class TableOperationsHe
return result;
}
- public static void checkIteratorConflicts(Map<String,String> props, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException {
- @Override
- public void checkIteratorConflicts(String tableName, IteratorSetting setting,
- EnumSet<IteratorScope> scopes) throws AccumuloException, TableNotFoundException {
- checkArgument(tableName != null, "tableName is null");
++ public static void checkIteratorConflicts(Map<String,String> props, IteratorSetting setting,
++ EnumSet<IteratorScope> scopes) throws AccumuloException {
checkArgument(setting != null, "setting is null");
checkArgument(scopes != null, "scopes is null");
for (IteratorScope scope : scopes) {
@@@ -128,11 -138,11 +136,11 @@@
String nameStr = String.format("%s.%s", scopeStr, setting.getName());
String optStr = String.format("%s.opt.", nameStr);
Map<String,String> optionConflicts = new TreeMap<>();
- for (Entry<String,String> property : this.getProperties(tableName)) {
+ for (Entry<String,String> property : props.entrySet()) {
if (property.getKey().startsWith(scopeStr)) {
if (property.getKey().equals(nameStr))
- throw new AccumuloException(new IllegalArgumentException("iterator name conflict for " + setting.getName() + ": " + property.getKey() + "="
- + property.getValue()));
+ throw new AccumuloException(new IllegalArgumentException("iterator name conflict for "
+ + setting.getName() + ": " + property.getKey() + "=" + property.getValue()));
if (property.getKey().startsWith(optStr))
optionConflicts.put(property.getKey(), property.getValue());
if (property.getKey().contains(".opt."))
@@@ -154,15 -168,8 +166,17 @@@
}
@Override
- public void checkIteratorConflicts(String tableName, IteratorSetting setting, EnumSet<IteratorScope> scopes) throws AccumuloException, TableNotFoundException {
++ public void checkIteratorConflicts(String tableName, IteratorSetting setting,
++ EnumSet<IteratorScope> scopes) throws AccumuloException, TableNotFoundException {
+ checkArgument(tableName != null, "tableName is null");
+ Map<String,String> iteratorProps = new HashMap<>();
+ for (Entry<String,String> entry : this.getProperties(tableName))
+ iteratorProps.put(entry.getKey(), entry.getValue());
+ checkIteratorConflicts(iteratorProps, setting, scopes);
+ }
+
- public int addConstraint(String tableName, String constraintClassName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+ public int addConstraint(String tableName, String constraintClassName)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
TreeSet<Integer> constraintNumbers = new TreeSet<>();
TreeMap<String,Integer> constraintClasses = new TreeMap<>();
int i;
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TableOperationsImpl.java
index 96afcf7,9632cc0..ea318a7
--- 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
@@@ -268,8 -258,9 +278,9 @@@ public class TableOperationsImpl extend
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(context);
- client.executeFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid, op, args, opts, autoCleanUp);
+ client.executeFateOperation(Tracer.traceInfo(), context.rpcCreds(), opid, op, args, opts,
+ autoCleanUp);
- break;
+ return;
} catch (TTransportException tte) {
log.debug("Failed to call executeFateOperation(), retrying ... ", tte);
sleepUninterruptibly(100, TimeUnit.MILLISECONDS);
@@@ -361,7 -348,8 +380,8 @@@
case NAMESPACE_NOTFOUND:
throw new NamespaceNotFoundException(e);
case OFFLINE:
- throw new TableOfflineException(context.getInstance(), Tables.getTableId(context.getInstance(), tableOrNamespaceName).canonicalID());
+ throw new TableOfflineException(context.getInstance(),
- Tables.getTableId(context.getInstance(), tableOrNamespaceName));
++ Tables.getTableId(context.getInstance(), tableOrNamespaceName).canonicalID());
default:
throw new AccumuloException(e.description, e);
}
@@@ -386,7 -374,8 +406,8 @@@
private CountDownLatch latch;
private AtomicReference<Throwable> exception;
- SplitEnv(String tableName, Table.ID tableId, ExecutorService executor, CountDownLatch latch, AtomicReference<Throwable> exception) {
- SplitEnv(String tableName, String tableId, ExecutorService executor, CountDownLatch latch,
++ SplitEnv(String tableName, Table.ID tableId, ExecutorService executor, CountDownLatch latch,
+ AtomicReference<Throwable> exception) {
this.tableName = tableName;
this.tableId = tableId;
this.executor = executor;
@@@ -436,8 -426,9 +458,9 @@@
}
@Override
- public void addSplits(String tableName, SortedSet<Text> partitionKeys) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
+ public void addSplits(String tableName, SortedSet<Text> partitionKeys)
+ throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
- String tableId = Tables.getTableId(context.getInstance(), tableName);
+ Table.ID tableId = Tables.getTableId(context.getInstance(), tableName);
List<Text> splits = new ArrayList<>(partitionKeys);
// should be sorted because we copied from a sorted set, but that makes assumptions about
@@@ -459,10 -453,12 +485,12 @@@
// user would only have the stack trace for the background thread.
if (excep instanceof TableNotFoundException) {
TableNotFoundException tnfe = (TableNotFoundException) excep;
- throw new TableNotFoundException(tableId.canonicalID(), tableName, "Table not found by background thread", tnfe);
- throw new TableNotFoundException(tableId, tableName,
++ throw new TableNotFoundException(tableId.canonicalID(), tableName,
+ "Table not found by background thread", tnfe);
} else if (excep instanceof TableOfflineException) {
- log.debug("TableOfflineException occurred in background thread. Throwing new exception", excep);
+ log.debug("TableOfflineException occurred in background thread. Throwing new exception",
+ excep);
- throw new TableOfflineException(context.getInstance(), tableId);
+ throw new TableOfflineException(context.getInstance(), tableId.canonicalID());
} else if (excep instanceof AccumuloSecurityException) {
// base == background accumulo security exception
AccumuloSecurityException base = (AccumuloSecurityException) excep;
@@@ -483,8 -480,9 +512,9 @@@
}
}
- private void addSplits(String tableName, SortedSet<Text> partitionKeys, Table.ID tableId) throws AccumuloException, AccumuloSecurityException,
- TableNotFoundException, AccumuloServerException {
- private void addSplits(String tableName, SortedSet<Text> partitionKeys, String tableId)
++ private void addSplits(String tableName, SortedSet<Text> partitionKeys, Table.ID tableId)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
+ AccumuloServerException {
TabletLocator tabLocator = TabletLocator.getLocator(context, tableId);
for (Text split : partitionKeys) {
@@@ -716,7 -731,8 +763,8 @@@
if (propertiesToSet == null)
propertiesToSet = Collections.emptyMap();
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(srcTableId.getUtf8()), ByteBuffer.wrap(newTableName.getBytes(UTF_8)));
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(srcTableId.getBytes(UTF_8)),
++ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(srcTableId.getUtf8()),
+ ByteBuffer.wrap(newTableName.getBytes(UTF_8)));
Map<String,String> opts = new HashMap<>();
for (Entry<String,String> entry : propertiesToSet.entrySet()) {
if (entry.getKey().startsWith(CLONE_EXCLUDE_PREFIX))
@@@ -751,17 -770,18 +802,18 @@@
}
@Override
- public void flush(String tableName, Text start, Text end, boolean wait) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+ public void flush(String tableName, Text start, Text end, boolean wait)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
checkArgument(tableName != null, "tableName is null");
- String tableId = Tables.getTableId(context.getInstance(), tableName);
+ Table.ID tableId = Tables.getTableId(context.getInstance(), tableName);
_flush(tableId, start, end, wait);
}
@Override
- public void compact(String tableName, Text start, Text end, boolean flush, boolean wait) throws AccumuloSecurityException, TableNotFoundException,
- AccumuloException {
+ public void compact(String tableName, Text start, Text end, boolean flush, boolean wait)
+ throws AccumuloSecurityException, TableNotFoundException, AccumuloException {
- compact(tableName, start, end, new ArrayList<IteratorSetting>(), flush, wait);
+ compact(tableName, start, end, new ArrayList<>(), flush, wait);
}
@Override
@@@ -800,9 -826,11 +858,11 @@@
if (config.getFlush())
_flush(tableId, start, end, true);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getUtf8()), start == null ? EMPTY : TextUtil.getByteBuffer(start), end == null ? EMPTY
- : TextUtil.getByteBuffer(end), ByteBuffer.wrap(IteratorUtil.encodeIteratorSettings(config.getIterators())), ByteBuffer
- .wrap(CompactionStrategyConfigUtil.encode(config.getCompactionStrategy())));
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(UTF_8)),
++ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getUtf8()),
+ start == null ? EMPTY : TextUtil.getByteBuffer(start),
+ end == null ? EMPTY : TextUtil.getByteBuffer(end),
+ ByteBuffer.wrap(IteratorUtil.encodeIteratorSettings(config.getIterators())),
+ ByteBuffer.wrap(CompactionStrategyConfigUtil.encode(config.getCompactionStrategy())));
Map<String,String> opts = new HashMap<>();
try {
@@@ -816,10 -847,11 +876,11 @@@
}
@Override
- public void cancelCompaction(String tableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException {
+ public void cancelCompaction(String tableName)
+ throws AccumuloSecurityException, TableNotFoundException, AccumuloException {
- String tableId = Tables.getTableId(context.getInstance(), tableName);
+ Table.ID tableId = Tables.getTableId(context.getInstance(), tableName);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(UTF_8)));
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getUtf8()));
Map<String,String> opts = new HashMap<>();
try {
@@@ -831,7 -864,8 +893,8 @@@
}
- private void _flush(Table.ID tableId, Text start, Text end, boolean wait) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- private void _flush(String tableId, Text start, Text end, boolean wait)
++ private void _flush(Table.ID tableId, Text start, Text end, boolean wait)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
try {
long flushID;
@@@ -843,7 -878,7 +907,8 @@@
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(context);
- flushID = client.initiateFlush(Tracer.traceInfo(), context.rpcCreds(), tableId.canonicalID());
- flushID = client.initiateFlush(Tracer.traceInfo(), context.rpcCreds(), tableId);
++ flushID = client.initiateFlush(Tracer.traceInfo(), context.rpcCreds(),
++ tableId.canonicalID());
break;
} catch (TTransportException tte) {
log.debug("Failed to call initiateFlush, retrying ... ", tte);
@@@ -861,8 -892,9 +926,9 @@@
MasterClientService.Iface client = null;
try {
client = MasterClient.getConnectionWithRetry(context);
- client.waitForFlush(Tracer.traceInfo(), context.rpcCreds(), tableId.canonicalID(), TextUtil.getByteBuffer(start), TextUtil.getByteBuffer(end),
- flushID, wait ? Long.MAX_VALUE : 1);
- client.waitForFlush(Tracer.traceInfo(), context.rpcCreds(), tableId,
++ client.waitForFlush(Tracer.traceInfo(), context.rpcCreds(), tableId.canonicalID(),
+ TextUtil.getByteBuffer(start), TextUtil.getByteBuffer(end), flushID,
+ wait ? Long.MAX_VALUE : 1);
break;
} catch (TTransportException tte) {
log.debug("Failed to call initiateFlush, retrying ... ", tte);
@@@ -956,9 -990,19 +1028,10 @@@
}
@Override
- public void setLocalityGroups(String tableName, Map<String,Set<Text>> groups) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+ public void setLocalityGroups(String tableName, Map<String,Set<Text>> groups)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
// ensure locality groups do not overlap
- HashSet<Text> all = new HashSet<>();
- for (Entry<String,Set<Text>> entry : groups.entrySet()) {
-
- if (!Collections.disjoint(all, entry.getValue())) {
- throw new IllegalArgumentException(
- "Group " + entry.getKey() + " overlaps with another group");
- }
-
- all.addAll(entry.getValue());
- }
+ LocalityGroupUtil.ensureNonOverlappingGroups(groups);
for (Entry<String,Set<Text>> entry : groups.entrySet()) {
Set<Text> colFams = entry.getValue();
@@@ -1023,9 -1069,10 +1098,10 @@@
Random random = new Random();
Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
- String tableId = Tables.getTableId(context.getInstance(), tableName);
+ Table.ID tableId = Tables.getTableId(context.getInstance(), tableName);
TabletLocator tl = TabletLocator.getLocator(context, tableId);
- // its possible that the cache could contain complete, but old information about a tables tablets... so clear it
+ // its possible that the cache could contain complete, but old information about a tables
+ // tablets... so clear it
tl.invalidateCache();
while (!tl.binRanges(context, Collections.singletonList(range), binnedRanges).isEmpty()) {
if (!Tables.exists(context.getInstance(), tableId))
@@@ -1129,8 -1183,8 +1212,8 @@@
}
}
- private void waitForTableStateTransition(Table.ID tableId, TableState expectedState) throws AccumuloException, TableNotFoundException,
- AccumuloSecurityException {
- private void waitForTableStateTransition(String tableId, TableState expectedState)
++ private void waitForTableStateTransition(Table.ID tableId, TableState expectedState)
+ throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
Text startRow = null;
Text lastRow = null;
@@@ -1142,10 -1196,11 +1225,11 @@@
TableState currentState = Tables.getTableState(context.getInstance(), tableId);
if (currentState != expectedState) {
if (!Tables.exists(context.getInstance(), tableId))
- throw new TableDeletedException(tableId);
+ throw new TableDeletedException(tableId.canonicalID());
if (currentState == TableState.DELETING)
- throw new TableNotFoundException(tableId, "", "Table is being deleted.");
+ throw new TableNotFoundException(tableId.canonicalID(), "", "Table is being deleted.");
- throw new AccumuloException("Unexpected table state " + tableId + " " + Tables.getTableState(context.getInstance(), tableId) + " != " + expectedState);
+ throw new AccumuloException("Unexpected table state " + tableId + " "
+ + Tables.getTableState(context.getInstance(), tableId) + " != " + expectedState);
}
}
@@@ -1263,11 -1323,12 +1352,12 @@@
}
@Override
- public void offline(String tableName, boolean wait) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
+ public void offline(String tableName, boolean wait)
+ throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
checkArgument(tableName != null, "tableName is null");
- String tableId = Tables.getTableId(context.getInstance(), tableName);
- List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getBytes(UTF_8)));
+ Table.ID tableId = Tables.getTableId(context.getInstance(), tableName);
+ List<ByteBuffer> args = Arrays.asList(ByteBuffer.wrap(tableId.getUtf8()));
Map<String,String> opts = new HashMap<>();
try {
@@@ -1287,10 -1350,11 +1379,11 @@@
}
@Override
- public void online(String tableName, boolean wait) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
+ public void online(String tableName, boolean wait)
+ throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
checkArgument(tableName != null, "tableName is null");
- String tableId = Tables.getTableId(context.getInstance(), tableName);
+ Table.ID tableId = Tables.getTableId(context.getInstance(), tableName);
/**
* ACCUMULO-4574 if table is already online return without executing fate operation.
@@@ -1679,138 -1775,4 +1801,151 @@@
return new LoctionsImpl(binnedRanges);
}
+
+ @Override
+ public SummaryRetriever summaries(String tableName) {
+
+ return new SummaryRetriever() {
+
+ private Text startRow = null;
+ private Text endRow = null;
+ private List<TSummarizerConfiguration> summariesToFetch = Collections.emptyList();
+ private String summarizerClassRegex;
+ private boolean flush = false;
+
+ @Override
+ public SummaryRetriever startRow(Text startRow) {
+ Objects.requireNonNull(startRow);
+ if (endRow != null) {
- Preconditions.checkArgument(startRow.compareTo(endRow) < 0, "Start row must be less than end row : %s >= %s", startRow, endRow);
++ Preconditions.checkArgument(startRow.compareTo(endRow) < 0,
++ "Start row must be less than end row : %s >= %s", startRow, endRow);
+ }
+ this.startRow = startRow;
+ return this;
+ }
+
+ @Override
+ public SummaryRetriever startRow(CharSequence startRow) {
+ return startRow(new Text(startRow.toString()));
+ }
+
+ @Override
- public List<Summary> retrieve() throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
++ public List<Summary> retrieve()
++ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+ Table.ID tableId = Tables.getTableId(context.getInstance(), tableName);
+ if (Tables.getTableState(context.getInstance(), tableId) == TableState.OFFLINE)
+ throw new TableOfflineException(context.getInstance(), tableId.canonicalID());
+
- TRowRange range = new TRowRange(TextUtil.getByteBuffer(startRow), TextUtil.getByteBuffer(endRow));
- TSummaryRequest request = new TSummaryRequest(tableId.canonicalID(), range, summariesToFetch, summarizerClassRegex);
++ TRowRange range = new TRowRange(TextUtil.getByteBuffer(startRow),
++ TextUtil.getByteBuffer(endRow));
++ TSummaryRequest request = new TSummaryRequest(tableId.canonicalID(), range,
++ summariesToFetch, summarizerClassRegex);
+ if (flush) {
+ _flush(tableId, startRow, endRow, true);
+ }
+
- TSummaries ret = ServerClient.execute(context, new TabletClientService.Client.Factory(), client -> {
- TSummaries tsr = client.startGetSummaries(Tracer.traceInfo(), context.rpcCreds(), request);
- while (!tsr.finished) {
- tsr = client.contiuneGetSummaries(Tracer.traceInfo(), tsr.sessionId);
- }
- return tsr;
- });
++ TSummaries ret = ServerClient.execute(context, new TabletClientService.Client.Factory(),
++ client -> {
++ TSummaries tsr = client.startGetSummaries(Tracer.traceInfo(), context.rpcCreds(),
++ request);
++ while (!tsr.finished) {
++ tsr = client.contiuneGetSummaries(Tracer.traceInfo(), tsr.sessionId);
++ }
++ return tsr;
++ });
+ return new SummaryCollection(ret).getSummaries();
+ }
+
+ @Override
+ public SummaryRetriever endRow(Text endRow) {
+ Objects.requireNonNull(endRow);
+ if (startRow != null) {
- Preconditions.checkArgument(startRow.compareTo(endRow) < 0, "Start row must be less than end row : %s >= %s", startRow, endRow);
++ Preconditions.checkArgument(startRow.compareTo(endRow) < 0,
++ "Start row must be less than end row : %s >= %s", startRow, endRow);
+ }
+ this.endRow = endRow;
+ return this;
+ }
+
+ @Override
+ public SummaryRetriever endRow(CharSequence endRow) {
+ return endRow(new Text(endRow.toString()));
+ }
+
+ @Override
+ public SummaryRetriever withConfiguration(Collection<SummarizerConfiguration> configs) {
+ Objects.requireNonNull(configs);
- summariesToFetch = configs.stream().map(SummarizerConfigurationUtil::toThrift).collect(Collectors.toList());
++ summariesToFetch = configs.stream().map(SummarizerConfigurationUtil::toThrift)
++ .collect(Collectors.toList());
+ return this;
+ }
+
+ @Override
+ public SummaryRetriever withConfiguration(SummarizerConfiguration... config) {
+ Objects.requireNonNull(config);
+ return withConfiguration(Arrays.asList(config));
+ }
+
+ @Override
+ public SummaryRetriever withMatchingConfiguration(String regex) {
+ Objects.requireNonNull(regex);
- // Do a sanity check here to make sure that regex compiles, instead of having it fail on a tserver.
++ // Do a sanity check here to make sure that regex compiles, instead of having it fail on a
++ // tserver.
+ Pattern.compile(regex);
+ this.summarizerClassRegex = regex;
+ return this;
+ }
+
+ @Override
+ public SummaryRetriever flush(boolean b) {
+ this.flush = b;
+ return this;
+ }
+ };
+ }
+
+ @Override
- public void addSummarizers(String tableName, SummarizerConfiguration... newConfigs) throws AccumuloException, AccumuloSecurityException,
- TableNotFoundException {
- HashSet<SummarizerConfiguration> currentConfigs = new HashSet<>(SummarizerConfiguration.fromTableProperties(getProperties(tableName)));
++ public void addSummarizers(String tableName, SummarizerConfiguration... newConfigs)
++ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
++ HashSet<SummarizerConfiguration> currentConfigs = new HashSet<>(
++ SummarizerConfiguration.fromTableProperties(getProperties(tableName)));
+ HashSet<SummarizerConfiguration> newConfigSet = new HashSet<>(Arrays.asList(newConfigs));
+
+ newConfigSet.removeIf(sc -> currentConfigs.contains(sc));
+
+ Set<String> newIds = newConfigSet.stream().map(sc -> sc.getPropertyId()).collect(toSet());
+
+ for (SummarizerConfiguration csc : currentConfigs) {
+ if (newIds.contains(csc.getPropertyId())) {
+ throw new IllegalArgumentException("Summarizer property id is in use by " + csc);
+ }
+ }
+
- Set<Entry<String,String>> es = SummarizerConfiguration.toTableProperties(newConfigSet).entrySet();
++ Set<Entry<String,String>> es = SummarizerConfiguration.toTableProperties(newConfigSet)
++ .entrySet();
+ for (Entry<String,String> entry : es) {
+ setProperty(tableName, entry.getKey(), entry.getValue());
+ }
+ }
+
+ @Override
- public void removeSummarizers(String tableName, Predicate<SummarizerConfiguration> predicate) throws AccumuloException, TableNotFoundException,
- AccumuloSecurityException {
- Collection<SummarizerConfiguration> summarizerConfigs = SummarizerConfiguration.fromTableProperties(getProperties(tableName));
++ public void removeSummarizers(String tableName, Predicate<SummarizerConfiguration> predicate)
++ throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
++ Collection<SummarizerConfiguration> summarizerConfigs = SummarizerConfiguration
++ .fromTableProperties(getProperties(tableName));
+ for (SummarizerConfiguration sc : summarizerConfigs) {
+ if (predicate.test(sc)) {
+ Set<String> ks = sc.toTableProperties().keySet();
+ for (String key : ks) {
+ removeProperty(tableName, key);
+ }
+ }
+ }
+ }
+
+ @Override
- public List<SummarizerConfiguration> listSummarizers(String tableName) throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
++ public List<SummarizerConfiguration> listSummarizers(String tableName)
++ throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
+ return new ArrayList<>(SummarizerConfiguration.fromTableProperties(getProperties(tableName)));
+ }
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
index a33d159,e9117bc..48c0eb0
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java
@@@ -43,26 -46,18 +43,31 @@@ public class Tables
public static final String VALID_NAME_REGEX = "^(\\w+\\.)?(\\w+)$";
- private static final SecurityPermission TABLES_PERMISSION = new SecurityPermission("tablesPermission");
- // Per instance cache will expire after 10 minutes in case we encounter an instance not used frequently
- private static Cache<String,TableMap> instanceToMapCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).build();
- private static Cache<String,ZooCache> instanceToZooCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).build();
+ private static final SecurityPermission TABLES_PERMISSION = new SecurityPermission(
+ "tablesPermission");
+ // Per instance cache will expire after 10 minutes in case we encounter an instance not used
+ // frequently
+ private static Cache<String,TableMap> instanceToMapCache = CacheBuilder.newBuilder()
+ .expireAfterAccess(10, TimeUnit.MINUTES).build();
+ private static Cache<String,ZooCache> instanceToZooCache = CacheBuilder.newBuilder()
+ .expireAfterAccess(10, TimeUnit.MINUTES).build();
/**
- * Lookup table ID in ZK. Throw TableNotFoundException if not found. Also wraps NamespaceNotFoundException in TableNotFoundException if namespace is not
- * found.
++ * Lookup table ID in ZK. Throw TableNotFoundException if not found. Also wraps
++ * NamespaceNotFoundException in TableNotFoundException if namespace is not found.
+ */
- public static Table.ID getTableId(Instance instance, String tableName) throws TableNotFoundException {
++ public static Table.ID getTableId(Instance instance, String tableName)
++ throws TableNotFoundException {
+ try {
+ return _getTableId(instance, tableName);
+ } catch (NamespaceNotFoundException e) {
+ throw new TableNotFoundException(tableName, e);
+ }
+ }
+
+ /**
- * Return the cached ZooCache for provided instance. ZooCache is initially created with a watcher that will clear the TableMap cache for that instance when
- * WatchedEvent occurs.
+ * Return the cached ZooCache for provided instance. ZooCache is initially created with a watcher
+ * that will clear the TableMap cache for that instance when WatchedEvent occurs.
*/
private static ZooCache getZooCache(final Instance instance) {
SecurityManager sm = System.getSecurityManager();
@@@ -73,23 -68,39 +78,26 @@@
final String uuid = instance.getInstanceID();
try {
- return instanceToZooCache.get(uuid, new Callable<ZooCache>() {
- @Override
- public ZooCache call() {
- final String zks = instance.getZooKeepers();
- final int timeOut = instance.getZooKeepersSessionTimeOut();
- return new ZooCacheFactory().getZooCache(zks, timeOut, new Watcher() {
- @Override
- public void process(WatchedEvent watchedEvent) {
- instanceToMapCache.invalidate(uuid);
- }
- });
- }
+ return instanceToZooCache.get(uuid, () -> {
+ final String zks = instance.getZooKeepers();
+ final int timeOut = instance.getZooKeepersSessionTimeOut();
- return new ZooCacheFactory().getZooCache(zks, timeOut, watchedEvent -> instanceToMapCache.invalidate(uuid));
++ return new ZooCacheFactory().getZooCache(zks, timeOut,
++ watchedEvent -> instanceToMapCache.invalidate(uuid));
});
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
- public static String getTableId(Instance instance, String tableName)
- throws TableNotFoundException {
- try {
- return _getTableId(instance, tableName);
- } catch (NamespaceNotFoundException e) {
- throw new TableNotFoundException(tableName, e);
- }
- }
-
- public static String _getTableId(Instance instance, String tableName)
+ /**
+ * Lookup table ID in ZK. If not found, clears cache and tries again.
+ */
- public static Table.ID _getTableId(Instance instance, String tableName) throws NamespaceNotFoundException, TableNotFoundException {
++ public static Table.ID _getTableId(Instance instance, String tableName)
+ throws NamespaceNotFoundException, TableNotFoundException {
- String tableId = getNameToIdMap(instance).get(tableName);
+ Table.ID tableId = getNameToIdMap(instance).get(tableName);
if (tableId == null) {
- // maybe the table exist, but the cache was not updated yet... so try to clear the cache and check again
+ // maybe the table exist, but the cache was not updated yet... so try to clear the cache and
+ // check again
clearCache(instance);
tableId = getNameToIdMap(instance).get(tableName);
if (tableId == null) {
@@@ -103,10 -114,11 +111,11 @@@
return tableId;
}
- public static String getTableName(Instance instance, Table.ID tableId) throws TableNotFoundException {
- public static String getTableName(Instance instance, String tableId)
++ public static String getTableName(Instance instance, Table.ID tableId)
+ throws TableNotFoundException {
String tableName = getIdToNameMap(instance).get(tableId);
if (tableName == null)
- throw new TableNotFoundException(tableId, null, null);
+ throw new TableNotFoundException(tableId.canonicalID(), null, null);
return tableName;
}
@@@ -125,7 -138,12 +135,8 @@@
private static TableMap getTableMap(final Instance instance) {
TableMap map;
try {
- map = instanceToMapCache.get(instance.getInstanceID(), () -> new TableMap(instance, getZooCache(instance)));
- map = instanceToMapCache.get(instance.getInstanceID(), new Callable<TableMap>() {
- @Override
- public TableMap call() {
- return new TableMap(instance, getZooCache(instance));
- }
- });
++ map = instanceToMapCache.get(instance.getInstanceID(),
++ () -> new TableMap(instance, getZooCache(instance)));
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
@@@ -165,7 -189,8 +176,8 @@@
} catch (TableNotFoundException e) {
// handled in the string formatting
}
- return tableName == null ? String.format("?(ID:%s)", tableId.canonicalID()) : String.format("%s(ID:%s)", tableName, tableId.canonicalID());
- return tableName == null ? String.format("?(ID:%s)", tableId)
- : String.format("%s(ID:%s)", tableName, tableId);
++ return tableName == null ? String.format("?(ID:%s)", tableId.canonicalID())
++ : String.format("%s(ID:%s)", tableName, tableId.canonicalID());
}
public static String getPrintableTableInfoFromName(Instance instance, String tableName) {
@@@ -175,10 -200,11 +187,11 @@@
} catch (TableNotFoundException e) {
// handled in the string formatting
}
- return tableId == null ? String.format("%s(?)", tableName) : String.format("%s(ID:%s)", tableName, tableId.canonicalID());
+ return tableId == null ? String.format("%s(?)", tableName)
- : String.format("%s(ID:%s)", tableName, tableId);
++ : String.format("%s(ID:%s)", tableName, tableId.canonicalID());
}
- public static TableState getTableState(Instance instance, String tableId) {
+ public static TableState getTableState(Instance instance, Table.ID tableId) {
return getTableState(instance, tableId, false);
}
@@@ -194,9 -220,11 +207,11 @@@
* if true clear the table state in zookeeper before checking status
* @return the table state.
*/
- public static TableState getTableState(Instance instance, Table.ID tableId, boolean clearCachedState) {
- public static TableState getTableState(Instance instance, String tableId,
++ public static TableState getTableState(Instance instance, Table.ID tableId,
+ boolean clearCachedState) {
- String statePath = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId.canonicalID() + Constants.ZTABLE_STATE;
- String statePath = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId
++ String statePath = ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId.canonicalID()
+ + Constants.ZTABLE_STATE;
if (clearCachedState) {
Tables.clearCacheByPath(instance, statePath);
@@@ -250,7 -278,8 +265,8 @@@
* @throws IllegalArgumentException
* if the table doesn't exist in ZooKeeper
*/
- public static Namespace.ID getNamespaceId(Instance instance, Table.ID tableId) throws TableNotFoundException {
- public static String getNamespaceId(Instance instance, String tableId)
++ public static Namespace.ID getNamespaceId(Instance instance, Table.ID tableId)
+ throws TableNotFoundException {
checkArgument(instance != null, "instance is null");
checkArgument(tableId != null, "tableId is null");
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocatorImpl.java
index 7c7a631,823115f..8dd736b
--- 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
@@@ -152,7 -156,8 +156,8 @@@ public class TabletLocatorImpl extends
}
}
- public TabletLocatorImpl(Table.ID tableId, TabletLocator parent, TabletLocationObtainer tlo, TabletServerLockChecker tslc) {
- public TabletLocatorImpl(String tableId, TabletLocator parent, TabletLocationObtainer tlo,
++ public TabletLocatorImpl(Table.ID tableId, TabletLocator parent, TabletLocationObtainer tlo,
+ TabletServerLockChecker tslc) {
this.tableId = tableId;
this.parent = parent;
this.locationObtainer = tlo;
@@@ -472,9 -494,10 +494,10 @@@
}
}
- private void lookupTabletLocation(ClientContext context, Text row, boolean retry, LockCheckerSession lcSession) throws AccumuloException,
- AccumuloSecurityException, TableNotFoundException {
+ private void lookupTabletLocation(ClientContext context, Text row, boolean retry,
+ LockCheckerSession lcSession)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- Text metadataRow = new Text(tableId);
+ Text metadataRow = new Text(tableId.getUtf8());
metadataRow.append(new byte[] {';'}, 0, 1);
metadataRow.append(row.getBytes(), 0, row.getLength());
TabletLocation ptl = parent.locateTablet(context, metadataRow, false, retry);
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchDeleter.java
index 4cd54cc,cc230b7..abbfc5d
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchDeleter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchDeleter.java
@@@ -35,10 -35,11 +35,11 @@@ import org.apache.accumulo.core.securit
public class TabletServerBatchDeleter extends TabletServerBatchReader implements BatchDeleter {
private final ClientContext context;
- private String tableId;
+ private Table.ID tableId;
private BatchWriterConfig bwConfig;
- public TabletServerBatchDeleter(ClientContext context, Table.ID tableId, Authorizations authorizations, int numQueryThreads, BatchWriterConfig bwConfig)
- public TabletServerBatchDeleter(ClientContext context, String tableId,
++ public TabletServerBatchDeleter(ClientContext context, Table.ID tableId,
+ Authorizations authorizations, int numQueryThreads, BatchWriterConfig bwConfig)
throws TableNotFoundException {
super(context, tableId, authorizations, numQueryThreads);
this.context = context;
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java
index 0999090,2be6d67..daffe19
--- a/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReader.java
@@@ -54,7 -54,8 +54,8 @@@ public class TabletServerBatchReader ex
private final int batchReaderInstance = getNextBatchReaderInstance();
- public TabletServerBatchReader(ClientContext context, Table.ID tableId, Authorizations authorizations, int numQueryThreads) {
- public TabletServerBatchReader(ClientContext context, String tableId,
++ public TabletServerBatchReader(ClientContext context, Table.ID tableId,
+ Authorizations authorizations, int numQueryThreads) {
checkArgument(context != null, "context is null");
checkArgument(tableId != null, "tableId is null");
checkArgument(authorizations != null, "authorizations is null");
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchReaderIterator.java
index a09576b,f00d95a..4609b8f
--- 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
@@@ -106,7 -106,8 +106,8 @@@ public class TabletServerBatchReaderIte
void receive(List<Entry<Key,Value>> entries);
}
- public TabletServerBatchReaderIterator(ClientContext context, Table.ID tableId, Authorizations authorizations, ArrayList<Range> ranges, int numThreads,
- public TabletServerBatchReaderIterator(ClientContext context, String tableId,
++ public TabletServerBatchReaderIterator(ClientContext context, Table.ID tableId,
+ Authorizations authorizations, ArrayList<Range> ranges, int numThreads,
ExecutorService queryThreadPool, ScannerOptions scannerOptions, long timeout) {
this.context = context;
@@@ -184,8 -186,9 +186,10 @@@
if (queryThreadPool.isShutdown()) {
String shortMsg = "The BatchScanner was unexpectedly closed while this Iterator was still in use.";
- log.error("{} Ensure that a reference to the BatchScanner is retained so that it can be closed when this Iterator is exhausted."
- + " Not retaining a reference to the BatchScanner guarantees that you are leaking threads in your client JVM.", shortMsg);
- log.error(shortMsg
- + " Ensure that a reference to the BatchScanner is retained so that it can be closed when this Iterator is exhausted."
- + " Not retaining a reference to the BatchScanner guarantees that you are leaking threads in your client JVM.");
++ log.error(
++ "{} Ensure that a reference to the BatchScanner is retained so that it can be closed when this Iterator is exhausted."
++ + " Not retaining a reference to the BatchScanner guarantees that you are leaking threads in your client JVM.",
++ shortMsg);
throw new RuntimeException(shortMsg + " Ensure proper handling of the BatchScanner.");
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/TabletServerBatchWriter.java
index fa21db7,3fb8651..bde322f
--- 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
@@@ -240,7 -244,7 +243,8 @@@ public class TabletServerBatchWriter
this.notifyAll();
}
- public synchronized void addMutation(Table.ID table, Mutation m) throws MutationsRejectedException {
- public synchronized void addMutation(String table, Mutation m) throws MutationsRejectedException {
++ public synchronized void addMutation(Table.ID table, Mutation m)
++ throws MutationsRejectedException {
if (closed)
throw new IllegalStateException("Closed");
@@@ -294,7 -298,8 +298,8 @@@
}
}
- public void addMutation(Table.ID table, Iterator<Mutation> iterator) throws MutationsRejectedException {
- public void addMutation(String table, Iterator<Mutation> iterator)
++ public void addMutation(Table.ID table, Iterator<Mutation> iterator)
+ throws MutationsRejectedException {
while (iterator.hasNext()) {
addMutation(table, iterator.next());
}
@@@ -638,7 -657,8 +657,8 @@@
if (rf != null) {
if (log.isTraceEnabled())
- log.trace("tid={} Requeuing {} failed mutations", Thread.currentThread().getId(), rf.size());
- log.trace("tid=" + Thread.currentThread().getId() + " Requeuing " + rf.size()
- + " failed mutations");
++ log.trace("tid={} Requeuing {} failed mutations", Thread.currentThread().getId(),
++ rf.size());
addFailedMutations(rf);
}
} catch (Throwable t) {
@@@ -680,13 -701,16 +701,14 @@@
return ret;
}
- private void binMutations(MutationSet mutationsToProcess, Map<String,TabletServerMutations<Mutation>> binnedMutations) {
+ private void binMutations(MutationSet mutationsToProcess,
+ Map<String,TabletServerMutations<Mutation>> binnedMutations) {
- String tableId = null;
+ Table.ID tableId = null;
try {
- Set<Entry<String,List<Mutation>>> es = mutationsToProcess.getMutations().entrySet();
- for (Entry<String,List<Mutation>> entry : es) {
+ Set<Entry<Table.ID,List<Mutation>>> es = mutationsToProcess.getMutations().entrySet();
+ for (Entry<Table.ID,List<Mutation>> entry : es) {
tableId = entry.getKey();
TabletLocator locator = getLocator(tableId);
-
- String table = entry.getKey();
List<Mutation> tableMutations = entry.getValue();
if (tableMutations != null) {
@@@ -698,9 -722,9 +720,10 @@@
if (tableFailures.size() == tableMutations.size())
if (!Tables.exists(context.getInstance(), entry.getKey()))
- throw new TableDeletedException(entry.getKey());
- else if (Tables.getTableState(context.getInstance(), table) == TableState.OFFLINE)
- throw new TableOfflineException(context.getInstance(), entry.getKey());
+ throw new TableDeletedException(entry.getKey().canonicalID());
+ else if (Tables.getTableState(context.getInstance(), tableId) == TableState.OFFLINE)
- throw new TableOfflineException(context.getInstance(), entry.getKey().canonicalID());
++ throw new TableOfflineException(context.getInstance(),
++ entry.getKey().canonicalID());
}
}
@@@ -712,8 -736,13 +735,9 @@@
// assume an IOError communicating with metadata tablet
failedMutations.add(mutationsToProcess);
} catch (AccumuloSecurityException e) {
- updateAuthorizationFailures(Collections.singletonMap(new KeyExtent(tableId, null, null), SecurityErrorCode.valueOf(e.getSecurityErrorCode().name())));
+ updateAuthorizationFailures(Collections.singletonMap(new KeyExtent(tableId, null, null),
+ SecurityErrorCode.valueOf(e.getSecurityErrorCode().name())));
- } catch (TableDeletedException e) {
- updateUnknownErrors(e.getMessage(), e);
- } catch (TableOfflineException e) {
- updateUnknownErrors(e.getMessage(), e);
- } catch (TableNotFoundException e) {
+ } catch (TableDeletedException | TableNotFoundException | TableOfflineException e) {
updateUnknownErrors(e.getMessage(), e);
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/ThriftScanner.java
index b495334,742b3b7..a0cd9d1
--- 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
@@@ -163,9 -169,12 +169,12 @@@ public class ThriftScanner
SamplerConfiguration samplerConfig;
- public ScanState(ClientContext context, Table.ID tableId, Authorizations authorizations, Range range, SortedSet<Column> fetchedColumns, int size,
- List<IterInfo> serverSideIteratorList, Map<String,Map<String,String>> serverSideIteratorOptions, boolean isolated, long readaheadThreshold,
- SamplerConfiguration samplerConfig, long batchTimeOut, String classLoaderContext) {
- public ScanState(ClientContext context, String tableId, Authorizations authorizations,
++ public ScanState(ClientContext context, Table.ID tableId, Authorizations authorizations,
+ Range range, SortedSet<Column> fetchedColumns, int size,
+ List<IterInfo> serverSideIteratorList,
+ Map<String,Map<String,String>> serverSideIteratorOptions, boolean isolated,
+ long readaheadThreshold, SamplerConfiguration samplerConfig, long batchTimeOut,
+ String classLoaderContext) {
this.context = context;
this.authorizations = authorizations;
this.classLoaderContext = classLoaderContext;
@@@ -246,11 -258,12 +258,12 @@@
if (loc == null) {
if (!Tables.exists(instance, scanState.tableId))
- throw new TableDeletedException(scanState.tableId);
+ throw new TableDeletedException(scanState.tableId.canonicalID());
else if (Tables.getTableState(instance, scanState.tableId) == TableState.OFFLINE)
- throw new TableOfflineException(instance, scanState.tableId);
+ throw new TableOfflineException(instance, scanState.tableId.canonicalID());
- error = "Failed to locate tablet for table : " + scanState.tableId + " row : " + scanState.startRow;
+ error = "Failed to locate tablet for table : " + scanState.tableId + " row : "
+ + scanState.startRow;
if (!error.equals(lastError))
log.debug("{}", error);
else if (log.isTraceEnabled())
@@@ -414,11 -435,14 +435,14 @@@
scanState.prevLoc = loc;
if (scanState.scanID == null) {
- Thread.currentThread().setName("Starting scan tserver=" + loc.tablet_location + " tableId=" + loc.tablet_extent.getTableId());
-
+ Thread.currentThread().setName("Starting scan tserver=" + loc.tablet_location + " tableId="
+ + loc.tablet_extent.getTableId());
if (log.isTraceEnabled()) {
- String msg = "Starting scan tserver=" + loc.tablet_location + " tablet=" + loc.tablet_extent + " range=" + scanState.range + " ssil="
- + scanState.serverSideIteratorList + " ssio=" + scanState.serverSideIteratorOptions + " context=" + scanState.classLoaderContext;
+ String msg = "Starting scan tserver=" + loc.tablet_location + " tablet="
+ + loc.tablet_extent + " range=" + scanState.range + " ssil="
- + scanState.serverSideIteratorList + " ssio=" + scanState.serverSideIteratorOptions;
++ + scanState.serverSideIteratorList + " ssio=" + scanState.serverSideIteratorOptions
++ + " context=" + scanState.classLoaderContext;
log.trace("tid={} {}", Thread.currentThread().getId(), msg);
timer = new OpTimer().start();
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/impl/Writer.java
index deabe08,75b8f55..76230c3
--- 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
@@@ -82,10 -85,11 +85,11 @@@ public class Writer
throw new IllegalArgumentException("Can not add empty mutations");
while (true) {
- TabletLocation tabLoc = TabletLocator.getLocator(context, tableId).locateTablet(context, new Text(m.getRow()), false, true);
+ TabletLocation tabLoc = TabletLocator.getLocator(context, tableId).locateTablet(context,
+ new Text(m.getRow()), false, true);
if (tabLoc == null) {
- log.trace("No tablet location found for row " + new String(m.getRow(), UTF_8));
+ log.trace("No tablet location found for row {}", new String(m.getRow(), UTF_8));
sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
continue;
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapred/AbstractInputFormat.java
index 5583f9f,9c7700b..f407163
--- 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
@@@ -118,20 -116,6 +119,21 @@@ public abstract class AbstractInputForm
}
/**
+ * Sets connection information needed to communicate with Accumulo for this job
+ *
+ * @param job
+ * Hadoop job instance to be configured
+ * @param info
+ * Connection information for Accumulo
+ * @since 2.0.0
+ */
- public static void setConnectionInfo(JobConf job, ConnectionInfo info) throws AccumuloSecurityException {
++ public static void setConnectionInfo(JobConf job, ConnectionInfo info)
++ throws AccumuloSecurityException {
+ setConnectorInfo(job, info.getPrincipal(), info.getAuthenticationToken());
+ setZooKeeperInstance(job, ConnectionInfoFactory.getClientConfiguration(info));
+ }
+
+ /**
* Sets the connector information needed to communicate with Accumulo in this job.
*
* <p>
@@@ -147,10 -134,9 +152,11 @@@
* @param token
* the user's password
* @since 1.5.0
+ * @deprecated since 2.0.0, use {@link #setConnectionInfo(JobConf, ConnectionInfo)} instead
*/
+ @Deprecated
- public static void setConnectorInfo(JobConf job, String principal, AuthenticationToken token) throws AccumuloSecurityException {
+ public static void setConnectorInfo(JobConf job, String principal, AuthenticationToken token)
+ throws AccumuloSecurityException {
if (token instanceof KerberosToken) {
log.info("Received KerberosToken, attempting to fetch DelegationToken");
try {
@@@ -190,10 -180,9 +200,11 @@@
* @param tokenFile
* the path to the token file
* @since 1.6.0
+ * @deprecated since 2.0.0, use {@link #setConnectionInfo(JobConf, ConnectionInfo)} instead
*/
+ @Deprecated
- public static void setConnectorInfo(JobConf job, String principal, String tokenFile) throws AccumuloSecurityException {
+ public static void setConnectorInfo(JobConf job, String principal, String tokenFile)
+ throws AccumuloSecurityException {
InputConfigurator.setConnectorInfo(CLASS, job, principal, tokenFile);
}
@@@ -252,7 -243,8 +264,8 @@@
*/
@Deprecated
public static void setZooKeeperInstance(JobConf job, String instanceName, String zooKeepers) {
- setZooKeeperInstance(job, ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers));
+ setZooKeeperInstance(job,
- new ClientConfiguration().withInstance(instanceName).withZkHosts(zooKeepers));
++ ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers));
}
/**
@@@ -566,13 -586,16 +590,16 @@@
try {
if (isOffline) {
- scanner = new OfflineScanner(instance, new Credentials(principal, token), Table.ID.of(baseSplit.getTableId()), authorizations);
+ scanner = new OfflineScanner(instance, new Credentials(principal, token),
- baseSplit.getTableId(), authorizations);
++ Table.ID.of(baseSplit.getTableId()), authorizations);
} else if (DeprecationUtil.isMockInstance(instance)) {
- scanner = instance.getConnector(principal, token).createScanner(baseSplit.getTableName(), authorizations);
+ scanner = instance.getConnector(principal, token)
+ .createScanner(baseSplit.getTableName(), authorizations);
} else {
ClientConfiguration clientConf = getClientConfiguration(job);
- ClientContext context = new ClientContext(instance, new Credentials(principal, token), clientConf);
+ ClientContext context = new ClientContext(instance, new Credentials(principal, token),
+ clientConf);
- scanner = new ScannerImpl(context, baseSplit.getTableId(), authorizations);
+ scanner = new ScannerImpl(context, Table.ID.of(baseSplit.getTableId()), authorizations);
}
if (isIsolated) {
log.info("Creating isolated scanner");
@@@ -645,8 -669,9 +673,9 @@@
}
- Map<String,Map<KeyExtent,List<Range>>> binOfflineTable(JobConf job, Table.ID tableId, List<Range> ranges) throws TableNotFoundException, AccumuloException,
- AccumuloSecurityException {
- Map<String,Map<KeyExtent,List<Range>>> binOfflineTable(JobConf job, String tableId,
++ Map<String,Map<KeyExtent,List<Range>>> binOfflineTable(JobConf job, Table.ID tableId,
+ List<Range> ranges)
+ throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
Instance instance = getInstance(job);
Connector conn = instance.getConnector(getPrincipal(job), getAuthenticationToken(job));
@@@ -775,8 -808,10 +813,10 @@@
for (Range r : extentRanges.getValue()) {
if (autoAdjust) {
// divide ranges into smaller ranges, based on the tablets
- RangeInputSplit split = new RangeInputSplit(tableName, tableId.canonicalID(), ke.clip(r), new String[] {location});
- SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel);
- RangeInputSplit split = new RangeInputSplit(tableName, tableId, ke.clip(r),
- new String[] {location});
++ RangeInputSplit split = new RangeInputSplit(tableName, tableId.canonicalID(),
++ ke.clip(r), new String[] {location});
+ SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths,
+ logLevel);
split.setOffline(tableConfig.isOfflineScan());
split.setIsolatedScan(tableConfig.shouldUseIsolatedScanners());
split.setUsesLocalIterators(tableConfig.shouldUseLocalIterators());
@@@ -797,7 -832,8 +837,8 @@@
if (!autoAdjust)
for (Map.Entry<Range,ArrayList<String>> entry : splitsToAdd.entrySet()) {
- RangeInputSplit split = new RangeInputSplit(tableName, tableId.canonicalID(), entry.getKey(), entry.getValue().toArray(new String[0]));
- RangeInputSplit split = new RangeInputSplit(tableName, tableId, entry.getKey(),
- entry.getValue().toArray(new String[0]));
++ RangeInputSplit split = new RangeInputSplit(tableName, tableId.canonicalID(),
++ entry.getKey(), entry.getValue().toArray(new String[0]));
SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel);
split.setOffline(tableConfig.isOfflineScan());
split.setIsolatedScan(tableConfig.shouldUseIsolatedScanners());
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloFileOutputFormat.java
index d7d2b2d,aa5f379..a88d1f4
--- 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
@@@ -55,7 -56,24 +58,8 @@@ public class AccumuloFileOutputFormat e
protected static final Logger log = Logger.getLogger(CLASS);
/**
- * Sets the compression type to use for data blocks. Specifying a compression may require additional libraries to be available to your Job.
- * This helper method provides an AccumuloConfiguration object constructed from the Accumulo
- * defaults, and overridden with Accumulo properties that have been stored in the Job's
- * configuration.
- *
- * @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);
- }
-
- /**
+ * Sets the compression type to use for data blocks. Specifying a compression may require
+ * additional libraries to be available to your Job.
*
* @param job
* the Hadoop job instance to be configured
@@@ -138,28 -162,17 +148,31 @@@
FileOutputConfigurator.setSampler(CLASS, job, samplerConfig);
}
+ /**
- * Specifies a list of summarizer configurations to create summary data in the output file. Each Key Value written will be passed to the configured
- * {@link Summarizer}'s.
++ * Specifies a list of summarizer configurations to create summary data in the output file. Each
++ * Key Value written will be passed to the configured {@link Summarizer}'s.
+ *
+ * @param job
+ * The Hadoop job instance to be configured
+ * @param sumarizerConfigs
+ * summarizer configurations
+ * @since 2.0.0
+ */
+ public static void setSummarizers(JobConf job, SummarizerConfiguration... sumarizerConfigs) {
+ FileOutputConfigurator.setSummarizers(CLASS, job, sumarizerConfigs);
+ }
+
@Override
- public RecordWriter<Key,Value> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress) throws IOException {
+ public RecordWriter<Key,Value> 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 = FileOutputConfigurator.getAccumuloConfiguration(CLASS, 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);
+ final Path file = new Path(getWorkOutputPath(job),
+ getUniqueName(job, "part") + "." + extension);
final int visCacheSize = ConfiguratorBase.getVisibilityCacheSize(conf);
return new RecordWriter<Key,Value>() {
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormat.java
index 62d32a6,2752fd3..3801e4d
--- 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
@@@ -81,20 -82,6 +82,21 @@@ public class AccumuloOutputFormat imple
protected static final Logger log = Logger.getLogger(CLASS);
/**
+ * Set the connection information needed to communicate with Accumulo in this job.
+ *
+ * @param job
+ * Hadoop job to be configured
+ * @param info
+ * Accumulo connection information
+ * @since 2.0.0
+ */
- public static void setConnectionInfo(JobConf job, ConnectionInfo info) throws AccumuloSecurityException {
++ public static void setConnectionInfo(JobConf job, ConnectionInfo info)
++ throws AccumuloSecurityException {
+ setConnectorInfo(job, info.getPrincipal(), info.getAuthenticationToken());
+ setZooKeeperInstance(job, ConnectionInfoFactory.getClientConfiguration(info));
+ }
+
+ /**
* Sets the connector information needed to communicate with Accumulo in this job.
*
* <p>
@@@ -110,10 -101,9 +116,11 @@@
* @param token
* the user's password
* @since 1.5.0
+ * @deprecated since 2.0.0, use {@link #setConnectionInfo(JobConf, ConnectionInfo)} instead.
*/
+ @Deprecated
- public static void setConnectorInfo(JobConf job, String principal, AuthenticationToken token) throws AccumuloSecurityException {
+ public static void setConnectorInfo(JobConf job, String principal, AuthenticationToken token)
+ throws AccumuloSecurityException {
if (token instanceof KerberosToken) {
log.info("Received KerberosToken, attempting to fetch DelegationToken");
try {
@@@ -153,10 -148,9 +165,11 @@@
* @param tokenFile
* the path to the password file
* @since 1.6.0
+ * @deprecated since 2.0.0, use {@link #setConnectionInfo(JobConf, ConnectionInfo)} instead
*/
+ @Deprecated
- public static void setConnectorInfo(JobConf job, String principal, String tokenFile) throws AccumuloSecurityException {
+ public static void setConnectorInfo(JobConf job, String principal, String tokenFile)
+ throws AccumuloSecurityException {
OutputConfigurator.setConnectorInfo(CLASS, job, principal, tokenFile);
}
@@@ -233,11 -228,14 +247,12 @@@
* @param zooKeepers
* a comma-separated list of zookeeper servers
* @since 1.5.0
- * @deprecated since 1.6.0; Use {@link #setZooKeeperInstance(JobConf, ClientConfiguration)}
- * instead.
+ * @deprecated since 1.6.0; Use {@link #setConnectionInfo(JobConf, ConnectionInfo)} instead.
*/
-
@Deprecated
public static void setZooKeeperInstance(JobConf job, String instanceName, String zooKeepers) {
- setZooKeeperInstance(job, ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers));
+ setZooKeeperInstance(job,
- new ClientConfiguration().withInstance(instanceName).withZkHosts(zooKeepers));
++ ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers));
}
/**
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapred/impl/BatchInputSplit.java
index d0a4d1f,aea267e..f583418
--- a/core/src/main/java/org/apache/accumulo/core/client/mapred/impl/BatchInputSplit.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapred/impl/BatchInputSplit.java
@@@ -36,7 -37,8 +38,8 @@@ public class BatchInputSplit extends or
super(split);
}
- public BatchInputSplit(String table, Table.ID tableId, Collection<Range> ranges, String[] location) {
- public BatchInputSplit(String table, String tableId, Collection<Range> ranges,
++ public BatchInputSplit(String table, Table.ID tableId, Collection<Range> ranges,
+ String[] location) {
super(table, tableId, ranges, location);
}
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/AbstractInputFormat.java
index 0ca7c2d,b81d930..99ca2a2
--- 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
@@@ -121,20 -119,6 +122,21 @@@ public abstract class AbstractInputForm
}
/**
+ * Sets connection information needed to communicate with Accumulo for this job
+ *
+ * @param job
+ * Hadoop job instance to be configured
+ * @param info
+ * Connection information for Accumulo
+ * @since 2.0.0
+ */
- public static void setConnectionInfo(Job job, ConnectionInfo info) throws AccumuloSecurityException {
++ public static void setConnectionInfo(Job job, ConnectionInfo info)
++ throws AccumuloSecurityException {
+ setConnectorInfo(job, info.getPrincipal(), info.getAuthenticationToken());
+ setZooKeeperInstance(job, ConnectionInfoFactory.getClientConfiguration(info));
+ }
+
+ /**
* Sets the connector information needed to communicate with Accumulo in this job.
*
* <p>
@@@ -150,10 -137,9 +155,11 @@@
* @param token
* the user's password
* @since 1.5.0
+ * @deprecated since 2.0.0; use {@link #setConnectionInfo(Job, ConnectionInfo)} instead.
*/
+ @Deprecated
- public static void setConnectorInfo(Job job, String principal, AuthenticationToken token) throws AccumuloSecurityException {
+ public static void setConnectorInfo(Job job, String principal, AuthenticationToken token)
+ throws AccumuloSecurityException {
if (token instanceof KerberosToken) {
log.info("Received KerberosToken, attempting to fetch DelegationToken");
try {
@@@ -275,7 -269,8 +289,8 @@@
*/
@Deprecated
public static void setZooKeeperInstance(Job job, String instanceName, String zooKeepers) {
- setZooKeeperInstance(job, ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers));
+ setZooKeeperInstance(job,
- new ClientConfiguration().withInstance(instanceName).withZkHosts(zooKeepers));
++ ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers));
}
/**
@@@ -402,9 -397,31 +419,10 @@@
return InputConfigurator.getInputTableConfig(CLASS, context.getConfiguration(), tableName);
}
- /**
- * Initializes an Accumulo {@link org.apache.accumulo.core.client.impl.TabletLocator} based on the
- * configuration.
- *
- * @param context
- * the Hadoop context for the configured job
- * @param table
- * the table for which to initialize the locator
- * @return an Accumulo tablet locator
- * @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);
- }
-
// InputFormat doesn't have the equivalent of OutputFormat's checkOutputSpecs(JobContext job)
/**
- * Check whether a configuration is fully configured to be used with an Accumulo {@link org.apache.hadoop.mapreduce.InputFormat}.
+ * Check whether a configuration is fully configured to be used with an Accumulo
+ * {@link org.apache.hadoop.mapreduce.InputFormat}.
*
* @param context
* the Hadoop context for the configured job
@@@ -592,13 -618,16 +619,16 @@@
try {
if (isOffline) {
- scanner = new OfflineScanner(instance, new Credentials(principal, token), Table.ID.of(split.getTableId()), authorizations);
+ scanner = new OfflineScanner(instance, new Credentials(principal, token),
- split.getTableId(), authorizations);
++ Table.ID.of(split.getTableId()), authorizations);
} else if (DeprecationUtil.isMockInstance(instance)) {
- scanner = instance.getConnector(principal, token).createScanner(split.getTableName(), authorizations);
+ scanner = instance.getConnector(principal, token).createScanner(split.getTableName(),
+ authorizations);
} else {
ClientConfiguration clientConf = getClientConfiguration(attempt);
- ClientContext context = new ClientContext(instance, new Credentials(principal, token), clientConf);
+ ClientContext context = new ClientContext(instance, new Credentials(principal, token),
+ clientConf);
- scanner = new ScannerImpl(context, split.getTableId(), authorizations);
+ scanner = new ScannerImpl(context, Table.ID.of(split.getTableId()), authorizations);
}
if (isIsolated) {
log.info("Creating isolated scanner");
@@@ -688,8 -718,9 +719,9 @@@
}
}
- Map<String,Map<KeyExtent,List<Range>>> binOfflineTable(JobContext context, Table.ID tableId, List<Range> ranges) throws TableNotFoundException,
- AccumuloException, AccumuloSecurityException {
- Map<String,Map<KeyExtent,List<Range>>> binOfflineTable(JobContext context, String tableId,
++ Map<String,Map<KeyExtent,List<Range>>> binOfflineTable(JobContext context, Table.ID tableId,
+ List<Range> ranges)
+ throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
Instance instance = getInstance(context);
Connector conn = instance.getConnector(getPrincipal(context), getAuthenticationToken(context));
@@@ -820,8 -860,10 +862,10 @@@
for (Range r : extentRanges.getValue()) {
if (autoAdjust) {
// divide ranges into smaller ranges, based on the tablets
- RangeInputSplit split = new RangeInputSplit(tableName, tableId.canonicalID(), ke.clip(r), new String[] {location});
- SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel);
- RangeInputSplit split = new RangeInputSplit(tableName, tableId, ke.clip(r),
- new String[] {location});
++ RangeInputSplit split = new RangeInputSplit(tableName, tableId.canonicalID(),
++ ke.clip(r), new String[] {location});
+ SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths,
+ logLevel);
split.setOffline(tableConfig.isOfflineScan());
split.setIsolatedScan(tableConfig.shouldUseIsolatedScanners());
split.setUsesLocalIterators(tableConfig.shouldUseLocalIterators());
@@@ -842,7 -884,8 +886,8 @@@
if (!autoAdjust)
for (Map.Entry<Range,ArrayList<String>> entry : splitsToAdd.entrySet()) {
- RangeInputSplit split = new RangeInputSplit(tableName, tableId.canonicalID(), entry.getKey(), entry.getValue().toArray(new String[0]));
- RangeInputSplit split = new RangeInputSplit(tableName, tableId, entry.getKey(),
- entry.getValue().toArray(new String[0]));
++ RangeInputSplit split = new RangeInputSplit(tableName, tableId.canonicalID(),
++ entry.getKey(), entry.getValue().toArray(new String[0]));
SplitUtils.updateSplit(split, instance, tableConfig, principal, token, auths, logLevel);
split.setOffline(tableConfig.isOfflineScan());
split.setIsolatedScan(tableConfig.shouldUseIsolatedScanners());
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormat.java
index dcdd42b,10ad85f..d37612a
--- 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
@@@ -53,7 -55,24 +56,8 @@@ public class AccumuloFileOutputFormat e
protected static final Logger log = Logger.getLogger(CLASS);
/**
- * Sets the compression type to use for data blocks. Specifying a compression may require additional libraries to be available to your Job.
- * This helper method provides an AccumuloConfiguration object constructed from the Accumulo
- * defaults, and overridden with Accumulo properties that have been stored in the Job's
- * configuration.
- *
- * @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());
- }
-
- /**
+ * Sets the compression type to use for data blocks. Specifying a compression may require
+ * additional libraries to be available to your Job.
*
* @param job
* the Hadoop job instance to be configured
@@@ -136,20 -161,6 +146,20 @@@
FileOutputConfigurator.setSampler(CLASS, job.getConfiguration(), samplerConfig);
}
+ /**
- * Specifies a list of summarizer configurations to create summary data in the output file. Each Key Value written will be passed to the configured
- * {@link Summarizer}'s.
++ * Specifies a list of summarizer configurations to create summary data in the output file. Each
++ * Key Value written will be passed to the configured {@link Summarizer}'s.
+ *
+ * @param job
+ * The Hadoop job instance to be configured
+ * @param sumarizerConfigs
+ * summarizer configurations
+ * @since 2.0.0
+ */
+ public static void setSummarizers(Job job, SummarizerConfiguration... sumarizerConfigs) {
+ FileOutputConfigurator.setSummarizers(CLASS, job.getConfiguration(), sumarizerConfigs);
+ }
+
@Override
public RecordWriter<Key,Value> getRecordWriter(TaskAttemptContext context) throws IOException {
// get the path of the temporary output file
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
index 21b7714,a4ebf3a..528e57f
--- 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
@@@ -82,20 -83,6 +83,21 @@@ public class AccumuloOutputFormat exten
protected static final Logger log = Logger.getLogger(CLASS);
/**
+ * Set the connection information needed to communicate with Accumulo in this job.
+ *
+ * @param job
+ * Hadoop job to be configured
+ * @param info
+ * Accumulo connection information
+ * @since 2.0.0
+ */
- public static void setConnectionInfo(Job job, ConnectionInfo info) throws AccumuloSecurityException {
++ public static void setConnectionInfo(Job job, ConnectionInfo info)
++ throws AccumuloSecurityException {
+ setConnectorInfo(job, info.getPrincipal(), info.getAuthenticationToken());
+ setZooKeeperInstance(job, ConnectionInfoFactory.getClientConfiguration(info));
+ }
+
+ /**
* Sets the connector information needed to communicate with Accumulo in this job.
*
* <p>
@@@ -111,10 -102,9 +117,11 @@@
* @param token
* the user's password
* @since 1.5.0
+ * @deprecated since 2.0.0, replaced by {@link #setConnectionInfo(Job, ConnectionInfo)}
*/
+ @Deprecated
- public static void setConnectorInfo(Job job, String principal, AuthenticationToken token) throws AccumuloSecurityException {
+ public static void setConnectorInfo(Job job, String principal, AuthenticationToken token)
+ throws AccumuloSecurityException {
if (token instanceof KerberosToken) {
log.info("Received KerberosToken, attempting to fetch DelegationToken");
try {
@@@ -154,10 -149,9 +166,11 @@@
* @param tokenFile
* the path to the token file
* @since 1.6.0
+ * @deprecated since 2.0.0, replaced by {@link #setConnectionInfo(Job, ConnectionInfo)}
*/
+ @Deprecated
- public static void setConnectorInfo(Job job, String principal, String tokenFile) throws AccumuloSecurityException {
+ public static void setConnectorInfo(Job job, String principal, String tokenFile)
+ throws AccumuloSecurityException {
OutputConfigurator.setConnectorInfo(CLASS, job.getConfiguration(), principal, tokenFile);
}
@@@ -238,7 -234,8 +253,8 @@@
*/
@Deprecated
public static void setZooKeeperInstance(Job job, String instanceName, String zooKeepers) {
- setZooKeeperInstance(job, ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers));
+ setZooKeeperInstance(job,
- new ClientConfiguration().withInstance(instanceName).withZkHosts(zooKeepers));
++ ClientConfiguration.create().withInstance(instanceName).withZkHosts(zooKeepers));
}
/**
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplit.java
index 13226e4,f0e9ae4..e56c1d9
--- 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
@@@ -276,10 -282,11 +281,12 @@@ public class RangeInputSplit extends In
out.writeInt(tokenSource.ordinal());
if (null != token && null != tokenFile) {
- throw new IOException("Cannot use both inline AuthenticationToken and file-based AuthenticationToken");
+ throw new IOException(
+ "Cannot use both inline AuthenticationToken and file-based AuthenticationToken");
} else if (null != token) {
out.writeUTF(token.getClass().getName());
- out.writeUTF(Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(token)));
- out.writeUTF(Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token)));
++ out.writeUTF(
++ Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(token)));
} else {
out.writeUTF(tokenFile);
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplit.java
index f1c612a,d055214..fb7e729
--- 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
@@@ -46,8 -46,9 +47,9 @@@ public class BatchInputSplit extends Ra
this.setRanges(split.getRanges());
}
- public BatchInputSplit(String table, Table.ID tableId, Collection<Range> ranges, String[] locations) {
- public BatchInputSplit(String table, String tableId, Collection<Range> ranges,
++ public BatchInputSplit(String table, Table.ID tableId, Collection<Range> ranges,
+ String[] locations) {
- super(table, tableId, new Range(), locations);
+ super(table, tableId.canonicalID(), new Range(), locations);
this.ranges = ranges;
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBase.java
index 942c746,79ae9af..90812c9
--- 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
@@@ -149,13 -154,15 +153,15 @@@ public class ConfiguratorBase
conf.setBoolean(enumToConfKey(implementingClass, ConnectorInfo.IS_CONFIGURED), true);
conf.set(enumToConfKey(implementingClass, ConnectorInfo.PRINCIPAL), principal);
if (token instanceof DelegationTokenImpl) {
- // Avoid serializing the DelegationToken secret in the configuration -- the Job will do that work for us securely
+ // Avoid serializing the DelegationToken secret in the configuration -- the Job will do that
+ // work for us securely
DelegationTokenImpl delToken = (DelegationTokenImpl) token;
- conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN), TokenSource.JOB.prefix() + token.getClass().getName() + ":"
- + delToken.getServiceName().toString());
+ conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN), TokenSource.JOB.prefix()
+ + token.getClass().getName() + ":" + delToken.getServiceName().toString());
} else {
- conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN), TokenSource.INLINE.prefix() + token.getClass().getName() + ":"
- + Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(token)));
+ conf.set(enumToConfKey(implementingClass, ConnectorInfo.TOKEN),
+ TokenSource.INLINE.prefix() + token.getClass().getName() + ":"
- + Base64.encodeBase64String(AuthenticationTokenSerializer.serialize(token)));
++ + Base64.getEncoder().encodeToString(AuthenticationTokenSerializer.serialize(token)));
}
}
@@@ -243,7 -257,8 +256,8 @@@
if (token.startsWith(TokenSource.INLINE.prefix())) {
String[] args = token.substring(TokenSource.INLINE.prefix().length()).split(":", 2);
if (args.length == 2)
- return AuthenticationTokenSerializer.deserialize(args[0], Base64.getDecoder().decode(args[1]));
+ return AuthenticationTokenSerializer.deserialize(args[0],
- Base64.decodeBase64(args[1].getBytes(UTF_8)));
++ Base64.getDecoder().decode(args[1]));
} else if (token.startsWith(TokenSource.FILE.prefix())) {
String tokenFileName = token.substring(TokenSource.FILE.prefix().length());
return getTokenFromFile(conf, getPrincipal(implementingClass, conf), tokenFileName);
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/FileOutputConfigurator.java
index 1da81fe,9a9c051..e803562
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/FileOutputConfigurator.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/FileOutputConfigurator.java
@@@ -99,9 -105,11 +107,10 @@@ public class FileOutputConfigurator ext
* the Hadoop configuration object to configure
* @since 1.6.0
*/
- public static AccumuloConfiguration getAccumuloConfiguration(Class<?> implementingClass, Configuration conf) {
+ public static AccumuloConfiguration getAccumuloConfiguration(Class<?> implementingClass,
+ Configuration conf) {
String prefix = enumToConfKey(implementingClass, Opts.ACCUMULO_PROPERTIES) + ".";
- ConfigurationCopy acuConf = new ConfigurationCopy(
- AccumuloConfiguration.getDefaultConfiguration());
+ ConfigurationCopy acuConf = new ConfigurationCopy(DefaultConfiguration.getInstance());
for (Entry<String,String> entry : conf)
if (entry.getKey().startsWith(prefix)) {
String propString = entry.getKey().substring(prefix.length());
@@@ -211,12 -236,4 +237,14 @@@
}
}
- public static void setSummarizers(Class<?> implementingClass, Configuration conf, SummarizerConfiguration[] sumarizerConfigs) {
++ public static void setSummarizers(Class<?> implementingClass, Configuration conf,
++ SummarizerConfiguration[] sumarizerConfigs) {
+ Map<String,String> props = SummarizerConfiguration.toTableProperties(sumarizerConfigs);
+
+ for (Entry<String,String> entry : props.entrySet()) {
- conf.set(enumToConfKey(implementingClass, Opts.ACCUMULO_PROPERTIES) + "." + entry.getKey(), entry.getValue());
++ conf.set(enumToConfKey(implementingClass, Opts.ACCUMULO_PROPERTIES) + "." + entry.getKey(),
++ entry.getValue());
+ }
+ }
+
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
index b9690d5,b5fd34c..261a196
--- 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
@@@ -215,9 -234,10 +235,10 @@@ public class InputConfigurator extends
for (Range r : ranges) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
r.write(new DataOutputStream(baos));
- rangeStrings.add(Base64.encodeBase64String(baos.toByteArray()));
+ rangeStrings.add(Base64.getEncoder().encodeToString(baos.toByteArray()));
}
- conf.setStrings(enumToConfKey(implementingClass, ScanOpts.RANGES), rangeStrings.toArray(new String[0]));
+ conf.setStrings(enumToConfKey(implementingClass, ScanOpts.RANGES),
+ rangeStrings.toArray(new String[0]));
} catch (IOException ex) {
throw new IllegalArgumentException("Unable to encode ranges to Base64", ex);
}
@@@ -236,12 -256,15 +257,14 @@@
* @since 1.6.0
* @see #setRanges(Class, Configuration, Collection)
*/
- public static List<Range> getRanges(Class<?> implementingClass, Configuration conf) throws IOException {
+ public static List<Range> getRanges(Class<?> implementingClass, Configuration conf)
+ throws IOException {
- Collection<String> encodedRanges = conf.getStringCollection(enumToConfKey(implementingClass, ScanOpts.RANGES));
+ Collection<String> encodedRanges = conf
+ .getStringCollection(enumToConfKey(implementingClass, ScanOpts.RANGES));
List<Range> ranges = new ArrayList<>();
for (String rangeString : encodedRanges) {
- ByteArrayInputStream bais = new ByteArrayInputStream(
- Base64.decodeBase64(rangeString.getBytes(UTF_8)));
+ ByteArrayInputStream bais = new ByteArrayInputStream(Base64.getDecoder().decode(rangeString));
Range range = new Range();
range.readFields(new DataInputStream(bais));
ranges.add(range);
@@@ -353,8 -384,10 +383,9 @@@
for (String col : serialized) {
int idx = col.indexOf(":");
- Text cf = new Text(idx < 0 ? Base64.getDecoder().decode(col) : Base64.getDecoder().decode(col.substring(0, idx)));
- Text cf = new Text(idx < 0 ? Base64.decodeBase64(col.getBytes(UTF_8))
- : Base64.decodeBase64(col.substring(0, idx).getBytes(UTF_8)));
- Text cq = idx < 0 ? null
- : new Text(Base64.decodeBase64(col.substring(idx + 1).getBytes(UTF_8)));
++ Text cf = new Text(idx < 0 ? Base64.getDecoder().decode(col)
++ : Base64.getDecoder().decode(col.substring(0, idx)));
+ Text cq = idx < 0 ? null : new Text(Base64.getDecoder().decode(col.substring(idx + 1)));
columns.add(new Pair<>(cf, cq));
}
return columns;
@@@ -675,7 -727,8 +725,8 @@@
* if the table name set on the configuration doesn't exist
* @since 1.6.0
*/
- public static TabletLocator getTabletLocator(Class<?> implementingClass, Configuration conf, Table.ID tableId) throws TableNotFoundException {
+ public static TabletLocator getTabletLocator(Class<?> implementingClass, Configuration conf,
- String tableId) throws TableNotFoundException {
++ Table.ID tableId) throws TableNotFoundException {
String instanceType = conf.get(enumToConfKey(implementingClass, InstanceOpts.TYPE));
if ("MockInstance".equals(instanceType))
return DeprecationUtil.makeMockLocator();
@@@ -842,7 -918,8 +908,8 @@@
return null;
}
- public static Map<String,Map<KeyExtent,List<Range>>> binOffline(Table.ID tableId, List<Range> ranges, Instance instance, Connector conn)
- public static Map<String,Map<KeyExtent,List<Range>>> binOffline(String tableId,
++ public static Map<String,Map<KeyExtent,List<Range>>> binOffline(Table.ID tableId,
+ List<Range> ranges, Instance instance, Connector conn)
throws AccumuloException, TableNotFoundException {
Map<String,Map<KeyExtent,List<Range>>> binnedRanges = new HashMap<>();
diff --cc core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
index f9d1bc1,1285889..1019e1f
--- a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/partition/RangePartitioner.java
@@@ -88,11 -88,16 +88,13 @@@ public class RangePartitioner extends P
if (cf != null) {
for (Path path : cf) {
- if (path.toUri().getPath().endsWith(cutFileName.substring(cutFileName.lastIndexOf('/')))) {
+ if (path.toUri().getPath()
+ .endsWith(cutFileName.substring(cutFileName.lastIndexOf('/')))) {
TreeSet<Text> cutPoints = new TreeSet<>();
- try (Scanner in = new Scanner(new BufferedReader(new InputStreamReader(new FileInputStream(path.toString()), UTF_8)))) {
- Scanner in = new Scanner(new BufferedReader(
- new InputStreamReader(new FileInputStream(path.toString()), UTF_8)));
- try {
++ try (Scanner in = new Scanner(new BufferedReader(
++ new InputStreamReader(new FileInputStream(path.toString()), UTF_8)))) {
while (in.hasNextLine())
- cutPoints.add(new Text(Base64.decodeBase64(in.nextLine().getBytes(UTF_8))));
- } finally {
- in.close();
+ cutPoints.add(new Text(Base64.getDecoder().decode(in.nextLine())));
}
cutPointArray = cutPoints.toArray(new Text[cutPoints.size()]);
break;
diff --cc core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchDeleter.java
index b55b327,7e8c409..1b20380
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchDeleter.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockBatchDeleter.java
@@@ -64,9 -67,12 +66,10 @@@ public class MockBatchDeleter extends M
Entry<Key,Value> next = iter.next();
Key k = next.getKey();
Mutation m = new Mutation(k.getRow());
- m.putDelete(k.getColumnFamily(), k.getColumnQualifier(), new ColumnVisibility(k.getColumnVisibility()), k.getTimestamp());
+ m.putDelete(k.getColumnFamily(), k.getColumnQualifier(),
+ new ColumnVisibility(k.getColumnVisibility()), k.getTimestamp());
writer.addMutation(m);
}
- } finally {
- writer.close();
}
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/mock/MockConnector.java
index 4918125,2aec560..e473f71
--- 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
@@@ -79,38 -84,32 +84,43 @@@ public class MockConnector extends Conn
}
@Override
- public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads, BatchWriterConfig config)
- throws TableNotFoundException {
- return createBatchDeleter(tableName, authorizations, numQueryThreads, config.getMaxMemory(), config.getMaxLatency(TimeUnit.MILLISECONDS),
- config.getMaxWriteThreads());
+ public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations,
+ int numQueryThreads, BatchWriterConfig config) throws TableNotFoundException {
+ return createBatchDeleter(tableName, authorizations, numQueryThreads, config.getMaxMemory(),
+ config.getMaxLatency(TimeUnit.MILLISECONDS), config.getMaxWriteThreads());
}
+ @Override
- public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations, int numQueryThreads) throws TableNotFoundException {
++ public BatchDeleter createBatchDeleter(String tableName, Authorizations authorizations,
++ int numQueryThreads) throws TableNotFoundException {
+ return createBatchDeleter(tableName, authorizations, numQueryThreads, new BatchWriterConfig());
+ }
+
@Deprecated
@Override
- public BatchWriter createBatchWriter(String tableName, long maxMemory, long maxLatency, int maxWriteThreads) throws TableNotFoundException {
+ public BatchWriter createBatchWriter(String tableName, long maxMemory, long maxLatency,
+ int maxWriteThreads) throws TableNotFoundException {
if (acu.tables.get(tableName) == null)
throw new TableNotFoundException(tableName, tableName, "no such table");
return new MockBatchWriter(acu, tableName);
}
@Override
- public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config) throws TableNotFoundException {
- return createBatchWriter(tableName, config.getMaxMemory(), config.getMaxLatency(TimeUnit.MILLISECONDS), config.getMaxWriteThreads());
+ public BatchWriter createBatchWriter(String tableName, BatchWriterConfig config)
+ throws TableNotFoundException {
+ return createBatchWriter(tableName, config.getMaxMemory(),
+ config.getMaxLatency(TimeUnit.MILLISECONDS), config.getMaxWriteThreads());
}
+ @Override
+ public BatchWriter createBatchWriter(String tableName) throws TableNotFoundException {
+ return createBatchWriter(tableName, new BatchWriterConfig());
+ }
+
@Deprecated
@Override
- public MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency, int maxWriteThreads) {
+ public MultiTableBatchWriter createMultiTableBatchWriter(long maxMemory, long maxLatency,
+ int maxWriteThreads) {
return new MockMultiTableBatchWriter(acu);
}
@@@ -120,12 -120,8 +131,13 @@@
}
@Override
+ public MultiTableBatchWriter createMultiTableBatchWriter() {
+ return createMultiTableBatchWriter(new BatchWriterConfig());
+ }
+
+ @Override
- public Scanner createScanner(String tableName, Authorizations authorizations) throws TableNotFoundException {
+ public Scanner createScanner(String tableName, Authorizations authorizations)
+ throws TableNotFoundException {
MockTable table = acu.tables.get(tableName);
if (table == null)
throw new TableNotFoundException(tableName, tableName, "no such table");
diff --cc core/src/main/java/org/apache/accumulo/core/client/mock/MockInstance.java
index ac53bed,f26638f..9f1f4c0
--- 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
@@@ -135,8 -143,23 +141,9 @@@ public class MockInstance implements In
return getConnector(user, TextUtil.getBytes(new Text(pass.toString())));
}
- AccumuloConfiguration conf = null;
-
- @Deprecated
- @Override
- public AccumuloConfiguration getConfiguration() {
- return conf == null ? DefaultConfiguration.getInstance() : conf;
- }
-
- @Override
- @Deprecated
- public void setConfiguration(AccumuloConfiguration conf) {
- this.conf = conf;
- }
-
@Override
- public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
+ public Connector getConnector(String principal, AuthenticationToken token)
+ throws AccumuloException, AccumuloSecurityException {
Connector conn = new MockConnector(new Credentials(principal, token), acu, this);
if (!acu.users.containsKey(principal))
conn.securityOperations().createLocalUser(principal, (PasswordToken) token);
diff --cc core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
index 112b6a9,a996c1a..fcf3d03
--- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
@@@ -292,8 -304,10 +307,9 @@@ class MockTableOperations extends Table
*/
for (FileStatus importStatus : fs.listStatus(importPath)) {
try {
- FileSKVIterator importIterator = FileOperations.getInstance().newReaderBuilder().forFile(importStatus.getPath().toString(), fs, fs.getConf())
+ FileSKVIterator importIterator = FileOperations.getInstance().newReaderBuilder()
+ .forFile(importStatus.getPath().toString(), fs, fs.getConf())
- .withTableConfiguration(AccumuloConfiguration.getDefaultConfiguration())
- .seekToBeginning().build();
+ .withTableConfiguration(DefaultConfiguration.getInstance()).seekToBeginning().build();
while (importIterator.hasTop()) {
Key key = importIterator.getTopKey();
Value value = importIterator.getTopValue();
@@@ -503,31 -538,8 +540,34 @@@
}
@Override
- public Locations locate(String tableName, Collection<Range> ranges) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+ public Locations locate(String tableName, Collection<Range> ranges)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
throw new UnsupportedOperationException();
}
+
+ @Override
- public SummaryRetriever summaries(String tableName) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
++ public SummaryRetriever summaries(String tableName)
++ throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
- public void addSummarizers(String tableName, SummarizerConfiguration... summarizerConf) throws TableNotFoundException, AccumuloException,
- AccumuloSecurityException {
++ public void addSummarizers(String tableName, SummarizerConfiguration... summarizerConf)
++ throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
+ throw new UnsupportedOperationException();
+
+ }
+
+ @Override
- public void removeSummarizers(String tableName, Predicate<SummarizerConfiguration> predicate) throws AccumuloException, TableNotFoundException,
- AccumuloSecurityException {
++ public void removeSummarizers(String tableName, Predicate<SummarizerConfiguration> predicate)
++ throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
+ throw new UnsupportedOperationException();
+
+ }
+
+ @Override
- public List<SummarizerConfiguration> listSummarizers(String tableName) throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
++ public List<SummarizerConfiguration> listSummarizers(String tableName)
++ throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
+ throw new UnsupportedOperationException();
+ }
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/mock/impl/MockTabletLocator.java
index 3837f2a,fbdb0e4..4e37294
--- 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
@@@ -55,9 -56,10 +56,10 @@@ public class MockTabletLocator extends
}
@Override
- public List<Range> binRanges(ClientContext context, List<Range> ranges, Map<String,Map<KeyExtent,List<Range>>> binnedRanges) throws AccumuloException,
- AccumuloSecurityException, TableNotFoundException {
+ public List<Range> binRanges(ClientContext context, List<Range> ranges,
+ Map<String,Map<KeyExtent,List<Range>>> binnedRanges)
+ throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
- binnedRanges.put("", Collections.singletonMap(new KeyExtent("", null, null), ranges));
+ binnedRanges.put("", Collections.singletonMap(new KeyExtent(), ranges));
return Collections.emptyList();
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/rfile/RFile.java
index 7c3f70e,fed3e35..f686e70
--- a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFile.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFile.java
@@@ -187,120 -195,8 +201,132 @@@ public class RFile
}
/**
- * This is an intermediate interface in a larger builder pattern. Supports setting the required input sources for reading summary data from an RFile.
+ * This is an intermediate interface in a larger builder pattern. Supports setting the required
++ * input sources for reading summary data from an RFile.
+ *
+ * @since 2.0.0
+ */
+ public static interface SummaryInputArguments {
+ /**
- * Specify RFiles to read from. When multiple inputs are specified the summary data will be merged.
++ * Specify RFiles to read from. When multiple inputs are specified the summary data will be
++ * merged.
+ *
+ * @param inputs
+ * one or more RFiles to read.
+ * @return this
+ */
+ SummaryOptions from(RFileSource... inputs);
+
+ /**
+ * Specify RFiles to read from. When multiple are specified the summary data will be merged.
+ *
+ * @param files
+ * one or more RFiles to read.
+ * @return this
+ */
+ SummaryFSOptions from(String... files);
+ }
+
+ /**
- * This is an intermediate interface in a larger builder pattern. Enables optionally setting a FileSystem to read RFile summary data from.
++ * This is an intermediate interface in a larger builder pattern. Enables optionally setting a
++ * FileSystem to read RFile summary data from.
+ *
+ * @since 2.0.0
+ */
+ public static interface SummaryFSOptions extends SummaryOptions {
+ /**
- * Optionally provide a FileSystem to open RFiles. If not specified, the FileSystem will be constructed using configuration on the classpath.
++ * Optionally provide a FileSystem to open RFiles. If not specified, the FileSystem will be
++ * constructed using configuration on the classpath.
+ *
+ * @param fs
+ * use this FileSystem to open files.
+ * @return this
+ */
+ SummaryOptions withFileSystem(FileSystem fs);
+ }
+
+ /**
- * This is an intermediate interface in a large builder pattern. Allows setting options for retrieving summary data.
++ * This is an intermediate interface in a large builder pattern. Allows setting options for
++ * retrieving summary data.
+ *
+ * @since 2.0.0
+ */
+ public static interface SummaryOptions {
+ /**
- * This method allows retrieving a subset of summary data from a file. If a file has lots of separate summaries, reading a subset may be faster.
++ * This method allows retrieving a subset of summary data from a file. If a file has lots of
++ * separate summaries, reading a subset may be faster.
+ *
+ * @param summarySelector
- * Only read summary data that was generated with configuration that this predicate matches.
++ * Only read summary data that was generated with configuration that this predicate
++ * matches.
+ * @return this
+ */
+ SummaryOptions selectSummaries(Predicate<SummarizerConfiguration> summarySelector);
+
+ /**
- * Summary data may possibly be stored at a more granular level than the entire file. However there is no guarantee of this. If the data was stored at a
- * more granular level, then this will get a subset of the summary data. The subset will very likely be an inaccurate approximation.
++ * Summary data may possibly be stored at a more granular level than the entire file. However
++ * there is no guarantee of this. If the data was stored at a more granular level, then this
++ * will get a subset of the summary data. The subset will very likely be an inaccurate
++ * approximation.
+ *
+ * @param startRow
+ * A non-null start row. The startRow is used exclusively.
+ * @return this
+ *
+ * @see FileStatistics#getExtra()
+ */
+ SummaryOptions startRow(Text startRow);
+
+ /**
+ * @param startRow
+ * UTF-8 encodes startRow. The startRow is used exclusively.
+ * @return this
+ * @see #startRow(Text)
+ */
+ SummaryOptions startRow(CharSequence startRow);
+
+ /**
- * Summary data may possibly be stored at a more granular level than the entire file. However there is no guarantee of this. If the data was stored at a
- * more granular level, then this will get a subset of the summary data. The subset will very likely be an inaccurate approximation.
++ * Summary data may possibly be stored at a more granular level than the entire file. However
++ * there is no guarantee of this. If the data was stored at a more granular level, then this
++ * will get a subset of the summary data. The subset will very likely be an inaccurate
++ * approximation.
+ *
+ * @param endRow
+ * A non-null end row. The end row is used inclusively.
+ * @return this
+ *
+ * @see FileStatistics#getExtra()
+ */
+ SummaryOptions endRow(Text endRow);
+
+ /**
+ * @param endRow
+ * UTF-8 encodes endRow. The end row is used inclusively.
+ * @return this
+ * @see #endRow(Text)
+ */
+ SummaryOptions endRow(CharSequence endRow);
+
+ /**
+ * Reads summary data from file.
+ *
+ * @return The summary data in the file that satisfied the selection criteria.
+ */
+ Collection<Summary> read() throws IOException;
+ }
+
+ /**
+ * Entry point for reading summary data from RFiles.
+ *
+ * @since 2.0.0
+ */
+ public static SummaryInputArguments summaries() {
+ return new RFileSummariesRetriever();
+ }
+
+ /**
- * This is an intermediate interface in a larger builder pattern. Supports setting the required output sink to write a RFile to.
++ * This is an intermediate interface in a larger builder pattern. Supports setting the required
+ * output sink to write a RFile to.
*
* @since 1.8.0
*/
@@@ -343,16 -241,6 +371,17 @@@
* @since 1.8.0
*/
public static interface WriterOptions {
+
+ /**
- * Enable generating summary data in the created RFile by running {@link Summarizer}'s based on the specified configuration.
++ * Enable generating summary data in the created RFile by running {@link Summarizer}'s based on
++ * the specified configuration.
+ *
+ * @param summarizerConf
+ * Configuration for summarizer to run.
+ * @since 2.0.0
+ */
+ public WriterOptions withSummarizers(SummarizerConfiguration... summarizerConf);
+
/**
* An option to store sample data in the generated RFile.
*
diff --cc core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java
index 15c89ed,9320fc0..bcb2e49
--- a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileScanner.java
@@@ -117,58 -113,6 +117,59 @@@ class RFileScanner extends ScannerOptio
public long getMaxSize() {
return Integer.MAX_VALUE;
}
+
+ @Override
+ public Stats getStats() {
+ return new BlockCache.Stats() {
+ @Override
+ public long hitCount() {
+ return 0L;
+ }
+
+ @Override
+ public long requestCount() {
+ return 0L;
+ }
+ };
+ }
+
+ @Override
+ public CacheEntry getBlock(String blockName, Loader loader) {
+ Map<String,Loader> depLoaders = loader.getDependencies();
+ Map<String,byte[]> depData;
+
+ switch (depLoaders.size()) {
+ case 0:
+ depData = Collections.emptyMap();
+ break;
+ case 1:
+ Entry<String,Loader> entry = depLoaders.entrySet().iterator().next();
- depData = Collections.singletonMap(entry.getKey(), getBlock(entry.getKey(), entry.getValue()).getBuffer());
++ depData = Collections.singletonMap(entry.getKey(),
++ getBlock(entry.getKey(), entry.getValue()).getBuffer());
+ break;
+ default:
+ depData = new HashMap<>();
+ depLoaders.forEach((k, v) -> depData.put(k, getBlock(k, v).getBuffer()));
+ }
+
+ byte[] data = loader.load(Integer.MAX_VALUE, depData);
+
+ return new CacheEntry() {
+
+ @Override
+ public byte[] getBuffer() {
+ return data;
+ }
+
+ @Override
+ public <T extends Weighbable> T getIndex(Supplier<T> supplier) {
+ return null;
+ }
+
+ @Override
+ public void indexWeightChanged() {}
+ };
+ }
}
RFileScanner(Opts opts) {
@@@ -340,10 -269,11 +345,11 @@@
RFileSource[] sources = opts.in.getSources();
List<SortedKeyValueIterator<Key,Value>> readers = new ArrayList<>(sources.length);
for (int i = 0; i < sources.length; i++) {
+ // TODO may have been a bug with multiple files and caching in older version...
FSDataInputStream inputStream = (FSDataInputStream) sources[i].getInputStream();
- readers.add(new RFile.Reader(new CachableBlockFile.Reader("source-" + i, inputStream, sources[i].getLength(), opts.in.getConf(), dataCache, indexCache,
- DefaultConfiguration.getInstance())));
-
- readers.add(new RFile.Reader(new CachableBlockFile.Reader("source-" + i, inputStream,
- sources[i].getLength(), opts.in.getConf(), dataCache, indexCache,
- AccumuloConfiguration.getDefaultConfiguration())));
++ readers.add(new RFile.Reader(
++ new CachableBlockFile.Reader("source-" + i, inputStream, sources[i].getLength(),
++ opts.in.getConf(), dataCache, indexCache, DefaultConfiguration.getInstance())));
}
if (getSamplerConfiguration() != null) {
diff --cc core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
index e4b3e05,0000000..7fd618c
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileSummariesRetriever.java
@@@ -1,122 -1,0 +1,124 @@@
+/*
+ * 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.rfile;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Objects;
+import java.util.function.Predicate;
+
+import org.apache.accumulo.core.client.rfile.RFile.SummaryFSOptions;
+import org.apache.accumulo.core.client.rfile.RFile.SummaryInputArguments;
+import org.apache.accumulo.core.client.rfile.RFile.SummaryOptions;
+import org.apache.accumulo.core.client.rfile.RFileScannerBuilder.InputArgs;
+import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
+import org.apache.accumulo.core.client.summary.Summary;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.DefaultConfiguration;
+import org.apache.accumulo.core.summary.Gatherer;
+import org.apache.accumulo.core.summary.SummarizerFactory;
+import org.apache.accumulo.core.summary.SummaryCollection;
+import org.apache.accumulo.core.summary.SummaryReader;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.io.Text;
+
+class RFileSummariesRetriever implements SummaryInputArguments, SummaryFSOptions, SummaryOptions {
+
+ private Predicate<SummarizerConfiguration> summarySelector = sc -> true;
+ private Text startRow;
+ private InputArgs in;
+ private Text endRow;
+
+ @Override
+ public SummaryOptions selectSummaries(Predicate<SummarizerConfiguration> summarySelector) {
+ Objects.requireNonNull(summarySelector);
+ this.summarySelector = summarySelector;
+ return this;
+ }
+
+ @Override
+ public SummaryOptions startRow(CharSequence startRow) {
+ return startRow(new Text(startRow.toString()));
+ }
+
+ @Override
+ public SummaryOptions startRow(Text startRow) {
+ Objects.requireNonNull(startRow);
+ this.startRow = startRow;
+ return this;
+ }
+
+ @Override
+ public SummaryOptions endRow(CharSequence endRow) {
+ return endRow(new Text(endRow.toString()));
+ }
+
+ @Override
+ public SummaryOptions endRow(Text endRow) {
+ Objects.requireNonNull(endRow);
+ this.endRow = endRow;
+ return this;
+ }
+
+ @Override
+ public Collection<Summary> read() throws IOException {
+ SummarizerFactory factory = new SummarizerFactory();
+ AccumuloConfiguration acuconf = DefaultConfiguration.getInstance();
+ Configuration conf = in.getFileSystem().getConf();
+
+ RFileSource[] sources = in.getSources();
+ try {
+ SummaryCollection all = new SummaryCollection();
+ for (RFileSource source : sources) {
- SummaryReader fileSummary = SummaryReader.load(conf, acuconf, source.getInputStream(), source.getLength(), summarySelector, factory);
- SummaryCollection sc = fileSummary.getSummaries(Collections.singletonList(new Gatherer.RowRange(startRow, endRow)));
++ SummaryReader fileSummary = SummaryReader.load(conf, acuconf, source.getInputStream(),
++ source.getLength(), summarySelector, factory);
++ SummaryCollection sc = fileSummary
++ .getSummaries(Collections.singletonList(new Gatherer.RowRange(startRow, endRow)));
+ all.merge(sc, factory);
+ }
+ return all.getSummaries();
+ } finally {
+ for (RFileSource source : sources) {
+ source.getInputStream().close();
+ }
+ }
+ }
+
+ @Override
+ public SummaryOptions withFileSystem(FileSystem fs) {
+ Objects.requireNonNull(fs);
+ this.in.fs = fs;
+ return this;
+ }
+
+ @Override
+ public SummaryOptions from(RFileSource... inputs) {
+ Objects.requireNonNull(inputs);
+ in = new InputArgs(inputs);
+ return this;
+ }
+
+ @Override
+ public SummaryFSOptions from(String... files) {
+ Objects.requireNonNull(files);
+ in = new InputArgs(files);
+ return this;
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/rfile/RFileWriterBuilder.java
index 9097a8b,4dd7184..20636f8
--- a/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileWriterBuilder.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/rfile/RFileWriterBuilder.java
@@@ -63,14 -59,9 +63,16 @@@ class RFileWriterBuilder implements RFi
}
private OutputArgs out;
- private SamplerConfiguration sampler = null;
private Map<String,String> tableConfig = Collections.emptyMap();
private int visCacheSize = 1000;
+ private Map<String,String> samplerProps = Collections.emptyMap();
+ private Map<String,String> summarizerProps = Collections.emptyMap();
+
- private void checkDisjoint(Map<String,String> props, Map<String,String> derivedProps, String kind) {
- checkArgument(Collections.disjoint(props.keySet(), derivedProps.keySet()), "Properties and derived %s properties are not disjoint", kind);
++ private void checkDisjoint(Map<String,String> props, Map<String,String> derivedProps,
++ String kind) {
++ checkArgument(Collections.disjoint(props.keySet(), derivedProps.keySet()),
++ "Properties and derived %s properties are not disjoint", kind);
+ }
@Override
public WriterOptions withSampler(SamplerConfiguration samplerConf) {
@@@ -102,11 -92,12 +104,16 @@@
} else {
fsdo = new FSDataOutputStream(out.getOutputStream(), new FileSystem.Statistics("foo"));
}
- return new RFileWriter(fileops.newWriterBuilder().forOutputStream(".rf", fsdo, out.getConf()).withTableConfiguration(acuconf)
- .setAccumuloStartEnabled(false).build(), visCacheSize);
- return new RFileWriter(fileops.newWriterBuilder().forOutputStream(".rf", fsdo, out.getConf())
- .withTableConfiguration(acuconf).build(), visCacheSize);
++ return new RFileWriter(
++ fileops.newWriterBuilder().forOutputStream(".rf", fsdo, out.getConf())
++ .withTableConfiguration(acuconf).setAccumuloStartEnabled(false).build(),
++ visCacheSize);
} else {
- return new RFileWriter(fileops.newWriterBuilder().forFile(out.path.toString(), out.getFileSystem(), out.getConf()).withTableConfiguration(acuconf)
- .setAccumuloStartEnabled(false).build(), visCacheSize);
- return new RFileWriter(fileops.newWriterBuilder()
- .forFile(out.path.toString(), out.getFileSystem(), out.getConf())
- .withTableConfiguration(acuconf).build(), visCacheSize);
++ return new RFileWriter(
++ fileops.newWriterBuilder()
++ .forFile(out.path.toString(), out.getFileSystem(), out.getConf())
++ .withTableConfiguration(acuconf).setAccumuloStartEnabled(false).build(),
++ visCacheSize);
}
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderToken.java
index b39afe2,e804737..320268c
--- a/core/src/main/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderToken.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/security/tokens/CredentialProviderToken.java
@@@ -31,11 -31,9 +31,12 @@@ import org.apache.hadoop.conf.Configura
* An {@link AuthenticationToken} backed by a Hadoop CredentialProvider.
*/
public class CredentialProviderToken extends PasswordToken {
- public static final String NAME_PROPERTY = "name", CREDENTIAL_PROVIDERS_PROPERTY = "credentialProviders";
+ public static final String NAME_PROPERTY = "name",
+ CREDENTIAL_PROVIDERS_PROPERTY = "credentialProviders";
+ private String name;
+ private String credentialProviders;
+
public CredentialProviderToken() {
super();
}
@@@ -46,9 -44,9 +47,10 @@@
setWithCredentialProviders(name, credentialProviders);
}
- protected void setWithCredentialProviders(String name, String credentialProviders) throws IOException {
+ protected void setWithCredentialProviders(String name, String credentialProviders)
+ throws IOException {
+ this.name = name;
+ this.credentialProviders = credentialProviders;
final Configuration conf = new Configuration(CachedConfiguration.getInstance());
conf.set(CredentialProviderFactoryShim.CREDENTIAL_PROVIDER_PATH, credentialProviders);
@@@ -61,26 -60,14 +64,28 @@@
setPassword(CharBuffer.wrap(password));
}
+ /**
+ * @return Name used to extract Accumulo user password from CredentialProvider
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return CSV list of CredentialProvider(s)
+ */
+ public String getCredentialProviders() {
+ return credentialProviders;
+ }
+
@Override
public void init(Properties properties) {
- char[] nameCharArray = properties.get(NAME_PROPERTY), credentialProvidersCharArray = properties.get(CREDENTIAL_PROVIDERS_PROPERTY);
+ char[] nameCharArray = properties.get(NAME_PROPERTY),
+ credentialProvidersCharArray = properties.get(CREDENTIAL_PROVIDERS_PROPERTY);
if (null != nameCharArray && null != credentialProvidersCharArray) {
try {
- this.setWithCredentialProviders(new String(nameCharArray), new String(credentialProvidersCharArray));
+ this.setWithCredentialProviders(new String(nameCharArray),
+ new String(credentialProvidersCharArray));
} catch (IOException e) {
throw new IllegalArgumentException("Could not extract password from CredentialProvider", e);
}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/CounterSummary.java
index a0f9bc5,0000000..b5a5cca
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/CounterSummary.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/CounterSummary.java
@@@ -1,123 -1,0 +1,131 @@@
+/*
+ * 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.summary;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import com.google.common.annotations.VisibleForTesting;
+
+/**
- * This a convenience class for interpreting summary data generated by implementations of {@link CountingSummarizer}
++ * This a convenience class for interpreting summary data generated by implementations of
++ * {@link CountingSummarizer}
+ *
+ * @since 2.0.0
+ */
+
+public class CounterSummary {
+ private Map<String,Long> stats;
+
+ /**
+ * This method will call {@link #CounterSummary(Summary, boolean)} with true.
+ */
+ public CounterSummary(Summary summary) {
+ this(summary, true);
+ }
+
+ /**
+ * @param summary
+ * a summary
+ * @param checkType
- * If true will try to ensure the classname from {@link Summary#getSummarizerConfiguration()} is an instance of {@link CountingSummarizer}. However
- * this check can only succeed if the class is on the classpath. For cases where the summary data needs to be used and the class is not on the
- * classpath, set this to false.
++ * If true will try to ensure the classname from
++ * {@link Summary#getSummarizerConfiguration()} is an instance of
++ * {@link CountingSummarizer}. However this check can only succeed if the class is on the
++ * classpath. For cases where the summary data needs to be used and the class is not on
++ * the classpath, set this to false.
+ */
+ public CounterSummary(Summary summary, boolean checkType) {
+ if (checkType) {
+ String className = summary.getSummarizerConfiguration().getClassName();
+ try {
+ getClass().getClassLoader().loadClass(className).asSubclass(CountingSummarizer.class);
+ } catch (ClassCastException e) {
- throw new IllegalArgumentException(className + " is not an instance of " + CountingSummarizer.class.getSimpleName(), e);
++ throw new IllegalArgumentException(
++ className + " is not an instance of " + CountingSummarizer.class.getSimpleName(), e);
+ } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException("Unable to check summary was produced by a " + CountingSummarizer.class.getSimpleName(), e);
++ throw new IllegalArgumentException(
++ "Unable to check summary was produced by a " + CountingSummarizer.class.getSimpleName(),
++ e);
+ }
+ }
+ this.stats = summary.getStatistics();
+ }
+
+ @VisibleForTesting
+ CounterSummary(Map<String,Long> stats) {
+ this.stats = stats;
+ }
+
+ /**
+ * @return statistic for {@link CountingSummarizer#SEEN_STAT}
+ */
+ public long getSeen() {
+ return stats.getOrDefault(CountingSummarizer.SEEN_STAT, 0l);
+ }
+
+ /**
+ * @return statistic for {@link CountingSummarizer#EMITTED_STAT}
+ */
+ public long getEmitted() {
+ return stats.getOrDefault(CountingSummarizer.EMITTED_STAT, 0l);
+ }
+
+ /**
+ * @return the sum of {@link #getTooLong()} and {@link #getTooLong()}
+ */
+ public long getIgnored() {
+ return getTooLong() + getTooMany();
+ }
+
+ /**
+ * @return statistic for {@link CountingSummarizer#TOO_LONG_STAT}
+ */
+ public long getTooLong() {
+ return stats.getOrDefault(CountingSummarizer.TOO_LONG_STAT, 0l);
+ }
+
+ /**
+ * @return statistic for {@link CountingSummarizer#TOO_MANY_STAT}
+ */
+ public long getTooMany() {
+ return stats.getOrDefault(CountingSummarizer.TOO_MANY_STAT, 0l);
+ }
+
+ /**
+ * @return statistic for {@link CountingSummarizer#DELETES_IGNORED_STAT}
+ */
+ public long getDeletesIgnored() {
+ return stats.getOrDefault(CountingSummarizer.DELETES_IGNORED_STAT, 0l);
+ }
+
+ /**
- * @return All statistics with a prefix of {@link CountingSummarizer#COUNTER_STAT_PREFIX} with the prefix stripped off.
++ * @return All statistics with a prefix of {@link CountingSummarizer#COUNTER_STAT_PREFIX} with the
++ * prefix stripped off.
+ */
+ public Map<String,Long> getCounters() {
+ HashMap<String,Long> ret = new HashMap<>();
+ for (Entry<String,Long> entry : stats.entrySet()) {
+ if (entry.getKey().startsWith(CountingSummarizer.COUNTER_STAT_PREFIX)) {
- ret.put(entry.getKey().substring(CountingSummarizer.COUNTER_STAT_PREFIX.length()), entry.getValue());
++ ret.put(entry.getKey().substring(CountingSummarizer.COUNTER_STAT_PREFIX.length()),
++ entry.getValue());
+ }
+ }
+ return ret;
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/CountingSummarizer.java
index b3e1b68,0000000..58bbc3b
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/CountingSummarizer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/CountingSummarizer.java
@@@ -1,302 -1,0 +1,319 @@@
+/*
+ * 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.summary;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.UnaryOperator;
+import java.util.stream.Collectors;
+
+import org.apache.accumulo.core.client.summary.summarizers.VisibilitySummarizer;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+import org.apache.commons.lang.mutable.MutableLong;
+
+//checkstyle and formatter are in conflict
+//@formatter:off
+/**
+ * This class counts arbitrary keys while defending against too many keys and keys that are too long.
+ *
+ * <p>
+ * During collection and summarization this class will use the functions from {@link #converter()} and {@link #encoder()}. For each key/value the function from
+ * {@link #converter()} will be called to create zero or more counter objects. A counter associated with each counter object will be incremented, as long as
+ * there are not too many counters and the counter object is not too long.
+ *
+ * <p>
+ * When {@link Summarizer.Collector#summarize(Summarizer.StatisticConsumer)} is called, the function from {@link #encoder()} will be used to convert counter
+ * objects to strings. These strings will be used to emit statistics. Overriding {@link #encoder()} is optional. One reason to override is if the counter object
+ * contains binary or special data. For example, a function that base64 encodes counter objects could be created.
+ *
+ * <p>
+ * If the counter key type is mutable, then consider overriding {@link #copier()}.
+ *
+ * <p>
+ * The function returned by {@link #converter()} will be called frequently and should be very efficient. The function returned by {@link #encoder()} will be
+ * called less frequently and can be more expensive. The reason these two functions exists is to avoid the conversion to string for each key value, if that
+ * conversion is unnecessary.
+ *
+ * <p>
+ * Below is an example implementation that counts column visibilities. This example avoids converting column visibility to string for each key/value. This
+ * example shows the source code for {@link VisibilitySummarizer}.
+ *
+ * <pre>
+ * <code>
+ * public class VisibilitySummarizer extends CountingSummarizer<ByteSequence> {
+ * @Override
+ * protected UnaryOperator<ByteSequence> copier() {
+ * // ByteSequences are mutable, so override and provide a copy function
+ * return ArrayByteSequence::new;
+ * }
+ *
+ * @Override
+ * protected Converter<ByteSequence> converter() {
+ * return (key, val, consumer) -> consumer.accept(key.getColumnVisibilityData());
+ * }
+ * }
+ * </code>
+ * </pre>
+ *
+ * @param <K>
+ * The counter key type. This type must have good implementations of {@link Object#hashCode()} and {@link Object#equals(Object)}.
+ * @see CounterSummary
+ * @since 2.0.0
+ */
+//@formatter:on
+public abstract class CountingSummarizer<K> implements Summarizer {
+
+ /**
- * A configuration option for specifying the maximum number of unique counters an instance of this summarizer should track. If not specified, a default of
- * {@value #MAX_COUNTER_DEFAULT} will be used.
++ * A configuration option for specifying the maximum number of unique counters an instance of this
++ * summarizer should track. If not specified, a default of {@value #MAX_COUNTER_DEFAULT} will be
++ * used.
+ */
+ public static final String MAX_COUNTERS_OPT = "maxCounters";
+
+ /**
- * A configuration option for specifying the maximum length of an individual counter key. If not specified, a default of {@value #MAX_CKL_DEFAULT} will be
- * used.
++ * A configuration option for specifying the maximum length of an individual counter key. If not
++ * specified, a default of {@value #MAX_CKL_DEFAULT} will be used.
+ */
+ public static final String MAX_COUNTER_LEN_OPT = "maxCounterLen";
+
+ /**
- * A configuration option to determine if delete keys should be counted. If set to true then delete keys will not be passed to the {@link Converter} and the
- * statistic {@value #DELETES_IGNORED_STAT} will track the number of deleted ignored. This options defaults to {@value #INGNORE_DELETES_DEFAULT}.
++ * A configuration option to determine if delete keys should be counted. If set to true then
++ * delete keys will not be passed to the {@link Converter} and the statistic
++ * {@value #DELETES_IGNORED_STAT} will track the number of deleted ignored. This options defaults
++ * to {@value #INGNORE_DELETES_DEFAULT}.
+ */
+ public static final String INGNORE_DELETES_OPT = "ignoreDeletes";
+
+ /**
- * This prefixes all counters when emitting statistics in {@link Summarizer.Collector#summarize(Summarizer.StatisticConsumer)}.
++ * This prefixes all counters when emitting statistics in
++ * {@link Summarizer.Collector#summarize(Summarizer.StatisticConsumer)}.
+ */
+ public static final String COUNTER_STAT_PREFIX = "c:";
+
+ /**
- * This is the name of the statistic that tracks how many counters objects were ignored because the number of unique counters was exceeded. The max number of
- * unique counters is specified by {@link #MAX_COUNTERS_OPT}.
++ * This is the name of the statistic that tracks how many counters objects were ignored because
++ * the number of unique counters was exceeded. The max number of unique counters is specified by
++ * {@link #MAX_COUNTERS_OPT}.
+ */
+ public static final String TOO_MANY_STAT = "tooMany";
+
+ /**
- * This is the name of the statistic that tracks how many counter objects were ignored because they were too long. The maximum lenght is specified by
- * {@link #MAX_COUNTER_LEN_OPT}.
++ * This is the name of the statistic that tracks how many counter objects were ignored because
++ * they were too long. The maximum lenght is specified by {@link #MAX_COUNTER_LEN_OPT}.
+ */
+ public static final String TOO_LONG_STAT = "tooLong";
+
+ /**
- * This is the name of the statistic that tracks the total number of counter objects emitted by the {@link Converter}. This includes emitted Counter objects
- * that were ignored.
++ * This is the name of the statistic that tracks the total number of counter objects emitted by
++ * the {@link Converter}. This includes emitted Counter objects that were ignored.
+ */
+ public static final String EMITTED_STAT = "emitted";
+
+ /**
- * This is the name of the statistic that tracks the total number of deleted keys seen. This statistic is only incremented when the
- * {@value #INGNORE_DELETES_OPT} option is set to true.
++ * This is the name of the statistic that tracks the total number of deleted keys seen. This
++ * statistic is only incremented when the {@value #INGNORE_DELETES_OPT} option is set to true.
+ */
+ public static final String DELETES_IGNORED_STAT = "deletesIgnored";
+
+ /**
+ * This tracks the total number of key/values seen by the {@link Summarizer.Collector}
+ */
+ public static final String SEEN_STAT = "seen";
+
- // this default can not be changed as persisted summary data depends on it. See the documentation about persistence in the Summarizer class javadoc.
++ // this default can not be changed as persisted summary data depends on it. See the documentation
++ // about persistence in the Summarizer class javadoc.
+ public static final String MAX_COUNTER_DEFAULT = "1024";
+
+ // this default can not be changed as persisted summary data depends on it
+ public static final String MAX_CKL_DEFAULT = "128";
+
+ // this default can not be changed as persisted summary data depends on it
+ public static final String INGNORE_DELETES_DEFAULT = "true";
+
- private static final String[] ALL_STATS = new String[] {TOO_LONG_STAT, TOO_MANY_STAT, EMITTED_STAT, SEEN_STAT, DELETES_IGNORED_STAT};
++ private static final String[] ALL_STATS = new String[] {TOO_LONG_STAT, TOO_MANY_STAT,
++ EMITTED_STAT, SEEN_STAT, DELETES_IGNORED_STAT};
+
+ private int maxCounters;
+ private int maxCounterKeyLen;
+ private boolean ignoreDeletes;
+
+ private void init(SummarizerConfiguration conf) {
- maxCounters = Integer.parseInt(conf.getOptions().getOrDefault(MAX_COUNTERS_OPT, MAX_COUNTER_DEFAULT));
- maxCounterKeyLen = Integer.parseInt(conf.getOptions().getOrDefault(MAX_COUNTER_LEN_OPT, MAX_CKL_DEFAULT));
- ignoreDeletes = Boolean.parseBoolean(conf.getOptions().getOrDefault(INGNORE_DELETES_OPT, INGNORE_DELETES_DEFAULT));
++ maxCounters = Integer
++ .parseInt(conf.getOptions().getOrDefault(MAX_COUNTERS_OPT, MAX_COUNTER_DEFAULT));
++ maxCounterKeyLen = Integer
++ .parseInt(conf.getOptions().getOrDefault(MAX_COUNTER_LEN_OPT, MAX_CKL_DEFAULT));
++ ignoreDeletes = Boolean
++ .parseBoolean(conf.getOptions().getOrDefault(INGNORE_DELETES_OPT, INGNORE_DELETES_DEFAULT));
+ }
+
+ /**
+ * A function that converts key values to zero or more counter objects.
+ *
+ * @since 2.0.0
+ */
+ public static interface Converter<K> {
+ /**
+ * @param consumer
+ * emit counter objects derived from key and value to this consumer
+ */
+ public void convert(Key k, Value v, Consumer<K> consumer);
+ }
+
+ /**
+ *
- * @return A function that is used to convert each key value to zero or more counter objects. Each function returned should be independent.
++ * @return A function that is used to convert each key value to zero or more counter objects. Each
++ * function returned should be independent.
+ */
+ protected abstract Converter<K> converter();
+
+ /**
- * @return A function that is used to convert counter objects to String. The default function calls {@link Object#toString()} on the counter object.
++ * @return A function that is used to convert counter objects to String. The default function
++ * calls {@link Object#toString()} on the counter object.
+ */
+ protected Function<K,String> encoder() {
+ return Object::toString;
+ }
+
+ /**
+ * Override this if your key type is mutable and subject to change.
+ *
- * @return a function that used to copy the counter object. This function is only used when the collector has never seen the counter object before. In this
- * case the collector needs to possibly copy the counter object before using as map key. The default implementation is the
- * {@link UnaryOperator#identity()} function.
++ * @return a function that used to copy the counter object. This function is only used when the
++ * collector has never seen the counter object before. In this case the collector needs to
++ * possibly copy the counter object before using as map key. The default implementation is
++ * the {@link UnaryOperator#identity()} function.
+ */
+ protected UnaryOperator<K> copier() {
+ return UnaryOperator.identity();
+ }
+
+ @Override
+ public Collector collector(SummarizerConfiguration sc) {
+ init(sc);
+ return new Collector() {
+
- // Map used for computing summary incrementally uses ByteSequence for key which is more efficient than converting String for each Key. The
++ // Map used for computing summary incrementally uses ByteSequence for key which is more
++ // efficient than converting String for each Key. The
+ // conversion to String is deferred until the summary is requested.
+
+ private Map<K,MutableLong> counters = new HashMap<>();
+ private long tooMany = 0;
+ private long tooLong = 0;
+ private long seen = 0;
+ private long emitted = 0;
+ private long deleted = 0;
+ private Converter<K> converter = converter();
+ private Function<K,String> encoder = encoder();
+ private UnaryOperator<K> copier = copier();
+
+ private void incrementCounter(K counter) {
+ emitted++;
+
+ MutableLong ml = counters.get(counter);
+ if (ml == null) {
+ if (counters.size() >= maxCounters) {
+ // no need to store this counter in the map and get() it... just use instance variable
+ tooMany++;
+ } else {
+ // we have never seen this key before, check if its too long
+ if (encoder.apply(counter).length() >= maxCounterKeyLen) {
+ tooLong++;
+ } else {
+ counters.put(copier.apply(counter), new MutableLong(1));
+ }
+ }
+ } else {
+ // using mutable long allows calling put() to be avoided
+ ml.increment();
+ }
+ }
+
+ @Override
+ public void accept(Key k, Value v) {
+ seen++;
+ if (ignoreDeletes && k.isDeleted()) {
+ deleted++;
+ } else {
+ converter.convert(k, v, this::incrementCounter);
+ }
+ }
+
+ @Override
+ public void summarize(StatisticConsumer sc) {
+ StringBuilder sb = new StringBuilder(COUNTER_STAT_PREFIX);
+
+ for (Entry<K,MutableLong> entry : counters.entrySet()) {
+ sb.setLength(COUNTER_STAT_PREFIX.length());
+ sb.append(encoder.apply(entry.getKey()));
+ sc.accept(sb.toString(), entry.getValue().longValue());
+ }
+
+ sc.accept(TOO_MANY_STAT, tooMany);
+ sc.accept(TOO_LONG_STAT, tooLong);
+ sc.accept(EMITTED_STAT, emitted);
+ sc.accept(SEEN_STAT, seen);
+ sc.accept(DELETES_IGNORED_STAT, deleted);
+ }
+ };
+ }
+
+ @Override
+ public Combiner combiner(SummarizerConfiguration sc) {
+ init(sc);
+ return new Combiner() {
+
+ @Override
+ public void merge(Map<String,Long> summary1, Map<String,Long> summary2) {
+
+ for (String key : ALL_STATS) {
+ summary1.merge(key, summary2.getOrDefault(key, 0l), Long::sum);
+ }
+
+ for (Entry<String,Long> entry : summary2.entrySet()) {
+ String k2 = entry.getKey();
+ Long v2 = entry.getValue();
+
+ if (k2.startsWith(COUNTER_STAT_PREFIX)) {
+ summary1.merge(k2, v2, Long::sum);
+ }
+ }
+
+ if (summary1.size() - ALL_STATS.length > maxCounters) {
+ // find the keys with the lowest counts to remove
- List<String> keysToRemove = summary1.entrySet().stream().filter(e -> e.getKey().startsWith(COUNTER_STAT_PREFIX)) // filter out non counters
- .sorted((e1, e2) -> Long.compare(e2.getValue(), e1.getValue())) // sort descending by count
++ List<String> keysToRemove = summary1.entrySet().stream()
++ .filter(e -> e.getKey().startsWith(COUNTER_STAT_PREFIX)) // filter out non counters
++ .sorted((e1, e2) -> Long.compare(e2.getValue(), e1.getValue())) // sort descending by
++ // count
+ .skip(maxCounters) // skip most frequent
- .map(e -> e.getKey()).collect(Collectors.toList()); // collect the least frequent counters in a list
++ .map(e -> e.getKey()).collect(Collectors.toList()); // collect the least frequent
++ // counters in a list
+
+ long removedCount = 0;
+ for (String key : keysToRemove) {
+ removedCount += summary1.remove(key);
+ }
+
+ summary1.merge(TOO_MANY_STAT, removedCount, Long::sum);
+ }
+ }
+ };
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/Summarizer.java
index f34c18e,0000000..02cf2ab
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/Summarizer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/Summarizer.java
@@@ -1,229 -1,0 +1,236 @@@
+/*
+ * 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.summary;
+
+import java.util.Map;
+
+import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.client.rfile.RFile;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+
+//checkstyle and the formatter are in conflict, so turn off the formatter
+//@formatter:off
+/**
+ * <p>
+ * Instances of this interface can be configured for Accumulo tables. When Accumulo compacts files, it will use this Factory to create {@link Collector} and
+ * {@link Combiner} objects to generate summary information about the data in the file.
+ *
+ * <p>
+ * In order to merge summary information from multiple files, Accumulo will use this factory to create a {@link Combiner} object.
+ *
+ * <p>
+ * Below is an example of a very simple summarizer that will compute the number of deletes, total number of keys, min timestamp and max timestamp.
+ *
+ * <pre>
+ * <code>
+ * public class BasicSummarizer implements Summarizer {
+ *
+ * public static final String DELETES_STAT = "deletes";
+ * public static final String MIN_STAMP_STAT = "minStamp";
+ * public static final String MAX_STAMP_STAT = "maxStamp";
+ * public static final String TOTAL_STAT = "total";
+ *
+ * @Override
+ * public Collector collector(SummarizerConfiguration sc) {
+ * return new Collector() {
+ *
+ * private long minStamp = Long.MAX_VALUE;
+ * private long maxStamp = Long.MIN_VALUE;
+ * private long deletes = 0;
+ * private long total = 0;
+ *
+ * @Override
+ * public void accept(Key k, Value v) {
+ * if (k.getTimestamp() < minStamp) {
+ * minStamp = k.getTimestamp();
+ * }
+ *
+ * if (k.getTimestamp() > maxStamp) {
+ * maxStamp = k.getTimestamp();
+ * }
+ *
+ * if (k.isDeleted()) {
+ * deletes++;
+ * }
+ *
+ * total++;
+ * }
+ *
+ * @Override
+ * public void summarize(StatisticConsumer sc) {
+ * sc.accept(MIN_STAMP_STAT, minStamp);
+ * sc.accept(MAX_STAMP_STAT, maxStamp);
+ * sc.accept(DELETES_STAT, deletes);
+ * sc.accept(TOTAL_STAT, total);
+ * }
+ * };
+ * }
+ *
+ * @Override
+ * public Combiner combiner(SummarizerConfiguration sc) {
+ * return (stats1, stats2) -> {
+ * stats1.merge(DELETES_STAT, stats2.get(DELETES_STAT), Long::sum);
+ * stats1.merge(TOTAL_STAT, stats2.get(TOTAL_STAT), Long::sum);
+ * stats1.merge(MIN_STAMP_STAT, stats2.get(MIN_STAMP_STAT), Long::min);
+ * stats1.merge(MAX_STAMP_STAT, stats2.get(MAX_STAMP_STAT), Long::max);
+ * };
+ * }
+ * }
+ * </code>
+ * </pre>
+ *
+ * <p>
+ * Below is an example summarizer that counts the log of the value length.
+ *
+ * <pre>
+ * <code>
+ * public class ValueLogLengthSummarizer implements Summarizer {
+ *
+ * @Override
+ * public Collector collector(SummarizerConfiguration sc) {
+ *
+ * return new Collector(){
+ *
+ * long[] counts = new long[32];
+ *
+ * @Override
+ * public void accept(Key k, Value v) {
+ * int idx;
+ * if(v.getSize() == 0)
+ * idx = 0;
+ * else
+ * idx = IntMath.log2(v.getSize(), RoundingMode.UP); //IntMath is from Guava
+ *
+ * counts[idx]++;
+ * }
+ *
+ * @Override
+ * public void summarize(StatisticConsumer sc) {
+ * for (int i = 0; i < counts.length; i++) {
+ * if(counts[i] > 0) {
+ * sc.accept(""+(1<<i), counts[i]);
+ * }
+ * }
+ * }
+ * };
+ * }
+ *
+ * @Override
+ * public Combiner combiner(SummarizerConfiguration sc) {
+ * return (m1, m2) -> m2.forEach((k,v) -> m1.merge(k, v, Long::sum));
+ * }
+ * }
+ * </code>
+ * </pre>
+ *
+ * <p>
+ * The reason a Summarizer is a factory for a Collector and Combiner is to make it very clear in the API that Accumulo uses them independently at different
+ * times. Therefore its not advisable to share internal state between the Collector and Combiner. The example implementation shows that the Collectors design
+ * allows for very efficient collection of specialized summary information. Creating {@link String} + {@link Long} pairs is deferred until the summarize method
+ * is called.
+ *
+ * <p>
+ * Summary data can be used by Compaction Strategies to decide which files to compact.
+ *
+ * <p>
+ * Summary data is persisted, so ideally the same summarizer class with the same options should always produce the same results. If you need to change the behavior
+ * of a summarizer, then consider doing this by adding a new option. If the same summarizer is configured twice with different options, then Accumulo will store and
+ * merge each one separately. This can allow old and new behavior to coexists simultaneously.
+ *
+ * @since 2.0.0
+ *
+ * @see TableOperations#summaries(String)
+ * @see TableOperations#addSummarizers(String, SummarizerConfiguration...)
+ * @see TableOperations#listSummarizers(String)
+ * @see TableOperations#removeSummarizers(String, java.util.function.Predicate)
+ * @see RFile#summaries()
+ * @see SummarizerConfiguration
+ */
+ //@formatter:on
+public interface Summarizer {
+
+ public static interface StatisticConsumer {
+ public void accept(String statistic, long value);
+ }
+
+ /**
- * When Accumulo calls methods in this interface, it will call {@link #accept(Key, Value)} zero or more times and then call
- * {@link Collector#summarize(Summarizer.StatisticConsumer)} once. After calling {@link Collector#summarize(Summarizer.StatisticConsumer)}, it will not use
- * the collector again.
++ * When Accumulo calls methods in this interface, it will call {@link #accept(Key, Value)} zero or
++ * more times and then call {@link Collector#summarize(Summarizer.StatisticConsumer)} once. After
++ * calling {@link Collector#summarize(Summarizer.StatisticConsumer)}, it will not use the
++ * collector again.
+ *
+ * @since 2.0.0
+ */
+ public static interface Collector {
+ /**
+ * During compactions, Accumulo passes each Key Value written to the file to this method.
+ */
+ void accept(Key k, Value v);
+
+ /**
- * After Accumulo has written some Key Values, it will call this method to generate some statistics about what was previously passed to
- * {@link #accept(Key, Value)}.
++ * After Accumulo has written some Key Values, it will call this method to generate some
++ * statistics about what was previously passed to {@link #accept(Key, Value)}.
+ *
+ * <p>
- * In order for summary data to be useful for decision making about data, it needs to be quickly accessible. In order to be quickly accessible, it needs to
- * fit in the tablet server cache as described in {@link TableOperations#summaries(String)} and the compaction strategy documentation. Therefore its
- * advisable to generate small summaries. If the summary data generated is too large it will not be stored. The maximum summary size is set using the per
- * table property {@code table.file.summary.maxSize}. The number of files that exceeded the summary size is reported by
- * {@link Summary.FileStatistics#getLarge()}.
++ * In order for summary data to be useful for decision making about data, it needs to be quickly
++ * accessible. In order to be quickly accessible, it needs to fit in the tablet server cache as
++ * described in {@link TableOperations#summaries(String)} and the compaction strategy
++ * documentation. Therefore its advisable to generate small summaries. If the summary data
++ * generated is too large it will not be stored. The maximum summary size is set using the per
++ * table property {@code table.file.summary.maxSize}. The number of files that exceeded the
++ * summary size is reported by {@link Summary.FileStatistics#getLarge()}.
+ *
+ * @param sc
+ * Emit statistics to this Object.
+ */
+ public void summarize(StatisticConsumer sc);
+ }
+
+ /**
- * A Combiner is used to merge statistics emitted from {@link Collector#summarize(Summarizer.StatisticConsumer)} and from previous invocations of itself.
++ * A Combiner is used to merge statistics emitted from
++ * {@link Collector#summarize(Summarizer.StatisticConsumer)} and from previous invocations of
++ * itself.
+ *
+ * @since 2.0.0
+ */
+ public static interface Combiner {
+ /**
- * This method should merge the statistics in the second map into the first map. Both maps may have statistics produced by a {@link Collector} or previous
- * calls to this method.
++ * This method should merge the statistics in the second map into the first map. Both maps may
++ * have statistics produced by a {@link Collector} or previous calls to this method.
+ *
+ * <p>
- * If first map is too large after this call, then it may not be stored. See the comment on {@link Collector#summarize(Summarizer.StatisticConsumer)}
++ * If first map is too large after this call, then it may not be stored. See the comment on
++ * {@link Collector#summarize(Summarizer.StatisticConsumer)}
+ */
+ public void merge(Map<String,Long> statistics1, Map<String,Long> statistics2);
+ }
+
+ /**
- * Factory method that creates a {@link Collector} based on configuration. Each {@link Collector} created by this method should be independent and have its
- * own internal state. Accumulo uses a Collector to generate summary statistics about a sequence of key values written to a file.
++ * Factory method that creates a {@link Collector} based on configuration. Each {@link Collector}
++ * created by this method should be independent and have its own internal state. Accumulo uses a
++ * Collector to generate summary statistics about a sequence of key values written to a file.
+ */
+ public Collector collector(SummarizerConfiguration sc);
+
+ /**
- * Factory method that creates a {@link Combiner}. Accumulo will only use the created Combiner to merge data from {@link Collector}s created using the same
- * {@link SummarizerConfiguration}.
++ * Factory method that creates a {@link Combiner}. Accumulo will only use the created Combiner to
++ * merge data from {@link Collector}s created using the same {@link SummarizerConfiguration}.
+ */
+ public Combiner combiner(SummarizerConfiguration sc);
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/SummarizerConfiguration.java
index 45fb7b1,0000000..d5abe00
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/SummarizerConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/SummarizerConfiguration.java
@@@ -1,285 -1,0 +1,293 @@@
+/*
+ * 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.summary;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.summary.SummarizerConfigurationUtil;
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.hash.Hasher;
+import com.google.common.hash.Hashing;
+
+/**
- * This class encapsulates the configuration needed to instantiate a {@link Summarizer}. It also provides methods and documentation for setting the table
- * properties that configure a Summarizer.
++ * This class encapsulates the configuration needed to instantiate a {@link Summarizer}. It also
++ * provides methods and documentation for setting the table properties that configure a Summarizer.
+ *
+ * @since 2.0.0
+ */
+public class SummarizerConfiguration {
+
+ private final String className;
+ private final Map<String,String> options;
+ private int hashCode = 0;
+ private final String configId;
+
+ private SummarizerConfiguration(String className, String configId, Map<String,String> options) {
+ this.className = className;
+ this.options = ImmutableMap.copyOf(options);
+
+ if (configId == null) {
+ ArrayList<String> keys = new ArrayList<>(this.options.keySet());
+ Collections.sort(keys);
+ Hasher hasher = Hashing.murmur3_32().newHasher();
+ hasher.putString(className);
+ for (String key : keys) {
+ hasher.putString(key);
+ hasher.putString(options.get(key));
+ }
+
+ this.configId = hasher.hash().toString();
+ } else {
+ this.configId = configId;
+ }
+ }
+
+ /**
+ * @return the name of a class that implements @link {@link Summarizer}.
+ */
+ public String getClassName() {
+ return className;
+ }
+
+ /**
+ * @return custom options for a {link @Summarizer}
+ */
+ public Map<String,String> getOptions() {
+ return options;
+ }
+
+ /**
- * The propertyId is used to when creating table properties for a summarizer. Its not used for equality or hashCode for this class.
++ * The propertyId is used to when creating table properties for a summarizer. Its not used for
++ * equality or hashCode for this class.
+ */
+ public String getPropertyId() {
+ return configId;
+ }
+
+ @Override
+ public String toString() {
+ return className + " " + configId + " " + options;
+ }
+
+ /**
+ * Compares the classname and options to determine equality.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof SummarizerConfiguration) {
+ SummarizerConfiguration osc = (SummarizerConfiguration) o;
+ return className.equals(osc.className) && options.equals(osc.options);
+ }
+
+ return false;
+ }
+
+ /**
+ * Hashes the classname and options to create a hashcode.
+ */
+ @Override
+ public int hashCode() {
+ if (hashCode == 0) {
+ hashCode = 31 * options.hashCode() + className.hashCode();
+ }
+ return hashCode;
+ }
+
+ /**
- * Converts this configuration to Accumulo per table properties. The returned map has the following key values. The {@code <configId>} below is from
- * {@link #getPropertyId()}. The {@code <optionKey>} and {@code <optionValue>} below are derived from the key values of {@link #getOptions()}.
++ * Converts this configuration to Accumulo per table properties. The returned map has the
++ * following key values. The {@code <configId>} below is from {@link #getPropertyId()}. The
++ * {@code <optionKey>} and {@code <optionValue>} below are derived from the key values of
++ * {@link #getOptions()}.
+ *
+ * <pre>
+ * {@code
+ * table.summarizer.<configId>=<classname>
+ * table.summarizer.<configId>.opt.<optionKey1>=<optionValue1>
+ * table.summarizer.<configId>.opt.<optionKey2>=<optionValue2>
+ * .
+ * .
+ * .
+ * table.summarizer.<configId>.opt.<optionKeyN>=<optionValueN>
+ * }
+ * </pre>
+ */
+ public Map<String,String> toTableProperties() {
+ return SummarizerConfigurationUtil.toTablePropertiesMap(Collections.singletonList(this));
+ }
+
+ /**
+ * Encodes each configuration in the same way as {@link #toTableProperties()}.
+ *
+ * @throws IllegalArgumentException
+ * when there are duplicate values for {@link #getPropertyId()}
+ */
+ public static Map<String,String> toTableProperties(SummarizerConfiguration... configurations) {
+ return SummarizerConfigurationUtil.toTablePropertiesMap(Arrays.asList(configurations));
+ }
+
+ /**
+ * Encodes each configuration in the same way as {@link #toTableProperties()}.
+ *
+ * @throws IllegalArgumentException
+ * when there are duplicate values for {@link #getPropertyId()}
+ */
- public static Map<String,String> toTableProperties(Collection<SummarizerConfiguration> configurations) {
++ public static Map<String,String> toTableProperties(
++ Collection<SummarizerConfiguration> configurations) {
+ return SummarizerConfigurationUtil.toTablePropertiesMap(new ArrayList<>(configurations));
+ }
+
+ /**
- * Decodes table properties with the prefix {@code table.summarizer} into {@link SummarizerConfiguration} objects. Table properties with prefixes other than
++ * Decodes table properties with the prefix {@code table.summarizer} into
++ * {@link SummarizerConfiguration} objects. Table properties with prefixes other than
+ * {@code table.summarizer} are ignored.
+ */
+ public static Collection<SummarizerConfiguration> fromTableProperties(Map<String,String> props) {
+ return fromTableProperties(props.entrySet());
+ }
+
+ /**
+ * @see #fromTableProperties(Map)
+ */
- public static Collection<SummarizerConfiguration> fromTableProperties(Iterable<Entry<String,String>> props) {
++ public static Collection<SummarizerConfiguration> fromTableProperties(
++ Iterable<Entry<String,String>> props) {
+ return SummarizerConfigurationUtil.getSummarizerConfigs(props);
+ }
+
+ public static class Builder {
+ private String className;
+ private ImmutableMap.Builder<String,String> imBuilder;
+ private String configId = null;
+
+ private Builder(String className) {
+ this.className = className;
+ this.imBuilder = ImmutableMap.builder();
+ }
+
+ /**
- * Sets the id used when generating table properties. Setting this is optional. If not set, an id is generated using hashing that will likely be unique.
++ * Sets the id used when generating table properties. Setting this is optional. If not set, an
++ * id is generated using hashing that will likely be unique.
+ *
+ * @param propId
- * This id is used when converting a {@link SummarizerConfiguration} to table properties. Since tables can have multiple summarizers, make sure its
- * unique.
++ * This id is used when converting a {@link SummarizerConfiguration} to table
++ * properties. Since tables can have multiple summarizers, make sure its unique.
+ *
+ * @see SummarizerConfiguration#toTableProperties()
+ */
+ public Builder setPropertyId(String propId) {
+ Preconditions.checkArgument(propId.matches("\\w+"), "Config Id %s is not alphanum", propId);
+ this.configId = propId;
+ return this;
+ }
+
+ /**
+ * Adds an option that Summarizers can use when constructing Collectors and Combiners.
+ *
+ * @return this
+ *
+ * @see SummarizerConfiguration#getOptions()
+ */
+ public Builder addOption(String key, String value) {
+ Preconditions.checkArgument(key.matches("\\w+"), "Option Id %s is not alphanum", key);
+ imBuilder.put(key, value);
+ return this;
+ }
+
+ /**
+ * Adds an option that Summarizers can use when constructing Collectors and Combiners.
+ *
+ * @return this
+ *
+ * @see SummarizerConfiguration#getOptions()
+ */
+ public Builder addOption(String key, long value) {
+ return addOption(key, Long.toString(value));
+ }
+
+ /**
+ * Convenience method for adding multiple options. The following
+ *
+ * <pre>
+ * {@code builder.addOptions("opt1","val1","opt2","val2","opt3","val3")}
+ * </pre>
+ *
+ * <p>
+ * is equivalent to
+ *
+ * <pre>
+ * {@code
+ * builder.addOption("opt1","val1");
+ * builder.addOption("opt2","val2");
+ * builder.addOption("opt3","val3");
+ * }
+ * </pre>
+ *
+ * @param keyValuePairs
+ * This array must have an even and positive number of elements.
+ * @return this
+ * @see SummarizerConfiguration#getOptions()
+ */
+ public Builder addOptions(String... keyValuePairs) {
- Preconditions.checkArgument(keyValuePairs.length % 2 == 0 && keyValuePairs.length > 0, "Require an even, positive number of arguments, got %s",
- keyValuePairs.length);
++ Preconditions.checkArgument(keyValuePairs.length % 2 == 0 && keyValuePairs.length > 0,
++ "Require an even, positive number of arguments, got %s", keyValuePairs.length);
+ for (int i = 0; i < keyValuePairs.length; i += 2) {
+ addOption(keyValuePairs[i], keyValuePairs[i + 1]);
+ }
+ return this;
+ }
+
+ /**
+ * @param options
+ * Each entry in the map is passed to {@link #addOption(String, String)}
+ * @return this
+ *
+ * @see SummarizerConfiguration#getOptions()
+ */
+ public Builder addOptions(Map<String,String> options) {
+ options.entrySet().forEach(e -> addOption(e.getKey(), e.getValue()));
+ return this;
+ }
+
+ public SummarizerConfiguration build() {
+ return new SummarizerConfiguration(className, configId, imBuilder.build());
+ }
+ }
+
+ /**
- * Call this method to initiate a chain of fluent method calls to a create an immutable {@link SummarizerConfiguration}
++ * Call this method to initiate a chain of fluent method calls to a create an immutable
++ * {@link SummarizerConfiguration}
+ *
+ * @param className
+ * The fully qualified name of a class that implements {@link Summarizer}.
+ */
+ public static Builder builder(String className) {
+ return new Builder(className);
+ }
+
+ /**
+ * @see #builder(String)
+ */
+ public static Builder builder(Class<? extends Summarizer> clazz) {
+ return new Builder(clazz.getName());
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/Summary.java
index 8a6a9aa,0000000..2e9f4e2
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/Summary.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/Summary.java
@@@ -1,145 -1,0 +1,158 @@@
+/*
+ * 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.summary;
+
+import java.util.Map;
+
+import com.google.common.collect.ImmutableMap;
+
+/**
- * This class encapsulates summary statistics, information about how those statistics were generated, and information about files the statistics were obtained
- * from.
++ * This class encapsulates summary statistics, information about how those statistics were
++ * generated, and information about files the statistics were obtained from.
+ *
+ * @see Summarizer
+ * @since 2.0.0
+ */
+public class Summary {
+
+ /**
+ * @since 2.0.0
+ */
+ public static class FileStatistics {
+ private final long total;
+ private final long missing;
+ private final long extra;
+ private final long large;
+ private final long deleted;
+
+ private FileStatistics(long total, long missing, long extra, long large, long deleted) {
+ this.total = total;
+ this.missing = missing;
+ this.extra = extra;
+ this.large = large;
+ this.deleted = deleted;
+ }
+
+ /**
+ * @return The total number of files from which summary information was obtained.
+ */
+ public long getTotal() {
+ return total;
+ }
+
+ /**
- * @return The number of files that did not contain the requested summary information. When this is non-zero, it means that summary counts may be
- * incomplete. In the Accumulo shell, the compact command has a -{@code -sf-no-summary} option to compact files missing summary information. The
- * compaction will create the summary information. This could be done over a range of the table to avoid doing the entire table at once.
++ * @return The number of files that did not contain the requested summary information. When this
++ * is non-zero, it means that summary counts may be incomplete. In the Accumulo shell,
++ * the compact command has a -{@code -sf-no-summary} option to compact files missing
++ * summary information. The compaction will create the summary information. This could
++ * be done over a range of the table to avoid doing the entire table at once.
+ */
+ public long getMissing() {
+ return missing;
+ }
+
+ /**
- * @return The number of files that had summary information outside of a tablet or query range boundaries. When this is non-zero, it means that summary
- * counts may be artificially inflated or contain extraneous information. In the Accumulo shell, the compact command has a -{@code -sf-extra-summary}
- * option to compact files with extra summary information.
++ * @return The number of files that had summary information outside of a tablet or query range
++ * boundaries. When this is non-zero, it means that summary counts may be artificially
++ * inflated or contain extraneous information. In the Accumulo shell, the compact
++ * command has a -{@code -sf-extra-summary} option to compact files with extra summary
++ * information.
+ */
+ public long getExtra() {
+ return extra;
+ }
+
+ /**
- * @return The number of files that an attempt was made to generate summaries, but the summarizer generated a summary that was larger than the configured
- * maximum. For these files no summary statistics are stored. Only the fact that summarization was attempted and failed is stored.
++ * @return The number of files that an attempt was made to generate summaries, but the
++ * summarizer generated a summary that was larger than the configured maximum. For these
++ * files no summary statistics are stored. Only the fact that summarization was
++ * attempted and failed is stored.
+ * @see Summarizer.Collector#summarize(org.apache.accumulo.core.client.summary.Summarizer.StatisticConsumer)
+ */
+ public long getLarge() {
+ return large;
+ }
+
+ /**
- * @return The number of files that were deleted after the summary retrieval operations started. This is a rare race condition where a compaction causes a
- * file to be deleted while retrieving summaries. When this happens, the file that replaced the deleted file can not be used because it may contain
- * duplication summary information for other files. Avoiding this race condition would be expensive, so reporting it was chosen. If this condition
- * must be avoided, then compactions must be stopped. Compactions could be stopped on a cloned table to avoid this.
++ * @return The number of files that were deleted after the summary retrieval operations started.
++ * This is a rare race condition where a compaction causes a file to be deleted while
++ * retrieving summaries. When this happens, the file that replaced the deleted file can
++ * not be used because it may contain duplication summary information for other files.
++ * Avoiding this race condition would be expensive, so reporting it was chosen. If this
++ * condition must be avoided, then compactions must be stopped. Compactions could be
++ * stopped on a cloned table to avoid this.
+ */
+ public long getDeleted() {
+ return deleted;
+ }
+
+ /**
- * @return The total number of files that had some kind of issue which would cause summary statistics to be inaccurate. This is the sum of
- * {@link #getMissing()}, {@link #getExtra()}, {{@link #getLarge()}, and {@link #getDeleted()}.
++ * @return The total number of files that had some kind of issue which would cause summary
++ * statistics to be inaccurate. This is the sum of {@link #getMissing()},
++ * {@link #getExtra()}, {{@link #getLarge()}, and {@link #getDeleted()}.
+ */
+ public long getInaccurate() {
+ return getMissing() + getExtra() + getLarge() + getDeleted();
+ }
+
+ @Override
+ public String toString() {
- return String.format("[total:%,d, missing:%,d, extra:%,d, large:%,d, deleted:%,d]", total, missing, extra, large, deleted);
++ return String.format("[total:%,d, missing:%,d, extra:%,d, large:%,d, deleted:%,d]", total,
++ missing, extra, large, deleted);
+ }
+ }
+
+ private final ImmutableMap<String,Long> statistics;
+ private final SummarizerConfiguration config;
+ private final FileStatistics fileStats;
+
- public Summary(Map<String,Long> summary, SummarizerConfiguration config, long totalFiles, long filesMissingSummary, long filesWithExtra, long filesWithLarge,
- long deletedFiles) {
++ public Summary(Map<String,Long> summary, SummarizerConfiguration config, long totalFiles,
++ long filesMissingSummary, long filesWithExtra, long filesWithLarge, long deletedFiles) {
+ this.statistics = ImmutableMap.copyOf(summary);
+ this.config = config;
- this.fileStats = new FileStatistics(totalFiles, filesMissingSummary, filesWithExtra, filesWithLarge, deletedFiles);
++ this.fileStats = new FileStatistics(totalFiles, filesMissingSummary, filesWithExtra,
++ filesWithLarge, deletedFiles);
+ }
+
+ /**
+ * @return Statistics about the files from which summary statistics were obtained.
+ */
+ public FileStatistics getFileStatistics() {
+ return fileStats;
+ }
+
+ /**
+ * @return The configuration used to generate and combine the summary statistics
+ */
+ public SummarizerConfiguration getSummarizerConfiguration() {
+ return config;
+ }
+
+ /**
- * @return An immutable map of the statistics that were generated and merged by the specified {@link Summarizer}.
++ * @return An immutable map of the statistics that were generated and merged by the specified
++ * {@link Summarizer}.
+ */
+ public Map<String,Long> getStatistics() {
+ return statistics;
+ }
+
+ @Override
+ public String toString() {
+ return "config : " + config + " filestats : " + fileStats + " statistics : " + statistics;
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/DeletesSummarizer.java
index 1e94298,0000000..891a5f6
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/DeletesSummarizer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/DeletesSummarizer.java
@@@ -1,75 -1,0 +1,77 @@@
+/*
+ * 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.summary.summarizers;
+
+import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.client.summary.Summarizer;
+import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+
+/**
+ * This summarizer tracks the total number of delete Keys seen and the total number of keys seen.
+ *
+ * <p>
- * This summarizer is used by org.apache.accumulo.tserver.compaction.strategies.TooManyDeletesCompactionStrategy to make compaction decisions based on the
- * number of deletes.
++ * This summarizer is used by
++ * org.apache.accumulo.tserver.compaction.strategies.TooManyDeletesCompactionStrategy to make
++ * compaction decisions based on the number of deletes.
+ *
+ * @since 2.0.0
- * @see TableOperations#addSummarizers(String, org.apache.accumulo.core.client.summary.SummarizerConfiguration...)
++ * @see TableOperations#addSummarizers(String,
++ * org.apache.accumulo.core.client.summary.SummarizerConfiguration...)
+ */
+public class DeletesSummarizer implements Summarizer {
+
+ /**
+ * The name of the statistics for the number of deletes.
+ */
+ public static final String DELETES_STAT = "deletes";
+
+ /**
+ * The name of the statistics for the total number of keys.
+ */
+ public static final String TOTAL_STAT = "total";
+
+ @Override
+ public Collector collector(SummarizerConfiguration sc) {
+ return new Collector() {
+
+ long total = 0;
+ long deletes = 0;
+
+ @Override
+ public void accept(Key k, Value v) {
+ total++;
+ if (k.isDeleted()) {
+ deletes++;
+ }
+ }
+
+ @Override
+ public void summarize(StatisticConsumer sc) {
+ sc.accept(DELETES_STAT, deletes);
+ sc.accept(TOTAL_STAT, total);
+ }
+ };
+ }
+
+ @Override
+ public Combiner combiner(SummarizerConfiguration sc) {
+ return (m1, m2) -> m2.forEach((k, v) -> m1.merge(k, v, Long::sum));
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/EntryLengthSummarizer.java
index 10fb9d9,0000000..564eb0b
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/EntryLengthSummarizer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/EntryLengthSummarizer.java
@@@ -1,147 -1,0 +1,151 @@@
+/*
+ * 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.summary.summarizers;
+
+import java.math.RoundingMode;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+import org.apache.accumulo.core.client.summary.Summarizer;
+import org.apache.accumulo.core.client.summary.SummarizerConfiguration;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+
+import com.google.common.math.IntMath;
+
+/**
- * Summarizer that computes summary information about field lengths. Specifically key length, row length, family length, qualifier length, visibility length,
- * and value length. Incrementally computes minimum, maximum, count, sum, and log2 histogram of the lengths.
++ * Summarizer that computes summary information about field lengths. Specifically key length, row
++ * length, family length, qualifier length, visibility length, and value length. Incrementally
++ * computes minimum, maximum, count, sum, and log2 histogram of the lengths.
+ *
+ * @since 2.0.0
+ */
+public class EntryLengthSummarizer implements Summarizer {
+
- /* Helper function that calculates the various statistics that is used for the Collector methods. */
++ /*
++ * Helper function that calculates the various statistics that is used for the Collector methods.
++ */
+ private static class LengthStats {
+ private long min = Long.MAX_VALUE;
+ private long max = Long.MIN_VALUE;
+ private long sum = 0;
+ private long[] counts = new long[32];
+
+ private void accept(int length) {
+ int idx;
+
+ if (length < min) {
+ min = length;
+ }
+
+ if (length > max) {
+ max = length;
+ }
+
+ sum += length;
+
+ if (length == 0) {
+ idx = 0;
+ } else {
+ idx = IntMath.log2(length, RoundingMode.HALF_UP);
+ }
+
+ counts[idx]++;
+ }
+
+ void summarize(String prefix, StatisticConsumer sc) {
+ sc.accept(prefix + ".min", (min != Long.MAX_VALUE ? min : 0));
+ sc.accept(prefix + ".max", (max != Long.MIN_VALUE ? max : 0));
+ sc.accept(prefix + ".sum", sum);
+
+ for (int i = 0; i < counts.length; i++) {
+ if (counts[i] > 0) {
+ sc.accept(prefix + ".logHist." + i, counts[i]);
+ }
+ }
+ }
+
+ }
+
+ /* Helper functions for merging that is used by the Combiner. */
- private static void merge(String key, BiFunction<Long,Long,Long> mergeFunc, Map<String,Long> stats1, Map<String,Long> stats2) {
++ private static void merge(String key, BiFunction<Long,Long,Long> mergeFunc,
++ Map<String,Long> stats1, Map<String,Long> stats2) {
+ Long mergeVal = stats2.get(key);
+
+ if (mergeVal != null) {
+ stats1.merge(key, mergeVal, mergeFunc);
+ }
+ }
+
- private static void merge(String prefix, Map<String, Long> stats1, Map<String,Long> stats2) {
- merge(prefix+".min", Long::min, stats1, stats2);
- merge(prefix+".max", Long::max, stats1, stats2);
- merge(prefix+".sum", Long::sum, stats1, stats2);
++ private static void merge(String prefix, Map<String,Long> stats1, Map<String,Long> stats2) {
++ merge(prefix + ".min", Long::min, stats1, stats2);
++ merge(prefix + ".max", Long::max, stats1, stats2);
++ merge(prefix + ".sum", Long::sum, stats1, stats2);
+ for (int i = 0; i < 32; i++) {
- merge(prefix+".logHist."+i, Long::sum, stats1, stats2);
++ merge(prefix + ".logHist." + i, Long::sum, stats1, stats2);
+ }
+ }
+
+ @Override
+ public Collector collector(SummarizerConfiguration sc) {
+ return new Collector() {
+
+ private LengthStats keyStats = new LengthStats();
+ private LengthStats rowStats = new LengthStats();
+ private LengthStats familyStats = new LengthStats();
+ private LengthStats qualifierStats = new LengthStats();
+ private LengthStats visibilityStats = new LengthStats();
+ private LengthStats valueStats = new LengthStats();
+ private long total = 0;
+
+ @Override
+ public void accept(Key k, Value v) {
+ keyStats.accept(k.getLength());
+ rowStats.accept(k.getRowData().length());
+ familyStats.accept(k.getColumnFamilyData().length());
+ qualifierStats.accept(k.getColumnQualifierData().length());
+ visibilityStats.accept(k.getColumnVisibilityData().length());
+ valueStats.accept(v.getSize());
+ total++;
+ }
+
+ @Override
+ public void summarize(StatisticConsumer sc) {
+ keyStats.summarize("key", sc);
+ rowStats.summarize("row", sc);
+ familyStats.summarize("family", sc);
+ qualifierStats.summarize("qualifier", sc);
+ visibilityStats.summarize("visibility", sc);
+ valueStats.summarize("value", sc);
+ sc.accept("total", total);
+ }
+ };
+ }
+
+ @Override
+ public Combiner combiner(SummarizerConfiguration sc) {
+ return (stats1, stats2) -> {
+ merge("key", stats1, stats2);
+ merge("row", stats1, stats2);
+ merge("family", stats1, stats2);
+ merge("qualifier", stats1, stats2);
+ merge("visibility", stats1, stats2);
+ merge("value", stats1, stats2);
+ stats1.merge("total", stats2.get("total"), Long::sum);
+ };
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/FamilySummarizer.java
index 9452530,0000000..53a408b
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/FamilySummarizer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/FamilySummarizer.java
@@@ -1,46 -1,0 +1,48 @@@
+/*
+ * 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.summary.summarizers;
+
+import java.util.function.UnaryOperator;
+
+import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.client.summary.CountingSummarizer;
+import org.apache.accumulo.core.data.ArrayByteSequence;
+import org.apache.accumulo.core.data.ByteSequence;
+
+/**
- * Counts column column families. Leverages super class to defend against too many. This class is useful for discovering what column families are present when
- * the expected number of families is small.
++ * Counts column column families. Leverages super class to defend against too many. This class is
++ * useful for discovering what column families are present when the expected number of families is
++ * small.
+ *
+ * @since 2.0.0
+ *
- * @see TableOperations#addSummarizers(String, org.apache.accumulo.core.client.summary.SummarizerConfiguration...)
++ * @see TableOperations#addSummarizers(String,
++ * org.apache.accumulo.core.client.summary.SummarizerConfiguration...)
+ * @see TableOperations#summaries(String)
+ */
+public class FamilySummarizer extends CountingSummarizer<ByteSequence> {
+
+ @Override
+ protected UnaryOperator<ByteSequence> copier() {
+ return ArrayByteSequence::new;
+ }
+
+ @Override
+ protected Converter<ByteSequence> converter() {
+ return (k, v, c) -> c.accept(k.getColumnFamilyData());
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/VisibilitySummarizer.java
index c8f76d0,0000000..630d42b
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/VisibilitySummarizer.java
+++ b/core/src/main/java/org/apache/accumulo/core/client/summary/summarizers/VisibilitySummarizer.java
@@@ -1,47 -1,0 +1,49 @@@
+/*
+ * 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.summary.summarizers;
+
+import java.util.function.UnaryOperator;
+
+import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.client.summary.CountingSummarizer;
+import org.apache.accumulo.core.data.ArrayByteSequence;
+import org.apache.accumulo.core.data.ByteSequence;
+
+/**
- * Counts column visibility labels. Leverages super class to defend against too many. This class is useful for discovering what column visibilities are present
- * when the expected number of visibilities is small.
++ * Counts column visibility labels. Leverages super class to defend against too many. This class is
++ * useful for discovering what column visibilities are present when the expected number of
++ * visibilities is small.
+ *
+ * @since 2.0.0
+ *
- * @see TableOperations#addSummarizers(String, org.apache.accumulo.core.client.summary.SummarizerConfiguration...)
++ * @see TableOperations#addSummarizers(String,
++ * org.apache.accumulo.core.client.summary.SummarizerConfiguration...)
+ * @see TableOperations#summaries(String)
+ */
+public class VisibilitySummarizer extends CountingSummarizer<ByteSequence> {
+
+ @Override
+ protected UnaryOperator<ByteSequence> copier() {
+ return ArrayByteSequence::new;
+ }
+
+ @Override
+ protected Converter<ByteSequence> converter() {
+ return (k, v, c) -> c.accept(k.getColumnVisibilityData());
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
index 701a388,28c44e6..e9f570a
--- a/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/AccumuloConfiguration.java
@@@ -104,9 -177,10 +107,10 @@@ public abstract class AccumuloConfigura
return entries.entrySet().iterator();
}
- private void checkType(Property property, PropertyType type) {
+ private static void checkType(Property property, PropertyType type) {
if (!property.getType().equals(type)) {
- String msg = "Configuration method intended for type " + type + " called with a " + property.getType() + " argument (" + property.getKey() + ")";
+ String msg = "Configuration method intended for type " + type + " called with a "
+ + property.getType() + " argument (" + property.getKey() + ")";
IllegalArgumentException err = new IllegalArgumentException(msg);
log.error(msg, err);
throw err;
@@@ -145,10 -220,11 +150,11 @@@
if (prefixProps == null || prefixProps.updateCount != updateCount) {
Map<String,String> propMap = new HashMap<>();
// The reason this caching exists is to avoid repeatedly making this expensive call.
- getProperties(propMap, new PrefixFilter(property.getKey()));
+ getProperties(propMap, key -> key.startsWith(property.getKey()));
propMap = ImmutableMap.copyOf(propMap);
- // So that locking is not needed when reading from enum map, always create a new one. Construct and populate map using a local var so its not visible
+ // So that locking is not needed when reading from enum map, always create a new one.
+ // Construct and populate map using a local var so its not visible
// until ready.
EnumMap<Property,PrefixProps> localPrefixes = new EnumMap<>(Property.class);
@@@ -171,10 -247,10 +177,11 @@@
}
/**
- * Gets a property of type {@link PropertyType#BYTES} or {@link PropertyType#MEMORY}, interpreting the value properly.
- * Gets a property of type {@link PropertyType#MEMORY}, interpreting the value properly.
++ * Gets a property of type {@link PropertyType#BYTES} or {@link PropertyType#MEMORY}, interpreting
++ * the value properly.
*
* @param property
- * property to get
+ * Property to get
* @return property value
* @throws IllegalArgumentException
* if the property is of the wrong type
diff --cc core/src/main/java/org/apache/accumulo/core/conf/CliConfiguration.java
index 7be1053,0000000..792d57b
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/CliConfiguration.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/CliConfiguration.java
@@@ -1,63 -1,0 +1,64 @@@
+/*
+ * 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.conf;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.function.Predicate;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CliConfiguration {
+
+ private static final Logger log = LoggerFactory.getLogger(CliConfiguration.class);
+ private static volatile Map<String,String> config = new HashMap<>();
+
+ /**
- * Sets CliConfiguration with map of configuration. Additional calls will overwrite existing properties and values.
++ * Sets CliConfiguration with map of configuration. Additional calls will overwrite existing
++ * properties and values.
+ *
+ * @param conf
+ * Map of configuration
+ */
+ public static void set(Map<String,String> conf) {
+ Objects.requireNonNull(conf);
+ config = conf;
+ }
+
+ public static void print() {
+ log.info("The following configuration was set on the command line:");
+ for (Map.Entry<String,String> entry : config.entrySet()) {
+ String key = entry.getKey();
+ log.info(key + " = " + (Property.isSensitive(key) ? "<hidden>" : entry.getValue()));
+ }
+ }
+
+ public static String get(Property property) {
+ return config.get(property.getKey());
+ }
+
+ public static void getProperties(Map<String,String> props, Predicate<String> filter) {
+ for (Map.Entry<String,String> entry : config.entrySet()) {
+ if (filter.test(entry.getKey())) {
+ props.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/conf/ClientConfigGenerate.java
index 0d95d2f,0000000..f71b7e0
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ClientConfigGenerate.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ClientConfigGenerate.java
@@@ -1,194 -1,0 +1,203 @@@
+/*
+ * 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.conf;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.io.FileNotFoundException;
+import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Objects;
+import java.util.Set;
+import java.util.TreeMap;
+
+import com.google.common.collect.Sets;
+
+/**
- * Generates client-properties.md for documentation on Accumulo website and accumulo-client.properties for Accumulo distribution tarball
++ * Generates client-properties.md for documentation on Accumulo website and
++ * accumulo-client.properties for Accumulo distribution tarball
+ */
+class ClientConfigGenerate {
+
+ private abstract class Format {
+
+ abstract void beginSection(String section);
+
+ abstract void pageHeader();
+
+ abstract void property(ClientProperty prop);
+
+ void generate() {
+ pageHeader();
+
+ generateSection("Instance", "instance.");
+ generateSection("Authentication", "auth.", "auth.method", "auth.username");
+ generateSection("Batch Writer", "batch.writer.");
+ generateSection("SSL", "ssl.");
+ generateSection("SASL", "sasl.");
+ generateSection("Tracing", "trace.");
+
+ doc.close();
+ }
+
+ void generateSection(String section, String prefix, String... prefixProps) {
+ beginSection(section);
+ for (String prop : prefixProps) {
+ ClientProperty cp = sortedProps.get(prop);
+ if (cp != null) {
+ property(cp);
+ }
+ }
+ Set<String> prefixSet = Sets.newHashSet(prefixProps);
+ for (ClientProperty prop : sortedProps.values()) {
+ if (prop.getKey().startsWith(prefix) && !prefixSet.contains(prop.getKey())) {
+ property(prop);
+ }
+ }
+ }
+
+ void generateSection(String section, String prefix) {
+ generateSection(section, prefix, "");
+ }
+ }
+
+ private class Markdown extends Format {
+
+ @Override
+ void beginSection(String section) {}
+
+ @Override
+ void pageHeader() {
+ doc.println("---");
+ doc.println("title: Client Properties");
+ doc.println("category: development");
+ doc.println("order: 9");
+ doc.println("---\n");
- doc.println("<!-- WARNING: Do not edit this file. It is a generated file that is copied from Accumulo build (from core/target/generated-docs) -->");
++ doc.println(
++ "<!-- WARNING: Do not edit this file. It is a generated file that is copied from Accumulo build (from core/target/generated-docs) -->");
+ doc.println("<!-- Generated by : " + getClass().getName() + " -->\n");
- doc.println("Below are properties set in `accumulo-client.properties` that configure [Accumulo clients]({{ page.docs_baseurl }}/getting-started/clients#connecting). "
- + "All properties have been part of the API since 2.0.0 (unless otherwise specified):\n");
++ doc.println(
++ "Below are properties set in `accumulo-client.properties` that configure [Accumulo clients]({{ page.docs_baseurl }}/getting-started/clients#connecting). "
++ + "All properties have been part of the API since 2.0.0 (unless otherwise specified):\n");
+ doc.println("| Property | Default value | Since | Description |");
+ doc.println("|----------|---------------|-------|-------------|");
+ }
+
+ @Override
+ void property(ClientProperty prop) {
+ Objects.nonNull(prop);
- doc.print("| <a name=\"" + prop.getKey().replace(".", "_") + "\" class=\"prop\"></a> " + prop.getKey() + " | ");
++ doc.print("| <a name=\"" + prop.getKey().replace(".", "_") + "\" class=\"prop\"></a> "
++ + prop.getKey() + " | ");
+ String defaultValue = sanitize(prop.getDefaultValue()).trim();
+ if (defaultValue.length() == 0) {
+ defaultValue = "*empty*";
+ }
- doc.println(defaultValue + " | " + prop.getSince() + " | " + sanitize(prop.getDescription() + " |"));
++ doc.println(
++ defaultValue + " | " + prop.getSince() + " | " + sanitize(prop.getDescription() + " |"));
+ }
+
+ String sanitize(String str) {
+ return str.replace("\n", "<br>");
+ }
+ }
+
+ private class ConfigFile extends Format {
+
+ @Override
+ void beginSection(String section) {
+ doc.println("\n## " + section + " properties");
+ doc.println("## --------------");
+ }
+
+ @Override
+ void pageHeader() {
+ doc.println("# Licensed to the Apache Software Foundation (ASF) under one or more");
+ doc.println("# contributor license agreements. See the NOTICE file distributed with");
+ doc.println("# this work for additional information regarding copyright ownership.");
+ doc.println("# The ASF licenses this file to You under the Apache License, Version 2.0");
+ doc.println("# (the \"License\"); you may not use this file except in compliance with");
+ doc.println("# the License. You may obtain a copy of the License at");
+ doc.println("#");
+ doc.println("# http://www.apache.org/licenses/LICENSE-2.0");
+ doc.println("#");
+ doc.println("# Unless required by applicable law or agreed to in writing, software");
+ doc.println("# distributed under the License is distributed on an \"AS IS\" BASIS,");
+ doc.println("# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.");
+ doc.println("# See the License for the specific language governing permissions and");
+ doc.println("# limitations under the License.\n");
+ doc.println("################################");
+ doc.println("## Accumulo client configuration");
+ doc.println("################################\n");
+ doc.println("## NOTE - All properties that have a default are set with it. Properties that");
+ doc.println("## are uncommented must be set by the user.");
+ }
+
+ @Override
+ void property(ClientProperty prop) {
+ doc.println("## " + prop.getDescription());
+ if (!prop.isRequired()) {
+ doc.print("#");
+ }
+ doc.println(prop.getKey() + "=" + prop.getDefaultValue() + "\n");
+ }
+ }
+
+ private PrintStream doc;
+ private final TreeMap<String,ClientProperty> sortedProps = new TreeMap<>();
+
+ private ClientConfigGenerate(PrintStream doc) {
+ Objects.nonNull(doc);
+ this.doc = doc;
+ for (ClientProperty prop : ClientProperty.values()) {
+ this.sortedProps.put(prop.getKey(), prop);
+ }
+ }
+
+ private void generateMarkdown() {
+ new Markdown().generate();
+ }
+
+ private void generateConfigFile() {
+ new ConfigFile().generate();
+ }
+
+ /**
- * Generates markdown and config files for Accumulo client properties. Arguments are: "--generate-markdown filename" or "--generate-config filename"
++ * Generates markdown and config files for Accumulo client properties. Arguments are:
++ * "--generate-markdown filename" or "--generate-config filename"
+ *
+ * @param args
+ * command-line arguments
+ * @throws IllegalArgumentException
+ * if args is invalid
+ */
- public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
++ public static void main(String[] args)
++ throws FileNotFoundException, UnsupportedEncodingException {
+ if (args.length == 2) {
- ClientConfigGenerate clientConfigGenerate = new ClientConfigGenerate(new PrintStream(args[1], UTF_8.name()));
++ ClientConfigGenerate clientConfigGenerate = new ClientConfigGenerate(
++ new PrintStream(args[1], UTF_8.name()));
+ if (args[0].equals("--generate-markdown")) {
+ clientConfigGenerate.generateMarkdown();
+ return;
+ } else if (args[0].equals("--generate-config")) {
+ clientConfigGenerate.generateConfigFile();
+ return;
+ }
+ }
- throw new IllegalArgumentException("Usage: " + ClientConfigGenerate.class.getName() + " [--generate-markdown|--generate-config] <filename>");
++ throw new IllegalArgumentException("Usage: " + ClientConfigGenerate.class.getName()
++ + " [--generate-markdown|--generate-config] <filename>");
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java
index be6240e,0000000..5a2fc44
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ClientProperty.java
@@@ -1,172 -1,0 +1,187 @@@
+/*
+ * 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.conf;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Properties;
+
+import org.apache.accumulo.core.Constants;
+
+public enum ClientProperty {
+
+ // Instance
+ INSTANCE_NAME("instance.name", "", "Name of Accumulo instance to connect to", "", true),
- INSTANCE_ZOOKEEPERS("instance.zookeepers", "localhost:2181", "Zookeeper connection information for Accumulo instance", "", true),
- INSTANCE_ZOOKEEPERS_TIMEOUT_SEC("instance.zookeepers.timeout.sec", "30", "Zookeeper session timeout (in seconds)"),
++ INSTANCE_ZOOKEEPERS("instance.zookeepers", "localhost:2181",
++ "Zookeeper connection information for Accumulo instance", "", true),
++ INSTANCE_ZOOKEEPERS_TIMEOUT_SEC("instance.zookeepers.timeout.sec", "30",
++ "Zookeeper session timeout (in seconds)"),
+
+ // Authentication
- AUTH_METHOD("auth.method", "password", "Authentication method (i.e password, kerberos, provider). Set more properties for chosen method below.", "", true),
- AUTH_USERNAME("auth.username", "", "Accumulo username/principal for chosen authentication method", "", true),
++ AUTH_METHOD("auth.method", "password",
++ "Authentication method (i.e password, kerberos, provider). Set more properties for chosen method below.",
++ "", true),
++ AUTH_USERNAME("auth.username", "", "Accumulo username/principal for chosen authentication method",
++ "", true),
+ AUTH_PASSWORD("auth.password", "", "Accumulo user password", "", true),
+ AUTH_KERBEROS_KEYTAB_PATH("auth.kerberos.keytab.path", "", "Path to Kerberos keytab"),
- AUTH_PROVIDER_NAME("auth.provider.name", "", "Alias used to extract Accumulo user password from CredentialProvider"),
- AUTH_PROVIDER_URLS("auth.provider.urls", "", "Comma separated list of URLs defining CredentialProvider(s)"),
++ AUTH_PROVIDER_NAME("auth.provider.name", "",
++ "Alias used to extract Accumulo user password from CredentialProvider"),
++ AUTH_PROVIDER_URLS("auth.provider.urls", "",
++ "Comma separated list of URLs defining CredentialProvider(s)"),
+
+ // BatchWriter
- BATCH_WRITER_MAX_MEMORY_BYTES("batch.writer.max.memory.bytes", "52428800", "Max memory (in bytes) to batch before writing"),
- BATCH_WRITER_MAX_LATENCY_SEC("batch.writer.max.latency.sec", "120", "Max amount of time (in seconds) to hold data in memory before flushing it"),
++ BATCH_WRITER_MAX_MEMORY_BYTES("batch.writer.max.memory.bytes", "52428800",
++ "Max memory (in bytes) to batch before writing"),
++ BATCH_WRITER_MAX_LATENCY_SEC("batch.writer.max.latency.sec", "120",
++ "Max amount of time (in seconds) to hold data in memory before flushing it"),
+ BATCH_WRITER_MAX_TIMEOUT_SEC("batch.writer.max.timeout.sec", "0",
+ "Max amount of time (in seconds) an unresponsive server will be re-tried. An exception is thrown when this timeout is exceeded. Set to zero for no timeout."),
- BATCH_WRITER_MAX_WRITE_THREADS("batch.writer.max.write.threads", "3", "Maximum number of threads to use for writing data to tablet servers."),
++ BATCH_WRITER_MAX_WRITE_THREADS("batch.writer.max.write.threads", "3",
++ "Maximum number of threads to use for writing data to tablet servers."),
+ BATCH_WRITER_DURABILITY("batch.writer.durability", "default",
+ "Change the durability for the BatchWriter session. To use the table's durability setting. use \"default\" which is the table's durability setting."),
+
+ // SSL
+ SSL_ENABLED("ssl.enabled", "false", "Enable SSL for client RPC"),
+ SSL_KEYSTORE_PASSWORD("ssl.keystore.password", "", "Password used to encrypt keystore"),
+ SSL_KEYSTORE_PATH("ssl.keystore.path", "", "Path to SSL keystore file"),
+ SSL_KEYSTORE_TYPE("ssl.keystore.type", "jks", "Type of SSL keystore"),
+ SSL_TRUSTSTORE_PASSWORD("ssl.truststore.password", "", "Password used to encrypt truststore"),
+ SSL_TRUSTSTORE_PATH("ssl.truststore.path", "", "Path to SSL truststore file"),
+ SSL_TRUSTSTORE_TYPE("ssl.truststore.type", "jks", "Type of SSL truststore"),
+ SSL_USE_JSSE("ssl.use.jsse", "false", "Use JSSE system properties to configure SSL"),
+
+ // SASL
+ SASL_ENABLED("sasl.enabled", "false", "Enable SASL for client RPC"),
- SASL_QOP("sasl.qop", "auth", "SASL quality of protection. Valid values are 'auth', 'auth-int', and 'auth-conf'"),
- SASL_KERBEROS_SERVER_PRIMARY("sasl.kerberos.server.primary", "accumulo", "Kerberos principal/primary that Accumulo servers use to login"),
++ SASL_QOP("sasl.qop", "auth",
++ "SASL quality of protection. Valid values are 'auth', 'auth-int', and 'auth-conf'"),
++ SASL_KERBEROS_SERVER_PRIMARY("sasl.kerberos.server.primary", "accumulo",
++ "Kerberos principal/primary that Accumulo servers use to login"),
+
+ // Trace
- TRACE_SPAN_RECEIVERS("trace.span.receivers", "org.apache.accumulo.tracer.ZooTraceClient", "A list of span receiver classes to send trace spans"),
- TRACE_ZOOKEEPER_PATH("trace.zookeeper.path", Constants.ZTRACERS, "The zookeeper node where tracers are registered");
++ TRACE_SPAN_RECEIVERS("trace.span.receivers", "org.apache.accumulo.tracer.ZooTraceClient",
++ "A list of span receiver classes to send trace spans"),
++ TRACE_ZOOKEEPER_PATH("trace.zookeeper.path", Constants.ZTRACERS,
++ "The zookeeper node where tracers are registered");
+
+ public static final String TRACE_SPAN_RECEIVER_PREFIX = "trace.span.receiver";
+
+ private String key;
+ private String defaultValue;
+ private String description;
+ private String since;
+ private boolean required;
+
- ClientProperty(String key, String defaultValue, String description, String since, boolean required) {
++ ClientProperty(String key, String defaultValue, String description, String since,
++ boolean required) {
+ Objects.requireNonNull(key);
+ Objects.requireNonNull(defaultValue);
+ Objects.requireNonNull(description);
+ Objects.requireNonNull(since);
+ this.key = key;
+ this.defaultValue = defaultValue;
+ this.description = description;
+ this.since = since;
+ this.required = required;
+ }
+
+ ClientProperty(String key, String defaultValue, String description, String since) {
+ this(key, defaultValue, description, since, false);
+ }
+
+ ClientProperty(String key, String defaultValue, String description) {
+ this(key, defaultValue, description, "");
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getSince() {
+ return since;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public String getValue(Properties properties) {
+ Objects.requireNonNull(properties);
+ String value = properties.getProperty(getKey());
+ if (value == null || value.isEmpty()) {
+ value = getDefaultValue();
+ }
+ Objects.requireNonNull(value);
+ if (isRequired() && value.isEmpty()) {
+ throw new IllegalArgumentException(getKey() + " must be set!");
+ }
+ return value;
+ }
+
+ public Long getLong(Properties properties) {
+ String value = getValue(properties);
+ if (value.isEmpty()) {
+ return null;
+ }
+ return Long.parseLong(value);
+ }
+
+ public Integer getInteger(Properties properties) {
+ String value = getValue(properties);
+ if (value.isEmpty()) {
+ return null;
+ }
+ return Integer.parseInt(value);
+ }
+
+ public boolean getBoolean(Properties properties) {
+ String value = getValue(properties);
+ if (value.isEmpty()) {
+ return false;
+ }
+ return Boolean.valueOf(value);
+ }
+
+ public static Properties getPrefix(Properties properties, String prefix) {
+ Properties props = new Properties();
+ for (Object keyObj : properties.keySet()) {
+ String key = (String) keyObj;
+ if (key.startsWith(prefix)) {
+ props.put(key, properties.getProperty(key));
+ }
+ }
+ return props;
+ }
+
+ public static Map<String,String> toMap(Properties properties) {
+ Map<String,String> propMap = new HashMap<>();
+ for (Object obj : properties.keySet()) {
+ propMap.put((String) obj, properties.getProperty((String) obj));
+ }
+ return propMap;
+ }
+}
diff --cc core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
index e6c1894,0f3e6a2..34ec3df
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigSanityCheck.java
@@@ -79,37 -68,6 +81,41 @@@ public class ConfigSanityCheck
if (key.equals(Property.INSTANCE_VOLUMES.getKey())) {
usingVolumes = value != null && !value.isEmpty();
}
+
- // If the block size or block size index is configured to be too large, we throw an exception to avoid potentially corrupting RFiles later
- if (key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey()) || key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())) {
++ // If the block size or block size index is configured to be too large, we throw an exception
++ // to avoid potentially corrupting RFiles later
++ if (key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX.getKey())
++ || key.equals(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE.getKey())) {
+ long bsize = ConfigurationTypeHelper.getFixedMemoryAsBytes(value);
- Preconditions.checkArgument(bsize > 0 && bsize < Integer.MAX_VALUE, key + " must be greater than 0 and less than " + Integer.MAX_VALUE + " but was: "
- + bsize);
++ Preconditions.checkArgument(bsize > 0 && bsize < Integer.MAX_VALUE, key
++ + " must be greater than 0 and less than " + Integer.MAX_VALUE + " but was: " + bsize);
+ }
+
+ if (key.equals(Property.CRYPTO_CIPHER_SUITE.getKey())) {
+ cipherSuite = Objects.requireNonNull(value);
- Preconditions.checkArgument(cipherSuite.equals(NULL_CIPHER) || cipherSuite.split("/").length == 3,
- "Cipher suite must be NullCipher or in the form algorithm/mode/padding. Suite: " + cipherSuite + " is invalid.");
++ Preconditions.checkArgument(
++ cipherSuite.equals(NULL_CIPHER) || cipherSuite.split("/").length == 3,
++ "Cipher suite must be NullCipher or in the form algorithm/mode/padding. Suite: "
++ + cipherSuite + " is invalid.");
+ }
+
+ if (key.equals(Property.CRYPTO_CIPHER_KEY_ALGORITHM_NAME.getKey())) {
+ keyAlgorithm = Objects.requireNonNull(value);
+ }
+
+ if (key.equals(Property.CRYPTO_MODULE_CLASS.getKey())) {
+ cryptoModule = Objects.requireNonNull(value);
+ if (!cryptoModule.equals(NULL_CRYPTO_MODULE)) {
+ verifyValidClassName(key, cryptoModule, CryptoModule.class);
+ }
+
+ }
+ if (key.equals(Property.CRYPTO_SECRET_KEY_ENCRYPTION_STRATEGY_CLASS.getKey())) {
+ secretKeyEncryptionStrategy = Objects.requireNonNull(value);
+ if (!secretKeyEncryptionStrategy.equals(NULL_SECRET_KEY_ENCRYPTION_STRATEGY)) {
+ verifyValidClassName(key, secretKeyEncryptionStrategy, SecretKeyEncryptionStrategy.class);
+ }
+ }
}
if (instanceZkTimeoutValue != null) {
@@@ -117,15 -76,8 +124,21 @@@
}
if (!usingVolumes) {
- log.warn("Use of {} and {} are deprecated. Consider using {} instead.", INSTANCE_DFS_URI, INSTANCE_DFS_DIR, Property.INSTANCE_VOLUMES);
- log.warn("Use of " + INSTANCE_DFS_URI + " and " + INSTANCE_DFS_DIR
- + " are deprecated. Consider using " + Property.INSTANCE_VOLUMES + " instead.");
++ log.warn("Use of {} and {} are deprecated. Consider using {} instead.", INSTANCE_DFS_URI,
++ INSTANCE_DFS_DIR, Property.INSTANCE_VOLUMES);
+ }
+
- if ((cipherSuite.equals(NULL_CIPHER) || keyAlgorithm.equals(NULL_CIPHER)) && !cipherSuite.equals(keyAlgorithm)) {
- fatal(Property.CRYPTO_CIPHER_SUITE.getKey() + " and " + Property.CRYPTO_CIPHER_KEY_ALGORITHM_NAME + " must both be configured.");
++ if ((cipherSuite.equals(NULL_CIPHER) || keyAlgorithm.equals(NULL_CIPHER))
++ && !cipherSuite.equals(keyAlgorithm)) {
++ fatal(Property.CRYPTO_CIPHER_SUITE.getKey() + " and "
++ + Property.CRYPTO_CIPHER_KEY_ALGORITHM_NAME + " must both be configured.");
+ }
+
- if (cryptoModule.equals(NULL_CRYPTO_MODULE) ^ secretKeyEncryptionStrategy.equals(NULL_SECRET_KEY_ENCRYPTION_STRATEGY)) {
- fatal(Property.CRYPTO_MODULE_CLASS.getKey() + " and " + Property.CRYPTO_SECRET_KEY_ENCRYPTION_STRATEGY_CLASS.getKey() + " must both be configured.");
++ if (cryptoModule.equals(NULL_CRYPTO_MODULE)
++ ^ secretKeyEncryptionStrategy.equals(NULL_SECRET_KEY_ENCRYPTION_STRATEGY)) {
++ fatal(Property.CRYPTO_MODULE_CLASS.getKey() + " and "
++ + Property.CRYPTO_SECRET_KEY_ENCRYPTION_STRATEGY_CLASS.getKey()
++ + " must both be configured.");
}
}
@@@ -185,24 -138,4 +199,27 @@@
log.error("FATAL: {}", msg);
throw new SanityCheckException(msg);
}
+
+ /**
+ * Verifies a configured option is a legal class and has a required base class.
+ *
+ * @param confOption
+ * The Property key name
+ * @param className
+ * The Property value, the string representation of a class to be loaded
+ * @param requiredBaseClass
+ * The base class required for the className
+ */
- private static void verifyValidClassName(String confOption, String className, Class<?> requiredBaseClass) {
++ private static void verifyValidClassName(String confOption, String className,
++ Class<?> requiredBaseClass) {
+ try {
+ ConfigurationTypeHelper.getClassInstance(null, className, requiredBaseClass);
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IOException e) {
++ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
++ | IOException e) {
+ fatal(confOption + " has an invalid class name: " + className);
+ } catch (ClassCastException e) {
- fatal(confOption + " must implement " + requiredBaseClass + ", but the configured class does not: " + className);
++ fatal(confOption + " must implement " + requiredBaseClass
++ + ", but the configured class does not: " + className);
+ }
+ }
}
diff --cc core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
index cf1c9fe,2a8d99d..d08f66d
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationCopy.java
@@@ -20,10 -20,12 +20,11 @@@ import java.util.Collections
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
-
-import com.google.common.base.Predicate;
+import java.util.function.Predicate;
/**
- * An {@link AccumuloConfiguration} which holds a flat copy of properties defined in another configuration
+ * An {@link AccumuloConfiguration} which holds a flat copy of properties defined in another
+ * configuration
*/
public class ConfigurationCopy extends AccumuloConfiguration {
private long updateCount = 0;
diff --cc core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java
index 91df2dc,b7753f6..90b8b55
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationDocGen.java
@@@ -19,12 -19,19 +19,13 @@@ package org.apache.accumulo.core.conf
import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
import java.util.TreeMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
/**
- * This class generates documentation to inform users of the available configuration properties in a presentable form.
+ * This class generates documentation to inform users of the available configuration properties in a
+ * presentable form.
*/
class ConfigurationDocGen {
private abstract class Format {
@@@ -78,40 -138,151 +79,46 @@@
}
@Override
- void propertyQuickLinks() {
- doc.println("<p>Jump to: ");
- String delimiter = "";
- for (Property prefix : prefixes) {
- if (!prefix.isExperimental()) {
- doc.print(delimiter + "<a href='#" + prefix.name() + "'>" + prefix.getKey() + "*</a>");
- delimiter = " | ";
- }
- }
- doc.println("</p>");
- }
-
- @Override
- void prefixSection(Property prefix) {
- beginRow();
+ void pageHeader() {
+ doc.println("---");
+ doc.println("title: Server Properties");
+ doc.println("category: administration");
+ doc.println("order: 3");
+ doc.println("---\n");
- doc.println("<!-- WARNING: Do not edit this file. It is a generated file that is copied from Accumulo build (from core/target/generated-docs) -->\n");
- doc.println("Below are properties set in `accumulo-site.xml` or the Accumulo shell that configure Accumulo servers (i.e tablet server, master, etc):\n");
+ doc.println(
- t("td", t("span", prefix.getKey() + '*', "id='" + prefix.name() + "' class='large'"),
- "colspan='5'" + (prefix.isDeprecated() ? " class='deprecated'" : "")));
- endRow();
- beginRow();
- doc.println(t("td",
- (prefix.isDeprecated() ? t("b", t("i", "Deprecated. ", null), null) : "")
- + sanitize(prefix.getDescription()),
- "colspan='5'" + (prefix.isDeprecated() ? " class='deprecated'" : "")));
- endRow();
-
- switch (prefix) {
- case TABLE_CONSTRAINT_PREFIX:
- break;
- case TABLE_ITERATOR_PREFIX:
- break;
- case TABLE_LOCALITY_GROUP_PREFIX:
- break;
- case TABLE_COMPACTION_STRATEGY_PREFIX:
- break;
- default:
- columnNames("Property", "Type", "ZooKeeper Mutable", "Default Value", "Description");
- break;
- }
- }
-
- @Override
- void property(Property prefix, Property prop) {
- boolean isDeprecated = prefix.isDeprecated() || prop.isDeprecated();
- if (prop.getKey().startsWith(prefix.getKey())) {
- beginRow();
- cellData(prop.getKey(), isDeprecated ? "class='deprecated'" : null);
- cellData(
- "<b><a href='#" + prop.getType().name() + "'>"
- + prop.getType().toString().replaceAll(" ", " ") + "</a></b>",
- isDeprecated ? "class='deprecated'" : null);
- cellData(isZooKeeperMutable(prop), isDeprecated ? "class='deprecated'" : null);
- cellData(
- "<pre>" + (prop.getRawDefaultValue().isEmpty() ? " "
- : sanitize(prop.getRawDefaultValue().replaceAll(" ", " "))) + "</pre>",
- isDeprecated ? "class='deprecated'" : null);
- cellData(
- (isDeprecated ? "<b><i>Deprecated.</i></b> " : "") + sanitize(prop.getDescription()),
- isDeprecated ? "class='deprecated'" : null);
- endRow();
- }
-
- }
-
- @Override
- void propertyTypeDescriptions() {
- columnNames("Property Type", "Description");
- for (PropertyType type : PropertyType.values()) {
- if (type == PropertyType.PREFIX)
- continue;
- beginRow();
- cellData("<h3 id='" + type.name() + "'>" + type + "</h3>", null);
- cellData(type.getFormatDescription(), null);
- endRow();
- }
- }
-
- @Override
- String sanitize(String str) {
- return str.replace("&", "&").replace("<", "<").replace(">", ">")
- .replaceAll("(?:\r\n|\r|\n)", "<br />");
- }
-
- private String startTag(String tag, String options) {
- return "<" + tag + (options != null ? " " + options : "") + ">";
- }
-
- }
-
- private class Asciidoc extends Format {
- @Override
- void beginSection(String section) {
- doc.println("=== " + section);
- }
-
- @Override
- String getExt() {
- return "txt";
- }
-
- @Override
- void propertyQuickLinks() {
- doc.println("Jump to: ");
- String delimiter = "";
- for (Property prefix : prefixes) {
- if (!prefix.isExperimental()) {
- doc.print(delimiter + "<<" + prefix.name() + ">>");
- delimiter = " | ";
- }
- }
- doc.println();
- doc.println();
++ "<!-- WARNING: Do not edit this file. It is a generated file that is copied from Accumulo build (from core/target/generated-docs) -->\n");
++ doc.println(
++ "Below are properties set in `accumulo-site.xml` or the Accumulo shell that configure Accumulo servers (i.e tablet server, master, etc):\n");
}
@Override
void prefixSection(Property prefix) {
boolean depr = prefix.isDeprecated();
- doc.print("| <a name=\"" + prefix.getKey().replace(".", "_") + "prefix\" class=\"prop\"></a> **" + prefix.getKey() + "*** | ");
- doc.println((depr ? "**Deprecated.** " : "") + strike(sanitize(prefix.getDescription()), depr) + " |");
- doc.println("[[" + prefix.name() + "]]");
- doc.println("==== " + prefix.getKey() + "*" + (depr ? " (Deprecated)" : ""));
- doc.println(strike((depr ? "_Deprecated._ " : "") + sanitize(prefix.getDescription()), depr));
- doc.println();
- }
-
- @Override
- void property(Property prefix, Property prop) {
- boolean depr = prefix.isDeprecated() || prop.isDeprecated();
- if (prop.getKey().startsWith(prefix.getKey())) {
- doc.println("===== " + prop.getKey());
- doc.println(strike((depr ? "_Deprecated._ " : "") + sanitize(prop.getDescription()), depr));
- doc.println();
- doc.println(strike("_Type:_ " + prop.getType().name(), depr) + " +");
- doc.println(strike("_Zookeeper Mutable:_ " + isZooKeeperMutable(prop), depr) + " +");
- String defaultValue = sanitize(prop.getRawDefaultValue()).trim();
- if (defaultValue.length() == 0) {
- // need a placeholder or the asciidoc line break won't work
- defaultValue = strike("_Default Value:_ _empty_", depr);
- } else if (defaultValue.contains("\n")) {
- // deal with multi-line values, skip strikethrough of value
- defaultValue = strike("_Default Value:_ ", depr) + "\n----\n" + defaultValue + "\n----\n";
- } else {
- defaultValue = strike("_Default Value:_ " + "`" + defaultValue + "`", depr);
- }
- doc.println(defaultValue);
- doc.println();
++ doc.print("| <a name=\"" + prefix.getKey().replace(".", "_")
++ + "prefix\" class=\"prop\"></a> **" + prefix.getKey() + "*** | ");
++ doc.println((depr ? "**Deprecated.** " : "") + strike(sanitize(prefix.getDescription()), depr)
++ + " |");
+ }
+
+ @Override
+ void property(Property prop) {
+ boolean depr = prop.isDeprecated();
- doc.print("| <a name=\"" + prop.getKey().replace(".", "_") + "\" class=\"prop\"></a> " + prop.getKey() + " | ");
- doc.print((depr ? "**Deprecated.** " : "") + strike(sanitize(prop.getDescription()), depr) + "<br>");
++ doc.print("| <a name=\"" + prop.getKey().replace(".", "_") + "\" class=\"prop\"></a> "
++ + prop.getKey() + " | ");
++ doc.print((depr ? "**Deprecated.** " : "") + strike(sanitize(prop.getDescription()), depr)
++ + "<br>");
+ doc.print(strike("**type:** " + prop.getType().name(), depr) + ", ");
+ doc.print(strike("**zk mutable:** " + isZooKeeperMutable(prop), depr) + ", ");
+ String defaultValue = sanitize(prop.getRawDefaultValue()).trim();
+ if (defaultValue.length() == 0) {
+ defaultValue = strike("**default value:** empty", depr);
+ } else if (defaultValue.contains("\n")) {
+ // deal with multi-line values, skip strikethrough of value
+ defaultValue = strike("**default value:** ", depr) + "\n```\n" + defaultValue + "\n```\n";
+ } else {
+ defaultValue = strike("**default value:** " + "`" + defaultValue + "`", depr);
}
+ doc.println(defaultValue + " |");
}
private String strike(String s, boolean isDeprecated) {
@@@ -123,7 -294,9 +130,8 @@@
for (PropertyType type : PropertyType.values()) {
if (type == PropertyType.PREFIX)
continue;
- doc.println("| " + sanitize(type.toString()) + " | " + sanitize(type.getFormatDescription()) + " |");
- doc.println("==== " + sanitize(type.toString()));
- doc.println(sanitize(type.getFormatDescription()));
- doc.println();
++ doc.println("| " + sanitize(type.toString()) + " | " + sanitize(type.getFormatDescription())
++ + " |");
}
}
@@@ -157,18 -368,25 +165,21 @@@
}
/**
- * Generates documentation for accumulo-site.xml file usage. Arguments are: "--generate-markdown filename"
- * Generates documentation for conf/accumulo-site.xml file usage. Arguments are: "--generate-doc",
- * file to write to.
++ * Generates documentation for accumulo-site.xml file usage. Arguments are: "--generate-markdown
++ * filename"
*
* @param args
* command-line arguments
* @throws IllegalArgumentException
* if args is invalid
*/
- public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
+ public static void main(String[] args)
+ throws FileNotFoundException, UnsupportedEncodingException {
- if (args.length == 2 && args[0].equals("--generate-html")) {
- new ConfigurationDocGen(new PrintStream(args[1], UTF_8.name())).generateHtml();
- } else if (args.length == 2 && args[0].equals("--generate-asciidoc")) {
- new ConfigurationDocGen(new PrintStream(args[1], UTF_8.name())).generateAsciidoc();
+ if (args.length == 2 && args[0].equals("--generate-markdown")) {
+ new ConfigurationDocGen(new PrintStream(args[1], UTF_8.name())).generateMarkdown();
} else {
- throw new IllegalArgumentException("Usage: " + ConfigurationDocGen.class.getName() + " --generate-markdown <filename>");
- throw new IllegalArgumentException("Usage: " + ConfigurationDocGen.class.getName()
- + " --generate-html <filename> | --generate-asciidoc <filename>");
++ throw new IllegalArgumentException(
++ "Usage: " + ConfigurationDocGen.class.getName() + " --generate-markdown <filename>");
}
}
-
}
diff --cc core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java
index 1ad7965,0000000..d718c9c
mode 100644,000000..100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/ConfigurationTypeHelper.java
@@@ -1,204 -1,0 +1,216 @@@
+/*
+ * 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.conf;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ConfigurationTypeHelper {
+
+ private static final Logger log = LoggerFactory.getLogger(ConfigurationTypeHelper.class);
+
+ /**
- * Interprets a string specifying bytes. A bytes type is specified as a long integer followed by an optional B (bytes), K (KB), M (MB), or G (GB).
++ * Interprets a string specifying bytes. A bytes type is specified as a long integer followed by
++ * an optional B (bytes), K (KB), M (MB), or G (GB).
+ *
+ * @param str
+ * String value
+ * @return interpreted memory size in bytes
+ */
+ public static long getFixedMemoryAsBytes(String str) {
+ char lastChar = str.charAt(str.length() - 1);
+
+ if (lastChar == 'b') {
- log.warn("The 'b' in {} is being considered as bytes. Setting memory by bits is not supported", str);
++ log.warn(
++ "The 'b' in {} is being considered as bytes. Setting memory by bits is not supported",
++ str);
+ }
+ try {
+ int multiplier;
+ switch (Character.toUpperCase(lastChar)) {
+ case 'G':
+ multiplier = 30;
+ break;
+ case 'M':
+ multiplier = 20;
+ break;
+ case 'K':
+ multiplier = 10;
+ break;
+ case 'B':
+ multiplier = 0;
+ break;
+ default:
+ return Long.parseLong(str);
+ }
+ return Long.parseLong(str.substring(0, str.length() - 1)) << multiplier;
+ } catch (Exception ex) {
- throw new IllegalArgumentException("The value '" + str + "' is not a valid memory setting. A valid value would a number "
- + "possibly followed by an optional 'G', 'M', 'K', or 'B'.");
++ throw new IllegalArgumentException(
++ "The value '" + str + "' is not a valid memory setting. A valid value would a number "
++ + "possibly followed by an optional 'G', 'M', 'K', or 'B'.");
+ }
+ }
+
+ /**
- * Interprets a string specifying a Memory type which is specified as a long integer followed by an optional B (bytes), K (KB), M (MB), G (GB) or %
- * (percentage).
++ * Interprets a string specifying a Memory type which is specified as a long integer followed by
++ * an optional B (bytes), K (KB), M (MB), G (GB) or % (percentage).
+ *
+ * @param str
+ * String value
+ * @return interpreted memory size in bytes
+ */
+ public static long getMemoryAsBytes(String str) {
+ char lastChar = str.charAt(str.length() - 1);
+ if (lastChar == '%') {
+ try {
+ int percent = Integer.parseInt(str.substring(0, str.length() - 1));
+ if (percent <= 0 || percent >= 100) {
- throw new IllegalArgumentException("The value '" + str + "' is not a valid memory setting.");
++ throw new IllegalArgumentException(
++ "The value '" + str + "' is not a valid memory setting.");
+ }
+ return Runtime.getRuntime().maxMemory() * percent / 100;
... 52926 lines suppressed ...
--
To stop receiving notification emails like this one, please contact
ctubbsii@apache.org.