View Javadoc

1   /**
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.client;
20  
21  import java.io.IOException;
22  import java.util.List;
23  
24  import org.apache.hadoop.hbase.classification.InterfaceAudience;
25  import org.apache.hadoop.hbase.classification.InterfaceStability;
26  
27  /**
28   * Used to communicate with a single HBase table.
29   * Obtain an instance from an {@link HConnection}.
30   *
31   * @since 0.21.0
32   * @deprecated use {@link org.apache.hadoop.hbase.client.Table} instead
33   */
34  @Deprecated
35  @InterfaceAudience.Private
36  @InterfaceStability.Stable
37  public interface HTableInterface extends Table {
38  
39    /**
40     * Gets the name of this table.
41     *
42     * @return the table name.
43     * @deprecated Use {@link #getName()} instead
44     */
45    @Deprecated
46    byte[] getTableName();
47  
48    /**
49     * @deprecated As of release 0.96
50     *             (<a href="https://issues.apache.org/jira/browse/HBASE-9508">HBASE-9508</a>).
51     *             This will be removed in HBase 2.0.0.
52     *             Use {@link #incrementColumnValue(byte[], byte[], byte[], long, Durability)}.
53     */
54    @Deprecated
55    long incrementColumnValue(final byte [] row, final byte [] family,
56        final byte [] qualifier, final long amount, final boolean writeToWAL)
57    throws IOException;
58  
59    /**
60     * @deprecated Use {@link #existsAll(java.util.List)}  instead.
61     */
62    @Deprecated
63    Boolean[] exists(List<Get> gets) throws IOException;
64  
65  
66    /**
67     * See {@link #setAutoFlush(boolean, boolean)}
68     *
69     * @param autoFlush
70     *          Whether or not to enable 'auto-flush'.
71     * @deprecated in 0.96. When called with setAutoFlush(false), this function also
72     *  set clearBufferOnFail to true, which is unexpected but kept for historical reasons.
73     *  Replace it with setAutoFlush(false, false) if this is exactly what you want, though
74     *  this is the method you want for most cases.
75     */
76    @Deprecated
77    void setAutoFlush(boolean autoFlush);
78  
79    /**
80     * Turns 'auto-flush' on or off.
81     * <p>
82     * When enabled (default), {@link Put} operations don't get buffered/delayed
83     * and are immediately executed. Failed operations are not retried. This is
84     * slower but safer.
85     * <p>
86     * Turning off {@code #autoFlush} means that multiple {@link Put}s will be
87     * accepted before any RPC is actually sent to do the write operations. If the
88     * application dies before pending writes get flushed to HBase, data will be
89     * lost.
90     * <p>
91     * When you turn {@code #autoFlush} off, you should also consider the
92     * {@code #clearBufferOnFail} option. By default, asynchronous {@link Put}
93     * requests will be retried on failure until successful. However, this can
94     * pollute the writeBuffer and slow down batching performance. Additionally,
95     * you may want to issue a number of Put requests and call
96     * {@link #flushCommits()} as a barrier. In both use cases, consider setting
97     * clearBufferOnFail to true to erase the buffer after {@link #flushCommits()}
98     * has been called, regardless of success.
99     * <p>
100    * In other words, if you call {@code #setAutoFlush(false)}; HBase will retry N time for each
101    *  flushCommit, including the last one when closing the table. This is NOT recommended,
102    *  most of the time you want to call {@code #setAutoFlush(false, true)}.
103    *
104    * @param autoFlush
105    *          Whether or not to enable 'auto-flush'.
106    * @param clearBufferOnFail
107    *          Whether to keep Put failures in the writeBuffer. If autoFlush is true, then
108    *          the value of this parameter is ignored and clearBufferOnFail is set to true.
109    *          Setting clearBufferOnFail to false is deprecated since 0.96.
110    * @deprecated in 0.99 since setting clearBufferOnFail is deprecated. Use
111    *  {@link #setAutoFlush(boolean)}} instead.
112    * @see BufferedMutator#flush()
113    */
114   @Deprecated
115   void setAutoFlush(boolean autoFlush, boolean clearBufferOnFail);
116 
117   /**
118    * Set the autoFlush behavior, without changing the value of {@code clearBufferOnFail}.
119    * @deprecated in 0.99 since setting clearBufferOnFail is deprecated. Use
120    * {@link #setAutoFlush(boolean)} instead, or better still, move on to {@link BufferedMutator}
121    */
122   @Deprecated
123   void setAutoFlushTo(boolean autoFlush);
124   
125   /**
126    * Tells whether or not 'auto-flush' is turned on.
127    *
128    * @return {@code true} if 'auto-flush' is enabled (default), meaning
129    * {@link Put} operations don't get buffered/delayed and are immediately
130    * executed.
131    * @deprecated as of 1.0.0. Replaced by {@link BufferedMutator}
132    */
133   @Deprecated
134   boolean isAutoFlush();
135 
136   /**
137    * Executes all the buffered {@link Put} operations.
138    * <p>
139    * This method gets called once automatically for every {@link Put} or batch
140    * of {@link Put}s (when <code>put(List&lt;Put&gt;)</code> is used) when
141    * {@link #isAutoFlush} is {@code true}.
142    * @throws IOException if a remote or network exception occurs.
143    * @deprecated as of 1.0.0. Replaced by {@link BufferedMutator#flush()}
144    */
145   @Deprecated
146   void flushCommits() throws IOException;
147 
148   /**
149    * Returns the maximum size in bytes of the write buffer for this HTable.
150    * <p>
151    * The default value comes from the configuration parameter
152    * {@code hbase.client.write.buffer}.
153    * @return The size of the write buffer in bytes.
154    * @deprecated as of 1.0.0. Replaced by {@link BufferedMutator#getWriteBufferSize()}
155    */
156   @Deprecated
157   long getWriteBufferSize();
158 
159   /**
160    * Sets the size of the buffer in bytes.
161    * <p>
162    * If the new size is less than the current amount of data in the
163    * write buffer, the buffer gets flushed.
164    * @param writeBufferSize The new write buffer size, in bytes.
165    * @throws IOException if a remote or network exception occurs.
166    * @deprecated as of 1.0.0. Replaced by {@link BufferedMutator} and
167    * {@link BufferedMutatorParams#writeBufferSize(long)}
168    */
169   @Deprecated
170   void setWriteBufferSize(long writeBufferSize) throws IOException;
171 
172 
173   /**
174    * Return the row that matches <i>row</i> exactly,
175    * or the one that immediately precedes it.
176    *
177    * @param row A row key.
178    * @param family Column family to include in the {@link Result}.
179    * @throws IOException if a remote or network exception occurs.
180    * @since 0.20.0
181    *
182    * @deprecated As of version 0.92 this method is deprecated without
183    * replacement. Since version 0.96+, you can use reversed scan.
184    * getRowOrBefore is used internally to find entries in hbase:meta and makes
185    * various assumptions about the table (which are true for hbase:meta but not
186    * in general) to be efficient.
187    */
188   @Deprecated
189   Result getRowOrBefore(byte[] row, byte[] family) throws IOException;
190 }