├── conf ├── regionservers └── hbase-site.xml ├── src ├── main │ ├── java │ │ └── org │ │ │ └── apache │ │ │ └── hadoop │ │ │ └── hbase │ │ │ ├── avro │ │ │ ├── hbase.genavro │ │ │ └── generated │ │ │ │ ├── ACompressionAlgorithm.java │ │ │ │ ├── IOError.java │ │ │ │ ├── AAlreadyExists.java │ │ │ │ ├── TCell.java │ │ │ │ ├── AIOError.java │ │ │ │ ├── ATableExists.java │ │ │ │ ├── AIllegalArgument.java │ │ │ │ ├── AMasterNotRunning.java │ │ │ │ ├── ATimeRange.java │ │ │ │ ├── AColumn.java │ │ │ │ ├── AServerAddress.java │ │ │ │ ├── ADelete.java │ │ │ │ └── AResult.java │ │ │ ├── zookeeper │ │ │ └── ZKTableDisable.java │ │ │ ├── rest │ │ │ ├── transform │ │ │ │ ├── NullTransform.java │ │ │ │ ├── Base64.java │ │ │ │ └── Transform.java │ │ │ ├── ResourceConfig.java │ │ │ ├── ResourceBase.java │ │ │ ├── metrics │ │ │ │ └── RESTStatistics.java │ │ │ ├── Constants.java │ │ │ └── ProtobufMessageHandler.java │ │ │ ├── ipc │ │ │ ├── ServerNotRunningException.java │ │ │ ├── HBaseRPCErrorHandler.java │ │ │ └── CoprocessorProtocol.java │ │ │ ├── TableExistsException.java │ │ │ ├── client │ │ │ ├── Row.java │ │ │ ├── RegionOfflineException.java │ │ │ ├── ScannerTimeoutException.java │ │ │ ├── NoServerForRegionException.java │ │ │ ├── HTableInterfaceFactory.java │ │ │ └── HTableFactory.java │ │ │ ├── coprocessor │ │ │ ├── MasterCoprocessorEnvironment.java │ │ │ └── RegionCoprocessorEnvironment.java │ │ │ ├── regionserver │ │ │ ├── FlushRequester.java │ │ │ ├── ChangedReadersObserver.java │ │ │ ├── RegionServerStoppedException.java │ │ │ ├── LeaseException.java │ │ │ ├── LeaseListener.java │ │ │ ├── wal │ │ │ │ ├── OrphanHLogAfterSplitException.java │ │ │ │ └── FailedLogCloseException.java │ │ │ ├── WrongRegionException.java │ │ │ ├── CompactionRequestor.java │ │ │ ├── NoSuchColumnFamilyException.java │ │ │ ├── handler │ │ │ │ ├── OpenMetaHandler.java │ │ │ │ └── OpenRootHandler.java │ │ │ └── RegionServerRunningException.java │ │ │ ├── Stoppable.java │ │ │ ├── ClockOutOfSyncException.java │ │ │ ├── DroppedSnapshotException.java │ │ │ ├── UnknownRegionException.java │ │ │ ├── util │ │ │ ├── EnvironmentEdge.java │ │ │ ├── DefaultEnvironmentEdge.java │ │ │ ├── FileSystemVersionException.java │ │ │ ├── IncrementingEnvironmentEdge.java │ │ │ ├── ManualEnvironmentEdge.java │ │ │ ├── HBaseConfTool.java │ │ │ └── JvmVersion.java │ │ │ ├── io │ │ │ ├── WritableWithSize.java │ │ │ └── HeapSize.java │ │ │ ├── TableNotFoundException.java │ │ │ ├── PleaseHoldException.java │ │ │ ├── YouAreDeadException.java │ │ │ ├── master │ │ │ ├── handler │ │ │ │ └── TotesHRegionInfo.java │ │ │ └── metrics │ │ │ │ └── MasterStatistics.java │ │ │ ├── filter │ │ │ ├── InvalidRowFilterException.java │ │ │ ├── IncompatibleFilterException.java │ │ │ ├── BinaryComparator.java │ │ │ └── package-info.java │ │ │ ├── UnknownRowLockException.java │ │ │ ├── mapred │ │ │ ├── Driver.java │ │ │ ├── TableReduce.java │ │ │ └── TableMap.java │ │ │ ├── RegionException.java │ │ │ ├── Abortable.java │ │ │ ├── mapreduce │ │ │ └── TableMapper.java │ │ │ ├── NotAllMetaRegionsOnlineException.java │ │ │ ├── UnknownScannerException.java │ │ │ ├── MasterNotRunningException.java │ │ │ ├── ZooKeeperConnectionException.java │ │ │ ├── DoNotRetryIOException.java │ │ │ ├── TableNotDisabledException.java │ │ │ ├── NotServingRegionException.java │ │ │ └── InvalidFamilyOperationException.java │ ├── resources │ │ ├── hbase-webapps │ │ │ ├── master │ │ │ │ ├── index.html │ │ │ │ └── zk.jsp │ │ │ ├── regionserver │ │ │ │ └── index.html │ │ │ └── static │ │ │ │ ├── hbase_logo_med.gif │ │ │ │ └── hbase.css │ │ └── org │ │ │ └── apache │ │ │ └── hadoop │ │ │ └── hbase │ │ │ ├── mapred │ │ │ └── RowCounter_Counters.properties │ │ │ ├── mapreduce │ │ │ └── RowCounter_Counters.properties │ │ │ └── rest │ │ │ └── protobuf │ │ │ ├── TableListMessage.proto │ │ │ ├── CellMessage.proto │ │ │ ├── CellSetMessage.proto │ │ │ ├── VersionMessage.proto │ │ │ ├── ScannerMessage.proto │ │ │ ├── TableInfoMessage.proto │ │ │ ├── ColumnSchemaMessage.proto │ │ │ └── TableSchemaMessage.proto │ ├── javadoc │ │ └── org │ │ │ └── apache │ │ │ └── hadoop │ │ │ └── hbase │ │ │ ├── thrift │ │ │ └── doc-files │ │ │ │ └── style.css │ │ │ ├── io │ │ │ └── hfile │ │ │ │ └── package.html │ │ │ └── ipc │ │ │ └── package.html │ └── ruby │ │ └── shell │ │ └── commands │ │ ├── zk_dump.rb │ │ ├── enable.rb │ │ ├── disable.rb │ │ ├── compact.rb │ │ ├── is_enabled.rb │ │ ├── is_disabled.rb │ │ ├── major_compact.rb │ │ ├── remove_peer.rb │ │ ├── drop.rb │ │ ├── exists.rb │ │ ├── truncate.rb │ │ ├── status.rb │ │ ├── balancer.rb │ │ ├── version.rb │ │ ├── flush.rb │ │ ├── enable_peer.rb │ │ ├── disable_peer.rb │ │ ├── assign.rb │ │ ├── describe.rb │ │ ├── balance_switch.rb │ │ ├── stop_replication.rb │ │ ├── start_replication.rb │ │ ├── put.rb │ │ ├── incr.rb │ │ ├── deleteall.rb │ │ ├── get_counter.rb │ │ ├── split.rb │ │ ├── unassign.rb │ │ ├── list.rb │ │ ├── add_peer.rb │ │ ├── delete.rb │ │ ├── create.rb │ │ └── close_region.rb ├── site │ └── resources │ │ └── images │ │ ├── favicon.ico │ │ ├── hadoop-logo.jpg │ │ ├── hbase_small.gif │ │ ├── architecture.gif │ │ ├── asf_logo_wide.png │ │ ├── hbase_logo_med.gif │ │ └── replication_overview.png ├── examples │ ├── README.txt │ ├── mapreduce │ │ └── index-builder-setup.rb │ └── thrift │ │ ├── README.txt │ │ └── Makefile └── test │ ├── java │ └── org │ │ └── apache │ │ └── hadoop │ │ └── hbase │ │ ├── EmptyWatcher.java │ │ ├── util │ │ ├── EnvironmentEdgeManagerTestHelper.java │ │ ├── TestIncrementingEnvironmentEdge.java │ │ └── SoftValueSortedMapTest.java │ │ └── coprocessor │ │ └── ColumnAggregationProtocol.java │ ├── ruby │ └── shell │ │ └── commands_test.rb │ └── resources │ ├── org │ └── apache │ │ └── hadoop │ │ └── hbase │ │ └── PerformanceEvaluation_Counter.properties │ └── log4j.properties ├── .gitignore ├── NOTICE.txt ├── bin ├── local-master-backup.sh └── local-regionservers.sh └── README.txt /conf/regionservers: -------------------------------------------------------------------------------- 1 | localhost 2 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/hbase.genavro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/zookeeper/ZKTableDisable.java: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/main/resources/hbase-webapps/master/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/main/resources/hbase-webapps/regionserver/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/site/resources/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/hbase/trunk/src/site/resources/images/favicon.ico -------------------------------------------------------------------------------- /src/site/resources/images/hadoop-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/hbase/trunk/src/site/resources/images/hadoop-logo.jpg -------------------------------------------------------------------------------- /src/site/resources/images/hbase_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/hbase/trunk/src/site/resources/images/hbase_small.gif -------------------------------------------------------------------------------- /src/site/resources/images/architecture.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/hbase/trunk/src/site/resources/images/architecture.gif -------------------------------------------------------------------------------- /src/site/resources/images/asf_logo_wide.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/hbase/trunk/src/site/resources/images/asf_logo_wide.png -------------------------------------------------------------------------------- /src/site/resources/images/hbase_logo_med.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/hbase/trunk/src/site/resources/images/hbase_logo_med.gif -------------------------------------------------------------------------------- /src/site/resources/images/replication_overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/hbase/trunk/src/site/resources/images/replication_overview.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.classpath 2 | /.externalToolBuilders 3 | /.project 4 | /.settings 5 | /build 6 | /.idea/ 7 | /logs 8 | /target 9 | *.iml 10 | *.orig 11 | *~ 12 | -------------------------------------------------------------------------------- /src/main/resources/hbase-webapps/static/hbase_logo_med.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/hbase/trunk/src/main/resources/hbase-webapps/static/hbase_logo_med.gif -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/mapred/RowCounter_Counters.properties: -------------------------------------------------------------------------------- 1 | 2 | # ResourceBundle properties file for RowCounter MR job 3 | 4 | CounterGroupName= RowCounter 5 | 6 | ROWS.name= Rows -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/mapreduce/RowCounter_Counters.properties: -------------------------------------------------------------------------------- 1 | 2 | # ResourceBundle properties file for RowCounter MR job 3 | 4 | CounterGroupName= RowCounter 5 | 6 | ROWS.name= Rows 7 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/ACompressionAlgorithm.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public enum ACompressionAlgorithm { 10 | LZO, GZ, NONE 11 | } 12 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | This product includes software developed by The Apache Software 2 | Foundation (http://www.apache.org/). 3 | 4 | In addition, this product includes software developed by: 5 | 6 | Facebook, Inc. (http://developers.facebook.com/thrift/ -- Page includes the Thrift Software License) 7 | 8 | JUnit (http://www.junit.org/) 9 | -------------------------------------------------------------------------------- /src/main/resources/hbase-webapps/static/hbase.css: -------------------------------------------------------------------------------- 1 | h1, h2, h3 { color: DarkSlateBlue } 2 | table { border: thin solid DodgerBlue } 3 | tr { border: thin solid DodgerBlue } 4 | td { border: thin solid DodgerBlue } 5 | th { border: thin solid DodgerBlue } 6 | #logo {float: left;} 7 | #logo img {border: none;} 8 | #page_title {padding-top: 27px;} 9 | 10 | div.warning { 11 | border: 1px solid #666; 12 | background-color: #fcc; 13 | font-size: 110%; 14 | font-weight: bold; 15 | } 16 | 17 | td.undeployed-region { 18 | background-color: #faa; 19 | } 20 | -------------------------------------------------------------------------------- /src/examples/README.txt: -------------------------------------------------------------------------------- 1 | Example code. 2 | 3 | * src/examples/thrift 4 | Examples for interacting with HBase via Thrift from C++, PHP, Python and Ruby. 5 | * org.apache.hadoop.hbase.mapreduce.SampleUploader 6 | Demonstrates uploading data from text files (presumably stored in HDFS) to HBase. 7 | * org.apache.hadoop.hbase.mapreduce.IndexBuilder 8 | Demonstrates map/reduce with a table as the source and other tables as the sink. 9 | 10 | As of 0.20 there is no ant target for building the examples. You can easily build 11 | the Java examples by copying them to the right location in the main source hierarchy. -------------------------------------------------------------------------------- /src/examples/mapreduce/index-builder-setup.rb: -------------------------------------------------------------------------------- 1 | # Set up sample data for IndexBuilder example 2 | create "people", "attributes" 3 | create "people-email", "INDEX" 4 | create "people-phone", "INDEX" 5 | create "people-name", "INDEX" 6 | 7 | [["1", "jenny", "jenny@example.com", "867-5309"], 8 | ["2", "alice", "alice@example.com", "555-1234"], 9 | ["3", "kevin", "kevinpet@example.com", "555-1212"]].each do |fields| 10 | (id, name, email, phone) = *fields 11 | put "people", id, "attributes:name", name 12 | put "people", id, "attributes:email", email 13 | put "people", id, "attributes:phone", phone 14 | end 15 | 16 | -------------------------------------------------------------------------------- /src/main/javadoc/org/apache/hadoop/hbase/thrift/doc-files/style.css: -------------------------------------------------------------------------------- 1 | /* Auto-generated CSS for generated Thrift docs */ 2 | body { font-family: Tahoma, sans-serif; } 3 | pre { background-color: #dddddd; padding: 6px; } 4 | h3,h4 { padding-top: 0px; margin-top: 0px; } 5 | div.definition { border: 1px solid gray; margin: 10px; padding: 10px; } 6 | div.extends { margin: -0.5em 0 1em 5em } 7 | table { border: 1px solid grey; border-collapse: collapse; } 8 | td { border: 1px solid grey; padding: 1px 6px; vertical-align: top; } 9 | th { border: 1px solid black; background-color: #bbbbbb; 10 | text-align: left; padding: 1px 6px; } 11 | -------------------------------------------------------------------------------- /src/examples/thrift/README.txt: -------------------------------------------------------------------------------- 1 | Hbase Thrift Client Examples 2 | ============================ 3 | 4 | Included in this directory are sample clients of the HBase ThriftServer. They 5 | all perform the same actions but are implemented in C++, Java, Ruby, PHP, and 6 | Python respectively. 7 | 8 | To run/compile this clients, you will first need to install the thrift package 9 | (from http://developers.facebook.com/thrift/) and then run thrift to generate 10 | the language files: 11 | 12 | thrift --gen cpp --gen java --gen rb --gen py -php \ 13 | ../../../src/java/org/apache/hadoop/hbase/thrift/Hbase.thrift 14 | 15 | See the individual DemoClient test files for more specific instructions on 16 | running each test. 17 | -------------------------------------------------------------------------------- /bin/local-master-backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is used for starting multiple masters on the same machine. 3 | # run it from hbase-dir/ just like 'bin/hbase' 4 | # Supports up to 10 masters (limitation = overlapping ports) 5 | 6 | bin=`dirname "${BASH_SOURCE-$0}"` 7 | bin=`cd "$bin" >/dev/null && pwd` 8 | 9 | if [ $# -lt 2 ]; then 10 | S=`basename "${BASH_SOURCE-$0}"` 11 | echo "Usage: $S [start|stop] offset(s)" 12 | echo "" 13 | echo " e.g. $S start 1" 14 | exit 15 | fi 16 | 17 | # sanity check: make sure your master opts don't use ports [i.e. JMX/DBG] 18 | export HBASE_MASTER_OPTS=" " 19 | 20 | run_master () { 21 | DN=$2 22 | export HBASE_IDENT_STRING="$USER-$DN" 23 | HBASE_MASTER_ARGS="\ 24 | --backup \ 25 | -D hbase.master.port=`expr 60000 + $DN` \ 26 | -D hbase.master.info.port=`expr 60010 + $DN`" 27 | "$bin"/hbase-daemon.sh $1 master $HBASE_MASTER_ARGS 28 | } 29 | 30 | cmd=$1 31 | shift; 32 | 33 | for i in $* 34 | do 35 | run_master $cmd $i 36 | done 37 | -------------------------------------------------------------------------------- /bin/local-regionservers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is used for starting multiple regionservers on the same machine. 3 | # run it from hbase-dir/ just like 'bin/hbase' 4 | # Supports up to 100 regionservers (limitation = overlapping ports) 5 | 6 | bin=`dirname "${BASH_SOURCE-$0}"` 7 | bin=`cd "$bin" >/dev/null && pwd` 8 | 9 | if [ $# -lt 2 ]; then 10 | S=`basename "${BASH_SOURCE-$0}"` 11 | echo "Usage: $S [start|stop] offset(s)" 12 | echo "" 13 | echo " e.g. $S start 1 2" 14 | exit 15 | fi 16 | 17 | # sanity check: make sure your regionserver opts don't use ports [i.e. JMX/DBG] 18 | export HBASE_REGIONSERVER_OPTS=" " 19 | 20 | run_regionserver () { 21 | DN=$2 22 | export HBASE_IDENT_STRING="$USER-$DN" 23 | HBASE_REGIONSERVER_ARGS="\ 24 | -D hbase.regionserver.port=`expr 60200 + $DN` \ 25 | -D hbase.regionserver.info.port=`expr 60300 + $DN`" 26 | "$bin"/hbase-daemon.sh $1 regionserver $HBASE_REGIONSERVER_ARGS 27 | } 28 | 29 | cmd=$1 30 | shift; 31 | 32 | for i in $* 33 | do 34 | run_regionserver $cmd $i 35 | done 36 | -------------------------------------------------------------------------------- /conf/hbase-site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/javadoc/org/apache/hadoop/hbase/io/hfile/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 22 | 23 | Provides the hbase data+index+metadata file. 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/main/javadoc/org/apache/hadoop/hbase/ipc/package.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 19 | 20 | 21 | Tools to help define network clients and servers. 22 | This is the hadoop copied local so can fix bugs and make hbase-specific optimizations. 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableListMessage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Apache Software Foundation 2 | // 3 | // Licensed to the Apache Software Foundation (ASF) under one 4 | // or more contributor license agreements. See the NOTICE file 5 | // distributed with this work for additional information 6 | // regarding copyright ownership. The ASF licenses this file 7 | // to you under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in compliance 9 | // with the License. You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | package org.apache.hadoop.hbase.rest.protobuf.generated; 20 | 21 | message TableList { 22 | repeated string name = 1; 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/IOError.java: -------------------------------------------------------------------------------- 1 | package org.apache.hadoop.hbase.avro.generated; 2 | 3 | @SuppressWarnings("all") 4 | public class IOError extends org.apache.avro.specific.SpecificExceptionBase implements org.apache.avro.specific.SpecificRecord { 5 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"error\",\"name\":\"IOError\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"message\",\"type\":\"string\"}]}"); 6 | public org.apache.avro.util.Utf8 message; 7 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 8 | public java.lang.Object get(int field$) { 9 | switch (field$) { 10 | case 0: return message; 11 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 12 | } 13 | } 14 | @SuppressWarnings(value="unchecked") 15 | public void put(int field$, java.lang.Object value$) { 16 | switch (field$) { 17 | case 0: message = (org.apache.avro.util.Utf8)value$; break; 18 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/AAlreadyExists.java: -------------------------------------------------------------------------------- 1 | package org.apache.hadoop.hbase.avro.generated; 2 | 3 | @SuppressWarnings("all") 4 | public class AAlreadyExists extends org.apache.avro.specific.SpecificExceptionBase implements org.apache.avro.specific.SpecificRecord { 5 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"error\",\"name\":\"AAlreadyExists\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"message\",\"type\":\"string\"}]}"); 6 | public org.apache.avro.util.Utf8 message; 7 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 8 | public java.lang.Object get(int field$) { 9 | switch (field$) { 10 | case 0: return message; 11 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 12 | } 13 | } 14 | @SuppressWarnings(value="unchecked") 15 | public void put(int field$, java.lang.Object value$) { 16 | switch (field$) { 17 | case 0: message = (org.apache.avro.util.Utf8)value$; break; 18 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/rest/transform/NullTransform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.rest.transform; 22 | 23 | public class NullTransform implements Transform { 24 | @Override 25 | public byte[] transform(byte[] data, Direction direction) { 26 | return data; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/ipc/ServerNotRunningException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.ipc; 22 | 23 | import java.io.IOException; 24 | 25 | public class ServerNotRunningException extends IOException { 26 | public ServerNotRunningException(String s) { 27 | super(s); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellMessage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Apache Software Foundation 2 | // 3 | // Licensed to the Apache Software Foundation (ASF) under one 4 | // or more contributor license agreements. See the NOTICE file 5 | // distributed with this work for additional information 6 | // regarding copyright ownership. The ASF licenses this file 7 | // to you under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in compliance 9 | // with the License. You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | package org.apache.hadoop.hbase.rest.protobuf.generated; 20 | 21 | message Cell { 22 | optional bytes row = 1; // unused if Cell is in a CellSet 23 | optional bytes column = 2; 24 | optional int64 timestamp = 3; 25 | optional bytes data = 4; 26 | } 27 | -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/rest/protobuf/CellSetMessage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Apache Software Foundation 2 | // 3 | // Licensed to the Apache Software Foundation (ASF) under one 4 | // or more contributor license agreements. See the NOTICE file 5 | // distributed with this work for additional information 6 | // regarding copyright ownership. The ASF licenses this file 7 | // to you under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in compliance 9 | // with the License. You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | import "CellMessage.proto"; 20 | 21 | package org.apache.hadoop.hbase.rest.protobuf.generated; 22 | 23 | message CellSet { 24 | message Row { 25 | required bytes key = 1; 26 | repeated Cell values = 2; 27 | } 28 | repeated Row rows = 1; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/zk_dump.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class ZkDump < Command 24 | def help 25 | return <<-EOF 26 | Dump status of HBase cluster as seen by ZooKeeper. 27 | EOF 28 | end 29 | 30 | def command 31 | puts admin.zk_dump 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/TableExistsException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.hadoop.hbase; 17 | 18 | import java.io.IOException; 19 | 20 | /** 21 | * Thrown when a table exists but should not 22 | */ 23 | public class TableExistsException extends IOException { 24 | private static final long serialVersionUID = 1L << 7 - 1L; 25 | /** default constructor */ 26 | public TableExistsException() { 27 | super(); 28 | } 29 | 30 | /** 31 | * Constructor 32 | * 33 | * @param s message 34 | */ 35 | public TableExistsException(String s) { 36 | super(s); 37 | } 38 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/client/Row.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.client; 21 | 22 | import org.apache.hadoop.io.WritableComparable; 23 | 24 | /** 25 | * Has a row. 26 | */ 27 | public interface Row extends WritableComparable { 28 | /** 29 | * @return The row. 30 | */ 31 | public byte [] getRow(); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/rest/ResourceConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.rest; 22 | 23 | import com.sun.jersey.api.core.PackagesResourceConfig; 24 | 25 | public class ResourceConfig extends PackagesResourceConfig { 26 | public ResourceConfig() { 27 | super("org.apache.hadoop.hbase.rest"); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/TCell.java: -------------------------------------------------------------------------------- 1 | package org.apache.hadoop.hbase.avro.generated; 2 | 3 | @SuppressWarnings("all") 4 | public class TCell extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 5 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"TCell\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"value\",\"type\":\"bytes\"},{\"name\":\"timestamp\",\"type\":\"long\"}]}"); 6 | public java.nio.ByteBuffer value; 7 | public long timestamp; 8 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 9 | public java.lang.Object get(int field$) { 10 | switch (field$) { 11 | case 0: return value; 12 | case 1: return timestamp; 13 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 14 | } 15 | } 16 | @SuppressWarnings(value="unchecked") 17 | public void put(int field$, java.lang.Object value$) { 18 | switch (field$) { 19 | case 0: value = (java.nio.ByteBuffer)value$; break; 20 | case 1: timestamp = (java.lang.Long)value$; break; 21 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/rest/ResourceBase.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.rest; 22 | 23 | import java.io.IOException; 24 | 25 | public class ResourceBase implements Constants { 26 | 27 | RESTServlet servlet; 28 | 29 | public ResourceBase() throws IOException { 30 | servlet = RESTServlet.getInstance(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/rest/protobuf/VersionMessage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Apache Software Foundation 2 | // 3 | // Licensed to the Apache Software Foundation (ASF) under one 4 | // or more contributor license agreements. See the NOTICE file 5 | // distributed with this work for additional information 6 | // regarding copyright ownership. The ASF licenses this file 7 | // to you under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in compliance 9 | // with the License. You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | package org.apache.hadoop.hbase.rest.protobuf.generated; 20 | 21 | message Version { 22 | optional string restVersion = 1; 23 | optional string jvmVersion = 2; 24 | optional string osVersion = 3; 25 | optional string serverVersion = 4; 26 | optional string jerseyVersion = 5; 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/coprocessor/MasterCoprocessorEnvironment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.coprocessor; 22 | 23 | import org.apache.hadoop.hbase.master.MasterServices; 24 | 25 | public interface MasterCoprocessorEnvironment extends CoprocessorEnvironment { 26 | /** @return reference to the HMaster services */ 27 | MasterServices getMasterServices(); 28 | } 29 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/enable.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Enable < Command 24 | def help 25 | return <<-EOF 26 | Start enable of named table: e.g. "hbase> enable 't1'" 27 | EOF 28 | end 29 | 30 | def command(table) 31 | format_simple_command do 32 | admin.enable(table) 33 | end 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/disable.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Disable < Command 24 | def help 25 | return <<-EOF 26 | Start disable of named table: e.g. "hbase> disable 't1'" 27 | EOF 28 | end 29 | 30 | def command(table) 31 | format_simple_command do 32 | admin.disable(table) 33 | end 34 | end 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/FlushRequester.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.regionserver; 22 | 23 | /** 24 | * Request a flush. 25 | */ 26 | public interface FlushRequester { 27 | /** 28 | * Tell the listener the cache needs to be flushed. 29 | * 30 | * @param region the HRegion requesting the cache flush 31 | */ 32 | void requestFlush(HRegion region); 33 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/AIOError.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class AIOError extends org.apache.avro.specific.SpecificExceptionBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"error\",\"name\":\"AIOError\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"message\",\"type\":\"string\"}]}"); 11 | public java.lang.CharSequence message; 12 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 13 | // Used by DatumWriter. Applications should not call. 14 | public java.lang.Object get(int field$) { 15 | switch (field$) { 16 | case 0: return message; 17 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 18 | } 19 | } 20 | // Used by DatumReader. Applications should not call. 21 | @SuppressWarnings(value="unchecked") 22 | public void put(int field$, java.lang.Object value$) { 23 | switch (field$) { 24 | case 0: message = (java.lang.CharSequence)value$; break; 25 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/ATableExists.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class ATableExists extends org.apache.avro.specific.SpecificExceptionBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"error\",\"name\":\"ATableExists\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"message\",\"type\":\"string\"}]}"); 11 | public java.lang.CharSequence message; 12 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 13 | // Used by DatumWriter. Applications should not call. 14 | public java.lang.Object get(int field$) { 15 | switch (field$) { 16 | case 0: return message; 17 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 18 | } 19 | } 20 | // Used by DatumReader. Applications should not call. 21 | @SuppressWarnings(value="unchecked") 22 | public void put(int field$, java.lang.Object value$) { 23 | switch (field$) { 24 | case 0: message = (java.lang.CharSequence)value$; break; 25 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/Stoppable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | /** 23 | * Implementers are Stoppable. 24 | */ 25 | public interface Stoppable { 26 | /** 27 | * Stop this service. 28 | * @param why Why we're stopping. 29 | */ 30 | public void stop(String why); 31 | 32 | /** 33 | * @return True if {@link #stop(String)} has been closed. 34 | */ 35 | public boolean isStopped(); 36 | } -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ScannerMessage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Apache Software Foundation 2 | // 3 | // Licensed to the Apache Software Foundation (ASF) under one 4 | // or more contributor license agreements. See the NOTICE file 5 | // distributed with this work for additional information 6 | // regarding copyright ownership. The ASF licenses this file 7 | // to you under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in compliance 9 | // with the License. You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | package org.apache.hadoop.hbase.rest.protobuf.generated; 20 | 21 | message Scanner { 22 | optional bytes startRow = 1; 23 | optional bytes endRow = 2; 24 | repeated bytes columns = 3; 25 | optional int32 batch = 4; 26 | optional int64 startTime = 5; 27 | optional int64 endTime = 6; 28 | optional int32 maxVersions = 7; 29 | optional string filter = 8; 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/AIllegalArgument.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class AIllegalArgument extends org.apache.avro.specific.SpecificExceptionBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"error\",\"name\":\"AIllegalArgument\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"message\",\"type\":\"string\"}]}"); 11 | public java.lang.CharSequence message; 12 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 13 | // Used by DatumWriter. Applications should not call. 14 | public java.lang.Object get(int field$) { 15 | switch (field$) { 16 | case 0: return message; 17 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 18 | } 19 | } 20 | // Used by DatumReader. Applications should not call. 21 | @SuppressWarnings(value="unchecked") 22 | public void put(int field$, java.lang.Object value$) { 23 | switch (field$) { 24 | case 0: message = (java.lang.CharSequence)value$; break; 25 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/AMasterNotRunning.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class AMasterNotRunning extends org.apache.avro.specific.SpecificExceptionBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"error\",\"name\":\"AMasterNotRunning\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"message\",\"type\":\"string\"}]}"); 11 | public java.lang.CharSequence message; 12 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 13 | // Used by DatumWriter. Applications should not call. 14 | public java.lang.Object get(int field$) { 15 | switch (field$) { 16 | case 0: return message; 17 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 18 | } 19 | } 20 | // Used by DatumReader. Applications should not call. 21 | @SuppressWarnings(value="unchecked") 22 | public void put(int field$, java.lang.Object value$) { 23 | switch (field$) { 24 | case 0: message = (java.lang.CharSequence)value$; break; 25 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableInfoMessage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Apache Software Foundation 2 | // 3 | // Licensed to the Apache Software Foundation (ASF) under one 4 | // or more contributor license agreements. See the NOTICE file 5 | // distributed with this work for additional information 6 | // regarding copyright ownership. The ASF licenses this file 7 | // to you under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in compliance 9 | // with the License. You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | package org.apache.hadoop.hbase.rest.protobuf.generated; 20 | 21 | message TableInfo { 22 | required string name = 1; 23 | message Region { 24 | required string name = 1; 25 | optional bytes startKey = 2; 26 | optional bytes endKey = 3; 27 | optional int64 id = 4; 28 | optional string location = 5; 29 | } 30 | repeated Region regions = 2; 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/ClockOutOfSyncException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * This exception is thrown by the master when a region server clock skew is 26 | * too high. 27 | */ 28 | @SuppressWarnings("serial") 29 | public class ClockOutOfSyncException extends IOException { 30 | public ClockOutOfSyncException(String message) { 31 | super(message); 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/ChangedReadersObserver.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.regionserver; 22 | 23 | import java.io.IOException; 24 | 25 | 26 | /** 27 | * If set of MapFile.Readers in Store change, implementors are notified. 28 | */ 29 | public interface ChangedReadersObserver { 30 | /** 31 | * Notify observers. 32 | * @throws IOException e 33 | */ 34 | void updateReaders() throws IOException; 35 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCErrorHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.ipc; 22 | 23 | /** 24 | * An interface for calling out of RPC for error conditions. 25 | */ 26 | public interface HBaseRPCErrorHandler { 27 | /** 28 | * Take actions on the event of an OutOfMemoryError. 29 | * @param e the throwable 30 | * @return if the server should be shut down 31 | */ 32 | public boolean checkOOME(final Throwable e) ; 33 | } 34 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/compact.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Compact < Command 24 | def help 25 | return <<-EOF 26 | Compact all regions in passed table or pass a region row 27 | to compact an individual region 28 | EOF 29 | end 30 | 31 | def command(table_or_region_name) 32 | format_simple_command do 33 | admin.compact(table_or_region_name) 34 | end 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/DroppedSnapshotException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.apache.hadoop.hbase; 17 | import java.io.IOException; 18 | 19 | 20 | /** 21 | * Thrown during flush if the possibility snapshot content was not properly 22 | * persisted into store files. Response should include replay of hlog content. 23 | */ 24 | public class DroppedSnapshotException extends IOException { 25 | 26 | private static final long serialVersionUID = -5463156580831677374L; 27 | 28 | /** 29 | * @param msg 30 | */ 31 | public DroppedSnapshotException(String msg) { 32 | super(msg); 33 | } 34 | 35 | /** 36 | * default constructor 37 | */ 38 | public DroppedSnapshotException() { 39 | super(); 40 | } 41 | } -------------------------------------------------------------------------------- /src/test/java/org/apache/hadoop/hbase/EmptyWatcher.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import org.apache.zookeeper.Watcher; 23 | import org.apache.zookeeper.WatchedEvent; 24 | 25 | /** 26 | * Class used as an empty watche for the tests 27 | */ 28 | public class EmptyWatcher implements Watcher{ 29 | public static EmptyWatcher instance = new EmptyWatcher(); 30 | private EmptyWatcher() {} 31 | 32 | public void process(WatchedEvent event) {} 33 | } 34 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/is_enabled.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class IsEnabled < Command 24 | def help 25 | return <<-EOF 26 | Is named table enabled?: e.g. "hbase> is_enabled 't1'" 27 | EOF 28 | end 29 | 30 | def command(table) 31 | format_simple_command do 32 | formatter.row([ 33 | admin.enabled?(table)? "true" : "false" 34 | ]) 35 | end 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/UnknownRegionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Thrown when we are asked to operate on a region we know nothing about. 26 | */ 27 | public class UnknownRegionException extends IOException { 28 | private static final long serialVersionUID = 1968858760475205392L; 29 | 30 | public UnknownRegionException(String regionName) { 31 | super(regionName); 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/is_disabled.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class IsDisabled < Command 24 | def help 25 | return <<-EOF 26 | Is named table disabled?: e.g. "hbase> is_disabled 't1'" 27 | EOF 28 | end 29 | 30 | def command(table) 31 | format_simple_command do 32 | formatter.row([ 33 | admin.disabled?(table)? "true" : "false" 34 | ]) 35 | end 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/major_compact.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class MajorCompact < Command 24 | def help 25 | return <<-EOF 26 | Run major compaction on passed table or pass a region row 27 | to major compact an individual region 28 | EOF 29 | end 30 | 31 | def command(table_or_region_name) 32 | format_simple_command do 33 | admin.major_compact(table_or_region_name) 34 | end 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /src/test/ruby/shell/commands_test.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | require 'shell' 22 | require 'shell/formatter' 23 | 24 | class ShellCommandsTest < Test::Unit::TestCase 25 | Shell.commands.each do |name, klass| 26 | define_test "#{name} command class #{klass} should respond to help" do 27 | assert_respond_to(klass.new(nil), :help) 28 | end 29 | 30 | define_test "#{name} command class #{klass} should respond to :command" do 31 | assert_respond_to(klass.new(nil), :command) 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/util/EnvironmentEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.util; 21 | 22 | /** 23 | * Has some basic interaction with the environment. Alternate implementations 24 | * can be used where required (eg in tests). 25 | * 26 | * @see EnvironmentEdgeManager 27 | */ 28 | public interface EnvironmentEdge { 29 | 30 | /** 31 | * Returns the currentTimeMillis. 32 | * 33 | * @return currentTimeMillis. 34 | */ 35 | long currentTimeMillis(); 36 | } 37 | -------------------------------------------------------------------------------- /src/examples/thrift/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2008 The Apache Software Foundation 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # Makefile for C++ Hbase Thrift DemoClient 20 | # NOTE: run 'thrift -cpp Hbase.thrift' first 21 | 22 | THRIFT_DIR = /usr/local/include/thrift 23 | LIB_DIR = /usr/local/lib 24 | 25 | GEN_SRC = ./gen-cpp/Hbase.cpp \ 26 | ./gen-cpp/Hbase_types.cpp \ 27 | ./gen-cpp/Hbase_constants.cpp 28 | 29 | default: DemoClient 30 | 31 | DemoClient: DemoClient.cpp 32 | g++ -o DemoClient -I${THRIFT_DIR} -I./gen-cpp -L${LIB_DIR} -lthrift DemoClient.cpp ${GEN_SRC} 33 | 34 | clean: 35 | rm -rf DemoClient 36 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/remove_peer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class RemovePeer< Command 24 | def help 25 | return <<-EOF 26 | Stops the specified replication stream and deletes all the meta 27 | information kept about it. Examples: 28 | 29 | hbase> remove_peer '1' 30 | EOF 31 | end 32 | 33 | def command(id) 34 | format_simple_command do 35 | replication_admin.remove_peer(id) 36 | end 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/drop.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Drop < Command 24 | def help 25 | return <<-EOF 26 | Drop the named table. Table must first be disabled. If table has 27 | more than one region, run a major compaction on .META.: 28 | 29 | hbase> major_compact ".META." 30 | EOF 31 | end 32 | 33 | def command(table) 34 | format_simple_command do 35 | admin.drop(table) 36 | end 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/exists.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Exists < Command 24 | def help 25 | return <<-EOF 26 | Does the named table exist? e.g. "hbase> exists 't1'" 27 | EOF 28 | end 29 | 30 | def command(table) 31 | format_simple_command do 32 | formatter.row([ 33 | "Table #{table} " + (admin.exists?(table.to_s) ? "does exist" : "does not exist") 34 | ]) 35 | end 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/truncate.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Truncate < Command 24 | def help 25 | return <<-EOF 26 | Disables, drops and recreates the specified table. 27 | EOF 28 | end 29 | 30 | def command(table) 31 | format_simple_command do 32 | puts "Truncating '#{table}' table (it may take a while):" 33 | admin.truncate(table) { |log| puts " - #{log}" } 34 | end 35 | end 36 | 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/io/WritableWithSize.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.io; 22 | 23 | /** 24 | * An optional interface to 'size' writables. 25 | */ 26 | public interface WritableWithSize { 27 | /** 28 | * Provide a size hint to the caller. write() should ideally 29 | * not go beyond this if at all possible. 30 | * 31 | * You can return 0 if there is no size hint. 32 | * 33 | * @return the size of the writable 34 | */ 35 | public long getWritableSize(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/util/DefaultEnvironmentEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.util; 21 | 22 | /** 23 | * Default implementation of an environment edge. 24 | */ 25 | public class DefaultEnvironmentEdge implements EnvironmentEdge { 26 | 27 | 28 | /** 29 | * {@inheritDoc} 30 | *

