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  
23  import org.apache.hadoop.hbase.classification.InterfaceAudience;
24  import org.apache.hadoop.hbase.classification.InterfaceStability;
25  
26  /**
27   * Used to communicate with a single HBase table.
28   * Obtain an instance from an {@link HConnection}.
29   *
30   * @since 0.21.0
31   * @deprecated use {@link org.apache.hadoop.hbase.client.Table} instead
32   */
33  @Deprecated
34  @InterfaceAudience.Private
35  @InterfaceStability.Stable
36  public interface HTableInterface extends Table {
37  
38    /**
39     * Gets the name of this table.
40     *
41     * @return the table name.
42     * @deprecated Use {@link #getName()} instead
43     */
44    @Deprecated
45    byte[] getTableName();
46  
47    /**
48     * Turns 'auto-flush' on or off.
49     * <p>
50     * When enabled (default), {@link Put} operations don't get buffered/delayed
51     * and are immediately executed. Failed operations are not retried. This is
52     * slower but safer.
53     * <p>
54     * Turning off {@code #autoFlush} means that multiple {@link Put}s will be
55     * accepted before any RPC is actually sent to do the write operations. If the
56     * application dies before pending writes get flushed to HBase, data will be
57     * lost.
58     * <p>
59     * When you turn {@code #autoFlush} off, you should also consider the
60     * {@code #clearBufferOnFail} option. By default, asynchronous {@link Put}
61     * requests will be retried on failure until successful. However, this can
62     * pollute the writeBuffer and slow down batching performance. Additionally,
63     * you may want to issue a number of Put requests and call
64     * {@link #flushCommits()} as a barrier. In both use cases, consider setting
65     * clearBufferOnFail to true to erase the buffer after {@link #flushCommits()}
66     * has been called, regardless of success.
67     * <p>
68     * In other words, if you call {@code #setAutoFlush(false)}; HBase will retry N time for each
69     *  flushCommit, including the last one when closing the table. This is NOT recommended,
70     *  most of the time you want to call {@code #setAutoFlush(false, true)}.
71     *
72     * @param autoFlush
73     *          Whether or not to enable 'auto-flush'.
74     * @param clearBufferOnFail
75     *          Whether to keep Put failures in the writeBuffer. If autoFlush is true, then
76     *          the value of this parameter is ignored and clearBufferOnFail is set to true.
77     *          Setting clearBufferOnFail to false is deprecated since 0.96.
78     * @deprecated in 0.99 since setting clearBufferOnFail is deprecated.
79     * @see BufferedMutator#flush()
80     */
81    @Deprecated
82    void setAutoFlush(boolean autoFlush, boolean clearBufferOnFail);
83  
84    /**
85     * Set the autoFlush behavior, without changing the value of {@code clearBufferOnFail}.
86     * @deprecated in 0.99 since setting clearBufferOnFail is deprecated. Move on to
87     *             {@link BufferedMutator}
88     */
89    @Deprecated
90    void setAutoFlushTo(boolean autoFlush);
91  
92    /**
93     * Tells whether or not 'auto-flush' is turned on.
94     *
95     * @return {@code true} if 'auto-flush' is enabled (default), meaning
96     * {@link Put} operations don't get buffered/delayed and are immediately
97     * executed.
98     * @deprecated as of 1.0.0. Replaced by {@link BufferedMutator}
99     */
100   @Deprecated
101   boolean isAutoFlush();
102 
103   /**
104    * Executes all the buffered {@link Put} operations.
105    * <p>
106    * This method gets called once automatically for every {@link Put} or batch
107    * of {@link Put}s (when <code>put(List&lt;Put&gt;)</code> is used) when
108    * {@link #isAutoFlush} is {@code true}.
109    * @throws IOException if a remote or network exception occurs.
110    * @deprecated as of 1.0.0. Replaced by {@link BufferedMutator#flush()}
111    */
112   @Deprecated
113   void flushCommits() throws IOException;
114 
115   /**
116    * Returns the maximum size in bytes of the write buffer for this HTable.
117    * <p>
118    * The default value comes from the configuration parameter
119    * {@code hbase.client.write.buffer}.
120    * @return The size of the write buffer in bytes.
121    * @deprecated as of 1.0.0. Replaced by {@link BufferedMutator#getWriteBufferSize()}
122    */
123   @Deprecated
124   long getWriteBufferSize();
125 
126   /**
127    * Sets the size of the buffer in bytes.
128    * <p>
129    * If the new size is less than the current amount of data in the
130    * write buffer, the buffer gets flushed.
131    * @param writeBufferSize The new write buffer size, in bytes.
132    * @throws IOException if a remote or network exception occurs.
133    * @deprecated as of 1.0.0. Replaced by {@link BufferedMutator} and
134    * {@link BufferedMutatorParams#writeBufferSize(long)}
135    */
136   @Deprecated
137   void setWriteBufferSize(long writeBufferSize) throws IOException;
138 }