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