31 | * This implementation returns {@link System#currentTimeMillis()} 32 | */ 33 | @Override 34 | public long currentTimeMillis() { 35 | return System.currentTimeMillis(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/rest/protobuf/ColumnSchemaMessage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Apache Software Foundation 2 | // 3 | // Licensed to the Apache Software Foundation (ASF) under one 4 | // or more contributor license agreements. See the NOTICE file 5 | // distributed with this work for additional information 6 | // regarding copyright ownership. The ASF licenses this file 7 | // to you under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in compliance 9 | // with the License. You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | package org.apache.hadoop.hbase.rest.protobuf.generated; 20 | 21 | message ColumnSchema { 22 | optional string name = 1; 23 | message Attribute { 24 | required string name = 1; 25 | required string value = 2; 26 | } 27 | repeated Attribute attrs = 2; 28 | // optional helpful encodings of commonly used attributes 29 | optional int32 ttl = 3; 30 | optional int32 maxVersions = 4; 31 | optional string compression = 5; 32 | } 33 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/status.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Status < Command 24 | def help 25 | return <<-EOF 26 | Show cluster status. Can be 'summary', 'simple', or 'detailed'. The 27 | default is 'summary'. Examples: 28 | 29 | hbase> status 30 | hbase> status 'simple' 31 | hbase> status 'summary' 32 | hbase> status 'detailed' 33 | EOF 34 | end 35 | 36 | def command(format = 'summary') 37 | admin.status(format) 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/TableNotFoundException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | /** Thrown when a table can not be located */ 23 | public class TableNotFoundException extends RegionException { 24 | private static final long serialVersionUID = 993179627856392526L; 25 | 26 | /** default constructor */ 27 | public TableNotFoundException() { 28 | super(); 29 | } 30 | 31 | /** @param s message */ 32 | public TableNotFoundException(String s) { 33 | super(s); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/balancer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Balancer < Command 24 | def help 25 | return <<-EOF 26 | Trigger the cluster balancer. Returns true if balancer ran. Otherwise 27 | false (Will not run if regions in transition). 28 | EOF 29 | end 30 | 31 | def command() 32 | format_simple_command do 33 | formatter.row([ 34 | admin.balancer()? "true": "false" 35 | ]) 36 | end 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/PleaseHoldException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * This exception is thrown by the master when a region server was shut down 26 | * and restarted so fast that the master still hasn't processed the server 27 | * shutdown of the first instance. 28 | */ 29 | @SuppressWarnings("serial") 30 | public class PleaseHoldException extends IOException { 31 | public PleaseHoldException(String message) { 32 | super(message); 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/version.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Version < Command 24 | def help 25 | return <<-EOF 26 | Output this HBase version 27 | EOF 28 | end 29 | 30 | def command 31 | # Output version. 32 | puts "#{org.apache.hadoop.hbase.util.VersionInfo.getVersion()}, " + 33 | "r#{org.apache.hadoop.hbase.util.VersionInfo.getRevision()}, " + 34 | "#{org.apache.hadoop.hbase.util.VersionInfo.getDate()}" 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/flush.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Flush < Command 24 | def help 25 | return <<-EOF 26 | Flush all regions in passed table or pass a region row to 27 | flush an individual region. For example: 28 | 29 | hbase> flush 'TABLENAME' 30 | hbase> flush 'REGIONNAME' 31 | EOF 32 | end 33 | 34 | def command(table_or_region_name) 35 | format_simple_command do 36 | admin.flush(table_or_region_name) 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/YouAreDeadException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * This exception is thrown by the master when a region server reports and is 26 | * already being processed as dead. This can happen when a region server loses 27 | * its session but didn't figure it yet. 28 | */ 29 | @SuppressWarnings("serial") 30 | public class YouAreDeadException extends IOException { 31 | public YouAreDeadException(String message) { 32 | super(message); 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/rest/transform/Base64.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.rest.transform; 22 | 23 | public class Base64 implements Transform { 24 | @Override 25 | public byte[] transform(byte[] data, Direction direction) { 26 | switch (direction) { 27 | case IN: 28 | return com.sun.jersey.core.util.Base64.encode(data); 29 | case OUT: 30 | return com.sun.jersey.core.util.Base64.decode(data); 31 | default: 32 | throw new RuntimeException("illegal direction"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/enable_peer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class EnablePeer< Command 24 | def help 25 | return <<-EOF 26 | Restarts the replication to the specified peer cluster, 27 | continuing from where it was disabled. 28 | 29 | CURRENTLY UNSUPPORTED 30 | 31 | Examples: 32 | 33 | hbase> enable_peer '1' 34 | EOF 35 | end 36 | 37 | def command(id) 38 | format_simple_command do 39 | replication_admin.enable_peer(id) 40 | end 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | Apache HBase [1] is an open-source, distributed, versioned, column-oriented 2 | store modeled after Google' Bigtable: A Distributed Storage System for 3 | Structured Data by Chang et al.[2] Just as Bigtable leverages the distributed 4 | data storage provided by the Google File System, HBase provides Bigtable-like 5 | capabilities on top of Apache Hadoop [3]. 6 | 7 | To get started using HBase, the full documentation for this release can be 8 | found under the doc/ directory that accompanies this README. Using a browser, 9 | open the docs/index.html to view the project home page (or browse to [1]). 10 | The hbase 'book' at docs/book.html has a 'quick start' section and is where you 11 | should being your exploration of the hbase project. 12 | 13 | The latest HBase can be downloaded from an Apache Mirror [4]. 14 | 15 | The source code can be found at [5] 16 | 17 | The HBase issue tracker is at [6] 18 | 19 | Apache HBase is made available under the Apache License, version 2.0 [7] 20 | 21 | The HBase mailing lists and archives are listed here [8]. 22 | 23 | 1. http://hbase.apache.org 24 | 2. http://labs.google.com/papers/bigtable.html 25 | 3. http://hadoop.apache.org 26 | 4. http://www.apache.org/dyn/closer.cgi/hbase/ 27 | 5. http://hbase.apache.org/docs/current/source-repository.html 28 | 6. http://hbase.apache.org/docs/current/issue-tracking.html 29 | 7. http://hbase.apache.org/docs/current/license.html 30 | 8. http://hbase.apache.org/docs/current/mail-lists.html 31 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerStoppedException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver; 21 | 22 | import org.apache.hadoop.hbase.DoNotRetryIOException; 23 | 24 | /** 25 | * Thrown by the region server when it is shutting down state. 26 | * 27 | * Should NEVER be thrown to HBase clients, they will abort the call chain 28 | * and not retry even though regions will transition to new servers. 29 | */ 30 | @SuppressWarnings("serial") 31 | public class RegionServerStoppedException extends DoNotRetryIOException { 32 | } -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/disable_peer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class DisablePeer< Command 24 | def help 25 | return <<-EOF 26 | Stops the replication stream to the specified cluster, but still 27 | keeps track of new edits to replicate. 28 | 29 | CURRENTLY UNSUPPORTED 30 | 31 | Examples: 32 | 33 | hbase> disable_peer '1' 34 | EOF 35 | end 36 | 37 | def command(id) 38 | format_simple_command do 39 | replication_admin.disable_peer(id) 40 | end 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/ATimeRange.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class ATimeRange extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"ATimeRange\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"minStamp\",\"type\":\"long\"},{\"name\":\"maxStamp\",\"type\":\"long\"}]}"); 11 | public long minStamp; 12 | public long maxStamp; 13 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 14 | // Used by DatumWriter. Applications should not call. 15 | public java.lang.Object get(int field$) { 16 | switch (field$) { 17 | case 0: return minStamp; 18 | case 1: return maxStamp; 19 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 20 | } 21 | } 22 | // Used by DatumReader. Applications should not call. 23 | @SuppressWarnings(value="unchecked") 24 | public void put(int field$, java.lang.Object value$) { 25 | switch (field$) { 26 | case 0: minStamp = (java.lang.Long)value$; break; 27 | case 1: maxStamp = (java.lang.Long)value$; break; 28 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/master/handler/TotesHRegionInfo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.master.handler; 21 | 22 | import java.beans.EventHandler; 23 | 24 | import org.apache.hadoop.hbase.HRegionInfo; 25 | 26 | /** 27 | * Implementors tote an HRegionInfo instance. 28 | * This is a marker interface that can be put on {@link EventHandler}s that 29 | * have an {@link HRegionInfo}. 30 | */ 31 | public interface TotesHRegionInfo { 32 | /** 33 | * @return HRegionInfo instance. 34 | */ 35 | public HRegionInfo getHRegionInfo(); 36 | } 37 | -------------------------------------------------------------------------------- /src/main/resources/org/apache/hadoop/hbase/rest/protobuf/TableSchemaMessage.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2010 The Apache Software Foundation 2 | // 3 | // Licensed to the Apache Software Foundation (ASF) under one 4 | // or more contributor license agreements. See the NOTICE file 5 | // distributed with this work for additional information 6 | // regarding copyright ownership. The ASF licenses this file 7 | // to you under the Apache License, Version 2.0 (the 8 | // "License"); you may not use this file except in compliance 9 | // with the License. You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | import "ColumnSchemaMessage.proto"; 20 | 21 | package org.apache.hadoop.hbase.rest.protobuf.generated; 22 | 23 | message TableSchema { 24 | optional string name = 1; 25 | message Attribute { 26 | required string name = 1; 27 | required string value = 2; 28 | } 29 | repeated Attribute attrs = 2; 30 | repeated ColumnSchema columns = 3; 31 | // optional helpful encodings of commonly used attributes 32 | optional bool inMemory = 4; 33 | optional bool readOnly = 5; 34 | } 35 | -------------------------------------------------------------------------------- /src/test/resources/org/apache/hadoop/hbase/PerformanceEvaluation_Counter.properties: -------------------------------------------------------------------------------- 1 | # ResourceBundle properties file for Map-Reduce counters 2 | 3 | #/** 4 | # * Copyright 2007 The Apache Software Foundation 5 | # * 6 | # * Licensed to the Apache Software Foundation (ASF) under one 7 | # * or more contributor license agreements. See the NOTICE file 8 | # * distributed with this work for additional information 9 | # * regarding copyright ownership. The ASF licenses this file 10 | # * to you under the Apache License, Version 2.0 (the 11 | # * "License"); you may not use this file except in compliance 12 | # * with the License. You may obtain a copy of the License at 13 | # * 14 | # * http://www.apache.org/licenses/LICENSE-2.0 15 | # * 16 | # * Unless required by applicable law or agreed to in writing, software 17 | # * distributed under the License is distributed on an "AS IS" BASIS, 18 | # * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 19 | # * See the License for the specific language governing permissions and 20 | # * limitations under the License. 21 | # */ 22 | 23 | CounterGroupName= HBase Performance Evaluation 24 | ELAPSED_TIME.name= Elapsed time in milliseconds 25 | ROWS.name= Row count 26 | # ResourceBundle properties file for Map-Reduce counters 27 | 28 | CounterGroupName= HBase Performance Evaluation 29 | ELAPSED_TIME.name= Elapsed time in milliseconds 30 | ROWS.name= Row count 31 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/assign.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Assign < Command 24 | def help 25 | return <<-EOF 26 | Assign a region. Add 'true' to force assign of a region. Use with caution. 27 | If region already assigned, this command will just go ahead and reassign 28 | the region anyways. For experts only. 29 | EOF 30 | end 31 | 32 | def command(region_name, force = 'false') 33 | format_simple_command do 34 | admin.assign(region_name, force) 35 | end 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/client/RegionOfflineException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.client; 21 | 22 | import org.apache.hadoop.hbase.RegionException; 23 | 24 | /** Thrown when a table can not be located */ 25 | public class RegionOfflineException extends RegionException { 26 | private static final long serialVersionUID = 466008402L; 27 | /** default constructor */ 28 | public RegionOfflineException() { 29 | super(); 30 | } 31 | 32 | /** @param s message */ 33 | public RegionOfflineException(String s) { 34 | super(s); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/describe.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Describe < Command 24 | def help 25 | return <<-EOF 26 | Describe the named table. For example: 27 | hbase> describe 't1' 28 | EOF 29 | end 30 | 31 | def command(table) 32 | now = Time.now 33 | 34 | desc = admin.describe(table) 35 | 36 | formatter.header([ "DESCRIPTION", "ENABLED" ], [ 64 ]) 37 | formatter.row([ desc, admin.enabled?(table).to_s ], true, [ 64 ]) 38 | formatter.footer(now) 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/coprocessor/RegionCoprocessorEnvironment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.coprocessor; 22 | 23 | import org.apache.hadoop.hbase.regionserver.HRegion; 24 | import org.apache.hadoop.hbase.regionserver.RegionServerServices; 25 | 26 | public interface RegionCoprocessorEnvironment extends CoprocessorEnvironment { 27 | /** @return the region associated with this coprocessor */ 28 | public HRegion getRegion(); 29 | 30 | /** @return reference to the region server services */ 31 | public RegionServerServices getRegionServerServices(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/filter/InvalidRowFilterException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.filter; 21 | 22 | /** 23 | * Used to indicate an invalid RowFilter. 24 | */ 25 | public class InvalidRowFilterException extends RuntimeException { 26 | private static final long serialVersionUID = 2667894046345657865L; 27 | 28 | 29 | /** constructor */ 30 | public InvalidRowFilterException() { 31 | super(); 32 | } 33 | 34 | /** 35 | * constructor 36 | * @param s message 37 | */ 38 | public InvalidRowFilterException(String s) { 39 | super(s); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/balance_switch.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class BalanceSwitch < Command 24 | def help 25 | return <<-EOF 26 | Enable/Disable balancer. Returns previous balancer state. 27 | Examples: 28 | 29 | hbase> balance_switch true 30 | hbase> balance_switch false 31 | EOF 32 | end 33 | 34 | def command(enableDisable) 35 | format_simple_command do 36 | formatter.row([ 37 | admin.balance_switch(enableDisable)? "true" : "false" 38 | ]) 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/UnknownRowLockException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | 23 | /** 24 | * Thrown if a region server is passed an unknown row lock id 25 | */ 26 | public class UnknownRowLockException extends DoNotRetryIOException { 27 | private static final long serialVersionUID = 993179627856392526L; 28 | 29 | /** constructor */ 30 | public UnknownRowLockException() { 31 | super(); 32 | } 33 | 34 | /** 35 | * Constructor 36 | * @param s message 37 | */ 38 | public UnknownRowLockException(String s) { 39 | super(s); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/util/FileSystemVersionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.util; 22 | 23 | import java.io.IOException; 24 | 25 | /** Thrown when the file system needs to be upgraded */ 26 | public class FileSystemVersionException extends IOException { 27 | private static final long serialVersionUID = 1004053363L; 28 | 29 | /** default constructor */ 30 | public FileSystemVersionException() { 31 | super(); 32 | } 33 | 34 | /** @param s message */ 35 | public FileSystemVersionException(String s) { 36 | super(s); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/AColumn.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class AColumn extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"AColumn\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"family\",\"type\":\"bytes\"},{\"name\":\"qualifier\",\"type\":[\"bytes\",\"null\"]}]}"); 11 | public java.nio.ByteBuffer family; 12 | public java.nio.ByteBuffer qualifier; 13 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 14 | // Used by DatumWriter. Applications should not call. 15 | public java.lang.Object get(int field$) { 16 | switch (field$) { 17 | case 0: return family; 18 | case 1: return qualifier; 19 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 20 | } 21 | } 22 | // Used by DatumReader. Applications should not call. 23 | @SuppressWarnings(value="unchecked") 24 | public void put(int field$, java.lang.Object value$) { 25 | switch (field$) { 26 | case 0: family = (java.nio.ByteBuffer)value$; break; 27 | case 1: qualifier = (java.nio.ByteBuffer)value$; break; 28 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/filter/IncompatibleFilterException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.filter; 21 | 22 | /** 23 | * Used to indicate a filter incompatibility 24 | */ 25 | public class IncompatibleFilterException extends RuntimeException { 26 | private static final long serialVersionUID = 3236763276623198231L; 27 | 28 | /** constructor */ 29 | public IncompatibleFilterException() { 30 | super(); 31 | } 32 | 33 | /** 34 | * constructor 35 | * @param s message 36 | */ 37 | public IncompatibleFilterException(String s) { 38 | super(s); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/client/ScannerTimeoutException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.client; 22 | 23 | import org.apache.hadoop.hbase.DoNotRetryIOException; 24 | 25 | /** 26 | * Thrown when a scanner has timed out. 27 | */ 28 | public class ScannerTimeoutException extends DoNotRetryIOException { 29 | 30 | private static final long serialVersionUID = 8788838690290688313L; 31 | 32 | /** default constructor */ 33 | ScannerTimeoutException() { 34 | super(); 35 | } 36 | 37 | /** @param s */ 38 | ScannerTimeoutException(String s) { 39 | super(s); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/stop_replication.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class StopReplication < Command 24 | def help 25 | return <<-EOF 26 | Stops all the replication features. The state in which each 27 | stream stops in is undetermined. 28 | WARNING: 29 | start/stop replication is only meant to be used in critical load situations. 30 | Examples: 31 | 32 | hbase> stop_replication 33 | EOF 34 | end 35 | 36 | def command 37 | format_simple_command do 38 | replication_admin.stop_replication 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/start_replication.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class StartReplication < Command 24 | def help 25 | return <<-EOF 26 | Restarts all the replication features. The state in which each 27 | stream starts in is undetermined. 28 | WARNING: 29 | start/stop replication is only meant to be used in critical load situations. 30 | Examples: 31 | 32 | hbase> start_replication 33 | EOF 34 | end 35 | 36 | def command 37 | format_simple_command do 38 | replication_admin.start_replication 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/LeaseException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2008 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver; 21 | 22 | import org.apache.hadoop.hbase.DoNotRetryIOException; 23 | 24 | /** 25 | * Reports a problem with a lease 26 | */ 27 | public class LeaseException extends DoNotRetryIOException { 28 | 29 | private static final long serialVersionUID = 8179703995292418650L; 30 | 31 | /** default constructor */ 32 | public LeaseException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * @param message 38 | */ 39 | public LeaseException(String message) { 40 | super(message); 41 | } 42 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/LeaseListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver; 21 | 22 | 23 | /** 24 | * LeaseListener is an interface meant to be implemented by users of the Leases 25 | * class. 26 | * 27 | * It receives events from the Leases class about the status of its accompanying 28 | * lease. Users of the Leases class can use a LeaseListener subclass to, for 29 | * example, clean up resources after a lease has expired. 30 | */ 31 | public interface LeaseListener { 32 | /** When a lease expires, this method is called. */ 33 | public void leaseExpired(); 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/wal/OrphanHLogAfterSplitException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver.wal; 21 | 22 | import java.io.IOException; 23 | 24 | public class OrphanHLogAfterSplitException extends IOException { 25 | 26 | /** 27 | * Create this exception without a message 28 | */ 29 | public OrphanHLogAfterSplitException() { 30 | super(); 31 | } 32 | 33 | /** 34 | * Create this exception with a message 35 | * @param message why it failed 36 | */ 37 | public OrphanHLogAfterSplitException(String message) { 38 | super(message); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/util/IncrementingEnvironmentEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.util; 21 | 22 | /** 23 | * Uses an incrementing algorithm instead of the default. 24 | */ 25 | public class IncrementingEnvironmentEdge implements EnvironmentEdge { 26 | 27 | private long timeIncrement = 1; 28 | 29 | /** 30 | * {@inheritDoc} 31 | *

32 | * This method increments a known value for the current time each time this 33 | * method is called. The first value is 1. 34 | */ 35 | @Override 36 | public synchronized long currentTimeMillis() { 37 | return timeIncrement++; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/mapred/Driver.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.mapred; 21 | 22 | import org.apache.hadoop.util.ProgramDriver; 23 | 24 | /** 25 | * Driver for hbase mapreduce jobs. Select which to run by passing 26 | * name of job to this main. 27 | */ 28 | @Deprecated 29 | public class Driver { 30 | /** 31 | * @param args 32 | * @throws Throwable 33 | */ 34 | public static void main(String[] args) throws Throwable { 35 | ProgramDriver pgd = new ProgramDriver(); 36 | pgd.addClass(RowCounter.NAME, RowCounter.class, 37 | "Count rows in HBase table"); 38 | pgd.driver(args); 39 | } 40 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/WrongRegionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Thrown when a request contains a key which is not part of this region 26 | */ 27 | public class WrongRegionException extends IOException { 28 | private static final long serialVersionUID = 993179627856392526L; 29 | 30 | /** constructor */ 31 | public WrongRegionException() { 32 | super(); 33 | } 34 | 35 | /** 36 | * Constructor 37 | * @param s message 38 | */ 39 | public WrongRegionException(String s) { 40 | super(s); 41 | } 42 | } -------------------------------------------------------------------------------- /src/test/java/org/apache/hadoop/hbase/util/EnvironmentEdgeManagerTestHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.util; 21 | 22 | /** 23 | * Used by tests to inject an edge into the manager. The intent is to minimise 24 | * the use of the injectEdge method giving it default permissions, but in 25 | * testing we may need to use this functionality elsewhere. 26 | */ 27 | public class EnvironmentEdgeManagerTestHelper { 28 | 29 | public static void reset() { 30 | EnvironmentEdgeManager.reset(); 31 | } 32 | 33 | public static void injectEdge(EnvironmentEdge edge) { 34 | EnvironmentEdgeManager.injectEdge(edge); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/RegionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2008 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | /** 24 | * Thrown when something happens related to region handling. 25 | * Subclasses have to be more specific. 26 | */ 27 | public class RegionException extends IOException { 28 | private static final long serialVersionUID = 1473510258071111371L; 29 | 30 | /** default constructor */ 31 | public RegionException() { 32 | super(); 33 | } 34 | 35 | /** 36 | * Constructor 37 | * @param s message 38 | */ 39 | public RegionException(String s) { 40 | super(s); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/put.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Put < Command 24 | def help 25 | return <<-EOF 26 | Put a cell 'value' at specified table/row/column and optionally 27 | timestamp coordinates. To put a cell value into table 't1' at 28 | row 'r1' under column 'c1' marked with the time 'ts1', do: 29 | 30 | hbase> put 't1', 'r1', 'c1', 'value', ts1 31 | EOF 32 | end 33 | 34 | def command(table, row, column, value, timestamp = nil) 35 | format_simple_command do 36 | table(table).put(row, column, value, timestamp) 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/Abortable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | /** 23 | * Interface to support the aborting of a given server or client. 24 | *

25 | * This is used primarily for ZooKeeper usage when we could get an unexpected 26 | * and fatal exception, requiring an abort. 27 | *

28 | * Implemented by the Master, RegionServer, and TableServers (client). 29 | */ 30 | public interface Abortable { 31 | /** 32 | * Abort the server or client. 33 | * @param why Why we're aborting. 34 | * @param e Throwable that caused abort. Can be null. 35 | */ 36 | public void abort(String why, Throwable e); 37 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/filter/BinaryComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.filter; 22 | 23 | /** 24 | * A binary comparator which lexicographically compares against the specified 25 | * byte array using {@link org.apache.hadoop.hbase.util.Bytes#compareTo(byte[], byte[])}. 26 | */ 27 | public class BinaryComparator extends WritableByteArrayComparable { 28 | 29 | /** Nullary constructor for Writable, do not use */ 30 | public BinaryComparator() { } 31 | 32 | /** 33 | * Constructor 34 | * @param value value 35 | */ 36 | public BinaryComparator(byte[] value) { 37 | super(value); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/util/ManualEnvironmentEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.util; 21 | 22 | /** 23 | * An environment edge that uses a manually set value. This is useful for testing events that are supposed to 24 | * happen in the same millisecond. 25 | */ 26 | public class ManualEnvironmentEdge implements EnvironmentEdge { 27 | 28 | // Sometimes 0 ts might have a special value, so lets start with 1 29 | protected long value = 1L; 30 | 31 | public void setValue(long newValue) { 32 | value = newValue; 33 | } 34 | 35 | @Override 36 | public long currentTimeMillis() { 37 | return this.value; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/client/NoServerForRegionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.client; 21 | 22 | import org.apache.hadoop.hbase.RegionException; 23 | 24 | /** 25 | * Thrown when no region server can be found for a region 26 | */ 27 | public class NoServerForRegionException extends RegionException { 28 | private static final long serialVersionUID = 1L << 11 - 1L; 29 | 30 | /** default constructor */ 31 | public NoServerForRegionException() { 32 | super(); 33 | } 34 | 35 | /** 36 | * Constructor 37 | * @param s message 38 | */ 39 | public NoServerForRegionException(String s) { 40 | super(s); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/CompactionRequestor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver; 21 | 22 | public interface CompactionRequestor { 23 | /** 24 | * @param r Region to compact 25 | * @param why Why compaction was requested -- used in debug messages 26 | */ 27 | public void requestCompaction(final HRegion r, final String why); 28 | 29 | /** 30 | * @param r Region to compact 31 | * @param why Why compaction was requested -- used in debug messages 32 | * @param pri Priority of this compaction. minHeap. <=0 is critical 33 | */ 34 | public void requestCompaction(final HRegion r, final String why, int pri); 35 | } -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/incr.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Incr < Command 24 | def help 25 | return <<-EOF 26 | Increments a cell 'value' at specified table/row/column coordinates. 27 | To increment a cell value in table 't1' at row 'r1' under column 28 | 'c1' by 1 (can be omitted) or 10 do: 29 | 30 | hbase> incr 't1', 'r1', 'c1' 31 | hbase> incr 't1', 'r1', 'c1', 1 32 | hbase> incr 't1', 'r1', 'c1', 10 33 | EOF 34 | end 35 | 36 | def command(table, row, column, value = nil) 37 | cnt = table(table).incr(row, column, value) 38 | puts "COUNTER VALUE = #{cnt}" 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /src/test/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Define some default values that can be overridden by system properties 2 | hbase.root.logger=INFO,console 3 | hbase.log.dir=. 4 | hbase.log.file=hbase.log 5 | 6 | # Define the root logger to the system property "hbase.root.logger". 7 | log4j.rootLogger=${hbase.root.logger} 8 | 9 | # Logging Threshold 10 | log4j.threshhold=ALL 11 | 12 | # 13 | # Daily Rolling File Appender 14 | # 15 | log4j.appender.DRFA=org.apache.log4j.DailyRollingFileAppender 16 | log4j.appender.DRFA.File=${hbase.log.dir}/${hbase.log.file} 17 | 18 | # Rollver at midnight 19 | log4j.appender.DRFA.DatePattern=.yyyy-MM-dd 20 | 21 | # 30-day backup 22 | #log4j.appender.DRFA.MaxBackupIndex=30 23 | log4j.appender.DRFA.layout=org.apache.log4j.PatternLayout 24 | 25 | # Pattern format: Date LogLevel LoggerName LogMessage 26 | #log4j.appender.DRFA.layout.ConversionPattern=%d{ISO8601} %p %c: %m%n 27 | 28 | # Debugging Pattern format 29 | log4j.appender.DRFA.layout.ConversionPattern=%d %-5p [%t] %C{2}(%L): %m%n 30 | 31 | 32 | # 33 | # console 34 | # Add "console" to rootlogger above if you want to use this 35 | # 36 | log4j.appender.console=org.apache.log4j.ConsoleAppender 37 | log4j.appender.console.target=System.err 38 | log4j.appender.console.layout=org.apache.log4j.PatternLayout 39 | log4j.appender.console.layout.ConversionPattern=%d %-5p [%t] %C{2}(%L): %m%n 40 | 41 | # Custom Logging levels 42 | 43 | #log4j.logger.org.apache.hadoop.fs.FSNamesystem=DEBUG 44 | 45 | log4j.logger.org.apache.hadoop=WARN 46 | log4j.logger.org.apache.zookeeper=ERROR 47 | log4j.logger.org.apache.hadoop.hbase=DEBUG 48 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/filter/package-info.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | /** 22 | * Provides row-level filters applied to HRegion scan results during calls to 23 | * {@link org.apache.hadoop.hbase.client.ResultScanner#next()}. 24 | 25 |

26 | Filters run the extent of a table unless you wrap your filter in a 27 | {@link org.apache.hadoop.hbase.filter.WhileMatchFilter}. 28 | The latter returns as soon as the filter stops matching. 29 |

30 |

Do not rely on filters carrying state across rows; its not reliable in current 31 | hbase as we have no handlers in place for when regions split, close or server 32 | crashes. 33 |

34 | */ 35 | package org.apache.hadoop.hbase.filter; 36 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/deleteall.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Deleteall < Command 24 | def help 25 | return <<-EOF 26 | Delete all cells in a given row; pass a table name, row, and optionally 27 | a column and timestamp. Examples: 28 | 29 | hbase> deleteall 't1', 'r1' 30 | hbase> deleteall 't1', 'r1', 'c1' 31 | hbase> deleteall 't1', 'r1', 'c1', ts1 32 | EOF 33 | end 34 | 35 | def command(table, row, column = nil, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP) 36 | format_simple_command do 37 | table(table).deleteall(row, column, timestamp) 38 | end 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/mapred/TableReduce.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.mapred; 21 | 22 | import org.apache.hadoop.hbase.client.Put; 23 | import org.apache.hadoop.hbase.io.ImmutableBytesWritable; 24 | import org.apache.hadoop.io.Writable; 25 | import org.apache.hadoop.io.WritableComparable; 26 | import org.apache.hadoop.mapred.Reducer; 27 | 28 | /** 29 | * Write a table, sorting by the input key 30 | * 31 | * @param key class 32 | * @param value class 33 | */ 34 | @Deprecated 35 | @SuppressWarnings("unchecked") 36 | public interface TableReduce 37 | extends Reducer { 38 | 39 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/mapreduce/TableMapper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.mapreduce; 21 | 22 | import org.apache.hadoop.hbase.client.Result; 23 | import org.apache.hadoop.hbase.io.ImmutableBytesWritable; 24 | import org.apache.hadoop.mapreduce.Mapper; 25 | 26 | /** 27 | * Extends the base Mapper class to add the required input key 28 | * and value classes. 29 | * 30 | * @param The type of the key. 31 | * @param The type of the value. 32 | * @see org.apache.hadoop.mapreduce.Mapper 33 | */ 34 | public abstract class TableMapper 35 | extends Mapper { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/wal/FailedLogCloseException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2008 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver.wal; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Thrown when we fail close of the write-ahead-log file. 26 | * Package private. Only used inside this package. 27 | */ 28 | public class FailedLogCloseException extends IOException { 29 | private static final long serialVersionUID = 1759152841462990925L; 30 | 31 | /** 32 | * 33 | */ 34 | public FailedLogCloseException() { 35 | super(); 36 | } 37 | 38 | /** 39 | * @param arg0 40 | */ 41 | public FailedLogCloseException(String arg0) { 42 | super(arg0); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/rest/transform/Transform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.rest.transform; 22 | 23 | /** 24 | * Data transformation module 25 | */ 26 | public interface Transform { 27 | 28 | /*** Transfer direction */ 29 | static enum Direction { 30 | /** From client to server */ 31 | IN, 32 | /** From server to client */ 33 | OUT 34 | }; 35 | 36 | /** 37 | * Transform data from one representation to another according to 38 | * transfer direction. 39 | * @param data input data 40 | * @param direction IN or OUT 41 | * @return the transformed data 42 | */ 43 | byte[] transform (byte[] data, Direction direction); 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/NoSuchColumnFamilyException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver; 21 | 22 | import org.apache.hadoop.hbase.DoNotRetryIOException; 23 | 24 | /** 25 | * Thrown if request for nonexistent column family. 26 | */ 27 | public class NoSuchColumnFamilyException extends DoNotRetryIOException { 28 | private static final long serialVersionUID = -6569952730832331274L; 29 | 30 | /** default constructor */ 31 | public NoSuchColumnFamilyException() { 32 | super(); 33 | } 34 | 35 | /** 36 | * @param message exception message 37 | */ 38 | public NoSuchColumnFamilyException(String message) { 39 | super(message); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/util/HBaseConfTool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.util; 22 | 23 | import org.apache.hadoop.conf.Configuration; 24 | import org.apache.hadoop.hbase.HBaseConfiguration; 25 | 26 | /** 27 | * Tool that prints out a configuration. 28 | * Pass the configuration key on the command-line. 29 | */ 30 | public class HBaseConfTool { 31 | public static void main(String args[]) { 32 | if (args.length < 1) { 33 | System.err.println("Usage: HBaseConfTool "); 34 | System.exit(1); 35 | return; 36 | } 37 | 38 | Configuration conf = HBaseConfiguration.create(); 39 | System.out.println(conf.get(args[0])); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/NotAllMetaRegionsOnlineException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase; 22 | 23 | import org.apache.hadoop.hbase.DoNotRetryIOException; 24 | 25 | /** 26 | * Thrown when an operation requires the root and all meta regions to be online 27 | */ 28 | public class NotAllMetaRegionsOnlineException extends DoNotRetryIOException { 29 | private static final long serialVersionUID = 6439786157874827523L; 30 | /** 31 | * default constructor 32 | */ 33 | public NotAllMetaRegionsOnlineException() { 34 | super(); 35 | } 36 | 37 | /** 38 | * @param message 39 | */ 40 | public NotAllMetaRegionsOnlineException(String message) { 41 | super(message); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/get_counter.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class GetCounter < Command 24 | def help 25 | return <<-EOF 26 | Return a counter cell value at specified table/row/column coordinates. 27 | A cell cell should be managed with atomic increment function oh HBase 28 | and the data should be binary encoded. Example: 29 | 30 | hbase> get_counter 't1', 'r1', 'c1' 31 | EOF 32 | end 33 | 34 | def command(table, row, column, value = nil) 35 | if cnt = table(table).get_counter(row, column) 36 | puts "COUNTER VALUE = #{cnt}" 37 | else 38 | puts "No counter found at specified coordinates" 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/split.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Split < Command 24 | def help 25 | return <<-EOF 26 | Split entire table or pass a region to split individual region. With the 27 | second parameter, you can specify an explicit split key for the region. 28 | Examples: 29 | split 'tableName' 30 | split 'regionName' # format: 'tableName,startKey,id' 31 | split 'tableName', 'splitKey' 32 | split 'regionName', 'splitKey' 33 | EOF 34 | end 35 | 36 | def command(table_or_region_name, split_point = nil) 37 | format_simple_command do 38 | admin.split(table_or_region_name, split_point) 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/unassign.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Unassign < Command 24 | def help 25 | return <<-EOF 26 | Unassign a region. Unassign will close region in current location and then 27 | reopen it again. Pass 'true' to force the unassignment ('force' will clear 28 | all in-memory state in master before the reassign). Use with caution. For 29 | expert use only. Examples: 30 | 31 | hbase> unassign 'REGIONNAME' 32 | hbase> unassign 'REGIONNAME', true 33 | EOF 34 | end 35 | 36 | def command(region_name, force = 'false') 37 | format_simple_command do 38 | admin.unassign(region_name, force) 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/list.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class List < Command 24 | def help 25 | return <<-EOF 26 | List all tables in hbase. Optional regular expression parameter could 27 | be used to filter the output. Examples: 28 | 29 | hbase> list 30 | hbase> list 'abc.*' 31 | EOF 32 | end 33 | 34 | def command(regex = ".*") 35 | now = Time.now 36 | formatter.header([ "TABLE" ]) 37 | 38 | regex = /#{regex}/ unless regex.is_a?(Regexp) 39 | list = admin.list.grep(regex) 40 | list.each do |table| 41 | formatter.row([ table ]) 42 | end 43 | 44 | formatter.footer(now, list.size) 45 | end 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenMetaHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver.handler; 21 | 22 | import org.apache.hadoop.hbase.HRegionInfo; 23 | import org.apache.hadoop.hbase.Server; 24 | import org.apache.hadoop.hbase.regionserver.RegionServerServices; 25 | 26 | /** 27 | * Handles opening of a meta region on a region server. 28 | *

29 | * This is executed after receiving an OPEN RPC from the master for meta. 30 | */ 31 | public class OpenMetaHandler extends OpenRegionHandler { 32 | public OpenMetaHandler(final Server server, 33 | final RegionServerServices rsServices, HRegionInfo regionInfo) { 34 | super(server,rsServices, regionInfo, EventType.M_RS_OPEN_META); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/handler/OpenRootHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver.handler; 21 | 22 | import org.apache.hadoop.hbase.HRegionInfo; 23 | import org.apache.hadoop.hbase.Server; 24 | import org.apache.hadoop.hbase.regionserver.RegionServerServices; 25 | 26 | /** 27 | * Handles opening of the root region on a region server. 28 | *

29 | * This is executed after receiving an OPEN RPC from the master for root. 30 | */ 31 | public class OpenRootHandler extends OpenRegionHandler { 32 | public OpenRootHandler(final Server server, 33 | final RegionServerServices rsServices, HRegionInfo regionInfo) { 34 | super(server, rsServices, regionInfo, EventType.M_RS_OPEN_ROOT); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/add_peer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class AddPeer< Command 24 | def help 25 | return <<-EOF 26 | Add a peer cluster to replicate to, the id must be a short and 27 | the cluster key is composed like this: 28 | hbase.zookeeper.quorum:hbase.zookeeper.property.clientPort:zookeeper.znode.parent 29 | This gives a full path for HBase to connect to another cluster. 30 | Examples: 31 | 32 | hbase> add_peer '1', "server1.cie.com:2181:/hbase" 33 | hbase> add_peer '2', "zk1,zk2,zk3:2182:/hbase-prod" 34 | EOF 35 | end 36 | 37 | def command(id, cluster_key) 38 | format_simple_command do 39 | replication_admin.add_peer(id, cluster_key) 40 | end 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /src/test/java/org/apache/hadoop/hbase/util/TestIncrementingEnvironmentEdge.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.util; 21 | 22 | import org.junit.Test; 23 | 24 | import static junit.framework.Assert.assertEquals; 25 | 26 | /** 27 | * Tests that the incrementing environment edge increments time instead of using 28 | * the default. 29 | */ 30 | public class TestIncrementingEnvironmentEdge { 31 | 32 | @Test 33 | public void testGetCurrentTimeUsesSystemClock() { 34 | IncrementingEnvironmentEdge edge = new IncrementingEnvironmentEdge(); 35 | assertEquals(1, edge.currentTimeMillis()); 36 | assertEquals(2, edge.currentTimeMillis()); 37 | assertEquals(3, edge.currentTimeMillis()); 38 | assertEquals(4, edge.currentTimeMillis()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/mapred/TableMap.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.mapred; 21 | 22 | import org.apache.hadoop.hbase.io.ImmutableBytesWritable; 23 | import org.apache.hadoop.hbase.client.Result; 24 | import org.apache.hadoop.io.Writable; 25 | import org.apache.hadoop.io.WritableComparable; 26 | import org.apache.hadoop.mapred.Mapper; 27 | 28 | /** 29 | * Scan an HBase table to sort by a specified sort column. 30 | * If the column does not exist, the record is not passed to Reduce. 31 | * 32 | * @param WritableComparable key class 33 | * @param Writable value class 34 | */ 35 | @Deprecated 36 | public interface TableMap, V extends Writable> 37 | extends Mapper { 38 | 39 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/UnknownScannerException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | 23 | /** 24 | * Thrown if a region server is passed an unknown scanner id. 25 | * Usually means the client has take too long between checkins and so the 26 | * scanner lease on the serverside has expired OR the serverside is closing 27 | * down and has cancelled all leases. 28 | */ 29 | public class UnknownScannerException extends DoNotRetryIOException { 30 | private static final long serialVersionUID = 993179627856392526L; 31 | 32 | /** constructor */ 33 | public UnknownScannerException() { 34 | super(); 35 | } 36 | 37 | /** 38 | * Constructor 39 | * @param s message 40 | */ 41 | public UnknownScannerException(String s) { 42 | super(s); 43 | } 44 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/regionserver/RegionServerRunningException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.regionserver; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Thrown if the region server log directory exists (which indicates another 26 | * region server is running at the same address) 27 | */ 28 | public class RegionServerRunningException extends IOException { 29 | private static final long serialVersionUID = 1L << 31 - 1L; 30 | 31 | /** Default Constructor */ 32 | public RegionServerRunningException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructs the exception and supplies a string as the message 38 | * @param s - message 39 | */ 40 | public RegionServerRunningException(String s) { 41 | super(s); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/rest/metrics/RESTStatistics.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.rest.metrics; 22 | 23 | import javax.management.ObjectName; 24 | 25 | import org.apache.hadoop.hbase.metrics.MetricsMBeanBase; 26 | 27 | import org.apache.hadoop.metrics.util.MBeanUtil; 28 | import org.apache.hadoop.metrics.util.MetricsRegistry; 29 | 30 | public class RESTStatistics extends MetricsMBeanBase { 31 | private final ObjectName mbeanName; 32 | 33 | public RESTStatistics(MetricsRegistry registry) { 34 | super(registry, "restStatistics"); 35 | mbeanName = MBeanUtil.registerMBean("rest", "restStatistics", this); 36 | } 37 | 38 | public void shutdown() { 39 | if (mbeanName != null) { 40 | MBeanUtil.unregisterMBean(mbeanName); 41 | } 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/delete.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Delete < Command 24 | def help 25 | return <<-EOF 26 | Put a delete cell value at specified table/row/column and optionally 27 | timestamp coordinates. Deletes must match the deleted cell's 28 | coordinates exactly. When scanning, a delete cell suppresses older 29 | versions. To delete a cell from 't1' at row 'r1' under column 'c1' 30 | marked with the time 'ts1', do: 31 | 32 | hbase> delete 't1', 'r1', 'c1', ts1 33 | EOF 34 | end 35 | 36 | def command(table, row, column, timestamp = org.apache.hadoop.hbase.HConstants::LATEST_TIMESTAMP) 37 | format_simple_command do 38 | table(table).delete(row, column, timestamp) 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/MasterNotRunningException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Thrown if the master is not running 26 | */ 27 | public class MasterNotRunningException extends IOException { 28 | private static final long serialVersionUID = 1L << 23 - 1L; 29 | /** default constructor */ 30 | public MasterNotRunningException() { 31 | super(); 32 | } 33 | 34 | /** 35 | * Constructor 36 | * @param s message 37 | */ 38 | public MasterNotRunningException(String s) { 39 | super(s); 40 | } 41 | 42 | /** 43 | * Constructor taking another exception. 44 | * @param e Exception to grab data from. 45 | */ 46 | public MasterNotRunningException(Exception e) { 47 | super(e); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/AServerAddress.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class AServerAddress extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"AServerAddress\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"hostname\",\"type\":\"string\"},{\"name\":\"inetSocketAddress\",\"type\":\"string\"},{\"name\":\"port\",\"type\":\"int\"}]}"); 11 | public java.lang.CharSequence hostname; 12 | public java.lang.CharSequence inetSocketAddress; 13 | public int port; 14 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 15 | // Used by DatumWriter. Applications should not call. 16 | public java.lang.Object get(int field$) { 17 | switch (field$) { 18 | case 0: return hostname; 19 | case 1: return inetSocketAddress; 20 | case 2: return port; 21 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 22 | } 23 | } 24 | // Used by DatumReader. Applications should not call. 25 | @SuppressWarnings(value="unchecked") 26 | public void put(int field$, java.lang.Object value$) { 27 | switch (field$) { 28 | case 0: hostname = (java.lang.CharSequence)value$; break; 29 | case 1: inetSocketAddress = (java.lang.CharSequence)value$; break; 30 | case 2: port = (java.lang.Integer)value$; break; 31 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/test/java/org/apache/hadoop/hbase/util/SoftValueSortedMapTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2008 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.util; 21 | 22 | import java.util.SortedMap; 23 | import java.util.TreeMap; 24 | 25 | public class SoftValueSortedMapTest { 26 | private static void testMap(SortedMap map) { 27 | System.out.println("Testing " + map.getClass()); 28 | for(int i = 0; i < 1000000; i++) { 29 | map.put(i, i); 30 | } 31 | System.out.println(map.size()); 32 | @SuppressWarnings("unused") 33 | byte[] block = new byte[849*1024*1024]; // FindBugs DLS_DEAD_LOCAL_STORE 34 | System.out.println(map.size()); 35 | } 36 | 37 | public static void main(String[] args) { 38 | testMap(new SoftValueSortedMap()); 39 | testMap(new TreeMap()); 40 | } 41 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/client/HTableInterfaceFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.client; 21 | 22 | import org.apache.hadoop.conf.Configuration; 23 | 24 | 25 | /** 26 | * Defines methods to create new HTableInterface. 27 | * 28 | * @since 0.21.0 29 | */ 30 | public interface HTableInterfaceFactory { 31 | 32 | /** 33 | * Creates a new HTableInterface. 34 | * 35 | * @param config HBaseConfiguration instance. 36 | * @param tableName name of the HBase table. 37 | * @return HTableInterface instance. 38 | */ 39 | HTableInterface createHTableInterface(Configuration config, byte[] tableName); 40 | 41 | 42 | /** 43 | * Release the HTable resource represented by the table. 44 | * @param table 45 | */ 46 | void releaseHTableInterface(final HTableInterface table); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/master/metrics/MasterStatistics.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | package org.apache.hadoop.hbase.master.metrics; 19 | 20 | import javax.management.ObjectName; 21 | 22 | import org.apache.hadoop.hbase.metrics.MetricsMBeanBase; 23 | import org.apache.hadoop.metrics.util.MBeanUtil; 24 | import org.apache.hadoop.metrics.util.MetricsRegistry; 25 | 26 | /** 27 | * Exports the {@link MasterMetrics} statistics as an MBean 28 | * for JMX. 29 | */ 30 | public class MasterStatistics extends MetricsMBeanBase { 31 | private final ObjectName mbeanName; 32 | 33 | public MasterStatistics(MetricsRegistry registry) { 34 | super(registry, "MasterStatistics"); 35 | mbeanName = MBeanUtil.registerMBean("Master", "MasterStatistics", this); 36 | } 37 | 38 | public void shutdown() { 39 | if (mbeanName != null) 40 | MBeanUtil.unregisterMBean(mbeanName); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/util/JvmVersion.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.util; 21 | 22 | import java.util.HashSet; 23 | import java.util.Set; 24 | 25 | /** 26 | * Certain JVM versions are known to be unstable with HBase. This 27 | * class has a utility function to determine whether the current JVM 28 | * is known to be unstable. 29 | */ 30 | public abstract class JvmVersion { 31 | private static Set BAD_JVM_VERSIONS = new HashSet(); 32 | static { 33 | BAD_JVM_VERSIONS.add("1.6.0_18"); 34 | } 35 | 36 | /** 37 | * Return true if the current JVM is known to be unstable. 38 | */ 39 | public static boolean isBadJvmVersion() { 40 | String version = System.getProperty("java.version"); 41 | return version != null && BAD_JVM_VERSIONS.contains(version); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/ADelete.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class ADelete extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"ADelete\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"row\",\"type\":\"bytes\"},{\"name\":\"columns\",\"type\":[{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"AColumn\",\"fields\":[{\"name\":\"family\",\"type\":\"bytes\"},{\"name\":\"qualifier\",\"type\":[\"bytes\",\"null\"]}]}},\"null\"]}]}"); 11 | public java.nio.ByteBuffer row; 12 | public java.util.List columns; 13 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 14 | // Used by DatumWriter. Applications should not call. 15 | public java.lang.Object get(int field$) { 16 | switch (field$) { 17 | case 0: return row; 18 | case 1: return columns; 19 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 20 | } 21 | } 22 | // Used by DatumReader. Applications should not call. 23 | @SuppressWarnings(value="unchecked") 24 | public void put(int field$, java.lang.Object value$) { 25 | switch (field$) { 26 | case 0: row = (java.nio.ByteBuffer)value$; break; 27 | case 1: columns = (java.util.List)value$; break; 28 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/ZooKeeperConnectionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Thrown if the client can't connect to zookeeper 26 | */ 27 | public class ZooKeeperConnectionException extends IOException { 28 | private static final long serialVersionUID = 1L << 23 - 1L; 29 | /** default constructor */ 30 | public ZooKeeperConnectionException() { 31 | super(); 32 | } 33 | 34 | /** 35 | * Constructor 36 | * @param s message 37 | */ 38 | public ZooKeeperConnectionException(String s) { 39 | super(s); 40 | } 41 | 42 | /** 43 | * Constructor taking another exception. 44 | * @param e Exception to grab data from. 45 | */ 46 | public ZooKeeperConnectionException(Exception e) { 47 | super(e); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/rest/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.rest; 22 | 23 | /** 24 | * Common constants for org.apache.hadoop.hbase.rest 25 | */ 26 | public interface Constants { 27 | public static final String VERSION_STRING = "0.0.2"; 28 | 29 | public static final int DEFAULT_MAX_AGE = 60 * 60 * 4; // 4 hours 30 | 31 | public static final int DEFAULT_LISTEN_PORT = 8080; 32 | 33 | public static final String MIMETYPE_TEXT = "text/plain"; 34 | public static final String MIMETYPE_HTML = "text/html"; 35 | public static final String MIMETYPE_XML = "text/xml"; 36 | public static final String MIMETYPE_BINARY = "application/octet-stream"; 37 | public static final String MIMETYPE_PROTOBUF = "application/x-protobuf"; 38 | public static final String MIMETYPE_JSON = "application/json"; 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/DoNotRetryIOException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2008 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Subclass if exception is not meant to be retried: e.g. 26 | * {@link UnknownScannerException} 27 | */ 28 | public class DoNotRetryIOException extends IOException { 29 | 30 | private static final long serialVersionUID = 1197446454511704139L; 31 | 32 | /** 33 | * default constructor 34 | */ 35 | public DoNotRetryIOException() { 36 | super(); 37 | } 38 | 39 | /** 40 | * @param message 41 | */ 42 | public DoNotRetryIOException(String message) { 43 | super(message); 44 | } 45 | 46 | /** 47 | * @param message 48 | * @param cause 49 | */ 50 | public DoNotRetryIOException(String message, Throwable cause) { 51 | super(message, cause); 52 | } 53 | } -------------------------------------------------------------------------------- /src/test/java/org/apache/hadoop/hbase/coprocessor/ColumnAggregationProtocol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.coprocessor; 21 | 22 | import org.apache.hadoop.hbase.ipc.CoprocessorProtocol; 23 | import java.io.IOException; 24 | 25 | /** 26 | * A sample protocol for performing aggregation at regions. 27 | */ 28 | public interface ColumnAggregationProtocol extends CoprocessorProtocol { 29 | /** 30 | * Perform aggregation for a given column at the region. The aggregation 31 | * will include all the rows inside the region. It can be extended to 32 | * allow passing start and end rows for a fine-grained aggregation. 33 | * @param family family 34 | * @param qualifier qualifier 35 | * @return Aggregation of the column. 36 | * @throws exception. 37 | */ 38 | public long sum(byte[] family, byte[] qualifier) throws IOException; 39 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/TableNotDisabledException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | import org.apache.hadoop.hbase.util.Bytes; 25 | 26 | /** 27 | * Thrown if a table should be offline but is not 28 | */ 29 | public class TableNotDisabledException extends IOException { 30 | private static final long serialVersionUID = 1L << 19 - 1L; 31 | /** default constructor */ 32 | public TableNotDisabledException() { 33 | super(); 34 | } 35 | 36 | /** 37 | * Constructor 38 | * @param s message 39 | */ 40 | public TableNotDisabledException(String s) { 41 | super(s); 42 | } 43 | 44 | /** 45 | * @param tableName Name of table that is not disabled 46 | */ 47 | public TableNotDisabledException(byte[] tableName) { 48 | this(Bytes.toString(tableName)); 49 | } 50 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/client/HTableFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.client; 21 | 22 | import org.apache.hadoop.conf.Configuration; 23 | 24 | import java.io.IOException; 25 | 26 | /** 27 | * Factory for creating HTable instances. 28 | * 29 | * @since 0.21.0 30 | */ 31 | public class HTableFactory implements HTableInterfaceFactory { 32 | @Override 33 | public HTableInterface createHTableInterface(Configuration config, 34 | byte[] tableName) { 35 | try { 36 | return new HTable(config, tableName); 37 | } catch (IOException ioe) { 38 | throw new RuntimeException(ioe); 39 | } 40 | } 41 | 42 | @Override 43 | public void releaseHTableInterface(HTableInterface table) { 44 | try { 45 | table.close(); 46 | } catch (IOException ioe) { 47 | throw new RuntimeException(ioe); 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/NotServingRegionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2007 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | import org.apache.hadoop.hbase.util.Bytes; 25 | 26 | /** 27 | * Thrown by a region server if it is sent a request for a region it is not 28 | * serving. 29 | */ 30 | public class NotServingRegionException extends IOException { 31 | private static final long serialVersionUID = 1L << 17 - 1L; 32 | 33 | /** default constructor */ 34 | public NotServingRegionException() { 35 | super(); 36 | } 37 | 38 | /** 39 | * Constructor 40 | * @param s message 41 | */ 42 | public NotServingRegionException(String s) { 43 | super(s); 44 | } 45 | 46 | /** 47 | * Constructor 48 | * @param s message 49 | */ 50 | public NotServingRegionException(final byte [] s) { 51 | super(Bytes.toString(s)); 52 | } 53 | } -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/rest/ProtobufMessageHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | package org.apache.hadoop.hbase.rest; 22 | 23 | import java.io.IOException; 24 | 25 | /** 26 | * Common interface for models capable of supporting protobuf marshalling 27 | * and unmarshalling. Hooks up to the ProtobufMessageBodyConsumer and 28 | * ProtobufMessageBodyProducer adapters. 29 | */ 30 | public abstract interface ProtobufMessageHandler { 31 | /** 32 | * @return the protobuf represention of the model 33 | */ 34 | public byte[] createProtobufOutput(); 35 | 36 | /** 37 | * Initialize the model from a protobuf representation. 38 | * @param message the raw bytes of the protobuf message 39 | * @return reference to self for convenience 40 | * @throws IOException 41 | */ 42 | public ProtobufMessageHandler getObjectFromMessage(byte[] message) 43 | throws IOException; 44 | } 45 | -------------------------------------------------------------------------------- /src/main/resources/hbase-webapps/master/zk.jsp: -------------------------------------------------------------------------------- 1 | <%@ page contentType="text/html;charset=UTF-8" 2 | import="java.io.IOException" 3 | import="org.apache.hadoop.conf.Configuration" 4 | import="org.apache.hadoop.hbase.client.HBaseAdmin" 5 | import="org.apache.hadoop.hbase.client.HConnection" 6 | import="org.apache.hadoop.hbase.HRegionInfo" 7 | import="org.apache.hadoop.hbase.zookeeper.ZKUtil" 8 | import="org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher" 9 | import="org.apache.hadoop.hbase.HBaseConfiguration" 10 | import="org.apache.hadoop.hbase.master.HMaster" 11 | import="org.apache.hadoop.hbase.HConstants"%><% 12 | HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); 13 | Configuration conf = master.getConfiguration(); 14 | HBaseAdmin hbadmin = new HBaseAdmin(conf); 15 | HConnection connection = hbadmin.getConnection(); 16 | ZooKeeperWatcher watcher = connection.getZooKeeperWatcher(); 17 | %> 18 | 19 | 20 | 22 | 23 | 24 | ZooKeeper Dump 25 | 26 | 27 | 28 | 29 |

ZooKeeper Dump

30 | 31 |
32 |
33 | <%= ZKUtil.dump(watcher) %>
34 | 
35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/create.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class Create < Command 24 | def help 25 | return <<-EOF 26 | Create table; pass table name, a dictionary of specifications per 27 | column family, and optionally a dictionary of table configuration. 28 | Dictionaries are described below in the GENERAL NOTES section. 29 | Examples: 30 | 31 | hbase> create 't1', {NAME => 'f1', VERSIONS => 5} 32 | hbase> create 't1', {NAME => 'f1'}, {NAME => 'f2'}, {NAME => 'f3'} 33 | hbase> # The above in shorthand would be the following: 34 | hbase> create 't1', 'f1', 'f2', 'f3' 35 | hbase> create 't1', {NAME => 'f1', VERSIONS => 1, TTL => 2592000, BLOCKCACHE => true} 36 | EOF 37 | end 38 | 39 | def command(table, *args) 40 | format_simple_command do 41 | admin.create(table, *args) 42 | end 43 | end 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/InvalidFamilyOperationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * Thrown if a request is table schema modification is requested but 26 | * made for an invalid family name. 27 | */ 28 | public class InvalidFamilyOperationException extends IOException { 29 | private static final long serialVersionUID = 1L << 22 - 1L; 30 | /** default constructor */ 31 | public InvalidFamilyOperationException() { 32 | super(); 33 | } 34 | 35 | /** 36 | * Constructor 37 | * @param s message 38 | */ 39 | public InvalidFamilyOperationException(String s) { 40 | super(s); 41 | } 42 | 43 | /** 44 | * Constructor taking another exception. 45 | * @param e Exception to grab data from. 46 | */ 47 | public InvalidFamilyOperationException(Exception e) { 48 | super(e); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/avro/generated/AResult.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Autogenerated by Avro 3 | * 4 | * DO NOT EDIT DIRECTLY 5 | */ 6 | package org.apache.hadoop.hbase.avro.generated; 7 | 8 | @SuppressWarnings("all") 9 | public class AResult extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 10 | public static final org.apache.avro.Schema SCHEMA$ = org.apache.avro.Schema.parse("{\"type\":\"record\",\"name\":\"AResult\",\"namespace\":\"org.apache.hadoop.hbase.avro.generated\",\"fields\":[{\"name\":\"row\",\"type\":\"bytes\"},{\"name\":\"entries\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"AResultEntry\",\"fields\":[{\"name\":\"family\",\"type\":\"bytes\"},{\"name\":\"qualifier\",\"type\":\"bytes\"},{\"name\":\"value\",\"type\":\"bytes\"},{\"name\":\"timestamp\",\"type\":\"long\"}]}}}]}"); 11 | public java.nio.ByteBuffer row; 12 | public java.util.List entries; 13 | public org.apache.avro.Schema getSchema() { return SCHEMA$; } 14 | // Used by DatumWriter. Applications should not call. 15 | public java.lang.Object get(int field$) { 16 | switch (field$) { 17 | case 0: return row; 18 | case 1: return entries; 19 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 20 | } 21 | } 22 | // Used by DatumReader. Applications should not call. 23 | @SuppressWarnings(value="unchecked") 24 | public void put(int field$, java.lang.Object value$) { 25 | switch (field$) { 26 | case 0: row = (java.nio.ByteBuffer)value$; break; 27 | case 1: entries = (java.util.List)value$; break; 28 | default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/ipc/CoprocessorProtocol.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2010 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.ipc; 21 | 22 | import org.apache.hadoop.ipc.VersionedProtocol; 23 | 24 | /** 25 | * All custom RPC protocols to be exported by Coprocessors must extend this interface. 26 | * 27 | *

28 | * Note that all callable methods must have a return type handled by 29 | * {@link org.apache.hadoop.hbase.io.HbaseObjectWritable#writeObject(java.io.DataOutput, Object, Class, org.apache.hadoop.conf.Configuration)}. 30 | * That is: 31 | *

    32 | *
  • a Java primitive type ({@code int}, {@code float}, etc)
  • 33 | *
  • a Java {@code String}
  • 34 | *
  • a {@link org.apache.hadoop.io.Writable}
  • 35 | *
  • an array or {@code java.util.List} of one of the above
  • 36 | *
37 | *

38 | */ 39 | public interface CoprocessorProtocol extends VersionedProtocol { 40 | } 41 | -------------------------------------------------------------------------------- /src/main/ruby/shell/commands/close_region.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2010 The Apache Software Foundation 3 | # 4 | # Licensed to the Apache Software Foundation (ASF) under one 5 | # or more contributor license agreements. See the NOTICE file 6 | # distributed with this work for additional information 7 | # regarding copyright ownership. The ASF licenses this file 8 | # to you under the Apache License, Version 2.0 (the 9 | # "License"); you may not use this file except in compliance 10 | # with the License. You may obtain a copy of the License at 11 | # 12 | # http://www.apache.org/licenses/LICENSE-2.0 13 | # 14 | # Unless required by applicable law or agreed to in writing, software 15 | # distributed under the License is distributed on an "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | # See the License for the specific language governing permissions and 18 | # limitations under the License. 19 | # 20 | 21 | module Shell 22 | module Commands 23 | class CloseRegion < Command 24 | def help 25 | return <<-EOF 26 | Close a single region. Optionally specify regionserver. Connects to the 27 | regionserver and runs close on hosting regionserver. The close is done 28 | without the master's involvement (It will not know of the close). Once 29 | closed, region will stay closed. Use assign to reopen/reassign. Use 30 | unassign or move to assign the region elsewhere on cluster. Use with 31 | caution. For experts only. Examples: 32 | 33 | hbase> close_region 'REGIONNAME' 34 | hbase> close_region 'REGIONNAME', 'REGIONSERVER_IP:PORT' 35 | EOF 36 | end 37 | 38 | def command(region_name, server = nil) 39 | format_simple_command do 40 | admin.close_region(region_name, server) 41 | end 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /src/main/java/org/apache/hadoop/hbase/io/HeapSize.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2009 The Apache Software Foundation 3 | * 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | package org.apache.hadoop.hbase.io; 21 | 22 | /** 23 | * Implementations can be asked for an estimate of their size in bytes. 24 | *

25 | * Useful for sizing caches. Its a given that implementation approximations 26 | * do not account for 32 vs 64 bit nor for different VM implementations. 27 | *

28 | * An Object's size is determined by the non-static data members in it, 29 | * as well as the fixed {@link Object} overhead. 30 | *

31 | * For example: 32 | *

33 |  * public class SampleObject implements HeapSize {
34 |  *
35 |  *   int [] numbers;
36 |  *   int x;
37 |  * }
38 |  * 
39 | */ 40 | public interface HeapSize { 41 | /** 42 | * @return Approximate 'exclusive deep size' of implementing object. Includes 43 | * count of payload and hosting object sizings. 44 | */ 45 | public long heapSize(); 46 | 47 | } 48 | --------------------------------------------------------------------------------