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