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  
22  import java.io.Closeable;
23  import java.io.IOException;
24  import java.util.List;
25  import java.util.Map;
26  import java.util.concurrent.Future;
27  import java.util.regex.Pattern;
28  
29  import org.apache.hadoop.conf.Configuration;
30  import org.apache.hadoop.hbase.Abortable;
31  import org.apache.hadoop.hbase.ClusterStatus;
32  import org.apache.hadoop.hbase.HColumnDescriptor;
33  import org.apache.hadoop.hbase.HRegionInfo;
34  import org.apache.hadoop.hbase.HTableDescriptor;
35  import org.apache.hadoop.hbase.NamespaceDescriptor;
36  import org.apache.hadoop.hbase.ServerName;
37  import org.apache.hadoop.hbase.TableExistsException;
38  import org.apache.hadoop.hbase.TableName;
39  import org.apache.hadoop.hbase.TableNotFoundException;
40  import org.apache.hadoop.hbase.classification.InterfaceAudience;
41  import org.apache.hadoop.hbase.classification.InterfaceStability;
42  import org.apache.hadoop.hbase.ipc.CoprocessorRpcChannel;
43  import org.apache.hadoop.hbase.protobuf.generated.AdminProtos;
44  import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos;
45  import org.apache.hadoop.hbase.protobuf.generated.MasterProtos;
46  import org.apache.hadoop.hbase.quotas.QuotaFilter;
47  import org.apache.hadoop.hbase.quotas.QuotaRetriever;
48  import org.apache.hadoop.hbase.quotas.QuotaSettings;
49  import org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException;
50  import org.apache.hadoop.hbase.snapshot.HBaseSnapshotException;
51  import org.apache.hadoop.hbase.snapshot.RestoreSnapshotException;
52  import org.apache.hadoop.hbase.snapshot.SnapshotCreationException;
53  import org.apache.hadoop.hbase.snapshot.UnknownSnapshotException;
54  import org.apache.hadoop.hbase.util.Pair;
55  
56  /**
57   * The administrative API for HBase. Obtain an instance from an {@link Connection#getAdmin()} and
58   * call {@link #close()} afterwards.
59   * <p>Admin can be used to create, drop, list, enable and disable tables, add and drop table
60   * column families and other administrative operations.
61   *
62   * @see ConnectionFactory
63   * @see Connection
64   * @see Table
65   * @since 0.99.0
66   */
67  @InterfaceAudience.Public
68  @InterfaceStability.Evolving
69  public interface Admin extends Abortable, Closeable {
70    int getOperationTimeout();
71  
72    @Override
73    void abort(String why, Throwable e);
74  
75    @Override
76    boolean isAborted();
77  
78    /**
79     * @return Connection used by this object.
80     */
81    Connection getConnection();
82  
83    /**
84     * @param tableName Table to check.
85     * @return True if table exists already.
86     * @throws IOException
87     */
88    boolean tableExists(final TableName tableName) throws IOException;
89  
90    /**
91     * List all the userspace tables.
92     *
93     * @return - returns an array of HTableDescriptors
94     * @throws IOException if a remote or network exception occurs
95     */
96    HTableDescriptor[] listTables() throws IOException;
97  
98    /**
99     * List all the userspace tables matching the given pattern.
100    *
101    * @param pattern The compiled regular expression to match against
102    * @return - returns an array of HTableDescriptors
103    * @throws IOException if a remote or network exception occurs
104    * @see #listTables()
105    */
106   HTableDescriptor[] listTables(Pattern pattern) throws IOException;
107 
108   /**
109    * List all the userspace tables matching the given regular expression.
110    *
111    * @param regex The regular expression to match against
112    * @return - returns an array of HTableDescriptors
113    * @throws IOException if a remote or network exception occurs
114    * @see #listTables(java.util.regex.Pattern)
115    */
116   HTableDescriptor[] listTables(String regex) throws IOException;
117 
118   /**
119    * List all the tables matching the given pattern.
120    *
121    * @param pattern The compiled regular expression to match against
122    * @param includeSysTables False to match only against userspace tables
123    * @return - returns an array of HTableDescriptors
124    * @throws IOException if a remote or network exception occurs
125    * @see #listTables()
126    */
127   HTableDescriptor[] listTables(Pattern pattern, boolean includeSysTables)
128       throws IOException;
129 
130   /**
131    * List all the tables matching the given pattern.
132    *
133    * @param regex The regular expression to match against
134    * @param includeSysTables False to match only against userspace tables
135    * @return - returns an array of HTableDescriptors
136    * @throws IOException if a remote or network exception occurs
137    * @see #listTables(java.util.regex.Pattern, boolean)
138    */
139   HTableDescriptor[] listTables(String regex, boolean includeSysTables)
140       throws IOException;
141 
142   /**
143    * List all of the names of userspace tables.
144    *
145    * @return TableName[] table names
146    * @throws IOException if a remote or network exception occurs
147    */
148   TableName[] listTableNames() throws IOException;
149 
150   /**
151    * List all of the names of userspace tables.
152    * @param pattern The regular expression to match against
153    * @return TableName[] table names
154    * @throws IOException if a remote or network exception occurs
155    */
156   TableName[] listTableNames(Pattern pattern) throws IOException;
157 
158   /**
159    * List all of the names of userspace tables.
160    * @param regex The regular expression to match against
161    * @return TableName[] table names
162    * @throws IOException if a remote or network exception occurs
163    */
164   TableName[] listTableNames(String regex) throws IOException;
165 
166   /**
167    * List all of the names of userspace tables.
168    * @param pattern The regular expression to match against
169    * @param includeSysTables False to match only against userspace tables
170    * @return TableName[] table names
171    * @throws IOException if a remote or network exception occurs
172    */
173   TableName[] listTableNames(final Pattern pattern, final boolean includeSysTables)
174       throws IOException;
175 
176   /**
177    * List all of the names of userspace tables.
178    * @param regex The regular expression to match against
179    * @param includeSysTables False to match only against userspace tables
180    * @return TableName[] table names
181    * @throws IOException if a remote or network exception occurs
182    */
183   TableName[] listTableNames(final String regex, final boolean includeSysTables)
184       throws IOException;
185 
186   /**
187    * Method for getting the tableDescriptor
188    *
189    * @param tableName as a {@link TableName}
190    * @return the tableDescriptor
191    * @throws org.apache.hadoop.hbase.TableNotFoundException
192    * @throws IOException if a remote or network exception occurs
193    */
194   HTableDescriptor getTableDescriptor(final TableName tableName)
195       throws TableNotFoundException, IOException;
196 
197   /**
198    * Creates a new table. Synchronous operation.
199    *
200    * @param desc table descriptor for table
201    * @throws IllegalArgumentException if the table name is reserved
202    * @throws MasterNotRunningException if master is not running
203    * @throws org.apache.hadoop.hbase.TableExistsException if table already exists (If concurrent
204    * threads, the table may have been created between test-for-existence and attempt-at-creation).
205    * @throws IOException if a remote or network exception occurs
206    */
207   void createTable(HTableDescriptor desc) throws IOException;
208 
209   /**
210    * Creates a new table with the specified number of regions.  The start key specified will become
211    * the end key of the first region of the table, and the end key specified will become the start
212    * key of the last region of the table (the first region has a null start key and the last region
213    * has a null end key). BigInteger math will be used to divide the key range specified into enough
214    * segments to make the required number of total regions. Synchronous operation.
215    *
216    * @param desc table descriptor for table
217    * @param startKey beginning of key range
218    * @param endKey end of key range
219    * @param numRegions the total number of regions to create
220    * @throws IllegalArgumentException if the table name is reserved
221    * @throws MasterNotRunningException if master is not running
222    * @throws org.apache.hadoop.hbase.TableExistsException if table already exists (If concurrent
223    * threads, the table may have been created between test-for-existence and attempt-at-creation).
224    * @throws IOException
225    */
226   void createTable(HTableDescriptor desc, byte[] startKey, byte[] endKey, int numRegions)
227       throws IOException;
228 
229   /**
230    * Creates a new table with an initial set of empty regions defined by the specified split keys.
231    * The total number of regions created will be the number of split keys plus one. Synchronous
232    * operation. Note : Avoid passing empty split key.
233    *
234    * @param desc table descriptor for table
235    * @param splitKeys array of split keys for the initial regions of the table
236    * @throws IllegalArgumentException if the table name is reserved, if the split keys are repeated
237    * and if the split key has empty byte array.
238    * @throws MasterNotRunningException if master is not running
239    * @throws org.apache.hadoop.hbase.TableExistsException if table already exists (If concurrent
240    * threads, the table may have been created between test-for-existence and attempt-at-creation).
241    * @throws IOException
242    */
243   void createTable(final HTableDescriptor desc, byte[][] splitKeys) throws IOException;
244 
245   /**
246    * Creates a new table but does not block and wait for it to come online.
247    * You can use Future.get(long, TimeUnit) to wait on the operation to complete.
248    * It may throw ExecutionException if there was an error while executing the operation
249    * or TimeoutException in case the wait timeout was not long enough to allow the
250    * operation to complete.
251    *
252    * @param desc table descriptor for table
253    * @param splitKeys keys to check if the table has been created with all split keys
254    * @throws IllegalArgumentException Bad table name, if the split keys
255    *    are repeated and if the split key has empty byte array.
256    * @throws IOException if a remote or network exception occurs
257    * @return the result of the async creation. You can use Future.get(long, TimeUnit)
258    *    to wait on the operation to complete.
259    */
260   Future<Void> createTableAsync(final HTableDescriptor desc, final byte[][] splitKeys) throws IOException;
261 
262   /**
263    * Deletes a table. Synchronous operation.
264    *
265    * @param tableName name of table to delete
266    * @throws IOException if a remote or network exception occurs
267    */
268   void deleteTable(final TableName tableName) throws IOException;
269 
270   /**
271    * Deletes the table but does not block and wait for it be completely removed.
272    * You can use Future.get(long, TimeUnit) to wait on the operation to complete.
273    * It may throw ExecutionException if there was an error while executing the operation
274    * or TimeoutException in case the wait timeout was not long enough to allow the
275    * operation to complete.
276    *
277    * @param tableName name of table to delete
278    * @throws IOException if a remote or network exception occurs
279    * @return the result of the async delete. You can use Future.get(long, TimeUnit)
280    *    to wait on the operation to complete.
281    */
282   Future<Void> deleteTableAsync(TableName tableName) throws IOException;
283 
284   /**
285    * Deletes tables matching the passed in pattern and wait on completion. Warning: Use this method
286    * carefully, there is no prompting and the effect is immediate. Consider using {@link
287    * #listTables(java.lang.String)} and {@link #deleteTable(org.apache.hadoop.hbase.TableName)}
288    *
289    * @param regex The regular expression to match table names against
290    * @return Table descriptors for tables that couldn't be deleted
291    * @throws IOException
292    * @see #deleteTables(java.util.regex.Pattern)
293    * @see #deleteTable(org.apache.hadoop.hbase.TableName)
294    */
295   HTableDescriptor[] deleteTables(String regex) throws IOException;
296 
297   /**
298    * Delete tables matching the passed in pattern and wait on completion. Warning: Use this method
299    * carefully, there is no prompting and the effect is immediate. Consider using {@link
300    * #listTables(java.util.regex.Pattern) } and
301    * {@link #deleteTable(org.apache.hadoop.hbase.TableName)}
302    *
303    * @param pattern The pattern to match table names against
304    * @return Table descriptors for tables that couldn't be deleted
305    * @throws IOException
306    */
307   HTableDescriptor[] deleteTables(Pattern pattern) throws IOException;
308 
309   /**
310    * Truncate a table.
311    * Synchronous operation.
312    *
313    * @param tableName name of table to truncate
314    * @param preserveSplits True if the splits should be preserved
315    * @throws IOException if a remote or network exception occurs
316    */
317   public void truncateTable(final TableName tableName, final boolean preserveSplits)
318       throws IOException;
319 
320   /**
321    * Enable a table.  May timeout.  Use {@link #enableTableAsync(org.apache.hadoop.hbase.TableName)}
322    * and {@link #isTableEnabled(org.apache.hadoop.hbase.TableName)} instead. The table has to be in
323    * disabled state for it to be enabled.
324    *
325    * @param tableName name of the table
326    * @throws IOException if a remote or network exception occurs There could be couple types of
327    * IOException TableNotFoundException means the table doesn't exist. TableNotDisabledException
328    * means the table isn't in disabled state.
329    * @see #isTableEnabled(org.apache.hadoop.hbase.TableName)
330    * @see #disableTable(org.apache.hadoop.hbase.TableName)
331    * @see #enableTableAsync(org.apache.hadoop.hbase.TableName)
332    */
333   void enableTable(final TableName tableName) throws IOException;
334 
335   /**
336    * Enable the table but does not block and wait for it be completely enabled.
337    * You can use Future.get(long, TimeUnit) to wait on the operation to complete.
338    * It may throw ExecutionException if there was an error while executing the operation
339    * or TimeoutException in case the wait timeout was not long enough to allow the
340    * operation to complete.
341    *
342    * @param tableName name of table to delete
343    * @throws IOException if a remote or network exception occurs
344    * @return the result of the async enable. You can use Future.get(long, TimeUnit)
345    *    to wait on the operation to complete.
346    */
347   Future<Void> enableTableAsync(final TableName tableName) throws IOException;
348 
349   /**
350    * Enable tables matching the passed in pattern and wait on completion. Warning: Use this method
351    * carefully, there is no prompting and the effect is immediate. Consider using {@link
352    * #listTables(java.lang.String)} and {@link #enableTable(org.apache.hadoop.hbase.TableName)}
353    *
354    * @param regex The regular expression to match table names against
355    * @throws IOException
356    * @see #enableTables(java.util.regex.Pattern)
357    * @see #enableTable(org.apache.hadoop.hbase.TableName)
358    */
359   HTableDescriptor[] enableTables(String regex) throws IOException;
360 
361   /**
362    * Enable tables matching the passed in pattern and wait on completion. Warning: Use this method
363    * carefully, there is no prompting and the effect is immediate. Consider using {@link
364    * #listTables(java.util.regex.Pattern) } and
365    * {@link #enableTable(org.apache.hadoop.hbase.TableName)}
366    *
367    * @param pattern The pattern to match table names against
368    * @throws IOException
369    */
370   HTableDescriptor[] enableTables(Pattern pattern) throws IOException;
371 
372   /**
373    * Disable the table but does not block and wait for it be completely disabled.
374    * You can use Future.get(long, TimeUnit) to wait on the operation to complete.
375    * It may throw ExecutionException if there was an error while executing the operation
376    * or TimeoutException in case the wait timeout was not long enough to allow the
377    * operation to complete.
378    *
379    * @param tableName name of table to delete
380    * @throws IOException if a remote or network exception occurs
381    * @return the result of the async disable. You can use Future.get(long, TimeUnit)
382    *    to wait on the operation to complete.
383    */
384   Future<Void> disableTableAsync(final TableName tableName) throws IOException;
385 
386   /**
387    * Disable table and wait on completion.  May timeout eventually.  Use {@link
388    * #disableTableAsync(org.apache.hadoop.hbase.TableName)} and
389    * {@link #isTableDisabled(org.apache.hadoop.hbase.TableName)} instead. The table has to be in
390    * enabled state for it to be disabled.
391    *
392    * @param tableName
393    * @throws IOException There could be couple types of IOException TableNotFoundException means the
394    * table doesn't exist. TableNotEnabledException means the table isn't in enabled state.
395    */
396   void disableTable(final TableName tableName) throws IOException;
397 
398   /**
399    * Disable tables matching the passed in pattern and wait on completion. Warning: Use this method
400    * carefully, there is no prompting and the effect is immediate. Consider using {@link
401    * #listTables(java.lang.String)} and {@link #disableTable(org.apache.hadoop.hbase.TableName)}
402    *
403    * @param regex The regular expression to match table names against
404    * @return Table descriptors for tables that couldn't be disabled
405    * @throws IOException
406    * @see #disableTables(java.util.regex.Pattern)
407    * @see #disableTable(org.apache.hadoop.hbase.TableName)
408    */
409   HTableDescriptor[] disableTables(String regex) throws IOException;
410 
411   /**
412    * Disable tables matching the passed in pattern and wait on completion. Warning: Use this method
413    * carefully, there is no prompting and the effect is immediate. Consider using {@link
414    * #listTables(java.util.regex.Pattern) } and
415    * {@link #disableTable(org.apache.hadoop.hbase.TableName)}
416    *
417    * @param pattern The pattern to match table names against
418    * @return Table descriptors for tables that couldn't be disabled
419    * @throws IOException
420    */
421   HTableDescriptor[] disableTables(Pattern pattern) throws IOException;
422 
423   /**
424    * @param tableName name of table to check
425    * @return true if table is on-line
426    * @throws IOException if a remote or network exception occurs
427    */
428   boolean isTableEnabled(TableName tableName) throws IOException;
429 
430   /**
431    * @param tableName name of table to check
432    * @return true if table is off-line
433    * @throws IOException if a remote or network exception occurs
434    */
435   boolean isTableDisabled(TableName tableName) throws IOException;
436 
437   /**
438    * @param tableName name of table to check
439    * @return true if all regions of the table are available
440    * @throws IOException if a remote or network exception occurs
441    */
442   boolean isTableAvailable(TableName tableName) throws IOException;
443 
444   /**
445    * Use this api to check if the table has been created with the specified number of splitkeys
446    * which was used while creating the given table. Note : If this api is used after a table's
447    * region gets splitted, the api may return false.
448    *
449    * @param tableName name of table to check
450    * @param splitKeys keys to check if the table has been created with all split keys
451    * @throws IOException if a remote or network excpetion occurs
452    */
453   boolean isTableAvailable(TableName tableName, byte[][] splitKeys) throws IOException;
454 
455   /**
456    * Get the status of alter command - indicates how many regions have received the updated schema
457    * Asynchronous operation.
458    *
459    * @param tableName TableName instance
460    * @return Pair indicating the number of regions updated Pair.getFirst() is the regions that are
461    * yet to be updated Pair.getSecond() is the total number of regions of the table
462    * @throws IOException if a remote or network exception occurs
463    */
464   Pair<Integer, Integer> getAlterStatus(final TableName tableName) throws IOException;
465 
466   /**
467    * Get the status of alter command - indicates how many regions have received the updated schema
468    * Asynchronous operation.
469    *
470    * @param tableName name of the table to get the status of
471    * @return Pair indicating the number of regions updated Pair.getFirst() is the regions that are
472    * yet to be updated Pair.getSecond() is the total number of regions of the table
473    * @throws IOException if a remote or network exception occurs
474    */
475   Pair<Integer, Integer> getAlterStatus(final byte[] tableName) throws IOException;
476 
477   /**
478    * Add a column to an existing table. Asynchronous operation.
479    *
480    * @param tableName name of the table to add column to
481    * @param column column descriptor of column to be added
482    * @throws IOException if a remote or network exception occurs
483    */
484   void addColumn(final TableName tableName, final HColumnDescriptor column) throws IOException;
485 
486   /**
487    * Delete a column from a table. Asynchronous operation.
488    *
489    * @param tableName name of table
490    * @param columnName name of column to be deleted
491    * @throws IOException if a remote or network exception occurs
492    */
493   void deleteColumn(final TableName tableName, final byte[] columnName) throws IOException;
494 
495   /**
496    * Modify an existing column family on a table. Asynchronous operation.
497    *
498    * @param tableName name of table
499    * @param descriptor new column descriptor to use
500    * @throws IOException if a remote or network exception occurs
501    */
502   void modifyColumn(final TableName tableName, final HColumnDescriptor descriptor)
503       throws IOException;
504 
505   /**
506    * Close a region. For expert-admins.  Runs close on the regionserver.  The master will not be
507    * informed of the close.
508    *
509    * @param regionname region name to close
510    * @param serverName If supplied, we'll use this location rather than the one currently in
511    * <code>hbase:meta</code>
512    * @throws IOException if a remote or network exception occurs
513    */
514   void closeRegion(final String regionname, final String serverName) throws IOException;
515 
516   /**
517    * Close a region.  For expert-admins  Runs close on the regionserver.  The master will not be
518    * informed of the close.
519    *
520    * @param regionname region name to close
521    * @param serverName The servername of the regionserver.  If passed null we will use servername
522    * found in the hbase:meta table. A server name is made of host, port and startcode.  Here is an
523    * example: <code> host187.example.com,60020,1289493121758</code>
524    * @throws IOException if a remote or network exception occurs
525    */
526   void closeRegion(final byte[] regionname, final String serverName) throws IOException;
527 
528   /**
529    * For expert-admins. Runs close on the regionserver. Closes a region based on the encoded region
530    * name. The region server name is mandatory. If the servername is provided then based on the
531    * online regions in the specified regionserver the specified region will be closed. The master
532    * will not be informed of the close. Note that the regionname is the encoded regionname.
533    *
534    * @param encodedRegionName The encoded region name; i.e. the hash that makes up the region name
535    * suffix: e.g. if regionname is
536    * <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>,
537    * then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>.
538    * @param serverName The servername of the regionserver. A server name is made of host, port and
539    * startcode. This is mandatory. Here is an example:
540    * <code> host187.example.com,60020,1289493121758</code>
541    * @return true if the region was closed, false if not.
542    * @throws IOException if a remote or network exception occurs
543    */
544   boolean closeRegionWithEncodedRegionName(final String encodedRegionName, final String serverName)
545       throws IOException;
546 
547   /**
548    * Close a region.  For expert-admins  Runs close on the regionserver.  The master will not be
549    * informed of the close.
550    *
551    * @param sn
552    * @param hri
553    * @throws IOException
554    */
555   void closeRegion(final ServerName sn, final HRegionInfo hri) throws IOException;
556 
557   /**
558    * Get all the online regions on a region server.
559    */
560   List<HRegionInfo> getOnlineRegions(final ServerName sn) throws IOException;
561 
562   /**
563    * Flush a table. Synchronous operation.
564    *
565    * @param tableName table to flush
566    * @throws IOException if a remote or network exception occurs
567    */
568   void flush(final TableName tableName) throws IOException;
569 
570   /**
571    * Flush an individual region. Synchronous operation.
572    *
573    * @param regionName region to flush
574    * @throws IOException if a remote or network exception occurs
575    */
576   void flushRegion(final byte[] regionName) throws IOException;
577 
578   /**
579    * Compact a table. Asynchronous operation.
580    *
581    * @param tableName table to compact
582    * @throws IOException if a remote or network exception occurs
583    */
584   void compact(final TableName tableName) throws IOException;
585 
586   /**
587    * Compact an individual region. Asynchronous operation.
588    *
589    * @param regionName region to compact
590    * @throws IOException if a remote or network exception occurs
591    */
592   void compactRegion(final byte[] regionName) throws IOException;
593 
594   /**
595    * Compact a column family within a table. Asynchronous operation.
596    *
597    * @param tableName table to compact
598    * @param columnFamily column family within a table
599    * @throws IOException if a remote or network exception occurs
600    */
601   void compact(final TableName tableName, final byte[] columnFamily)
602     throws IOException;
603 
604   /**
605    * Compact a column family within a region. Asynchronous operation.
606    *
607    * @param regionName region to compact
608    * @param columnFamily column family within a region
609    * @throws IOException if a remote or network exception occurs
610    */
611   void compactRegion(final byte[] regionName, final byte[] columnFamily)
612     throws IOException;
613 
614   /**
615    * Major compact a table. Asynchronous operation.
616    *
617    * @param tableName table to major compact
618    * @throws IOException if a remote or network exception occurs
619    */
620   void majorCompact(TableName tableName) throws IOException;
621 
622   /**
623    * Major compact a table or an individual region. Asynchronous operation.
624    *
625    * @param regionName region to major compact
626    * @throws IOException if a remote or network exception occurs
627    */
628   void majorCompactRegion(final byte[] regionName) throws IOException;
629 
630   /**
631    * Major compact a column family within a table. Asynchronous operation.
632    *
633    * @param tableName table to major compact
634    * @param columnFamily column family within a table
635    * @throws IOException if a remote or network exception occurs
636    */
637   void majorCompact(TableName tableName, final byte[] columnFamily)
638     throws IOException;
639 
640   /**
641    * Major compact a column family within region. Asynchronous operation.
642    *
643    * @param regionName egion to major compact
644    * @param columnFamily column family within a region
645    * @throws IOException if a remote or network exception occurs
646    */
647   void majorCompactRegion(final byte[] regionName, final byte[] columnFamily)
648     throws IOException;
649 
650   /**
651    * Compact all regions on the region server
652    * @param sn the region server name
653    * @param major if it's major compaction
654    * @throws IOException
655    * @throws InterruptedException
656    */
657   public void compactRegionServer(final ServerName sn, boolean major)
658     throws IOException, InterruptedException;
659 
660   /**
661    * Move the region <code>r</code> to <code>dest</code>.
662    *
663    * @param encodedRegionName The encoded region name; i.e. the hash that makes up the region name
664    * suffix: e.g. if regionname is
665    * <code>TestTable,0094429456,1289497600452.527db22f95c8a9e0116f0cc13c680396.</code>,
666    * then the encoded region name is: <code>527db22f95c8a9e0116f0cc13c680396</code>.
667    * @param destServerName The servername of the destination regionserver.  If passed the empty byte
668    * array we'll assign to a random server.  A server name is made of host, port and startcode.
669    * Here is an example: <code> host187.example.com,60020,1289493121758</code>
670    * @throws UnknownRegionException Thrown if we can't find a region named
671    * <code>encodedRegionName</code>
672    */
673   void move(final byte[] encodedRegionName, final byte[] destServerName)
674       throws IOException;
675 
676   /**
677    * @param regionName Region name to assign.
678    */
679   void assign(final byte[] regionName)
680       throws IOException;
681 
682   /**
683    * Unassign a region from current hosting regionserver.  Region will then be assigned to a
684    * regionserver chosen at random.  Region could be reassigned back to the same server.  Use {@link
685    * #move(byte[], byte[])} if you want to control the region movement.
686    *
687    * @param regionName Region to unassign. Will clear any existing RegionPlan if one found.
688    * @param force If true, force unassign (Will remove region from regions-in-transition too if
689    * present. If results in double assignment use hbck -fix to resolve. To be used by experts).
690    */
691   void unassign(final byte[] regionName, final boolean force)
692       throws IOException;
693 
694   /**
695    * Offline specified region from master's in-memory state. It will not attempt to reassign the
696    * region as in unassign. This API can be used when a region not served by any region server and
697    * still online as per Master's in memory state. If this API is incorrectly used on active region
698    * then master will loose track of that region. This is a special method that should be used by
699    * experts or hbck.
700    *
701    * @param regionName Region to offline.
702    * @throws IOException
703    */
704   void offline(final byte[] regionName) throws IOException;
705 
706   /**
707    * Turn the load balancer on or off.
708    *
709    * @param synchronous If true, it waits until current balance() call, if outstanding, to return.
710    * @return Previous balancer value
711    */
712   boolean setBalancerRunning(final boolean on, final boolean synchronous)
713       throws IOException;
714 
715   /**
716    * Invoke the balancer.  Will run the balancer and if regions to move, it will go ahead and do the
717    * reassignments.  Can NOT run for various reasons.  Check logs.
718    *
719    * @return True if balancer ran, false otherwise.
720    */
721   boolean balancer() throws IOException;
722 
723   /**
724    * Query the current state of the balancer
725    *
726    * @return true if the balancer is enabled, false otherwise.
727    */
728   boolean isBalancerEnabled() throws IOException;
729 
730   /**
731    * Enable/Disable the catalog janitor
732    *
733    * @param enable if true enables the catalog janitor
734    * @return the previous state
735    */
736   boolean enableCatalogJanitor(boolean enable) throws IOException;
737 
738   /**
739    * Ask for a scan of the catalog table
740    *
741    * @return the number of entries cleaned
742    */
743   int runCatalogScan() throws IOException;
744 
745   /**
746    * Query on the catalog janitor state (Enabled/Disabled?)
747    *
748    */
749   boolean isCatalogJanitorEnabled() throws IOException;
750 
751   /**
752    * Merge two regions. Asynchronous operation.
753    *
754    * @param encodedNameOfRegionA encoded name of region a
755    * @param encodedNameOfRegionB encoded name of region b
756    * @param forcible true if do a compulsory merge, otherwise we will only merge two adjacent
757    * regions
758    * @throws IOException
759    */
760   void mergeRegions(final byte[] encodedNameOfRegionA, final byte[] encodedNameOfRegionB,
761       final boolean forcible) throws IOException;
762 
763   /**
764    * Split a table. Asynchronous operation.
765    *
766    * @param tableName table to split
767    * @throws IOException if a remote or network exception occurs
768    */
769   void split(final TableName tableName) throws IOException;
770 
771   /**
772    * Split an individual region. Asynchronous operation.
773    *
774    * @param regionName region to split
775    * @throws IOException if a remote or network exception occurs
776    */
777   void splitRegion(final byte[] regionName) throws IOException;
778 
779   /**
780    * Split a table. Asynchronous operation.
781    *
782    * @param tableName table to split
783    * @param splitPoint the explicit position to split on
784    * @throws IOException if a remote or network exception occurs
785    */
786   void split(final TableName tableName, final byte[] splitPoint)
787     throws IOException;
788 
789   /**
790    * Split an individual region. Asynchronous operation.
791    *
792    * @param regionName region to split
793    * @param splitPoint the explicit position to split on
794    * @throws IOException if a remote or network exception occurs
795    */
796   void splitRegion(final byte[] regionName, final byte[] splitPoint)
797     throws IOException;
798 
799   /**
800    * Modify an existing table, more IRB friendly version. Asynchronous operation.  This means that
801    * it may be a while before your schema change is updated across all of the table.
802    *
803    * @param tableName name of table.
804    * @param htd modified description of the table
805    * @throws IOException if a remote or network exception occurs
806    */
807   void modifyTable(final TableName tableName, final HTableDescriptor htd)
808       throws IOException;
809 
810   /**
811    * Shuts down the HBase cluster
812    *
813    * @throws IOException if a remote or network exception occurs
814    */
815   void shutdown() throws IOException;
816 
817   /**
818    * Shuts down the current HBase master only. Does not shutdown the cluster.
819    *
820    * @throws IOException if a remote or network exception occurs
821    * @see #shutdown()
822    */
823   void stopMaster() throws IOException;
824 
825   /**
826    * Stop the designated regionserver
827    *
828    * @param hostnamePort Hostname and port delimited by a <code>:</code> as in
829    * <code>example.org:1234</code>
830    * @throws IOException if a remote or network exception occurs
831    */
832   void stopRegionServer(final String hostnamePort) throws IOException;
833 
834   /**
835    * @return cluster status
836    * @throws IOException if a remote or network exception occurs
837    */
838   ClusterStatus getClusterStatus() throws IOException;
839 
840   /**
841    * @return Configuration used by the instance.
842    */
843   Configuration getConfiguration();
844 
845   /**
846    * Create a new namespace
847    *
848    * @param descriptor descriptor which describes the new namespace
849    * @throws IOException
850    */
851   void createNamespace(final NamespaceDescriptor descriptor)
852       throws IOException;
853 
854   /**
855    * Modify an existing namespace
856    *
857    * @param descriptor descriptor which describes the new namespace
858    * @throws IOException
859    */
860   void modifyNamespace(final NamespaceDescriptor descriptor)
861       throws IOException;
862 
863   /**
864    * Delete an existing namespace. Only empty namespaces (no tables) can be removed.
865    *
866    * @param name namespace name
867    * @throws IOException
868    */
869   void deleteNamespace(final String name) throws IOException;
870 
871   /**
872    * Get a namespace descriptor by name
873    *
874    * @param name name of namespace descriptor
875    * @return A descriptor
876    * @throws IOException
877    */
878   NamespaceDescriptor getNamespaceDescriptor(final String name)
879       throws IOException;
880 
881   /**
882    * List available namespace descriptors
883    *
884    * @return List of descriptors
885    * @throws IOException
886    */
887   NamespaceDescriptor[] listNamespaceDescriptors()
888     throws IOException;
889 
890   /**
891    * Get list of table descriptors by namespace
892    *
893    * @param name namespace name
894    * @return A descriptor
895    * @throws IOException
896    */
897   HTableDescriptor[] listTableDescriptorsByNamespace(final String name)
898       throws IOException;
899 
900   /**
901    * Get list of table names by namespace
902    *
903    * @param name namespace name
904    * @return The list of table names in the namespace
905    * @throws IOException
906    */
907   TableName[] listTableNamesByNamespace(final String name)
908       throws IOException;
909 
910   /**
911    * Get the regions of a given table.
912    *
913    * @param tableName the name of the table
914    * @return List of {@link HRegionInfo}.
915    * @throws IOException
916    */
917   List<HRegionInfo> getTableRegions(final TableName tableName)
918     throws IOException;
919 
920   @Override
921   void close() throws IOException;
922 
923   /**
924    * Get tableDescriptors
925    *
926    * @param tableNames List of table names
927    * @return HTD[] the tableDescriptor
928    * @throws IOException if a remote or network exception occurs
929    */
930   HTableDescriptor[] getTableDescriptorsByTableName(List<TableName> tableNames)
931     throws IOException;
932 
933   /**
934    * Get tableDescriptors
935    *
936    * @param names List of table names
937    * @return HTD[] the tableDescriptor
938    * @throws IOException if a remote or network exception occurs
939    */
940   HTableDescriptor[] getTableDescriptors(List<String> names)
941     throws IOException;
942 
943   /**
944    * Roll the log writer. I.e. for filesystem based write ahead logs, start writing to a new file.
945    *
946    * Note that the actual rolling of the log writer is asynchronous and may not be complete when
947    * this method returns. As a side effect of this call, the named region server may schedule
948    * store flushes at the request of the wal.
949    *
950    * @param serverName The servername of the regionserver.
951    * @throws IOException if a remote or network exception occurs
952    * @throws org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException
953    */
954   void rollWALWriter(ServerName serverName) throws IOException, FailedLogCloseException;
955 
956   /**
957    * Helper delegage to getClusterStatus().getMasterCoprocessors().
958    * @return an array of master coprocessors
959    * @see org.apache.hadoop.hbase.ClusterStatus#getMasterCoprocessors()
960    */
961   String[] getMasterCoprocessors() throws IOException;
962 
963   /**
964    * Get the current compaction state of a table. It could be in a major compaction, a minor
965    * compaction, both, or none.
966    *
967    * @param tableName table to examine
968    * @return the current compaction state
969    * @throws IOException if a remote or network exception occurs
970    */
971   AdminProtos.GetRegionInfoResponse.CompactionState getCompactionState(final TableName tableName)
972     throws IOException;
973 
974   /**
975    * Get the current compaction state of region. It could be in a major compaction, a minor
976    * compaction, both, or none.
977    *
978    * @param regionName region to examine
979    * @return the current compaction state
980    * @throws IOException if a remote or network exception occurs
981    */
982   AdminProtos.GetRegionInfoResponse.CompactionState getCompactionStateForRegion(
983     final byte[] regionName) throws IOException;
984 
985   /**
986    * Get the timestamp of the last major compaction for the passed table
987    *
988    * The timestamp of the oldest HFile resulting from a major compaction of that table,
989    * or 0 if no such HFile could be found.
990    *
991    * @param tableName table to examine
992    * @return the last major compaction timestamp or 0
993    * @throws IOException if a remote or network exception occurs
994    */
995   long getLastMajorCompactionTimestamp(final TableName tableName)
996     throws IOException;
997 
998   /**
999    * Get the timestamp of the last major compaction for the passed region.
1000    *
1001    * The timestamp of the oldest HFile resulting from a major compaction of that region,
1002    * or 0 if no such HFile could be found.
1003    *
1004    * @param regionName region to examine
1005    * @return the last major compaction timestamp or 0
1006    * @throws IOException if a remote or network exception occurs
1007    */
1008   long getLastMajorCompactionTimestampForRegion(final byte[] regionName)
1009       throws IOException;
1010 
1011   /**
1012    * Take a snapshot for the given table. If the table is enabled, a FLUSH-type snapshot will be
1013    * taken. If the table is disabled, an offline snapshot is taken. Snapshots are considered unique
1014    * based on <b>the name of the snapshot</b>. Attempts to take a snapshot with the same name (even
1015    * a different type or with different parameters) will fail with a {@link
1016    * org.apache.hadoop.hbase.snapshot.SnapshotCreationException} indicating the duplicate naming.
1017    * Snapshot names follow the same naming constraints as tables in HBase. See {@link
1018    * org.apache.hadoop.hbase.TableName#isLegalFullyQualifiedTableName(byte[])}.
1019    *
1020    * @param snapshotName name of the snapshot to be created
1021    * @param tableName name of the table for which snapshot is created
1022    * @throws IOException if a remote or network exception occurs
1023    * @throws org.apache.hadoop.hbase.snapshot.SnapshotCreationException if snapshot creation failed
1024    * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
1025    */
1026   void snapshot(final String snapshotName, final TableName tableName)
1027       throws IOException, SnapshotCreationException, IllegalArgumentException;
1028 
1029   /**
1030    * public void snapshot(final String snapshotName, Create a timestamp consistent snapshot for the
1031    * given table. final byte[] tableName) throws IOException, Snapshots are considered unique based
1032    * on <b>the name of the snapshot</b>. Attempts to take a snapshot with the same name (even a
1033    * different type or with different parameters) will fail with a {@link SnapshotCreationException}
1034    * indicating the duplicate naming. Snapshot names follow the same naming constraints as tables in
1035    * HBase.
1036    *
1037    * @param snapshotName name of the snapshot to be created
1038    * @param tableName name of the table for which snapshot is created
1039    * @throws IOException if a remote or network exception occurs
1040    * @throws SnapshotCreationException if snapshot creation failed
1041    * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
1042    */
1043   void snapshot(final byte[] snapshotName, final TableName tableName)
1044       throws IOException, SnapshotCreationException, IllegalArgumentException;
1045 
1046   /**
1047    * Create typed snapshot of the table. Snapshots are considered unique based on <b>the name of the
1048    * snapshot</b>. Attempts to take a snapshot with the same name (even a different type or with
1049    * different parameters) will fail with a {@link SnapshotCreationException} indicating the
1050    * duplicate naming. Snapshot names follow the same naming constraints as tables in HBase. See
1051    * {@link org.apache.hadoop.hbase.TableName#isLegalFullyQualifiedTableName(byte[])}.
1052    *
1053    * @param snapshotName name to give the snapshot on the filesystem. Must be unique from all other
1054    * snapshots stored on the cluster
1055    * @param tableName name of the table to snapshot
1056    * @param type type of snapshot to take
1057    * @throws IOException we fail to reach the master
1058    * @throws SnapshotCreationException if snapshot creation failed
1059    * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
1060    */
1061   void snapshot(final String snapshotName,
1062       final TableName tableName,
1063       HBaseProtos.SnapshotDescription.Type type) throws IOException, SnapshotCreationException,
1064       IllegalArgumentException;
1065 
1066   /**
1067    * Take a snapshot and wait for the server to complete that snapshot (blocking). Only a single
1068    * snapshot should be taken at a time for an instance of HBase, or results may be undefined (you
1069    * can tell multiple HBase clusters to snapshot at the same time, but only one at a time for a
1070    * single cluster). Snapshots are considered unique based on <b>the name of the snapshot</b>.
1071    * Attempts to take a snapshot with the same name (even a different type or with different
1072    * parameters) will fail with a {@link SnapshotCreationException} indicating the duplicate naming.
1073    * Snapshot names follow the same naming constraints as tables in HBase. See {@link
1074    * org.apache.hadoop.hbase.TableName#isLegalFullyQualifiedTableName(byte[])}. You should probably
1075    * use {@link #snapshot(String, org.apache.hadoop.hbase.TableName)} or
1076    * {@link #snapshot(byte[], org.apache.hadoop.hbase.TableName)} unless you are sure about the type
1077    * of snapshot that you want to take.
1078    *
1079    * @param snapshot snapshot to take
1080    * @throws IOException or we lose contact with the master.
1081    * @throws SnapshotCreationException if snapshot failed to be taken
1082    * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
1083    */
1084   void snapshot(HBaseProtos.SnapshotDescription snapshot)
1085       throws IOException, SnapshotCreationException, IllegalArgumentException;
1086 
1087   /**
1088    * Take a snapshot without waiting for the server to complete that snapshot (asynchronous) Only a
1089    * single snapshot should be taken at a time, or results may be undefined.
1090    *
1091    * @param snapshot snapshot to take
1092    * @return response from the server indicating the max time to wait for the snapshot
1093    * @throws IOException if the snapshot did not succeed or we lose contact with the master.
1094    * @throws SnapshotCreationException if snapshot creation failed
1095    * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
1096    */
1097   MasterProtos.SnapshotResponse takeSnapshotAsync(HBaseProtos.SnapshotDescription snapshot)
1098       throws IOException, SnapshotCreationException;
1099 
1100   /**
1101    * Check the current state of the passed snapshot. There are three possible states: <ol>
1102    * <li>running - returns <tt>false</tt></li> <li>finished - returns <tt>true</tt></li>
1103    * <li>finished with error - throws the exception that caused the snapshot to fail</li> </ol> The
1104    * cluster only knows about the most recent snapshot. Therefore, if another snapshot has been
1105    * run/started since the snapshot your are checking, you will recieve an {@link
1106    * org.apache.hadoop.hbase.snapshot.UnknownSnapshotException}.
1107    *
1108    * @param snapshot description of the snapshot to check
1109    * @return <tt>true</tt> if the snapshot is completed, <tt>false</tt> if the snapshot is still
1110    * running
1111    * @throws IOException if we have a network issue
1112    * @throws org.apache.hadoop.hbase.snapshot.HBaseSnapshotException if the snapshot failed
1113    * @throws org.apache.hadoop.hbase.snapshot.UnknownSnapshotException if the requested snapshot is
1114    * unknown
1115    */
1116   boolean isSnapshotFinished(final HBaseProtos.SnapshotDescription snapshot)
1117       throws IOException, HBaseSnapshotException, UnknownSnapshotException;
1118 
1119   /**
1120    * Restore the specified snapshot on the original table. (The table must be disabled) If the
1121    * "hbase.snapshot.restore.take.failsafe.snapshot" configuration property is set to true, a
1122    * snapshot of the current table is taken before executing the restore operation. In case of
1123    * restore failure, the failsafe snapshot will be restored. If the restore completes without
1124    * problem the failsafe snapshot is deleted.
1125    *
1126    * @param snapshotName name of the snapshot to restore
1127    * @throws IOException if a remote or network exception occurs
1128    * @throws org.apache.hadoop.hbase.snapshot.RestoreSnapshotException if snapshot failed to be
1129    * restored
1130    * @throws IllegalArgumentException if the restore request is formatted incorrectly
1131    */
1132   void restoreSnapshot(final byte[] snapshotName) throws IOException, RestoreSnapshotException;
1133 
1134   /**
1135    * Restore the specified snapshot on the original table. (The table must be disabled) If the
1136    * "hbase.snapshot.restore.take.failsafe.snapshot" configuration property is set to true, a
1137    * snapshot of the current table is taken before executing the restore operation. In case of
1138    * restore failure, the failsafe snapshot will be restored. If the restore completes without
1139    * problem the failsafe snapshot is deleted.
1140    *
1141    * @param snapshotName name of the snapshot to restore
1142    * @throws IOException if a remote or network exception occurs
1143    * @throws RestoreSnapshotException if snapshot failed to be restored
1144    * @throws IllegalArgumentException if the restore request is formatted incorrectly
1145    */
1146   void restoreSnapshot(final String snapshotName) throws IOException, RestoreSnapshotException;
1147 
1148   /**
1149    * Restore the specified snapshot on the original table. (The table must be disabled) If
1150    * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before
1151    * executing the restore operation. In case of restore failure, the failsafe snapshot will be
1152    * restored. If the restore completes without problem the failsafe snapshot is deleted. The
1153    * failsafe snapshot name is configurable by using the property
1154    * "hbase.snapshot.restore.failsafe.name".
1155    *
1156    * @param snapshotName name of the snapshot to restore
1157    * @param takeFailSafeSnapshot true if the failsafe snapshot should be taken
1158    * @throws IOException if a remote or network exception occurs
1159    * @throws RestoreSnapshotException if snapshot failed to be restored
1160    * @throws IllegalArgumentException if the restore request is formatted incorrectly
1161    */
1162   void restoreSnapshot(final byte[] snapshotName, final boolean takeFailSafeSnapshot)
1163       throws IOException, RestoreSnapshotException;
1164 
1165   /**
1166    * Restore the specified snapshot on the original table. (The table must be disabled) If
1167    * 'takeFailSafeSnapshot' is set to true, a snapshot of the current table is taken before
1168    * executing the restore operation. In case of restore failure, the failsafe snapshot will be
1169    * restored. If the restore completes without problem the failsafe snapshot is deleted. The
1170    * failsafe snapshot name is configurable by using the property
1171    * "hbase.snapshot.restore.failsafe.name".
1172    *
1173    * @param snapshotName name of the snapshot to restore
1174    * @param takeFailSafeSnapshot true if the failsafe snapshot should be taken
1175    * @throws IOException if a remote or network exception occurs
1176    * @throws RestoreSnapshotException if snapshot failed to be restored
1177    * @throws IllegalArgumentException if the restore request is formatted incorrectly
1178    */
1179   void restoreSnapshot(final String snapshotName, boolean takeFailSafeSnapshot)
1180       throws IOException, RestoreSnapshotException;
1181 
1182   /**
1183    * Create a new table by cloning the snapshot content.
1184    *
1185    * @param snapshotName name of the snapshot to be cloned
1186    * @param tableName name of the table where the snapshot will be restored
1187    * @throws IOException if a remote or network exception occurs
1188    * @throws TableExistsException if table to be created already exists
1189    * @throws RestoreSnapshotException if snapshot failed to be cloned
1190    * @throws IllegalArgumentException if the specified table has not a valid name
1191    */
1192   void cloneSnapshot(final byte[] snapshotName, final TableName tableName)
1193       throws IOException, TableExistsException, RestoreSnapshotException;
1194 
1195   /**
1196    * Create a new table by cloning the snapshot content.
1197    *
1198    * @param snapshotName name of the snapshot to be cloned
1199    * @param tableName name of the table where the snapshot will be restored
1200    * @throws IOException if a remote or network exception occurs
1201    * @throws TableExistsException if table to be created already exists
1202    * @throws RestoreSnapshotException if snapshot failed to be cloned
1203    * @throws IllegalArgumentException if the specified table has not a valid name
1204    */
1205   void cloneSnapshot(final String snapshotName, final TableName tableName)
1206       throws IOException, TableExistsException, RestoreSnapshotException;
1207 
1208   /**
1209    * Execute a distributed procedure on a cluster.
1210    *
1211    * @param signature A distributed procedure is uniquely identified by its signature (default the
1212    * root ZK node name of the procedure).
1213    * @param instance The instance name of the procedure. For some procedures, this parameter is
1214    * optional.
1215    * @param props Property/Value pairs of properties passing to the procedure
1216    * @throws IOException
1217    */
1218   void execProcedure(String signature, String instance, Map<String, String> props)
1219       throws IOException;
1220 
1221   /**
1222    * Execute a distributed procedure on a cluster.
1223    *
1224    * @param signature A distributed procedure is uniquely identified by its signature (default the
1225    * root ZK node name of the procedure).
1226    * @param instance The instance name of the procedure. For some procedures, this parameter is
1227    * optional.
1228    * @param props Property/Value pairs of properties passing to the procedure
1229    * @return data returned after procedure execution. null if no return data.
1230    * @throws IOException
1231    */
1232   byte[] execProcedureWithRet(String signature, String instance, Map<String, String> props)
1233       throws IOException;
1234 
1235   /**
1236    * Check the current state of the specified procedure. There are three possible states: <ol>
1237    * <li>running - returns <tt>false</tt></li> <li>finished - returns <tt>true</tt></li>
1238    * <li>finished with error - throws the exception that caused the procedure to fail</li> </ol>
1239    *
1240    * @param signature The signature that uniquely identifies a procedure
1241    * @param instance The instance name of the procedure
1242    * @param props Property/Value pairs of properties passing to the procedure
1243    * @return true if the specified procedure is finished successfully, false if it is still running
1244    * @throws IOException if the specified procedure finished with error
1245    */
1246   boolean isProcedureFinished(String signature, String instance, Map<String, String> props)
1247       throws IOException;
1248 
1249   /**
1250    * List completed snapshots.
1251    *
1252    * @return a list of snapshot descriptors for completed snapshots
1253    * @throws IOException if a network error occurs
1254    */
1255   List<HBaseProtos.SnapshotDescription> listSnapshots() throws IOException;
1256 
1257   /**
1258    * List all the completed snapshots matching the given regular expression.
1259    *
1260    * @param regex The regular expression to match against
1261    * @return - returns a List of SnapshotDescription
1262    * @throws IOException if a remote or network exception occurs
1263    */
1264   List<HBaseProtos.SnapshotDescription> listSnapshots(String regex) throws IOException;
1265 
1266   /**
1267    * List all the completed snapshots matching the given pattern.
1268    *
1269    * @param pattern The compiled regular expression to match against
1270    * @return - returns a List of SnapshotDescription
1271    * @throws IOException if a remote or network exception occurs
1272    */
1273   List<HBaseProtos.SnapshotDescription> listSnapshots(Pattern pattern) throws IOException;
1274 
1275   /**
1276    * Delete an existing snapshot.
1277    *
1278    * @param snapshotName name of the snapshot
1279    * @throws IOException if a remote or network exception occurs
1280    */
1281   void deleteSnapshot(final byte[] snapshotName) throws IOException;
1282 
1283   /**
1284    * Delete an existing snapshot.
1285    *
1286    * @param snapshotName name of the snapshot
1287    * @throws IOException if a remote or network exception occurs
1288    */
1289   void deleteSnapshot(final String snapshotName) throws IOException;
1290 
1291   /**
1292    * Delete existing snapshots whose names match the pattern passed.
1293    *
1294    * @param regex The regular expression to match against
1295    * @throws IOException if a remote or network exception occurs
1296    */
1297   void deleteSnapshots(final String regex) throws IOException;
1298 
1299   /**
1300    * Delete existing snapshots whose names match the pattern passed.
1301    *
1302    * @param pattern pattern for names of the snapshot to match
1303    * @throws IOException if a remote or network exception occurs
1304    */
1305   void deleteSnapshots(final Pattern pattern) throws IOException;
1306 
1307   /**
1308    * Apply the new quota settings.
1309    *
1310    * @param quota the quota settings
1311    * @throws IOException if a remote or network exception occurs
1312    */
1313   void setQuota(final QuotaSettings quota) throws IOException;
1314 
1315   /**
1316    * Return a QuotaRetriever to list the quotas based on the filter.
1317    *
1318    * @param filter the quota settings filter
1319    * @return the quota retriever
1320    * @throws IOException if a remote or network exception occurs
1321    */
1322   QuotaRetriever getQuotaRetriever(final QuotaFilter filter) throws IOException;
1323 
1324   /**
1325    * Creates and returns a {@link com.google.protobuf.RpcChannel} instance connected to the active
1326    * master. <p> The obtained {@link com.google.protobuf.RpcChannel} instance can be used to access
1327    * a published coprocessor {@link com.google.protobuf.Service} using standard protobuf service
1328    * invocations: </p> <div style="background-color: #cccccc; padding: 2px">
1329    * <blockquote><pre>
1330    * CoprocessorRpcChannel channel = myAdmin.coprocessorService();
1331    * MyService.BlockingInterface service = MyService.newBlockingStub(channel);
1332    * MyCallRequest request = MyCallRequest.newBuilder()
1333    *     ...
1334    *     .build();
1335    * MyCallResponse response = service.myCall(null, request);
1336    * </pre></blockquote></div>
1337    *
1338    * @return A MasterCoprocessorRpcChannel instance
1339    */
1340   CoprocessorRpcChannel coprocessorService();
1341 
1342 
1343   /**
1344    * Creates and returns a {@link com.google.protobuf.RpcChannel} instance
1345    * connected to the passed region server.
1346    *
1347    * <p>
1348    * The obtained {@link com.google.protobuf.RpcChannel} instance can be used to access a published
1349    * coprocessor {@link com.google.protobuf.Service} using standard protobuf service invocations:
1350    * </p>
1351    *
1352    * <div style="background-color: #cccccc; padding: 2px">
1353    * <blockquote><pre>
1354    * CoprocessorRpcChannel channel = myAdmin.coprocessorService(serverName);
1355    * MyService.BlockingInterface service = MyService.newBlockingStub(channel);
1356    * MyCallRequest request = MyCallRequest.newBuilder()
1357    *     ...
1358    *     .build();
1359    * MyCallResponse response = service.myCall(null, request);
1360    * </pre></blockquote></div>
1361    *
1362    * @param sn the server name to which the endpoint call is made
1363    * @return A RegionServerCoprocessorRpcChannel instance
1364    */
1365   CoprocessorRpcChannel coprocessorService(ServerName sn);
1366 
1367 
1368   /**
1369    * Update the configuration and trigger an online config change
1370    * on the regionserver
1371    * @param server : The server whose config needs to be updated.
1372    * @throws IOException
1373    */
1374   void updateConfiguration(ServerName server) throws IOException;
1375 
1376 
1377   /**
1378    * Update the configuration and trigger an online config change
1379    * on all the regionservers
1380    * @throws IOException
1381    */
1382   void updateConfiguration() throws IOException;
1383 
1384   /**
1385    * Get the info port of the current master if one is available.
1386    * @return master info port
1387    * @throws IOException
1388    */
1389   public int getMasterInfoPort() throws IOException;
1390 }