You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2014/08/01 18:40:16 UTC
[2/3] HBASE-11640 Add syntax highlighting support to HBase Ref Guide
programlistings (Misty Stanley-Jones)
http://git-wip-us.apache.org/repos/asf/hbase/blob/24b5fa7f/src/main/docbkx/developer.xml
----------------------------------------------------------------------
diff --git a/src/main/docbkx/developer.xml b/src/main/docbkx/developer.xml
index 3d003f1..93d8a61 100644
--- a/src/main/docbkx/developer.xml
+++ b/src/main/docbkx/developer.xml
@@ -90,9 +90,9 @@
<section xml:id="eclipse.commandline">
<title>Import into eclipse with the command line</title>
<para>For those not inclined to use m2eclipse, you can generate the Eclipse files from the command line. First, run (you should only have to do this once):
- <programlisting>mvn clean install -DskipTests</programlisting>
+ <programlisting language="bourne">mvn clean install -DskipTests</programlisting>
and then close Eclipse and execute...
- <programlisting>mvn eclipse:eclipse</programlisting>
+ <programlisting language="bourne">mvn eclipse:eclipse</programlisting>
... from your local HBase project directory in your workspace to generate some new <filename>.project</filename>
and <filename>.classpath</filename>files. Then reopen Eclipse, or refresh your eclipse project (F5), and import
the .project file in the HBase directory to a workspace.
@@ -136,11 +136,11 @@ Access restriction: The method getLong(Object, long) from the type Unsafe is not
<title>Basic Compile</title>
<para>Thanks to maven, building HBase is pretty easy. You can read about the various maven commands in <xref linkend="maven.build.commands"/>,
but the simplest command to compile HBase from its java source code is:
- <programlisting>
+ <programlisting language="bourne">
mvn package -DskipTests
</programlisting>
Or, to clean up before compiling:
- <programlisting>
+ <programlisting language="bourne">
mvn clean package -DskipTests
</programlisting>
With Eclipse set up as explained above in <xref linkend="eclipse"/>, you can also simply use the build command in Eclipse.
@@ -152,14 +152,14 @@ mvn clean package -DskipTests
<para>
The protobuf files are located <filename>hbase-protocol/src/main/protobuf</filename>.
For the change to be effective, you will need to regenerate the classes. You can use maven profile compile-protobuf to do this.
- <programlisting>
+ <programlisting language="bourne">
mvn compile -Dcompile-protobuf
or
mvn compile -Pcompile-protobuf
</programlisting>
You may also want to define protoc.path for the protoc binary
- <programlisting>
+ <programlisting language="bourne">
mvn compile -Dcompile-protobuf -Dprotoc.path=/opt/local/bin/protoc
</programlisting> Read the <filename>hbase-protocol/README.txt</filename> for more details.
</para>
@@ -212,7 +212,7 @@ mvn compile -Dcompile-protobuf -Dprotoc.path=/opt/local/bin/protoc
build do this for you, you need to make sure you have a properly configured
<filename>settings.xml</filename> in your local repository under <filename>.m2</filename>.
Here is my <filename>~/.m2/settings.xml</filename>.
- <programlisting><![CDATA[<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ <programlisting language="xml"><![CDATA[<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
@@ -287,7 +287,7 @@ under the respective release documentation folders.
publish a SNAPSHOT, you must keep the <emphasis>-SNAPSHOT</emphasis> suffix on the hbase version.
The <link xlink:href="http://mojo.codehaus.org/versions-maven-plugin/">Versions Maven Plugin</link> can be of use here. To
set a version in all the many poms of the hbase multi-module project, do something like this:
- <programlisting>$ mvn clean org.codehaus.mojo:versions-maven-plugin:1.3.1:set -DnewVersion=0.96.0</programlisting>
+ <programlisting language="bourne">$ mvn clean org.codehaus.mojo:versions-maven-plugin:1.3.1:set -DnewVersion=0.96.0</programlisting>
Checkin the <filename>CHANGES.txt</filename> and any version changes.
</para>
<para>
@@ -296,7 +296,7 @@ under the respective release documentation folders.
</para>
<para>Now, build the src tarball. This tarball is hadoop version independent. It is just the pure src code and documentation without a particular hadoop taint, etc.
Add the <varname>-Prelease</varname> profile when building; it checks files for licenses and will fail the build if unlicensed files present.
- <programlisting>$ MAVEN_OPTS="-Xmx2g" mvn clean install -DskipTests assembly:single -Dassembly.file=hbase-assembly/src/main/assembly/src.xml -Prelease</programlisting>
+ <programlisting language="bourne">$ MAVEN_OPTS="-Xmx2g" mvn clean install -DskipTests assembly:single -Dassembly.file=hbase-assembly/src/main/assembly/src.xml -Prelease</programlisting>
Undo the tarball and make sure it looks good. A good test for the src tarball being 'complete' is to see if
you can build new tarballs from this source bundle.
If the source tarball is good, save it off to a <emphasis>version directory</emphasis>, i.e a directory somewhere where you are collecting
@@ -309,7 +309,7 @@ under the respective release documentation folders.
Do it in two steps. First install into the local repository and then generate documentation and assemble the tarball
(Otherwise build complains that hbase modules are not in maven repo when we try to do it all in the one go especially on fresh repo).
It seems that you need the install goal in both steps.
- <programlisting>$ MAVEN_OPTS="-Xmx3g" mvn clean install -DskipTests -Prelease
+ <programlisting language="bourne">$ MAVEN_OPTS="-Xmx3g" mvn clean install -DskipTests -Prelease
$ MAVEN_OPTS="-Xmx3g" mvn install -DskipTests site assembly:single -Prelease</programlisting>
Undo the generated tarball and check it out. Look at doc. and see if it runs, etc.
If good, copy the tarball to the above mentioned <emphasis>version directory</emphasis>.
@@ -320,7 +320,7 @@ If good, copy the tarball to the above mentioned <emphasis>version directory</em
This time we use the <varname>apache-release</varname> profile instead of just <varname>release</varname> profile when doing mvn deploy;
it will invoke the apache pom referenced by our poms. It will also sign your artifacts published to mvn as long as your settings.xml in your local <filename>.m2</filename>
repository is configured correctly (your <filename>settings.xml</filename> adds your gpg password property to the apache profile).
-<programlisting>$ MAVEN_OPTS="-Xmx3g" mvn deploy -DskipTests -Papache-release</programlisting>
+<programlisting language="bourne">$ MAVEN_OPTS="-Xmx3g" mvn deploy -DskipTests -Papache-release</programlisting>
The last command above copies all artifacts up to a temporary staging apache mvn repo in an 'open' state.
We'll need to do more work on these maven artifacts to make them generally available.
</para>
@@ -379,7 +379,7 @@ or borked, just delete the 'open' staged artifacts.
<para>
If all checks out, next put the <emphasis>version directory</emphasis> up on people.apache.org. You will need to sign and fingerprint them before you
push them up. In the <emphasis>version directory</emphasis> do this:
- <programlisting>$ for i in *.tar.gz; do echo $i; gpg --print-mds $i > $i.mds ; done
+ <programlisting language="bourne">$ for i in *.tar.gz; do echo $i; gpg --print-mds $i > $i.mds ; done
$ for i in *.tar.gz; do echo $i; gpg --armor --output $i.asc --detach-sig $i ; done
$ cd ..
# Presuming our 'version directory' is named 0.96.0RC0, now copy it up to people.apache.org.
@@ -396,7 +396,7 @@ $ rsync -av 0.96.0RC0 people.apache.org:public_html
<para>Make sure your <filename>settings.xml</filename> is set up properly (see above for how).
Make sure the hbase version includes <varname>-SNAPSHOT</varname> as a suffix. Here is how I published SNAPSHOTS of
a release that had an hbase version of 0.96.0 in its poms.
- <programlisting>$ MAVEN_OPTS="-Xmx3g" mvn clean install -DskipTests javadoc:aggregate site assembly:single -Prelease
+ <programlisting language="bourne">$ MAVEN_OPTS="-Xmx3g" mvn clean install -DskipTests javadoc:aggregate site assembly:single -Prelease
$ MAVEN_OPTS="-Xmx3g" mvn -DskipTests deploy -Papache-release</programlisting>
</para>
<para>The <filename>make_rc.sh</filename> script mentioned above in the
@@ -436,7 +436,7 @@ $ rsync -av 0.96.0RC0 people.apache.org:public_html
(see <xref linkend="submitting.patches"/>). Your Jira should contain a summary of the changes in each
section (see <link xlink:href="https://issues.apache.org/jira/browse/HBASE-6081">HBASE-6081</link> for an example).</para>
<para>To generate the site locally while you're working on it, run:
- <programlisting>mvn site</programlisting>
+ <programlisting language="bourne">mvn site</programlisting>
Then you can load up the generated HTML files in your browser (file are under <filename>/target/site</filename>).</para>
</section>
<section xml:id="hbase.org.site.publishing">
@@ -446,14 +446,14 @@ $ rsync -av 0.96.0RC0 people.apache.org:public_html
Finally, check it in. For example, if trunk is checked out out at <filename>/Users/stack/checkouts/trunk</filename>
and the hbase website, hbase.apache.org, is checked out at <filename>/Users/stack/checkouts/hbase.apache.org/trunk</filename>, to update
the site, do the following:
- <programlisting>
+ <programlisting language="bourne">
# Build the site and deploy it to the checked out directory
# Getting the javadoc into site is a little tricky. You have to build it before you invoke 'site'.
$ MAVEN_OPTS=" -Xmx3g" mvn clean install -DskipTests javadoc:aggregate site site:stage -DstagingDirectory=/Users/stack/checkouts/hbase.apache.org/trunk
</programlisting>
Now check the deployed site by viewing in a brower, browse to file:////Users/stack/checkouts/hbase.apache.org/trunk/index.html and check all is good.
If all checks out, commit it and your new build will show up immediately at http://hbase.apache.org
- <programlisting>
+ <programlisting language="bourne">
$ cd /Users/stack/checkouts/hbase.apache.org/trunk
$ svn status
# Do an svn add of any new content...
@@ -500,16 +500,16 @@ HBase have a character not usually seen in other projects.</para>
<title>Running Tests in other Modules</title>
<para>If the module you are developing in has no other dependencies on other HBase modules, then
you can cd into that module and just run:</para>
- <programlisting>mvn test</programlisting>
+ <programlisting language="bourne">mvn test</programlisting>
<para>which will just run the tests IN THAT MODULE. If there are other dependencies on other modules,
then you will have run the command from the ROOT HBASE DIRECTORY. This will run the tests in the other
modules, unless you specify to skip the tests in that module. For instance, to skip the tests in the hbase-server module,
you would run:</para>
- <programlisting>mvn clean test -PskipServerTests</programlisting>
+ <programlisting language="bourne">mvn clean test -PskipServerTests</programlisting>
<para>from the top level directory to run all the tests in modules other than hbase-server. Note that you
can specify to skip tests in multiple modules as well as just for a single module. For example, to skip
the tests in <classname>hbase-server</classname> and <classname>hbase-common</classname>, you would run:</para>
- <programlisting>mvn clean test -PskipServerTests -PskipCommonTests</programlisting>
+ <programlisting language="bourne">mvn clean test -PskipServerTests -PskipCommonTests</programlisting>
<para>Also, keep in mind that if you are running tests in the <classname>hbase-server</classname> module you will need to
apply the maven profiles discussed in <xref linkend="hbase.unittests.cmds"/> to get the tests to run properly.</para>
</section>
@@ -522,7 +522,7 @@ integration with corresponding JUnit <link xlink:href="http://www.junit.org/node
<classname>SmallTests</classname>, <classname>MediumTests</classname>,
<classname>LargeTests</classname>, <classname>IntegrationTests</classname>.
JUnit categories are denoted using java annotations and look like this in your unit test code.</para>
-<programlisting>...
+<programlisting language="java">...
@Category(SmallTests.class)
public class TestHRegionInfo {
@Test
@@ -589,7 +589,7 @@ public class TestHRegionInfo {
<section
xml:id="hbase.unittests.cmds.test">
<title>Default: small and medium category tests </title>
- <para>Running <programlisting>mvn test</programlisting> will execute all small tests
+ <para>Running <programlisting language="bourne">mvn test</programlisting> will execute all small tests
in a single JVM (no fork) and then medium tests in a separate JVM for each test
instance. Medium tests are NOT executed if there is an error in a small test.
Large tests are NOT executed. There is one report for small tests, and one
@@ -599,7 +599,7 @@ public class TestHRegionInfo {
<section
xml:id="hbase.unittests.cmds.test.runAllTests">
<title>Running all tests</title>
- <para>Running <programlisting>mvn test -P runAllTests</programlisting> will execute
+ <para>Running <programlisting language="bourne">mvn test -P runAllTests</programlisting> will execute
small tests in a single JVM then medium and large tests in a separate JVM for
each test. Medium and large tests are NOT executed if there is an error in a
small test. Large tests are NOT executed if there is an error in a small or
@@ -611,11 +611,11 @@ public class TestHRegionInfo {
xml:id="hbase.unittests.cmds.test.localtests.mytest">
<title>Running a single test or all tests in a package</title>
<para>To run an individual test, e.g. <classname>MyTest</classname>, do
- <programlisting>mvn test -Dtest=MyTest</programlisting> You can also pass
+ <programlisting language="bourne">mvn test -Dtest=MyTest</programlisting> You can also pass
multiple, individual tests as a comma-delimited list:
- <programlisting>mvn test -Dtest=MyTest1,MyTest2,MyTest3</programlisting> You can
+ <programlisting language="bourne">mvn test -Dtest=MyTest1,MyTest2,MyTest3</programlisting> You can
also pass a package, which will run all tests under the package:
- <programlisting>mvn test '-Dtest=org.apache.hadoop.hbase.client.*'</programlisting>
+ <programlisting language="bourne">mvn test '-Dtest=org.apache.hadoop.hbase.client.*'</programlisting>
</para>
<para> When <code>-Dtest</code> is specified, <code>localTests</code> profile will
@@ -656,10 +656,10 @@ public class TestHRegionInfo {
can as well use a ramdisk. You will need 2Gb of memory to run all tests. You
will also need to delete the files between two test run. The typical way to
configure a ramdisk on Linux is:</para>
- <screen>$ sudo mkdir /ram2G
+ <screen language="bourne">$ sudo mkdir /ram2G
sudo mount -t tmpfs -o size=2048M tmpfs /ram2G</screen>
<para>You can then use it to run all HBase tests with the command: </para>
- <screen>mvn test
+ <screen language="bourne">mvn test
-P runAllTests -Dsurefire.secondPartThreadCount=12
-Dtest.build.data.basedirectory=/ram2G</screen>
</section>
@@ -848,7 +848,7 @@ ConnectionCount=1 (was 1) </screen>
tests that are in the HBase integration test group. After you have completed
<command>mvn install -DskipTests</command> You can run just the integration
tests by invoking:</para>
- <programlisting>
+ <programlisting language="bourne">
cd hbase-it
mvn verify</programlisting>
<para>If you just want to run the integration tests in top-level, you need to run
@@ -890,9 +890,9 @@ mvn verify</programlisting>
<para> If you have an already-setup HBase cluster, you can launch the integration
tests by invoking the class <code>IntegrationTestsDriver</code>. You may have to
run test-compile first. The configuration will be picked by the bin/hbase
- script. <programlisting>mvn test-compile</programlisting> Then launch the tests
+ script. <programlisting language="bourne">mvn test-compile</programlisting> Then launch the tests
with:</para>
- <programlisting>bin/hbase [--config config_dir] org.apache.hadoop.hbase.IntegrationTestsDriver</programlisting>
+ <programlisting language="bourne">bin/hbase [--config config_dir] org.apache.hadoop.hbase.IntegrationTestsDriver</programlisting>
<para>Pass <code>-h</code> to get usage on this sweet tool. Running the
IntegrationTestsDriver without any argument will launch tests found under
<code>hbase-it/src/test</code>, having
@@ -968,7 +968,7 @@ mvn verify</programlisting>
ChaosMonkey uses the configuration from the bin/hbase script, thus no extra
configuration needs to be done. You can invoke the ChaosMonkey by
running:</para>
- <programlisting>bin/hbase org.apache.hadoop.hbase.util.ChaosMonkey</programlisting>
+ <programlisting language="bourne">bin/hbase org.apache.hadoop.hbase.util.ChaosMonkey</programlisting>
<para> This will output smt like: </para>
<screen>
12/11/19 23:21:57 INFO util.ChaosMonkey: Using ChaosMonkey Policy: class org.apache.hadoop.hbase.util.ChaosMonkey$PeriodicRandomActionPolicy, period:60000
@@ -1021,7 +1021,7 @@ As you can see from the log, ChaosMonkey started the default PeriodicRandomActio
<classname>org.apache.hadoop.hbase.chaos.factories.MonkeyConstants</classname> class.
If any chaos monkey configuration is missing from the property file, then the default values are assumed.
For example:</para>
- <programlisting>
+ <programlisting language="bourne">
$<userinput>bin/hbase org.apache.hadoop.hbase.IntegrationTestIngest -m slowDeterministic -monkeyProps monkey.properties</userinput>
</programlisting>
<para>The above command will start the integration tests and chaos monkey passing the properties file <filename>monkey.properties</filename>.
@@ -1046,7 +1046,7 @@ batch.restart.rs.ratio=0.4f
</para>
<section xml:id="maven.build.commands.compile">
<title>Compile</title>
- <programlisting>
+ <programlisting language="bourne">
mvn compile
</programlisting>
</section>
@@ -1063,7 +1063,7 @@ mvn compile
By default, in 0.96 and earlier, we will build with Hadoop-1.0.x.
As of 0.98, Hadoop 1.x is deprecated and Hadoop 2.x is the default.
To change the version to build against, add a hadoop.profile property when you invoke <command>mvn</command>:</para>
- <programlisting>mvn -Dhadoop.profile=1.0 ...</programlisting>
+ <programlisting language="bourne">mvn -Dhadoop.profile=1.0 ...</programlisting>
<para>
The above will build against whatever explicit hadoop 1.x version we have in our <filename>pom.xml</filename> as our '1.0' version.
Tests may not all pass so you may need to pass <code>-DskipTests</code> unless you are inclined to fix the failing tests.</para>
@@ -1083,7 +1083,7 @@ pecularity that is probably fixable but we've not spent the time trying to figur
<para> In earilier versions of Apache HBase, you can build against older versions of Apache
Hadoop, notably, Hadoop 0.22.x and 0.23.x. If you are running, for example
HBase-0.94 and wanted to build against Hadoop 0.23.x, you would run with:</para>
- <programlisting>mvn -Dhadoop.profile=22 ...</programlisting>
+ <programlisting language="bourne">mvn -Dhadoop.profile=22 ...</programlisting>
</section>
</section>
@@ -1154,7 +1154,7 @@ pecularity that is probably fixable but we've not spent the time trying to figur
<para>HBase uses <link
xlink:href="http://junit.org">JUnit</link> 4 for unit tests</para>
<para>This example will add unit tests to the following example class:</para>
- <programlisting>
+ <programlisting language="java">
public class MyHBaseDAO {
public static void insertRecord(HTableInterface table, HBaseTestObj obj)
@@ -1174,7 +1174,7 @@ public class MyHBaseDAO {
}
</programlisting>
<para>The first step is to add JUnit dependencies to your Maven POM file:</para>
- <programlisting><![CDATA[
+ <programlisting language="xml"><![CDATA[
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -1184,7 +1184,7 @@ public class MyHBaseDAO {
]]></programlisting>
<para>Next, add some unit tests to your code. Tests are annotated with
<literal>@Test</literal>. Here, the unit tests are in bold.</para>
- <programlisting>
+ <programlisting language="java">
public class TestMyHbaseDAOData {
@Test
public void testCreatePut() throws Exception {
@@ -1222,7 +1222,7 @@ public class TestMyHbaseDAOData {
linkend="unit.tests" />, to test the <code>insertRecord</code>
method.</para>
<para>First, add a dependency for Mockito to your Maven POM file.</para>
- <programlisting><![CDATA[
+ <programlisting language="xml"><![CDATA[
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
@@ -1232,7 +1232,7 @@ public class TestMyHbaseDAOData {
]]></programlisting>
<para>Next, add a <code>@RunWith</code> annotation to your test class, to direct it
to use Mockito.</para>
- <programlisting>
+ <programlisting language="java">
<userinput>@RunWith(MockitoJUnitRunner.class)</userinput>
public class TestMyHBaseDAO{
@Mock
@@ -1283,7 +1283,7 @@ public class TestMyHBaseDAO{
<literal>MyTest</literal>, which has one column family called
<literal>CF</literal>, the reducer of such a job could look like the
following:</para>
- <programlisting><![CDATA[
+ <programlisting language="java"><![CDATA[
public class MyReducer extends TableReducer<Text, Text, ImmutableBytesWritable> {
public static final byte[] CF = "CF".getBytes();
public static final byte[] QUALIFIER = "CQ-1".getBytes();
@@ -1304,7 +1304,7 @@ public class MyReducer extends TableReducer<Text, Text, ImmutableBytesWritable>
</programlisting>
<para>To test this code, the first step is to add a dependency to MRUnit to your
Maven POM file. </para>
- <programlisting><![CDATA[
+ <programlisting language="xml"><![CDATA[
<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
@@ -1313,7 +1313,7 @@ public class MyReducer extends TableReducer<Text, Text, ImmutableBytesWritable>
</dependency>
]]></programlisting>
<para>Next, use the ReducerDriver provided by MRUnit, in your Reducer job.</para>
- <programlisting><![CDATA[
+ <programlisting language="java"><![CDATA[
public class MyReducerTest {
ReduceDriver<Text, Text, ImmutableBytesWritable, Writable> reduceDriver;
byte[] CF = "CF".getBytes();
@@ -1367,7 +1367,7 @@ strValue2 = "DATA2";
tests using a <firstterm>mini-cluster</firstterm>. The first step is to add some
dependencies to your Maven POM file. Check the versions to be sure they are
appropriate.</para>
- <programlisting><![CDATA[
+ <programlisting language="xml"><![CDATA[
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
@@ -1401,7 +1401,7 @@ strValue2 = "DATA2";
]]></programlisting>
<para>This code represents an integration test for the MyDAO insert shown in <xref
linkend="unit.tests" />.</para>
- <programlisting>
+ <programlisting language="java">
public class MyHBaseIntegrationTest {
private static HBaseTestingUtility utility;
byte[] CF = "CF".getBytes();
@@ -1567,12 +1567,12 @@ public class MyHBaseIntegrationTest {
<para>If you are developing Apache HBase, frequently it is useful to test your changes against a more-real cluster than what you find in unit tests. In this case, HBase can be run directly from the source in local-mode.
All you need to do is run:
</para>
- <programlisting>${HBASE_HOME}/bin/start-hbase.sh</programlisting>
+ <programlisting language="bourne">${HBASE_HOME}/bin/start-hbase.sh</programlisting>
<para>
This will spin up a full local-cluster, just as if you had packaged up HBase and installed it on your machine.
</para>
<para>Keep in mind that you will need to have installed HBase into your local maven repository for the in-situ cluster to work properly. That is, you will need to run:</para>
- <programlisting>mvn clean install -DskipTests</programlisting>
+ <programlisting language="bourne">mvn clean install -DskipTests</programlisting>
<para>to ensure that maven can find the correct classpath and dependencies. Generally, the above command
is just a good thing to try running first, if maven is acting oddly.</para>
</section> <!-- run.insitu -->
@@ -1638,7 +1638,7 @@ public class MyHBaseIntegrationTest {
selected resource when generating the patch is a directory. Patch files can reflect changes in multiple files. </para>
<para>
Generating patches using git:</para>
-<screen>$ git diff --no-prefix > HBASE_XXXX.patch</screen>
+<screen language="bourne">$ git diff --no-prefix > HBASE_XXXX.patch</screen>
<para>
Don't forget the 'no-prefix' option; and generate the diff from the root directory of project
</para>
@@ -1686,20 +1686,20 @@ public class MyHBaseIntegrationTest {
<section xml:id="common.patch.feedback.space.invaders">
<title>Space Invaders</title>
<para>Rather than do this...
-<programlisting>
+<programlisting language="java">
if ( foo.equals( bar ) ) { // don't do this
</programlisting>
... do this instead...
-<programlisting>
+<programlisting language="java">
if (foo.equals(bar)) {
</programlisting>
</para>
<para>Also, rather than do this...
-<programlisting>
+<programlisting language="java">
foo = barArray[ i ]; // don't do this
</programlisting>
... do this instead...
-<programlisting>
+<programlisting language="java">
foo = barArray[i];
</programlisting>
</para>
@@ -1707,12 +1707,12 @@ foo = barArray[i];
<section xml:id="common.patch.feedback.autogen">
<title>Auto Generated Code</title>
<para>Auto-generated code in Eclipse often looks like this...
-<programlisting>
+<programlisting language="java">
public void readFields(DataInput arg0) throws IOException { // don't do this
foo = arg0.readUTF(); // don't do this
</programlisting>
... do this instead ...
-<programlisting>
+<programlisting language="java">
public void readFields(DataInput di) throws IOException {
foo = di.readUTF();
</programlisting>
@@ -1723,11 +1723,11 @@ foo = barArray[i];
<title>Long Lines</title>
<para>
Keep lines less than 100 characters.
-<programlisting>
+<programlisting language="java">
Bar bar = foo.veryLongMethodWithManyArguments(argument1, argument2, argument3, argument4, argument5, argument6, argument7, argument8, argument9); // don't do this
</programlisting>
... do something like this instead ...
-<programlisting>
+<programlisting language="java">
Bar bar = foo.veryLongMethodWithManyArguments(
argument1, argument2, argument3,argument4, argument5, argument6, argument7, argument8, argument9);
</programlisting>
@@ -1737,8 +1737,8 @@ Bar bar = foo.veryLongMethodWithManyArguments(
<title>Trailing Spaces</title>
<para>
This happens more than people would imagine.
-<programlisting>
-Bar bar = foo.getBar(); <--- imagine there's an extra space(s) after the semicolon instead of a line break.
+<programlisting language="java">
+Bar bar = foo.getBar(); <--- imagine there is an extra space(s) after the semicolon instead of a line break.
</programlisting>
Make sure there's a line-break after the end of your code, and also avoid lines that have nothing
but whitespace.
@@ -1772,7 +1772,7 @@ Bar bar = foo.getBar(); <--- imagine there's an extra space(s) after the
findbugs files locally. Sometimes, you may have to write code smarter than
Findbugs. You can annotate your code to tell Findbugs you know what you're
doing, by annotating your class with:
- <programlisting>@edu.umd.cs.findbugs.annotations.SuppressWarnings(
+ <programlisting language="java">@edu.umd.cs.findbugs.annotations.SuppressWarnings(
value="HE_EQUALS_USE_HASHCODE",
justification="I know what I'm doing")</programlisting>
</para>
@@ -1785,7 +1785,7 @@ Bar bar = foo.getBar(); <--- imagine there's an extra space(s) after the
<title>Javadoc - Useless Defaults</title>
<para>Don't just leave the @param arguments the way your IDE generated them. Don't do
this...</para>
-<programlisting>
+<programlisting language="java">
/**
*
* @param bar <---- don't do this!!!!
@@ -1853,7 +1853,7 @@ Bar bar = foo.getBar(); <--- imagine there's an extra space(s) after the
<para>patch 1:</para>
<itemizedlist>
<listitem>
- <screen>$ git diff --no-prefix > HBASE_XXXX-1.patch</screen>
+ <screen language="bourne">$ git diff --no-prefix > HBASE_XXXX-1.patch</screen>
</listitem>
</itemizedlist>
</listitem>
@@ -1862,12 +1862,12 @@ Bar bar = foo.getBar(); <--- imagine there's an extra space(s) after the
<itemizedlist>
<listitem>
<para>create a new git branch</para>
- <screen>$ git checkout -b my_branch</screen>
+ <screen language="bourne">$ git checkout -b my_branch</screen>
</listitem>
<listitem>
<para>save your work</para>
- <screen>$ git add file1 file2 </screen>
- <screen>$ git commit -am 'saved after HBASE_XXXX-1.patch'</screen>
+ <screen language="bourne">$ git add file1 file2 </screen>
+ <screen language="bourne">$ git commit -am 'saved after HBASE_XXXX-1.patch'</screen>
<para>now you have your own branch, that is different from remote
master branch</para>
</listitem>
@@ -1876,7 +1876,7 @@ Bar bar = foo.getBar(); <--- imagine there's an extra space(s) after the
</listitem>
<listitem>
<para>create second patch</para>
- <screen>$ git diff --no-prefix > HBASE_XXXX-2.patch</screen>
+ <screen language="bourne">$ git diff --no-prefix > HBASE_XXXX-2.patch</screen>
</listitem>
</itemizedlist>
http://git-wip-us.apache.org/repos/asf/hbase/blob/24b5fa7f/src/main/docbkx/getting_started.xml
----------------------------------------------------------------------
diff --git a/src/main/docbkx/getting_started.xml b/src/main/docbkx/getting_started.xml
index b4e9911..fcf71f2 100644
--- a/src/main/docbkx/getting_started.xml
+++ b/src/main/docbkx/getting_started.xml
@@ -111,7 +111,7 @@
</step>
<step>
<para>Extract the downloaded file, and change to the newly-created directory.</para>
- <screen>
+ <screen language="bourne">
$ tar xzvf hbase-<![CDATA[<?eval ${project.version}?>]]>-hadoop2-bin.tar.gz
$ cd hbase-<![CDATA[<?eval ${project.version}?>]]>-hadoop2/
</screen>
@@ -127,7 +127,7 @@ $ cd hbase-<![CDATA[<?eval ${project.version}?>]]>-hadoop2/
<markup><configuration></markup> tags, which should be empty in a new HBase install.</para>
<example>
<title>Example <filename>hbase-site.xml</filename> for Standalone HBase</title>
- <programlisting><![CDATA[
+ <programlisting language="xml"><![CDATA[
<configuration>
<property>
<name>hbase.rootdir</name>
@@ -168,7 +168,7 @@ $ cd hbase-<![CDATA[<?eval ${project.version}?>]]>-hadoop2/
install. In this example, some usage and version information that is printed when you
start HBase Shell has been omitted. The HBase Shell prompt ends with a
<literal>></literal> character.</para>
- <screen>
+ <screen language="bourne">
$ <userinput>./bin/hbase shell</userinput>
hbase(main):001:0>
</screen>
@@ -283,7 +283,7 @@ hbase> drop 'test'
<para>In the same way that the <filename>bin/start-hbase.sh</filename> script is provided
to conveniently start all HBase daemons, the <filename>bin/stop-hbase.sh</filename>
script stops them.</para>
- <screen>
+ <screen language="bourne">
$ ./bin/stop-hbase.sh
stopping hbase....................
$
@@ -335,7 +335,7 @@ $
property <code>hbase.master.wait.on.regionservers.mintostart</code> should be set to
<code>1</code> (Its default is changed to <code>2</code> since version 1.0.0).
</para>
- <programlisting><![CDATA[
+ <programlisting language="xml"><![CDATA[
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
@@ -348,7 +348,7 @@ $
<para>Next, change the <code>hbase.rootdir</code> from the local filesystem to the address
of your HDFS instance, using the <code>hdfs:////</code> URI syntax. In this example,
HDFS is running on the localhost at port 8020.</para>
- <programlisting><![CDATA[
+ <programlisting language="xml"><![CDATA[
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:8020/hbase</value>
@@ -371,7 +371,7 @@ $
configuration above, it is stored in <filename>/hbase/</filename> on HDFS. You can use
the <command>hadoop fs</command> command in Hadoop's <filename>bin/</filename> directory
to list this directory.</para>
- <screen>
+ <screen language="bourne">
$ <userinput>./bin/hadoop fs -ls /hbase</userinput>
Found 7 items
drwxr-xr-x - hbase users 0 2014-06-25 18:58 /hbase/.tmp
@@ -404,7 +404,7 @@ drwxr-xr-x - hbase users 0 2014-06-25 21:49 /hbase/oldWALs
using an offset of 2, the backup HMaster would use ports 16012, 16022, and 16032. The
following command starts 3 backup servers using ports 16012/16022/16032, 16013/16023/16033,
and 16015/16025/16035.</para>
- <screen>
+ <screen language="bourne">
$ ./bin/local-master-backup.sh 2 3 5
</screen>
<para>To kill a backup master without killing the entire cluster, you need to find its
@@ -413,7 +413,7 @@ $ ./bin/local-master-backup.sh 2 3 5
The only contents of the file are the PID. You can use the <command>kill -9</command>
command to kill that PID. The following command will kill the master with port offset 1,
but leave the cluster running:</para>
- <screen>
+ <screen language="bourne">
$ cat /tmp/hbase-testuser-1-master.pid |xargs kill -9
</screen>
</step>
@@ -432,13 +432,13 @@ $ cat /tmp/hbase-testuser-1-master.pid |xargs kill -9
You can run 99 additional RegionServers that are not a HMaster or backup HMaster,
on a server. The following command starts four additional RegionServers, running on
sequential ports starting at 16202/16302 (base ports 16200/16300 plus 2).</para>
- <screen>
+ <screen language="bourne">
$ .bin/local-regionservers.sh start 2 3 4 5
</screen>
<para>To stop a RegionServer manually, use the <command>local-regionservers.sh</command>
command with the <literal>stop</literal> parameter and the offset of the server to
stop.</para>
- <screen>$ .bin/local-regionservers.sh stop 3</screen>
+ <screen language="bourne">$ .bin/local-regionservers.sh stop 3</screen>
</step>
<step>
<title>Stop HBase.</title>
@@ -510,7 +510,7 @@ $ .bin/local-regionservers.sh start 2 3 4 5
<para>While logged in as the user who will run HBase, generate a SSH key pair, using the
following command:
</para>
- <screen>$ ssh-keygen -t rsa</screen>
+ <screen language="bourne">$ ssh-keygen -t rsa</screen>
<para>If the command succeeds, the location of the key pair is printed to standard output.
The default name of the public key is <filename>id_rsa.pub</filename>.</para>
</step>
@@ -528,7 +528,7 @@ $ .bin/local-regionservers.sh start 2 3 4 5
not already exist</emphasis>, and append the contents of the
<filename>id_rsa.pub</filename> file to the end of it. Note that you also need to do
this for <code>node-a</code> itself.</para>
- <screen>$ cat id_rsa.pub >> ~/.ssh/authorized_keys</screen>
+ <screen language="bourne">$ cat id_rsa.pub >> ~/.ssh/authorized_keys</screen>
</step>
<step>
<title>Test password-less login.</title>
@@ -574,7 +574,7 @@ $ .bin/local-regionservers.sh start 2 3 4 5
ZooKeeper instance on each node of the cluster.</para>
<para>On <code>node-a</code>, edit <filename>conf/hbase-site.xml</filename> and add the
following properties.</para>
- <programlisting><![CDATA[
+ <programlisting language="bourne"><![CDATA[
<property>
<name>hbase.zookeeper.quorum</name>
<value>node-a.example.com,node-b.example.com,node-c.example.com</value>
@@ -623,7 +623,7 @@ $ .bin/local-regionservers.sh start 2 3 4 5
<title>Start the cluster.</title>
<para>On <code>node-a</code>, issue the <command>start-hbase.sh</command> command. Your
output will be similar to that below.</para>
- <screen>
+ <screen language="bourne">
$ <userinput>bin/start-hbase.sh</userinput>
node-c.example.com: starting zookeeper, logging to /home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-zookeeper-node-c.example.com.out
node-a.example.com: starting zookeeper, logging to /home/hbuser/hbase-0.98.3-hadoop2/bin/../logs/hbase-hbuser-zookeeper-node-a.example.com.out
@@ -643,7 +643,7 @@ node-b.example.com: starting master, logging to /home/hbuser/hbase-0.98.3-hadoop
running on your servers as well, if they are used for other purposes.</para>
<example>
<title><code>node-a</code> <command>jps</command> Output</title>
- <screen>
+ <screen language="bourne">
$ <userinput>jps</userinput>
20355 Jps
20071 HQuorumPeer
@@ -652,7 +652,7 @@ $ <userinput>jps</userinput>
</example>
<example>
<title><code>node-b</code> <command>jps</command> Output</title>
- <screen>
+ <screen language="bourne">
$ <userinput>jps</userinput>
15930 HRegionServer
16194 Jps
@@ -662,7 +662,7 @@ $ <userinput>jps</userinput>
</example>
<example>
<title><code>node-c</code> <command>jps</command> Output</title>
- <screen>
+ <screen language="bourne">
$ <userinput>jps</userinput>
13901 Jps
13639 HQuorumPeer
http://git-wip-us.apache.org/repos/asf/hbase/blob/24b5fa7f/src/main/docbkx/hbase_apis.xml
----------------------------------------------------------------------
diff --git a/src/main/docbkx/hbase_apis.xml b/src/main/docbkx/hbase_apis.xml
index b803269..bc35aba 100644
--- a/src/main/docbkx/hbase_apis.xml
+++ b/src/main/docbkx/hbase_apis.xml
@@ -40,7 +40,7 @@
<example>
<title>Create a Table Using Java</title>
<para>This example has been tested on HBase 0.96.1.1.</para>
- <programlisting>
+ <programlisting language="java">
package com.example.hbase.admin;
import java.io.IOException;
@@ -90,7 +90,7 @@ public class CreateSchema {
<example>
<title>Add, Modify, and Delete a Table</title>
<para>This example has been tested on HBase 0.96.1.1.</para>
- <programlisting>
+ <programlisting language="java">
public static void upgradeFrom0 (Configuration config) {
try {
http://git-wip-us.apache.org/repos/asf/hbase/blob/24b5fa7f/src/main/docbkx/ops_mgt.xml
----------------------------------------------------------------------
diff --git a/src/main/docbkx/ops_mgt.xml b/src/main/docbkx/ops_mgt.xml
index 5d01f82..fdf4a6a 100644
--- a/src/main/docbkx/ops_mgt.xml
+++ b/src/main/docbkx/ops_mgt.xml
@@ -46,7 +46,7 @@
<para> There is a Canary class can help users to canary-test the HBase cluster status, with
every column-family for every regions or regionservers granularity. To see the usage, use
the <literal>--help</literal> parameter. </para>
- <screen>$ ${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.tool.Canary -help
+ <screen language="bourne">$ ${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.tool.Canary -help
Usage: bin/hbase org.apache.hadoop.hbase.tool.Canary [opts] [table1 [table2]...] | [regionserver1 [regionserver2]..]
where [opts] are:
@@ -61,7 +61,7 @@ Usage: bin/hbase org.apache.hadoop.hbase.tool.Canary [opts] [table1 [table2]...]
-t <N> timeout for a check, default is 600000 (milliseconds)</screen>
<para> This tool will return non zero error codes to user for collaborating with other
monitoring tools, such as Nagios. The error code definitions are: </para>
- <programlisting>private static final int USAGE_EXIT_CODE = 1;
+ <programlisting language="java">private static final int USAGE_EXIT_CODE = 1;
private static final int INIT_ERROR_EXIT_CODE = 2;
private static final int TIMEOUT_ERROR_EXIT_CODE = 3;
private static final int ERROR_EXIT_CODE = 4;</programlisting>
@@ -113,7 +113,7 @@ private static final int ERROR_EXIT_CODE = 4;</programlisting>
<para> Following are some examples based on the previous given case. </para>
<section>
<title>Canary test for every column family (store) of every region of every table</title>
- <screen>$ ${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.tool.Canary
+ <screen language="bourne">$ ${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.tool.Canary
3/12/09 03:26:32 INFO tool.Canary: read from region test-01,,1386230156732.0e3c7d77ffb6361ea1b996ac1042ca9a. column family cf1 in 2ms
13/12/09 03:26:32 INFO tool.Canary: read from region test-01,,1386230156732.0e3c7d77ffb6361ea1b996ac1042ca9a. column family cf2 in 2ms
@@ -134,14 +134,14 @@ private static final int ERROR_EXIT_CODE = 4;</programlisting>
<title>Canary test for every column family (store) of every region of specific
table(s)</title>
<para> You can also test one or more specific tables.</para>
- <screen>$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary test-01 test-02</screen>
+ <screen language="bourne">$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary test-01 test-02</screen>
</section>
<section>
<title>Canary test with regionserver granularity</title>
<para> This will pick one small piece of data from each regionserver, and can also put your
resionserver name as input options for canary-test specific regionservers.</para>
- <screen>$ ${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.tool.Canary -regionserver
+ <screen language="bourne">$ ${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.tool.Canary -regionserver
13/12/09 06:05:17 INFO tool.Canary: Read from table:test-01 on region server:rs2 in 72ms
13/12/09 06:05:17 INFO tool.Canary: Read from table:test-02 on region server:rs3 in 34ms
@@ -150,7 +150,7 @@ private static final int ERROR_EXIT_CODE = 4;</programlisting>
<section>
<title>Canary test with regular expression pattern</title>
<para> This will test both table test-01 and test-02.</para>
- <screen>$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary -e test-0[1-2]</screen>
+ <screen language="bourne">$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary -e test-0[1-2]</screen>
</section>
<section>
@@ -158,10 +158,10 @@ private static final int ERROR_EXIT_CODE = 4;</programlisting>
<para> Run repeatedly with interval defined in option -interval whose default value is 6
seconds. This daemon will stop itself and return non-zero error code if any error occurs,
due to the default value of option -f is true.</para>
- <screen>$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary -daemon</screen>
+ <screen language="bourne">$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary -daemon</screen>
<para>Run repeatedly with internal 5 seconds and will not stop itself even error occurs in
the test.</para>
- <screen>$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary -daemon -interval 50000 -f false</screen>
+ <screen language="bourne">$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary -daemon -interval 50000 -f false</screen>
</section>
<section>
@@ -171,7 +171,7 @@ private static final int ERROR_EXIT_CODE = 4;</programlisting>
Master, which would bring the clients hung. So we provide the timeout option to kill the
canary test forcefully and return non-zero error code as well. This run sets the timeout
value to 60 seconds, the default value is 600 seconds.</para>
- <screen>$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary -t 600000</screen>
+ <screen language="bourne">$ ${HBASE_HOME}/bin/hbase orghapache.hadoop.hbase.tool.Canary -t 600000</screen>
</section>
</section>
@@ -194,7 +194,7 @@ private static final int ERROR_EXIT_CODE = 4;</programlisting>
<replaceable>UtilityName</replaceable> with the utility you want to run. This command
assumes you have set the environment variable <literal>HBASE_HOME</literal> to the directory
where HBase is unpacked on your server.</para>
- <screen>
+ <screen language="bourne">
${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.mapreduce.<replaceable>UtilityName</replaceable>
</screen>
<para>The following utilities are available:</para>
@@ -267,13 +267,13 @@ ${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.mapreduce.<replaceable>UtilityNa
<filename>recovered.edits</filename>. directory.</para>
<para>You can get a textual dump of a WAL file content by doing the following:</para>
- <screen> $ ./bin/hbase org.apache.hadoop.hbase.regionserver.wal.FSHLog --dump hdfs://example.org:8020/hbase/.logs/example.org,60020,1283516293161/10.10.21.10%3A60020.1283973724012 </screen>
+ <screen language="bourne"> $ ./bin/hbase org.apache.hadoop.hbase.regionserver.wal.FSHLog --dump hdfs://example.org:8020/hbase/.logs/example.org,60020,1283516293161/10.10.21.10%3A60020.1283973724012 </screen>
<para>The return code will be non-zero if issues with the file so you can test wholesomeness
of file by redirecting <varname>STDOUT</varname> to <code>/dev/null</code> and testing the
program return.</para>
<para>Similarly you can force a split of a log file directory by doing:</para>
- <screen> $ ./bin/hbase org.apache.hadoop.hbase.regionserver.wal.FSHLog --split hdfs://example.org:8020/hbase/.logs/example.org,60020,1283516293161/</screen>
+ <screen language="bourne"> $ ./bin/hbase org.apache.hadoop.hbase.regionserver.wal.FSHLog --split hdfs://example.org:8020/hbase/.logs/example.org,60020,1283516293161/</screen>
<section
xml:id="hlog_tool.prettyprint">
@@ -297,7 +297,7 @@ ${HBASE_HOME}/bin/hbase org.apache.hadoop.hbase.mapreduce.<replaceable>UtilityNa
cluster or another cluster. The target table must first exist. The usage is as
follows:</para>
- <screen>
+ <screen language="bourne">
$ <userinput>./bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable --help </userinput>
/bin/hbase org.apache.hadoop.hbase.mapreduce.CopyTable --help
Usage: CopyTable [general options] [--starttime=X] [--endtime=Y] [--new.name=NEW] [--peer.adr=ADR] <tablename>
@@ -355,7 +355,7 @@ For performance consider the following general options:
<title>Export</title>
<para>Export is a utility that will dump the contents of table to HDFS in a sequence file.
Invoke via:</para>
- <screen>$ bin/hbase org.apache.hadoop.hbase.mapreduce.Export <tablename> <outputdir> [<versions> [<starttime> [<endtime>]]]
+ <screen language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.Export <tablename> <outputdir> [<versions> [<starttime> [<endtime>]]]
</screen>
<para>Note: caching for the input Scan is configured via
@@ -366,11 +366,11 @@ For performance consider the following general options:
<title>Import</title>
<para>Import is a utility that will load data that has been exported back into HBase. Invoke
via:</para>
- <screen>$ bin/hbase org.apache.hadoop.hbase.mapreduce.Import <tablename> <inputdir>
+ <screen language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.Import <tablename> <inputdir>
</screen>
<para>To import 0.94 exported files in a 0.96 cluster or onwards, you need to set system
property "hbase.import.version" when running the import command as below:</para>
- <screen>$ bin/hbase -Dhbase.import.version=0.94 org.apache.hadoop.hbase.mapreduce.Import <tablename> <inputdir>
+ <screen language="bourne">$ bin/hbase -Dhbase.import.version=0.94 org.apache.hadoop.hbase.mapreduce.Import <tablename> <inputdir>
</screen>
</section>
<section
@@ -380,11 +380,11 @@ For performance consider the following general options:
usages: loading data from TSV format in HDFS into HBase via Puts, and preparing StoreFiles
to be loaded via the <code>completebulkload</code>. </para>
<para>To load data via Puts (i.e., non-bulk loading):</para>
- <screen>$ bin/hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.columns=a,b,c <tablename> <hdfs-inputdir>
+ <screen language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.columns=a,b,c <tablename> <hdfs-inputdir>
</screen>
<para>To generate StoreFiles for bulk-loading:</para>
- <programlisting>$ bin/hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.columns=a,b,c -Dimporttsv.bulk.output=hdfs://storefile-outputdir <tablename> <hdfs-data-inputdir>
+ <programlisting language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.columns=a,b,c -Dimporttsv.bulk.output=hdfs://storefile-outputdir <tablename> <hdfs-data-inputdir>
</programlisting>
<para>These generated StoreFiles can be loaded into HBase via <xref
linkend="completebulkload" />. </para>
@@ -438,7 +438,7 @@ row10 c1 c2
</screen>
</para>
<para>For ImportTsv to use this imput file, the command line needs to look like this:</para>
- <screen>
+ <screen language="bourne">
HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase classpath` ${HADOOP_HOME}/bin/hadoop jar ${HBASE_HOME}/hbase-VERSION.jar importtsv -Dimporttsv.columns=HBASE_ROW_KEY,d:c1,d:c2 -Dimporttsv.bulk.output=hdfs://storefileoutput datatsv hdfs://inputfile
</screen>
<para> ... and in this example the first column is the rowkey, which is why the
@@ -467,10 +467,10 @@ row10 c1 c2
linkend="importtsv" />. </para>
<para>There are two ways to invoke this utility, with explicit classname and via the
driver:</para>
- <screen>$ bin/hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles <hdfs://storefileoutput> <tablename>
+ <screen language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles <hdfs://storefileoutput> <tablename>
</screen>
<para> .. and via the Driver..</para>
- <screen>HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase classpath` ${HADOOP_HOME}/bin/hadoop jar ${HBASE_HOME}/hbase-VERSION.jar completebulkload <hdfs://storefileoutput> <tablename>
+ <screen language="bourne">HADOOP_CLASSPATH=`${HBASE_HOME}/bin/hbase classpath` ${HADOOP_HOME}/bin/hadoop jar ${HBASE_HOME}/hbase-VERSION.jar completebulkload <hdfs://storefileoutput> <tablename>
</screen>
<section
xml:id="completebulkload.warning">
@@ -493,10 +493,10 @@ row10 c1 c2
<para>WALPlayer can also generate HFiles for later bulk importing, in that case only a single
table and no mapping can be specified. </para>
<para>Invoke via:</para>
- <screen>$ bin/hbase org.apache.hadoop.hbase.mapreduce.WALPlayer [options] <wal inputdir> <tables> [<tableMappings>]>
+ <screen language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.WALPlayer [options] <wal inputdir> <tables> [<tableMappings>]>
</screen>
<para>For example:</para>
- <screen>$ bin/hbase org.apache.hadoop.hbase.mapreduce.WALPlayer /backuplogdir oldTable1,oldTable2 newTable1,newTable2
+ <screen language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.WALPlayer /backuplogdir oldTable1,oldTable2 newTable1,newTable2
</screen>
<para> WALPlayer, by default, runs as a mapreduce job. To NOT run WALPlayer as a mapreduce job
on your cluster, force it to run all in the local process by adding the flags
@@ -511,7 +511,7 @@ row10 c1 c2
sanity check to ensure that HBase can read all the blocks of a table if there are any
concerns of metadata inconsistency. It will run the mapreduce all in a single process but it
will run faster if you have a MapReduce cluster in place for it to exploit.</para>
- <screen>$ bin/hbase org.apache.hadoop.hbase.mapreduce.RowCounter <tablename> [<column1> <column2>...]
+ <screen language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.RowCounter <tablename> [<column1> <column2>...]
</screen>
<para>Note: caching for the input Scan is configured via
<code>hbase.client.scanner.caching</code> in the job configuration. </para>
@@ -542,7 +542,7 @@ row10 c1 c2
<para>The program allows you to limit the scope of the run. Provide a row regex or prefix to
limit the rows to analyze. Use <code>hbase.mapreduce.scan.column.family</code> to specify
scanning a single column family.</para>
- <screen>$ bin/hbase org.apache.hadoop.hbase.mapreduce.CellCounter <tablename> <outputDir> [regex or prefix]</screen>
+ <screen language="bourne">$ bin/hbase org.apache.hadoop.hbase.mapreduce.CellCounter <tablename> <outputDir> [regex or prefix]</screen>
<para>Note: just like RowCounter, caching for the input Scan is configured via
<code>hbase.client.scanner.caching</code> in the job configuration. </para>
</section>
@@ -585,7 +585,7 @@ row10 c1 c2
<title>Merge</title>
<para>Merge is a utility that can merge adjoining regions in the same table (see
org.apache.hadoop.hbase.util.Merge).</para>
- <programlisting>$ bin/hbase org.apache.hadoop.hbase.util.Merge <tablename> <region1> <region2>
+ <programlisting language="bourne">$ bin/hbase org.apache.hadoop.hbase.util.Merge <tablename> <region1> <region2>
</programlisting>
<para>If you feel you have too many regions and want to consolidate them, Merge is the utility
you need. Merge must run be done when the cluster is down. See the <link
@@ -609,7 +609,7 @@ row10 c1 c2
<title>Node Decommission</title>
<para>You can stop an individual RegionServer by running the following script in the HBase
directory on the particular node:</para>
- <screen>$ ./bin/hbase-daemon.sh stop regionserver</screen>
+ <screen language="bourne">$ ./bin/hbase-daemon.sh stop regionserver</screen>
<para> The RegionServer will first close all regions and then shut itself down. On shutdown,
the RegionServer's ephemeral node in ZooKeeper will expire. The master will notice the
RegionServer gone and will treat it as a 'crashed' server; it will reassign the nodes the
@@ -627,7 +627,7 @@ row10 c1 c2
the RegionServer's znode gone. In Apache HBase 0.90.2, we added facility for having a node
gradually shed its load and then shutdown itself down. Apache HBase 0.90.2 added the
<filename>graceful_stop.sh</filename> script. Here is its usage:</para>
- <screen>$ ./bin/graceful_stop.sh
+ <screen language="bourne">$ ./bin/graceful_stop.sh
Usage: graceful_stop.sh [--config &conf-dir>] [--restart] [--reload] [--thrift] [--rest] &hostname>
thrift If we should stop/start thrift before/after the hbase stop/start
rest If we should stop/start rest before/after the hbase stop/start
@@ -729,7 +729,7 @@ false
<para> You can also ask this script to restart a RegionServer after the shutdown AND move its
old regions back into place. The latter you might do to retain data locality. A primitive
rolling restart might be effected by running something like the following:</para>
- <screen>$ for i in `cat conf/regionservers|sort`; do ./bin/graceful_stop.sh --restart --reload --debug $i; done &> /tmp/log.txt &</screen>
+ <screen language="bourne">$ for i in `cat conf/regionservers|sort`; do ./bin/graceful_stop.sh --restart --reload --debug $i; done &> /tmp/log.txt &</screen>
<para> Tail the output of <filename>/tmp/log.txt</filename> to follow the scripts progress.
The above does RegionServers only. The script will also disable the load balancer before
moving the regions. You'd need to do the master update separately. Do it before you run the
@@ -741,18 +741,18 @@ false
</listitem>
<listitem>
<para>Run hbck to ensure the cluster consistent
- <programlisting>$ ./bin/hbase hbck</programlisting> Effect repairs if inconsistent.
+ <programlisting language="bourne">$ ./bin/hbase hbck</programlisting> Effect repairs if inconsistent.
</para>
</listitem>
<listitem>
<para>Restart the Master:
- <programlisting>$ ./bin/hbase-daemon.sh stop master; ./bin/hbase-daemon.sh start master</programlisting>
+ <programlisting language="bourne">$ ./bin/hbase-daemon.sh stop master; ./bin/hbase-daemon.sh start master</programlisting>
</para>
</listitem>
<listitem>
<para>Run the <filename>graceful_stop.sh</filename> script per RegionServer. For
example:</para>
- <programlisting>$ for i in `cat conf/regionservers|sort`; do ./bin/graceful_stop.sh --restart --reload --debug $i; done &> /tmp/log.txt &
+ <programlisting language="bourne">$ for i in `cat conf/regionservers|sort`; do ./bin/graceful_stop.sh --restart --reload --debug $i; done &> /tmp/log.txt &
</programlisting>
<para> If you are running thrift or rest servers on the RegionServer, pass --thrift or
--rest options (See usage for <filename>graceful_stop.sh</filename> script). </para>
@@ -1678,7 +1678,7 @@ false
<para>To turn on the snapshot support just set the <varname>hbase.snapshot.enabled</varname>
property to true. (Snapshots are enabled by default in 0.95+ and off by default in
0.94.6+)</para>
- <programlisting>
+ <programlisting language="java">
<property>
<name>hbase.snapshot.enabled</name>
<value>true</value>
@@ -1690,7 +1690,7 @@ false
<title>Take a Snapshot</title>
<para>You can take a snapshot of a table regardless of whether it is enabled or disabled. The
snapshot operation doesn't involve any data copying.</para>
- <screen>
+ <screen language="bourne">
$ ./bin/hbase shell
hbase> snapshot 'myTable', 'myTableSnapshot-122112'
</screen>
@@ -1699,7 +1699,7 @@ hbase> snapshot 'myTable', 'myTableSnapshot-122112'
xml:id="ops.snapshots.list">
<title>Listing Snapshots</title>
<para>List all snapshots taken (by printing the names and relative information).</para>
- <screen>
+ <screen language="bourne">
$ ./bin/hbase shell
hbase> list_snapshots
</screen>
@@ -1709,7 +1709,7 @@ hbase> list_snapshots
<title>Deleting Snapshots</title>
<para>You can remove a snapshot, and the files retained for that snapshot will be removed if
no longer needed.</para>
- <screen>
+ <screen language="bourne">
$ ./bin/hbase shell
hbase> delete_snapshot 'myTableSnapshot-122112'
</screen>
@@ -1720,7 +1720,7 @@ hbase> delete_snapshot 'myTableSnapshot-122112'
<para>From a snapshot you can create a new table (clone operation) with the same data that you
had when the snapshot was taken. The clone operation, doesn't involve data copies, and a
change to the cloned table doesn't impact the snapshot or the original table.</para>
- <screen>
+ <screen language="bourne">
$ ./bin/hbase shell
hbase> clone_snapshot 'myTableSnapshot-122112', 'myNewTestTable'
</screen>
@@ -1731,7 +1731,7 @@ hbase> clone_snapshot 'myTableSnapshot-122112', 'myNewTestTable'
<para>The restore operation requires the table to be disabled, and the table will be restored
to the state at the time when the snapshot was taken, changing both data and schema if
required.</para>
- <screen>
+ <screen language="bourne">
$ ./bin/hbase shell
hbase> disable 'myTable'
hbase> restore_snapshot 'myTableSnapshot-122112'
@@ -1763,14 +1763,14 @@ hbase> restore_snapshot 'myTableSnapshot-122112'
hbase cluster does not have to be online.</para>
<para>To copy a snapshot called MySnapshot to an HBase cluster srv2 (hdfs:///srv2:8082/hbase)
using 16 mappers:</para>
- <programlisting>$ bin/hbase class org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot MySnapshot -copy-to hdfs://srv2:8082/hbase -mappers 16</programlisting>
+ <programlisting language="bourne">$ bin/hbase class org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot MySnapshot -copy-to hdfs://srv2:8082/hbase -mappers 16</programlisting>
<formalpara>
<title>Limiting Bandwidth Consumption</title>
<para>You can limit the bandwidth consumption when exporting a snapshot, by specifying the
<code>-bandwidth</code> parameter, which expects an integer representing megabytes per
second. The following example limits the above example to 200 MB/sec.</para>
</formalpara>
- <programlisting>$ bin/hbase class org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot MySnapshot -copy-to hdfs://srv2:8082/hbase -mappers 16 -bandwidth 200</programlisting>
+ <programlisting language="bourne">$ bin/hbase class org.apache.hadoop.hbase.snapshot.ExportSnapshot -snapshot MySnapshot -copy-to hdfs://srv2:8082/hbase -mappers 16 -bandwidth 200</programlisting>
</section>
</section>
<!-- snapshots -->
@@ -2035,7 +2035,7 @@ hbase shell> clone_snapshot 'tableSnapshot', 'newTableName'
hbase shell> delete_snapshot 'tableSnapshot'
hbase shell> drop 'tableName']]></screen>
<para>or in code it would be as follows:</para>
- <programlisting role="Java" language="Java">void rename(HBaseAdmin admin, String oldTableName, String newTableName) {
+ <programlisting language="Java">void rename(HBaseAdmin admin, String oldTableName, String newTableName) {
String snapshotName = randomName();
admin.disableTable(oldTableName);
admin.snapshot(snapshotName, oldTableName);
http://git-wip-us.apache.org/repos/asf/hbase/blob/24b5fa7f/src/main/docbkx/performance.xml
----------------------------------------------------------------------
diff --git a/src/main/docbkx/performance.xml b/src/main/docbkx/performance.xml
index c00b635..47b67be 100644
--- a/src/main/docbkx/performance.xml
+++ b/src/main/docbkx/performance.xml
@@ -475,7 +475,7 @@ hbase> <userinput>create 'mytable',{NAME => 'colfam1', BLOOMFILTER => 'ROWCOL'}<
<title>Constants</title>
<para>When people get started with HBase they have a tendency to write code that looks like
this:</para>
- <programlisting>
+ <programlisting language="java">
Get get = new Get(rowkey);
Result r = htable.get(get);
byte[] b = r.getValue(Bytes.toBytes("cf"), Bytes.toBytes("attr")); // returns current version of value
@@ -483,7 +483,7 @@ byte[] b = r.getValue(Bytes.toBytes("cf"), Bytes.toBytes("attr")); // returns c
<para>But especially when inside loops (and MapReduce jobs), converting the columnFamily and
column-names to byte-arrays repeatedly is surprisingly expensive. It's better to use
constants for the byte-arrays, like this:</para>
- <programlisting>
+ <programlisting language="java">
public static final byte[] CF = "cf".getBytes();
public static final byte[] ATTR = "attr".getBytes();
...
@@ -517,14 +517,14 @@ byte[] b = r.getValue(CF, ATTR); // returns current version of value
<para>There are two different approaches to pre-creating splits. The first approach is to rely
on the default <code>HBaseAdmin</code> strategy (which is implemented in
<code>Bytes.split</code>)... </para>
- <programlisting>
-byte[] startKey = ...; // your lowest keuy
+ <programlisting language="java">
+byte[] startKey = ...; // your lowest key
byte[] endKey = ...; // your highest key
int numberOfRegions = ...; // # of regions to create
admin.createTable(table, startKey, endKey, numberOfRegions);
</programlisting>
<para>And the other approach is to define the splits yourself... </para>
- <programlisting>
+ <programlisting language="java">
byte[][] splits = ...; // create your own splits
admin.createTable(table, splits);
</programlisting>
@@ -676,7 +676,7 @@ admin.createTable(table, splits);
<code>Scan.HINT_LOOKAHEAD</code> can be set the on Scan object. The following code
instructs the RegionServer to attempt two iterations of next before a seek is
scheduled:</para>
- <programlisting>
+ <programlisting language="java">
Scan scan = new Scan();
scan.addColumn(...);
scan.setAttribute(Scan.HINT_LOOKAHEAD, Bytes.toBytes(2));
@@ -701,7 +701,7 @@ table.getScanner(scan);
xlink:href="http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/ResultScanner.html">ResultScanners</link>
you can cause problems on the RegionServers. Always have ResultScanner processing enclosed
in try/catch blocks...</para>
- <programlisting>
+ <programlisting language="java">
Scan scan = new Scan();
// set attrs...
ResultScanner rs = htable.getScanner(scan);
@@ -907,7 +907,7 @@ htable.close();
shortcircuit reads configuration page</link> for how to enable the latter, better version
of shortcircuit. For example, here is a minimal config. enabling short-circuit reads added
to <filename>hbase-site.xml</filename>: </para>
- <programlisting><![CDATA[<property>
+ <programlisting language="xml"><![CDATA[<property>
<name>dfs.client.read.shortcircuit</name>
<value>true</value>
<description>
http://git-wip-us.apache.org/repos/asf/hbase/blob/24b5fa7f/src/main/docbkx/preface.xml
----------------------------------------------------------------------
diff --git a/src/main/docbkx/preface.xml b/src/main/docbkx/preface.xml
index 5885bfe..582d04a 100644
--- a/src/main/docbkx/preface.xml
+++ b/src/main/docbkx/preface.xml
@@ -45,7 +45,7 @@
the <filename>src/main/docbkx</filename> directory of the HBase source. This reference
guide is marked up using <link xlink:href="http://www.docbook.com/">DocBook</link> from
which the the finished guide is generated as part of the 'site' build target. Run
- <programlisting>mvn site</programlisting> to generate this documentation. Amendments and
+ <programlisting language="bourne">mvn site</programlisting> to generate this documentation. Amendments and
improvements to the documentation are welcomed. Click <link
xlink:href="https://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310753&issuetype=1&components=12312132&summary=SHORT+DESCRIPTION"
>this link</link> to file a new documentation bug against Apache HBase with some
http://git-wip-us.apache.org/repos/asf/hbase/blob/24b5fa7f/src/main/docbkx/schema_design.xml
----------------------------------------------------------------------
diff --git a/src/main/docbkx/schema_design.xml b/src/main/docbkx/schema_design.xml
index 2fdeb00..de05c14 100644
--- a/src/main/docbkx/schema_design.xml
+++ b/src/main/docbkx/schema_design.xml
@@ -44,7 +44,7 @@
xlink:href="http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/HBaseAdmin.html">HBaseAdmin</link>
in the Java API. </para>
<para>Tables must be disabled when making ColumnFamily modifications, for example:</para>
- <programlisting>
+ <programlisting language="java">
Configuration config = HBaseConfiguration.create();
HBaseAdmin admin = new HBaseAdmin(conf);
String table = "myTable";
@@ -184,7 +184,7 @@ admin.enableTable(table);
in those eight bytes. If you stored this number as a String -- presuming a byte per
character -- you need nearly 3x the bytes. </para>
<para>Not convinced? Below is some sample code that you can run on your own.</para>
- <programlisting>
+ <programlisting language="java">
// long
//
long l = 1234567890L;
@@ -307,7 +307,7 @@ COLUMN CELL
are accessible in the keyspace. </para>
<para>To conclude this example, the following is an example of how appropriate splits can be
pre-created for hex-keys:. </para>
- <programlisting><![CDATA[public static boolean createTable(HBaseAdmin admin, HTableDescriptor table, byte[][] splits)
+ <programlisting language="java"><![CDATA[public static boolean createTable(HBaseAdmin admin, HTableDescriptor table, byte[][] splits)
throws IOException {
try {
admin.createTable( table, splits );
@@ -580,7 +580,7 @@ public static byte[][] getHexSplits(String startKey, String endKey, int numRegio
timestamps, by performing a mod operation on the timestamp. If time-oriented scans are
important, this could be a useful approach. Attention must be paid to the number of
buckets, because this will require the same number of scans to return results.</para>
- <programlisting>
+ <programlisting language="java">
long bucket = timestamp % numBuckets;
</programlisting>
<para>… to construct:</para>
@@ -1041,13 +1041,13 @@ long bucket = timestamp % numBuckets;
]]></programlisting>
<para>The other option we had was to do this entirely using:</para>
- <programlisting><![CDATA[
+ <programlisting language="xml"><![CDATA[
<FixedWidthUserName><FixedWidthPageNum0>:<FixedWidthLength><FixedIdNextPageNum><ValueId1><ValueId2><ValueId3>...
<FixedWidthUserName><FixedWidthPageNum1>:<FixedWidthLength><FixedIdNextPageNum><ValueId1><ValueId2><ValueId3>...
]]></programlisting>
<para> where each row would contain multiple values. So in one case reading the first thirty
values would be: </para>
- <programlisting><![CDATA[
+ <programlisting language="java"><![CDATA[
scan { STARTROW => 'FixedWidthUsername' LIMIT => 30}
]]></programlisting>
<para>And in the second case it would be </para>