You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ec...@apache.org on 2012/12/19 17:25:07 UTC
svn commit: r1423923 [1/8] - in /accumulo/trunk: ./ bin/ core/
core/src/main/java/org/apache/accumulo/core/cli/
core/src/main/java/org/apache/accumulo/core/client/impl/
core/src/main/java/org/apache/accumulo/core/client/mapreduce/
core/src/main/java/or...
Author: ecn
Date: Wed Dec 19 16:25:03 2012
New Revision: 1423923
URL: http://svn.apache.org/viewvc?rev=1423923&view=rev
Log:
ACCUMULO-745 use jcommander to parse command line arguments
Added:
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java (with props)
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java (with props)
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java (with props)
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/Help.java (with props)
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java (with props)
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/file/BloomFilterLayerLookupTest.java (with props)
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/cli/
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/cli/ClientOnDefaultTable.java (with props)
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/cli/ClientOnRequiredTable.java (with props)
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/cli/ClientOpts.java (with props)
Removed:
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/EncodedBinaryTreePath.java
accumulo/trunk/test/system/test5/
Modified:
accumulo/trunk/LICENSE
accumulo/trunk/bin/accumulo
accumulo/trunk/bin/config.sh
accumulo/trunk/bin/tool.sh
accumulo/trunk/core/pom.xml
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingCombiner.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/LoggingRunnable.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/command/FormatterCommandTest.java
accumulo/trunk/docs/examples/README.batch
accumulo/trunk/docs/examples/README.bloom
accumulo/trunk/docs/examples/README.bulkIngest
accumulo/trunk/docs/examples/README.dirlist
accumulo/trunk/docs/examples/README.filedata
accumulo/trunk/docs/examples/README.helloworld
accumulo/trunk/docs/examples/README.isolation
accumulo/trunk/docs/examples/README.mapred
accumulo/trunk/docs/examples/README.maxmutation
accumulo/trunk/docs/examples/README.shard
accumulo/trunk/docs/examples/README.visibility
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/Flush.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchScanner.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RandomBatchWriter.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/ReadWriteExample.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/RowOperations.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/client/SequentialBatchWriter.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/FileCount.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/Ingest.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/QueryUtil.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/dirlist/Viewer.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/CharacterHistogram.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataIngest.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/filedata/FileDataQuery.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/helloworld/InsertWithBatchWriter.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/helloworld/InsertWithOutputFormat.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/helloworld/ReadData.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/isolation/InterferenceTest.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RegexExample.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/RowHash.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TableToFile.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/TeraSortIngest.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/UniqueColumns.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/WordCount.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/GenerateTestData.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/SetupTable.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/VerifyIngest.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/ContinuousQuery.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/Index.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/Query.java
accumulo/trunk/examples/simple/src/main/java/org/apache/accumulo/examples/simple/shard/Reverse.java
accumulo/trunk/examples/simple/src/test/java/org/apache/accumulo/examples/simple/dirlist/CountTest.java
accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/util/LoggingRunnable.java
accumulo/trunk/pom.xml
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/fate/Admin.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/gc/SimpleGarbageCollector.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/logger/LogReader.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/EventCoordinator.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/Master.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/master/state/MergeStats.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/FindTablet.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/IndexMeta.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/metanalysis/PrintEvents.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/monitor/servlets/trace/Basic.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/tabletserver/TabletServer.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/BulkImportDirectory.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/CreateRFiles.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/CreateRandomRFile.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/CreateTestTable.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/GCLotsOfCandidatesTest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/ListTables.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/NativeMapConcurrencyTest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/QueryMetadataTable.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestBinaryRows.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestIngest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestMultiTableIngest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/TestRandomDeletes.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/VerifyIngest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/WrongTabletTest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousBatchWalker.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousIngest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousMoru.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousQuery.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousScanner.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousStatsCollector.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousVerify.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/ContinuousWalk.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/TimeBinner.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/continuous/UndefinedAnalyzer.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/BatchWriterFlushTest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/CacheTestClean.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/FateStarvationTest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/FunctionalTest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/LargeRowTest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/MaxOpenTest.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/RunTests.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/functional/ZombieTServer.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/scan/CollectTabletStats.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/performance/thrift/NullTserver.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/randomwalk/Framework.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/test/scalability/Run.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Admin.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/DeleteZooInstance.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/DumpZookeeper.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/FindOfflineTablets.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/ListInstances.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/RandomWriter.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TServerUtils.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TableDiskUsage.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/TabletServerLocks.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
accumulo/trunk/server/src/main/java/org/apache/accumulo/server/util/ZooZap.java
accumulo/trunk/start/src/main/java/org/apache/accumulo/start/TestMain.java
accumulo/trunk/test/system/auto/JavaTest.py
accumulo/trunk/test/system/auto/TestUtils.py
accumulo/trunk/test/system/auto/simple/binary.py
accumulo/trunk/test/system/auto/simple/bulk.py
accumulo/trunk/test/system/auto/simple/compaction.py
accumulo/trunk/test/system/auto/simple/delete.py
accumulo/trunk/test/system/auto/simple/deleterows.py
accumulo/trunk/test/system/auto/simple/dynamicThreadPools.py
accumulo/trunk/test/system/auto/simple/examples.py
accumulo/trunk/test/system/auto/simple/gc.py
accumulo/trunk/test/system/auto/simple/mapreduce.py
accumulo/trunk/test/system/auto/simple/merge.py
accumulo/trunk/test/system/auto/simple/readwrite.py
accumulo/trunk/test/system/auto/simple/split.py
accumulo/trunk/test/system/auto/simple/zoo.py
accumulo/trunk/test/system/auto/simple/zooCacheTest.py
accumulo/trunk/test/system/auto/stress/batchWrite.py
accumulo/trunk/test/system/auto/stress/halfDead.py
accumulo/trunk/test/system/bench/lib/IngestBenchmark.py
accumulo/trunk/test/system/bench/lib/RowHashBenchmark.py
accumulo/trunk/test/system/continuous/report.pl
accumulo/trunk/test/system/continuous/run-moru.sh
accumulo/trunk/test/system/continuous/run-verify.sh
accumulo/trunk/test/system/continuous/start-batchwalkers.sh
accumulo/trunk/test/system/continuous/start-ingest.sh
accumulo/trunk/test/system/continuous/start-scanners.sh
accumulo/trunk/test/system/continuous/start-stats.sh
accumulo/trunk/test/system/continuous/start-walkers.sh
accumulo/trunk/test/system/randomwalk/bin/start-local.sh
accumulo/trunk/test/system/test1/ingest_test.sh
accumulo/trunk/test/system/test1/ingest_test_2.sh
accumulo/trunk/test/system/test1/verify_test.sh
accumulo/trunk/test/system/test1/verify_test_2.sh
accumulo/trunk/test/system/test2/concurrent.sh
accumulo/trunk/test/system/test3/bigrow.sh
accumulo/trunk/test/system/test4/bulk_import_test.sh
accumulo/trunk/test/system/upgrade_test.sh
accumulo/trunk/trace/src/main/java/org/apache/accumulo/cloudtrace/instrument/impl/MilliSpan.java
Modified: accumulo/trunk/LICENSE
URL: http://svn.apache.org/viewvc/accumulo/trunk/LICENSE?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/LICENSE (original)
+++ accumulo/trunk/LICENSE Wed Dec 19 16:25:03 2012
@@ -328,43 +328,6 @@ For the jline library:
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.
-For the kryo and minlog libraries:
-
- The BSD License
-
- Copyright (c) 2008, Nathan Sweet
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or
- without modification, are permitted provided that the following
- conditions are met:
-
- Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer
- in the documentation and/or other materials provided with
- the distribution.
-
- Neither the name of Esoteric Software nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- OF THE POSSIBILITY OF SUCH DAMAGE.
-
For the protobuf library:
The BSD License
@@ -1006,3 +969,206 @@ For the jersey-server runtime dependency
state courts of the State of California, with venue lying in Santa Clara
County, California.
+For JCommander:
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 2012, Cedric Beust
+
+ Licensed 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.
+
Modified: accumulo/trunk/bin/accumulo
URL: http://svn.apache.org/viewvc/accumulo/trunk/bin/accumulo?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/bin/accumulo (original)
+++ accumulo/trunk/bin/accumulo Wed Dec 19 16:25:03 2012
@@ -109,4 +109,4 @@ JAVA=$JAVA_HOME/bin/java
PLATFORM="`$JAVA -cp $CLASSPATH org.apache.accumulo.start.Platform`"
# app isn't used anywhere, but it makes the process easier to spot when ps/top/snmp truncate the command line
-exec $JAVA "-Dapp=$1" -classpath $CLASSPATH $ACCUMULO_OPTS -XX:OnOutOfMemoryError="kill -9 %p" -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl -Djava.library.path="$HADOOP_HOME/lib/native/$PLATFORM" -Dorg.apache.accumulo.core.home.dir="$ACCUMULO_HOME" -Dhadoop.home.dir="$HADOOP_HOME" -Dzookeeper.home.dir="$ZOOKEEPER_HOME" org.apache.accumulo.start.Main "$@"
+exec $JAVA "-Dapp=$1" $ACCUMULO_OPTS -classpath $CLASSPATH -XX:OnOutOfMemoryError="kill -9 %p" -Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl -Djava.library.path="$HADOOP_HOME/lib/native/$PLATFORM" -Dorg.apache.accumulo.core.home.dir="$ACCUMULO_HOME" -Dhadoop.home.dir="$HADOOP_HOME" -Dzookeeper.home.dir="$ZOOKEEPER_HOME" org.apache.accumulo.start.Main "$@"
Modified: accumulo/trunk/bin/config.sh
URL: http://svn.apache.org/viewvc/accumulo/trunk/bin/config.sh?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/bin/config.sh (original)
+++ accumulo/trunk/bin/config.sh Wed Dec 19 16:25:03 2012
@@ -66,6 +66,7 @@ then
exit 1
fi
export HADOOP_HOME
+export HADOOP_HOME_WARN_SUPPRESS=leavemealone
if [ ! -f "$ACCUMULO_HOME/conf/masters" -o ! -f "$ACCUMULO_HOME/conf/slaves" ]
then
Modified: accumulo/trunk/bin/tool.sh
URL: http://svn.apache.org/viewvc/accumulo/trunk/bin/tool.sh?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/bin/tool.sh (original)
+++ accumulo/trunk/bin/tool.sh Wed Dec 19 16:25:03 2012
@@ -36,6 +36,7 @@ CORE_CMD='ls -1 $LIB/accumulo-core-*[^cs
FATE_CMD='ls -1 $LIB/accumulo-fate-*[^cs].jar'
THRIFT_CMD='ls -1 $LIB/libthrift-*[^cs].jar'
CLOUDTRACE_CMD='ls -1 $LIB/cloudtrace-*[^cs].jar'
+JCOMMANDER_CMD='ls -1 $LIB/jcommander-*[^cs].jar'
if [ `eval $ZOOKEEPER_CMD | wc -l` != "1" ] ; then
echo "Not exactly one zookeeper jar in $ZOOKEEPER_HOME"
@@ -62,11 +63,17 @@ if [ `eval $CLOUDTRACE_CMD | wc -l` != "
exit 1
fi
+if [ `eval $JCOMMANDER_CMD | wc -l` != "1" ] ; then
+ echo "Not exactly one jcommander jar in $LIB"
+ exit 1
+fi
+
ZOOKEEPER_LIB=`eval $ZOOKEEPER_CMD`
CORE_LIB=`eval $CORE_CMD`
FATE_LIB=`eval $FATE_CMD`
THRIFT_LIB=`eval $THRIFT_CMD`
CLOUDTRACE_LIB=`eval $CLOUDTRACE_CMD`
+JCOMMANDER_LIB=`eval $JCOMMANDER_CMD`
USERJARS=" "
for arg in "$@"; do
@@ -87,8 +94,8 @@ for arg in "$@"; do
fi
done
-LIB_JARS="$THRIFT_LIB,$CORE_LIB,$FATE_LIB,$ZOOKEEPER_LIB,$CLOUDTRACE_LIB"
-H_JARS="$THRIFT_LIB:$CORE_LIB:$FATE_LIB:$ZOOKEEPER_LIB:$CLOUDTRACE_LIB:"
+LIB_JARS="$THRIFT_LIB,$CORE_LIB,$FATE_LIB,$ZOOKEEPER_LIB,$CLOUDTRACE_LIB,$JCOMMANDER_LIB"
+H_JARS="$THRIFT_LIB:$CORE_LIB:$FATE_LIB:$ZOOKEEPER_LIB:$CLOUDTRACE_LIB:$JCOMMANDER_LIB:"
COMMONS_LIBS=`ls -1 $LIB/commons-*.jar`
for jar in $USERJARS $COMMONS_LIBS; do
Modified: accumulo/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/pom.xml?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/pom.xml (original)
+++ accumulo/trunk/core/pom.xml Wed Dec 19 16:25:03 2012
@@ -163,6 +163,10 @@
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.beust</groupId>
+ <artifactId>jcommander</artifactId>
+ </dependency>
</dependencies>
</project>
Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java?rev=1423923&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java Wed Dec 19 16:25:03 2012
@@ -0,0 +1,36 @@
+/*
+ * 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.cli;
+
+import com.beust.jcommander.Parameter;
+
+public class ClientOnDefaultTable extends ClientOpts {
+ private final String defaultTable;
+
+ public ClientOnDefaultTable(String table) {
+ this.defaultTable = table;
+ }
+
+ @Parameter(names="--table", description="table to use")
+ String tableName;
+
+ public String getTableName() {
+ if (tableName == null)
+ return defaultTable;
+ return tableName;
+ }
+}
Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnDefaultTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java?rev=1423923&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java Wed Dec 19 16:25:03 2012
@@ -0,0 +1,36 @@
+/*
+ * 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.cli;
+
+import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
+import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat;
+import org.apache.hadoop.mapreduce.Job;
+
+import com.beust.jcommander.Parameter;
+
+public class ClientOnRequiredTable extends ClientOpts {
+
+ @Parameter(names={"-t", "--table"}, required=true, description="table to use")
+ public String tableName = null;
+
+ @Override
+ public void setAccumuloConfigs(Job job) {
+ super.setAccumuloConfigs(job);
+ AccumuloInputFormat.setInputInfo(job.getConfiguration(), user, getPassword(), tableName, auths);
+ AccumuloOutputFormat.setOutputInfo(job.getConfiguration(), user, getPassword(), true, tableName);
+ }
+}
Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOnRequiredTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java?rev=1423923&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java Wed Dec 19 16:25:03 2012
@@ -0,0 +1,195 @@
+/*
+ * 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.cli;
+
+import java.nio.ByteBuffer;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.accumulo.cloudtrace.instrument.Trace;
+import org.apache.accumulo.core.Constants;
+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.Connector;
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
+import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat;
+import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat;
+import org.apache.accumulo.core.client.mock.MockInstance;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.ColumnVisibility;
+import org.apache.accumulo.core.security.thrift.AuthInfo;
+import org.apache.hadoop.mapreduce.Job;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+
+import com.beust.jcommander.IStringConverter;
+import com.beust.jcommander.Parameter;
+
+public class ClientOpts extends Help {
+
+ public static class TimeConverter implements IStringConverter<Long> {
+ @Override
+ public Long convert(String value) {
+ return AccumuloConfiguration.getTimeInMillis(value);
+ }
+ }
+
+ public static class MemoryConverter implements IStringConverter<Long> {
+ @Override
+ public Long convert(String value) {
+ return AccumuloConfiguration.getMemoryInBytes(value);
+ }
+ }
+
+ public static class AuthConverter implements IStringConverter<Authorizations> {
+ @Override
+ public Authorizations convert(String value) {
+ return new Authorizations(value.split(","));
+ }
+ }
+
+ public static class Password {
+ public byte[] value;
+ public Password(String dfault) { value = dfault.getBytes(); }
+ public String toString() {
+ return new String(value);
+ }
+ }
+
+ public static class PasswordConverter implements IStringConverter<Password> {
+ @Override
+ public Password convert(String value) {
+ return new Password(value);
+ }
+ }
+
+ public static class VisibilityConverter implements IStringConverter<ColumnVisibility> {
+ @Override
+ public ColumnVisibility convert(String value) {
+ return new ColumnVisibility(value);
+ }
+ }
+
+ private static final BatchWriterConfig BWDEFAULTS = new BatchWriterConfig();
+
+ @Parameter(names={"-u", "--user"}, description = "Connection user")
+ public String user = System.getProperty("user.name");
+
+ @Parameter(names="-p", converter=PasswordConverter.class, description = "Connection password")
+ public Password password = new Password("secret");
+
+ @Parameter(names="--password", converter=PasswordConverter.class, description = "Enter the connection password", password=true)
+ public Password securePassword = null;
+
+ public byte[] getPassword() {
+ if (securePassword == null) {
+ return password.value;
+ }
+ return securePassword.value;
+ }
+
+ @Parameter(names={"-z", "--keepers"}, description="Comma separated list of zookeeper hosts (host:port,host:port)")
+ public String zookeepers = "localhost:2181";
+
+ @Parameter(names={"-i", "--instance"}, description="The name of the accumulo instance")
+ public String instance = null;
+
+ @Parameter(names={"-auths", "--auths"}, converter=AuthConverter.class, description="the authorizations to use when reading or writing")
+ public Authorizations auths = Constants.NO_AUTHS;
+
+ @Parameter(names="--batchThreads", description="Number of threads to use when writing large batches")
+ public Integer batchThreads = BWDEFAULTS.getMaxWriteThreads();
+
+ @Parameter(names="--batchLatency", converter=TimeConverter.class, description="The maximum time to wait before flushing data to servers when writing")
+ public Long batchLatency = BWDEFAULTS.getMaxLatency(TimeUnit.MILLISECONDS);
+
+ @Parameter(names="--batchMemory", converter=MemoryConverter.class, description="memory used to batch data when writing")
+ public Long batchMemory = BWDEFAULTS.getMaxMemory();
+
+ @Parameter(names="--batchTimeout", converter=TimeConverter.class, description="timeout used to fail a batch write")
+ public Long batchTimeout = BWDEFAULTS.getTimeout(TimeUnit.MILLISECONDS);
+
+ @Parameter(names="--scanBatchSize", description="the number of key-values to pull during a scan or batch scan")
+ public int scanBatchSize = 1000;
+
+ @Parameter(names="--scanThreads", description="number of threads to use when batch scanning")
+ public Integer scanThreads = 10;
+
+ @Parameter(names="--debug", description="turn on TRACE-level log messages")
+ public boolean debug = false;
+
+ @Parameter(names={"-fake", "--mock"}, description="Use a mock Instance")
+ public boolean mock=false;
+
+ public void startDebugLogging() {
+ if (debug)
+ Logger.getLogger(Constants.CORE_PACKAGE_NAME).setLevel(Level.TRACE);
+ }
+
+ @Parameter(names="--trace", description="turn on distributed tracing")
+ public boolean trace = false;
+
+ public void startTracing(String applicationName) {
+ if (trace) {
+ Trace.on(applicationName);
+ }
+ }
+
+ public void stopTracing() {
+ Trace.off();
+ }
+
+ public void parseArgs(String programName, String[] args) {
+ super.parseArgs(programName, args);
+ startDebugLogging();
+ startTracing(programName);
+ }
+
+ public BatchWriterConfig getBatchWriterConfig() {
+ BatchWriterConfig config = new BatchWriterConfig();
+ config.setMaxLatency(this.batchLatency, TimeUnit.MILLISECONDS);
+ config.setMaxMemory(this.batchMemory);
+ config.setTimeout(this.batchTimeout, TimeUnit.MILLISECONDS);
+ return config;
+ }
+
+ protected Instance cachedInstance = null;
+
+ synchronized public Instance getInstance() {
+ if (cachedInstance != null)
+ return cachedInstance;
+ if (mock)
+ return cachedInstance = new MockInstance(instance);
+ return cachedInstance = new ZooKeeperInstance(this.instance, this.zookeepers);
+ }
+
+ public Connector getConnector() throws AccumuloException, AccumuloSecurityException {
+ return getInstance().getConnector(this.user, this.getPassword());
+ }
+
+ public AuthInfo getAuthInfo() {
+ return new AuthInfo(user, ByteBuffer.wrap(getPassword()), getInstance().getInstanceID());
+ }
+
+ public void setAccumuloConfigs(Job job) {
+ AccumuloInputFormat.setZooKeeperInstance(job.getConfiguration(), instance, zookeepers);
+ AccumuloOutputFormat.setZooKeeperInstance(job.getConfiguration(), instance, zookeepers);
+ }
+
+}
Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/ClientOpts.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/Help.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/Help.java?rev=1423923&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/Help.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/Help.java Wed Dec 19 16:25:03 2012
@@ -0,0 +1,41 @@
+/*
+ * 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.cli;
+
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.ParameterException;
+
+public class Help {
+ @Parameter(names={"-h", "-?", "--help", "-help"}, help=true)
+ public boolean help = false;
+ public void parseArgs(String programName, String[] args) {
+ JCommander commander = new JCommander(this);
+ commander.setProgramName(programName);
+ try {
+ commander.parse(args);
+ } catch (ParameterException ex) {
+ commander.usage();
+ System.err.println(ex.getMessage());
+ System.exit(0);
+ }
+ if (help) {
+ commander.usage();
+ System.exit(0);
+ }
+ }
+}
Propchange: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/cli/Help.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ServerClient.java Wed Dec 19 16:25:03 2012
@@ -26,6 +26,7 @@ import org.apache.accumulo.core.client.A
import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.impl.thrift.ClientService;
import org.apache.accumulo.core.client.impl.thrift.ClientService.Client;
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.security.thrift.ThriftSecurityException;
import org.apache.accumulo.core.util.ArgumentChecker;
@@ -130,13 +131,15 @@ public class ServerClient {
// add tservers
ZooCache zc = getZooCache(instance);
-
+ AccumuloConfiguration conf = instance.getConfiguration();
for (String tserver : zc.getChildren(ZooUtil.getRoot(instance) + Constants.ZTSERVERS)) {
String path = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + tserver;
byte[] data = ZooUtil.getLockData(zc, path);
if (data != null && !new String(data).equals("master"))
- servers.add(new ThriftTransportKey(new ServerServices(new String(data)).getAddressString(Service.TSERV_CLIENT), instance.getConfiguration().getPort(
- Property.TSERV_CLIENTPORT), instance.getConfiguration().getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)));
+ servers.add(new ThriftTransportKey(
+ new ServerServices(new String(data)).getAddressString(Service.TSERV_CLIENT),
+ conf.getPort(Property.TSERV_CLIENTPORT),
+ conf.getTimeInMillis(Property.GENERAL_RPC_TIMEOUT)));
}
boolean opened = false;
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/impl/ThriftTransportPool.java Wed Dec 19 16:25:03 2012
@@ -417,7 +417,7 @@ public class ThriftTransportPool {
if (!cachedConnection.isReserved()) {
cachedConnection.setReserved(true);
if (log.isTraceEnabled())
- log.trace("Using existing connection to " + ttk.getLocation() + ":" + ttk.getPort());
+ log.trace("Using existing connection to " + ttk.getLocation() + ":" + ttk.getPort() + " timeout " + ttk.getTimeout());
return new Pair<String,TTransport>(ttk.getLocation() + ":" + ttk.getPort(), cachedConnection.transport);
}
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormat.java Wed Dec 19 16:25:03 2012
@@ -122,10 +122,10 @@ public class AccumuloOutputFormat extend
if (conf.getBoolean(INSTANCE_HAS_BEEN_SET, false))
throw new IllegalStateException("Instance info can only be set once per job");
conf.setBoolean(INSTANCE_HAS_BEEN_SET, true);
-
ArgumentChecker.notNull(instanceName, zooKeepers);
conf.set(INSTANCE_NAME, instanceName);
conf.set(ZOOKEEPERS, zooKeepers);
+ System.out.println("instance set: " + conf.get(INSTANCE_HAS_BEEN_SET));
}
public static void setMockInstance(Configuration conf, String instanceName) {
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/Property.java Wed Dec 19 16:25:03 2012
@@ -54,6 +54,7 @@ public enum Property {
GENERAL_KERBEROS_KEYTAB("general.kerberos.keytab", "", PropertyType.PATH, "Path to the kerberos keytab to use. Leave blank if not using kerberoized hdfs"),
GENERAL_KERBEROS_PRINCIPAL("general.kerberos.principal", "", PropertyType.STRING, "Name of the kerberos principal to use. _HOST will automatically be "
+ "replaced by the machines hostname in the hostname portion of the principal. Leave blank if not using kerberoized hdfs"),
+ GENERAL_MAX_MESSAGE_SIZE("tserver.server.message.size.max", "1G", PropertyType.MEMORY, "The maximum size of a message that can be sent to a tablet server."),
// properties that are specific to master server behavior
MASTER_PREFIX("master.", null, PropertyType.PREFIX, "Properties in this category affect the behavior of the master server"),
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/PrintInfo.java Wed Dec 19 16:25:03 2012
@@ -17,7 +17,9 @@
package org.apache.accumulo.core.file.rfile;
import java.util.ArrayList;
+import java.util.List;
+import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
@@ -26,51 +28,40 @@ import org.apache.accumulo.core.data.Val
import org.apache.accumulo.core.file.FileUtil;
import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile;
import org.apache.accumulo.core.file.rfile.RFile.Reader;
-import org.apache.commons.cli.BasicParser;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
+import com.beust.jcommander.Parameter;
+
public class PrintInfo {
+
+ static class Opts extends Help {
+ @Parameter(names={"-d", "--dump"}, description="dump the key/value pairs")
+ boolean dump = false;
+ @Parameter(names={"--historgram"}, description="print a histogram of the key-value sizes")
+ boolean histogram = false;
+ @Parameter(description=" <file> { <file> ... }")
+ List<String> files = new ArrayList<String>();
+ }
+
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
@SuppressWarnings("deprecation")
//Not for client use
FileSystem fs = FileUtil.getFileSystem(conf, AccumuloConfiguration.getSiteConfiguration());
-
- Options opts = new Options();
- Option dumpKeys = new Option("d", "dump", false, "dump the key/value pairs");
- opts.addOption(dumpKeys);
- Option histogramOption = new Option("h", "histogram", false, "print a histogram of the key-value sizes");
- opts.addOption(histogramOption);
-
- CommandLine commandLine = null;
- try {
- commandLine = new BasicParser().parse(opts, args);
- if (commandLine.getArgs().length == 0) {
- throw new ParseException("No files were given");
- }
-
- } catch (ParseException e) {
- System.err.println("Failed to parse command line : " + e.getMessage());
- System.err.println();
- HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp("rfile-info <rfile> {<rfile>}", opts);
+ Opts opts = new Opts();
+ opts.parseArgs(PrintInfo.class.getName(), args);
+ if (opts.files.isEmpty()) {
+ System.err.println("No files were given");
System.exit(-1);
}
- boolean dump = commandLine.hasOption(dumpKeys.getOpt());
- boolean doHistogram = commandLine.hasOption(histogramOption.getOpt());
long countBuckets[] = new long[11];
long sizeBuckets[] = new long[countBuckets.length];
long totalSize = 0;
- for (String arg : commandLine.getArgs()) {
+ for (String arg : opts.files) {
Path path = new Path(arg);
CachableBlockFile.Reader _rdr = new CachableBlockFile.Reader(fs, path, conf, null, null);
@@ -80,14 +71,14 @@ public class PrintInfo {
System.out.println();
org.apache.accumulo.core.file.rfile.bcfile.PrintInfo.main(new String[] {arg});
- if (doHistogram || dump) {
+ if (opts.histogram || opts.dump) {
iter.seek(new Range((Key) null, (Key) null), new ArrayList<ByteSequence>(), false);
while (iter.hasTop()) {
Key key = iter.getTopKey();
Value value = iter.getTopValue();
- if (dump)
+ if (opts.dump)
System.out.println(key + " -> " + value);
- if (doHistogram) {
+ if (opts.histogram) {
long size = key.getSize() + value.getSize();
int bucket = (int) Math.log10(size);
countBuckets[bucket]++;
@@ -98,7 +89,7 @@ public class PrintInfo {
}
}
iter.close();
- if (doHistogram) {
+ if (opts.histogram) {
System.out.println("Up to size count %-age");
for (int i = 1; i < countBuckets.length; i++) {
System.out.println(String.format("%11.0f : %10d %6.2f%%", Math.pow(10, i), countBuckets[i], sizeBuckets[i] * 100. / totalSize));
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/file/rfile/SplitLarge.java Wed Dec 19 16:25:03 2012
@@ -17,7 +17,9 @@
package org.apache.accumulo.core.file.rfile;
import java.util.ArrayList;
+import java.util.List;
+import org.apache.accumulo.core.cli.Help;
import org.apache.accumulo.core.conf.DefaultConfiguration;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.ByteSequence;
@@ -28,44 +30,43 @@ import org.apache.accumulo.core.file.blo
import org.apache.accumulo.core.file.rfile.RFile.Reader;
import org.apache.accumulo.core.file.rfile.RFile.Writer;
import org.apache.accumulo.core.util.CachedConfiguration;
-import org.apache.commons.cli.BasicParser;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
+import com.beust.jcommander.Parameter;
+
/**
* Split an RFile into large and small key/value files.
*
*/
public class SplitLarge {
+ static class Opts extends Help {
+ @Parameter(names="-m", description="the maximum size of the key/value pair to shunt to the small file")
+ long maxSize = 10 * 1024 * 1024;
+ @Parameter(description="<file.rf> { <file.rf> ... }")
+ List<String> files = new ArrayList<String>();
+ }
+
+
public static void main(String[] args) throws Exception {
Configuration conf = CachedConfiguration.getInstance();
FileSystem fs = FileSystem.get(conf);
long maxSize = 10 * 1024 * 1024;
+ Opts opts = new Opts();
+ opts.parseArgs(SplitLarge.class.getName(), args);
- Options opts = new Options();
- Option maxSizeOption = new Option("m", "", true, "the maximum size of the key/value pair to shunt to the small file");
- opts.addOption(maxSizeOption);
-
- CommandLine commandLine = new BasicParser().parse(opts, args);
- if (commandLine.hasOption(maxSizeOption.getOpt())) {
- maxSize = Long.parseLong(commandLine.getOptionValue(maxSizeOption.getOpt()));
- }
-
- for (String arg : commandLine.getArgs()) {
- Path path = new Path(arg);
+ for (String file : opts.files) {
+ Path path = new Path(file);
CachableBlockFile.Reader rdr = new CachableBlockFile.Reader(fs, path, conf, null, null);
Reader iter = new RFile.Reader(rdr);
- if (!arg.endsWith(".rf")) {
+ if (!file.endsWith(".rf")) {
throw new IllegalArgumentException("File must end with .rf");
}
- String smallName = arg.substring(0, arg.length() - 3) + "_small.rf";
- String largeName = arg.substring(0, arg.length() - 3) + "_large.rf";
+ String smallName = file.substring(0, file.length() - 3) + "_small.rf";
+ String largeName = file.substring(0, file.length() - 3) + "_large.rf";
int blockSize = (int) DefaultConfiguration.getDefaultConfiguration().getMemoryInBytes(Property.TABLE_FILE_BLOCK_SIZE);
Writer small = new RFile.Writer(new CachableBlockFile.Writer(fs, new Path(smallName), "gz", conf), blockSize);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/conf/ColumnSet.java Wed Dec 19 16:25:03 2012
@@ -92,7 +92,7 @@ public class ColumnSet {
return sb.toString();
}
-
+
static void encode(StringBuilder sb, Text t) {
for (int i = 0; i < t.getLength(); i++) {
int b = (0xff & t.getBytes()[i]);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingCombiner.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingCombiner.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingCombiner.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/iterators/user/SummingCombiner.java Wed Dec 19 16:25:03 2012
@@ -29,7 +29,8 @@ public class SummingCombiner extends Lon
public Long typedReduce(Key key, Iterator<Long> iter) {
long sum = 0;
while (iter.hasNext()) {
- sum = safeAdd(sum, iter.next());
+ Long next = iter.next();
+ sum = safeAdd(sum, next);
}
return sum;
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/master/thrift/TabletServerStatus.java Wed Dec 19 16:25:03 2012
@@ -1111,7 +1111,7 @@ import org.slf4j.LoggerFactory;
for (int _i1 = 0; _i1 < _map0.size; ++_i1)
{
String _key2; // required
- TableInfo _val3; // optional
+ TableInfo _val3; // required
_key2 = iprot.readString();
_val3 = new TableInfo();
_val3.read(iprot);
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/trace/TraceDump.java Wed Dec 19 16:25:03 2012
@@ -29,68 +29,49 @@ import java.util.Map.Entry;
import java.util.Set;
import org.apache.accumulo.cloudtrace.thrift.RemoteSpan;
+import org.apache.accumulo.core.cli.ClientOnDefaultTable;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
-import org.apache.commons.cli.BasicParser;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.Options;
import org.apache.hadoop.io.Text;
+import com.beust.jcommander.Parameter;
+
public class TraceDump {
static final long DEFAULT_TIME_IN_MILLIS = 10 * 60 * 1000l;
- private static final Options OPTIONS = new Options();
- public static final Option LIST_SPANS = new Option("l", "list", false, "List recent traces.");
- public static final Option START_TIME = new Option("s", "start", true, "The start time of traces to display");
- public static final Option END_TIME = new Option("e", "end", true, "The end time of traces to display");
- public static final Option DUMP_TRACE = new Option("d", "dump", false, "Dump the traces");
- public static final Option INSTANCE_URL = new Option("i", "instance", true, "URL to point to accumulo.");
- public static final String TRACE_TABLE = "trace";
-
- static {
- for (Option opt : new Option[] {LIST_SPANS, START_TIME, END_TIME, DUMP_TRACE, INSTANCE_URL}) {
- OPTIONS.addOption(opt);
- }
+ static class Opts extends ClientOnDefaultTable {
+ @Parameter(names={"-l", "--list"}, description="List recent traces")
+ boolean list = false;
+ @Parameter(names={"-s", "--start"}, description="The start time of traces to display")
+ String start;
+ @Parameter(names={"-e", "--end"}, description="The end time of traces to display")
+ String end;
+ @Parameter(names={"-d", "--dump"}, description="Dump the traces")
+ boolean dump = false;
+ @Parameter(names={"-i", "--instance"}, description="URL to point to accumulo.")
+ String instance;
+ @Parameter(description=" <trace id> { <trace id> ... }")
+ List<String> traceIds = new ArrayList<String>();
+ Opts() { super("trace");}
}
public static void main(String[] args) throws Exception {
- CommandLine commandLine = new BasicParser().parse(OPTIONS, args);
+ Opts opts = new Opts();
+ opts.parseArgs(TraceDump.class.getName(), args);
int code = 0;
- if (code == 0 && commandLine.hasOption(LIST_SPANS.getLongOpt())) {
- code = listSpans(commandLine);
+ if (opts.list) {
+ code = listSpans(opts);
}
- if (code == 0 && commandLine.hasOption(DUMP_TRACE.getLongOpt())) {
- code = dumpTrace(commandLine);
+ if (code == 0 && opts.dump) {
+ code = dumpTrace(opts);
}
System.exit(code);
}
- public static InstanceUserPassword getInstance(CommandLine commandLine) {
- InstanceUserPassword result = null;
- String url = commandLine.getOptionValue(INSTANCE_URL.getOpt(), "zoo://root:secret@localhost/test");
- if (!url.startsWith("zoo://")) {
- throw new IllegalArgumentException("Instance url must start with zoo://");
- }
- String uri = url.substring(6); // root:secret@localhost/test
- String parts[] = uri.split("@", 2); // root:secret, localhost/test
- String userPass = parts[0];
- String zooInstance = parts[1];
- parts = userPass.split(":", 2); // root, secret
- String user = parts[0];
- String password = parts[1];
- parts = zooInstance.split("/", 2); // localhost, test
- String zoo = parts[0];
- String instance = parts[1];
- result = new InstanceUserPassword(new ZooKeeperInstance(instance, zoo), user, password);
- return result;
- }
-
public static List<RemoteSpan> sortByStart(Collection<RemoteSpan> spans) {
List<RemoteSpan> spanList = new ArrayList<RemoteSpan>(spans);
Collections.sort(spanList, new Comparator<RemoteSpan>() {
@@ -102,13 +83,13 @@ public class TraceDump {
return spanList;
}
- private static int listSpans(CommandLine commandLine) throws Exception {
+ private static int listSpans(Opts opts) throws Exception {
PrintStream out = System.out;
long endTime = System.currentTimeMillis();
long startTime = endTime - DEFAULT_TIME_IN_MILLIS;
- InstanceUserPassword info = getInstance(commandLine);
- Connector conn = info.instance.getConnector(info.username, info.password);
- Scanner scanner = conn.createScanner(TRACE_TABLE, conn.securityOperations().getUserAuthorizations(info.username));
+ Connector conn = opts.getConnector();
+ Scanner scanner = conn.createScanner(opts.getTableName(), opts.auths);
+ scanner.setBatchSize(opts.scanBatchSize);
Range range = new Range(new Text("start:" + Long.toHexString(startTime)), new Text("start:" + Long.toHexString(endTime)));
scanner.setRange(range);
out.println("Trace Day/Time (ms) Start");
@@ -123,15 +104,15 @@ public class TraceDump {
void print(String line);
}
- private static int dumpTrace(CommandLine commandLine) throws Exception {
+ private static int dumpTrace(Opts opts) throws Exception {
final PrintStream out = System.out;
- InstanceUserPassword info = getInstance(commandLine);
- Connector conn = info.instance.getConnector(info.username, info.password);
+ Connector conn = opts.getConnector();
int count = 0;
- for (Object arg : commandLine.getArgList()) {
- Scanner scanner = conn.createScanner(TRACE_TABLE, conn.securityOperations().getUserAuthorizations(info.username));
- Range range = new Range(new Text(arg.toString()));
+ for (String traceId : opts.traceIds) {
+ Scanner scanner = conn.createScanner(opts.getTableName(), opts.auths);
+ scanner.setBatchSize(opts.scanBatchSize);
+ Range range = new Range(new Text(traceId.toString()));
scanner.setRange(range);
count = printTrace(scanner, new Printer() {
@Override
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/LoggingRunnable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/LoggingRunnable.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/LoggingRunnable.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/LoggingRunnable.java Wed Dec 19 16:25:03 2012
@@ -46,20 +46,4 @@ public class LoggingRunnable implements
}
}
}
-
- public static void main(String[] args) {
- Runnable r = new Runnable() {
- @Override
- public void run() {
- int x[] = new int[0];
-
- x[0]++;
- }
- };
-
- LoggingRunnable lr = new LoggingRunnable(null, r);
- lr.run();
-
- }
-
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Merge.java Wed Dec 19 16:25:03 2012
@@ -22,10 +22,9 @@ import java.util.List;
import java.util.Map.Entry;
import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.cli.ClientOnRequiredTable;
import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.ZooKeeperInstance;
import org.apache.accumulo.core.client.impl.Tables;
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.conf.ConfigurationCopy;
@@ -33,13 +32,13 @@ import org.apache.accumulo.core.conf.Pro
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Value;
-import org.apache.commons.cli.BasicParser;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.hadoop.io.Text;
import org.apache.log4j.Logger;
+import com.beust.jcommander.IStringConverter;
+import com.beust.jcommander.Parameter;
+
public class Merge {
public static class MergeException extends Exception {
@@ -56,74 +55,48 @@ public class Merge {
log.info(String.format(format, args));
}
- public void start(String[] args) throws MergeException, ParseException {
- String keepers = "localhost";
- String instance = "instance";
- String table = null;
- long goalSize = -1;
- String user = "root";
- byte[] password = "secret".getBytes();
+ static class MemoryConverter implements IStringConverter<Long> {
+ @Override
+ public Long convert(String value) {
+ return AccumuloConfiguration.getMemoryInBytes(value);
+ }
+ }
+ static class TextConverter implements IStringConverter<Text> {
+ @Override
+ public Text convert(String value) {
+ return new Text(value);
+ }
+ }
+
+ static class Opts extends ClientOnRequiredTable {
+ @Parameter(names={"-s", "--size"}, description="merge goal size", converter=MemoryConverter.class)
+ Long goalSize = null;
+ @Parameter(names={"-f", "--force"}, description="merge small tablets even if merging them to larger tablets might cause a split")
boolean force = false;
+ @Parameter(names={"-b", "--begin"}, description="start tablet", converter=TextConverter.class)
Text begin = null;
+ @Parameter(names={"-e", "--end"}, description="end tablet", converter=TextConverter.class)
Text end = null;
+ }
+
+ public void start(String[] args) throws MergeException, ParseException {
+ Opts opts = new Opts();
+ opts.parseArgs(Merge.class.getCanonicalName(), args);
- Options options = new Options();
- options.addOption("k", "keepers", true, "ZooKeeper list");
- options.addOption("i", "instance", true, "instance name");
- options.addOption("t", "table", true, "table to merge");
- options.addOption("s", "size", true, "merge goal size");
- options.addOption("u", "user", true, "user");
- options.addOption("p", "password", true, "password");
- options.addOption("f", "force", false, "merge small tablets even if merging them to larger tablets might cause a split");
- options.addOption("b", "begin", true, "start tablet");
- options.addOption("e", "end", true, "end tablet");
- CommandLine commandLine = new BasicParser().parse(options, args);
- if (commandLine.hasOption("k")) {
- keepers = commandLine.getOptionValue("k");
- }
- if (commandLine.hasOption("i")) {
- instance = commandLine.getOptionValue("i");
- }
- if (commandLine.hasOption("t")) {
- table = commandLine.getOptionValue("t");
- }
- if (commandLine.hasOption("s")) {
- goalSize = AccumuloConfiguration.getMemoryInBytes(commandLine.getOptionValue("s"));
- }
- if (commandLine.hasOption("u")) {
- table = commandLine.getOptionValue("u");
- }
- if (commandLine.hasOption("p")) {
- password = commandLine.getOptionValue("p").getBytes();
- }
- if (commandLine.hasOption("f")) {
- force = true;
- }
- if (commandLine.hasOption("b")) {
- begin = new Text(commandLine.getOptionValue("b"));
- }
- if (commandLine.hasOption("e")) {
- end = new Text(commandLine.getOptionValue("e"));
- }
- if (table == null) {
- System.err.println("Specify the table to merge");
- return;
- }
- Instance zki = new ZooKeeperInstance(instance, keepers);
try {
- Connector conn = zki.getConnector(user, password);
+ Connector conn = opts.getConnector();
- if (!conn.tableOperations().exists(table)) {
- System.err.println("table " + table + " does not exist");
+ if (!conn.tableOperations().exists(opts.tableName)) {
+ System.err.println("table " + opts.tableName + " does not exist");
return;
}
- if (goalSize < 1) {
- AccumuloConfiguration tableConfig = new ConfigurationCopy(conn.tableOperations().getProperties(table));
- goalSize = tableConfig.getMemoryInBytes(Property.TABLE_SPLIT_THRESHOLD);
+ if (opts.goalSize == null || opts.goalSize < 1) {
+ AccumuloConfiguration tableConfig = new ConfigurationCopy(conn.tableOperations().getProperties(opts.tableName));
+ opts.goalSize = tableConfig.getMemoryInBytes(Property.TABLE_SPLIT_THRESHOLD);
}
- message("Merging tablets in table %s to %d bytes", table, goalSize);
- mergomatic(conn, table, begin, end, goalSize, force);
+ message("Merging tablets in table %s to %d bytes", opts.tableName, opts.goalSize);
+ mergomatic(conn, opts.tableName, opts.begin, opts.end, opts.goalSize, opts.force);
} catch (Exception ex) {
throw new MergeException(ex);
}
Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java?rev=1423923&r1=1423922&r2=1423923&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/TTimeoutTransport.java Wed Dec 19 16:25:03 2012
@@ -25,7 +25,8 @@ import java.net.Socket;
import java.net.SocketAddress;
import java.nio.channels.spi.SelectorProvider;
-import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.net.SocketInputStream;
+import org.apache.hadoop.net.SocketOutputStream;
import org.apache.thrift.transport.TIOStreamTransport;
import org.apache.thrift.transport.TTransport;
@@ -36,8 +37,8 @@ public class TTimeoutTransport {
socket.setSoLinger(false, 0);
socket.setTcpNoDelay(true);
socket.connect(addr);
- InputStream input = new BufferedInputStream(NetUtils.getInputStream(socket, timeoutMillis), 1024 * 10);
- OutputStream output = new BufferedOutputStream(NetUtils.getOutputStream(socket, timeoutMillis), 1024 * 10);
+ InputStream input = new BufferedInputStream(new SocketInputStream(socket, timeoutMillis), 1024 * 10);
+ OutputStream output = new BufferedOutputStream(new SocketOutputStream(socket, timeoutMillis), 1024 * 10);
return new TIOStreamTransport(input, output);
}
}
Added: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java?rev=1423923&view=auto
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java (added)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java Wed Dec 19 16:25:03 2012
@@ -0,0 +1,88 @@
+/*
+ * 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.cli;
+
+import static org.junit.Assert.*;
+
+import java.util.concurrent.TimeUnit;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.security.Authorizations;
+import org.junit.Test;
+
+import com.beust.jcommander.JCommander;
+
+public class TestClientOpts {
+
+ @Test
+ public void test() {
+ BatchWriterConfig cfg = new BatchWriterConfig();
+
+ // document the defaults
+ ClientOpts args = new ClientOpts();
+ assertEquals(System.getProperty("user.name"), args.user);
+ assertNull(args.securePassword);
+ assertArrayEquals("secret".getBytes(), args.getPassword());
+ assertEquals(new Long(cfg.getMaxLatency(TimeUnit.MILLISECONDS)), args.batchLatency);
+ assertEquals(new Long(cfg.getTimeout(TimeUnit.MILLISECONDS)), args.batchTimeout);
+ assertEquals(new Long(cfg.getMaxMemory()), args.batchMemory);
+ assertFalse(args.debug);
+ assertFalse(args.trace);
+ assertEquals(10, args.scanThreads.intValue());
+ assertEquals(null, args.instance);
+ assertEquals(Constants.NO_AUTHS, args.auths);
+ assertEquals("localhost:2181", args.zookeepers);
+ assertFalse(args.help);
+
+ args = evaluate(
+ "-u", "bar",
+ "-p", "foo",
+ "--batchLatency", "3s",
+ "--batchTimeout", "2s",
+ "--batchMemory", "1M",
+ "--debug",
+ "--trace",
+ "--scanThreads", "7",
+ "-i", "instance",
+ "--auths", "G1,G2,G3",
+ "-z", "zoohost1,zoohost2",
+ "--help"
+ );
+ assertEquals("bar", args.user);
+ assertNull(args.securePassword);
+ assertArrayEquals("foo".getBytes(), args.getPassword());
+ assertEquals(new Long(3000), args.batchLatency);
+ assertEquals(new Long(2000), args.batchTimeout);
+ assertEquals(new Long(1024*1024), args.batchMemory);
+ assertTrue(args.debug);
+ assertTrue(args.trace);
+ assertEquals(7, args.scanThreads.intValue());
+ assertEquals("instance", args.instance);
+ assertEquals(new Authorizations("G1", "G2", "G3"), args.auths);
+ assertEquals("zoohost1,zoohost2", args.zookeepers);
+ assertTrue(args.help);
+
+ }
+
+ private ClientOpts evaluate(String ... args) {
+ ClientOpts ca = new ClientOpts();
+ new JCommander(ca, args);
+ return ca;
+ }
+
+}
Propchange: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/cli/TestClientOpts.java
------------------------------------------------------------------------------
svn:eol-style = native