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