View Javadoc

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.regionserver.wal;
19  
20  import java.io.IOException;
21  import java.io.PrintStream;
22  import org.apache.hadoop.hbase.classification.InterfaceAudience;
23  import org.apache.hadoop.hbase.classification.InterfaceStability;
24  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
25  import org.apache.hadoop.hbase.wal.WALPrettyPrinter;
26  
27  /**
28   * HLogPrettyPrinter prints the contents of a given HLog with a variety of
29   * options affecting formatting and extent of content.
30   *
31   * It targets two usage cases: pretty printing for ease of debugging directly by
32   * humans, and JSON output for consumption by monitoring and/or maintenance
33   * scripts.
34   *
35   * It can filter by row, region, or sequence id.
36   *
37   * It can also toggle output of values.
38   *
39   * @deprecated use the "hbase wal" command
40   */
41  @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS)
42  @InterfaceStability.Evolving
43  @Deprecated
44  public class HLogPrettyPrinter extends WALPrettyPrinter {
45  
46    /**
47     * Basic constructor that simply initializes values to reasonable defaults.
48     */
49    public HLogPrettyPrinter() {
50      this(false, false, -1l, null, null, false, System.out);
51    }
52  
53    /**
54     * Fully specified constructor.
55     *
56     * @param outputValues
57     *          when true, enables output of values along with other log
58     *          information
59     * @param outputJSON
60     *          when true, enables output in JSON format rather than a
61     *          "pretty string"
62     * @param sequence
63     *          when nonnegative, serves as a filter; only log entries with this
64     *          sequence id will be printed
65     * @param region
66     *          when not null, serves as a filter; only log entries from this
67     *          region will be printed
68     * @param row
69     *          when not null, serves as a filter; only log entries from this row
70     *          will be printed
71     * @param persistentOutput
72     *          keeps a single list running for multiple files. if enabled, the
73     *          endPersistentOutput() method must be used!
74     * @param out
75     *          Specifies an alternative to stdout for the destination of this
76     *          PrettyPrinter's output.
77     */
78    public HLogPrettyPrinter(boolean outputValues, boolean outputJSON,
79        long sequence, String region, String row, boolean persistentOutput,
80        PrintStream out) {
81      super(outputValues, outputJSON, sequence, region, row, persistentOutput, out);
82    }
83  
84    public static void main(String[] args) throws IOException {
85      WALPrettyPrinter.main(args);
86    }
87  
88  }