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  
20  package org.apache.hadoop.hbase.coprocessor;
21  
22  import java.io.IOException;
23  import java.util.List;
24  
25  import org.apache.hadoop.hbase.Coprocessor;
26  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
27  import org.apache.hadoop.hbase.HColumnDescriptor;
28  import org.apache.hadoop.hbase.HRegionInfo;
29  import org.apache.hadoop.hbase.HTableDescriptor;
30  import org.apache.hadoop.hbase.NamespaceDescriptor;
31  import org.apache.hadoop.hbase.ProcedureInfo;
32  import org.apache.hadoop.hbase.ServerName;
33  import org.apache.hadoop.hbase.TableName;
34  import org.apache.hadoop.hbase.classification.InterfaceAudience;
35  import org.apache.hadoop.hbase.classification.InterfaceStability;
36  import org.apache.hadoop.hbase.master.RegionPlan;
37  import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
38  import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
39  import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
40  import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Quotas;
41  
42  /**
43   * Defines coprocessor hooks for interacting with operations on the
44   * {@link org.apache.hadoop.hbase.master.HMaster} process.
45   */
46  @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
47  @InterfaceStability.Evolving
48  public interface MasterObserver extends Coprocessor {
49  
50    /**
51     * Called before a new table is created by
52     * {@link org.apache.hadoop.hbase.master.HMaster}.  Called as part of create
53     * table RPC call.
54     * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
55     * @param ctx the environment to interact with the framework and master
56     * @param desc the HTableDescriptor for the table
57     * @param regions the initial regions created for the table
58     * @throws IOException
59     */
60    void preCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
61        HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
62  
63    /**
64     * Called after the createTable operation has been requested.  Called as part
65     * of create table RPC call.
66     * @param ctx the environment to interact with the framework and master
67     * @param desc the HTableDescriptor for the table
68     * @param regions the initial regions created for the table
69     * @throws IOException
70     */
71    void postCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
72        HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
73    /**
74     * Called before a new table is created by
75     * {@link org.apache.hadoop.hbase.master.HMaster}.  Called as part of create
76     * table handler and it is async to the create RPC call.
77     * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
78     * @param ctx the environment to interact with the framework and master
79     * @param desc the HTableDescriptor for the table
80     * @param regions the initial regions created for the table
81     * @throws IOException
82     */
83    void preCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
84        ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
85  
86    /**
87     * Called after the createTable operation has been requested.  Called as part
88     * of create table RPC call.  Called as part of create table handler and
89     * it is async to the create RPC call.
90     * @param ctx the environment to interact with the framework and master
91     * @param desc the HTableDescriptor for the table
92     * @param regions the initial regions created for the table
93     * @throws IOException
94     */
95    void postCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
96    ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
97  
98    /**
99     * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
100    * table.  Called as part of delete table RPC call.
101    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
102    * @param ctx the environment to interact with the framework and master
103    * @param tableName the name of the table
104    */
105   void preDeleteTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
106       TableName tableName) throws IOException;
107 
108   /**
109    * Called after the deleteTable operation has been requested.  Called as part
110    * of delete table RPC call.
111    * @param ctx the environment to interact with the framework and master
112    * @param tableName the name of the table
113    */
114   void postDeleteTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
115       TableName tableName) throws IOException;
116 
117   /**
118    * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
119    * table.  Called as part of delete table handler and
120    * it is async to the delete RPC call.
121    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
122    * @param ctx the environment to interact with the framework and master
123    * @param tableName the name of the table
124    */
125   void preDeleteTableHandler(
126       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
127       throws IOException;
128 
129   /**
130    * Called after {@link org.apache.hadoop.hbase.master.HMaster} deletes a
131    * table.  Called as part of delete table handler and it is async to the
132    * delete RPC call.
133    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
134    * @param ctx the environment to interact with the framework and master
135    * @param tableName the name of the table
136    */
137   void postDeleteTableHandler(
138       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
139       throws IOException;
140 
141 
142   /**
143    * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a
144    * table.  Called as part of truncate table RPC call.
145    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
146    * @param ctx the environment to interact with the framework and master
147    * @param tableName the name of the table
148    */
149   void preTruncateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
150       TableName tableName) throws IOException;
151 
152   /**
153    * Called after the truncateTable operation has been requested.  Called as part
154    * of truncate table RPC call.
155    * The truncate is synchronous, so this method will be called when the
156    * truncate operation is terminated.
157    * @param ctx the environment to interact with the framework and master
158    * @param tableName the name of the table
159    */
160   void postTruncateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
161       TableName tableName) throws IOException;
162 
163   /**
164    * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a
165    * table.  Called as part of truncate table handler and it is sync
166    * to the truncate RPC call.
167    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
168    * @param ctx the environment to interact with the framework and master
169    * @param tableName the name of the table
170    */
171   void preTruncateTableHandler(
172       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
173       throws IOException;
174 
175   /**
176    * Called after {@link org.apache.hadoop.hbase.master.HMaster} truncates a
177    * table.  Called as part of truncate table handler and it is sync to the
178    * truncate RPC call.
179    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
180    * @param ctx the environment to interact with the framework and master
181    * @param tableName the name of the table
182    */
183   void postTruncateTableHandler(
184       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
185       throws IOException;
186 
187   /**
188    * Called prior to modifying a table's properties.  Called as part of modify
189    * table RPC call.
190    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
191    * @param ctx the environment to interact with the framework and master
192    * @param tableName the name of the table
193    * @param htd the HTableDescriptor
194    */
195   void preModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
196       final TableName tableName, HTableDescriptor htd) throws IOException;
197 
198   /**
199    * Called after the modifyTable operation has been requested.  Called as part
200    * of modify table RPC call.
201    * @param ctx the environment to interact with the framework and master
202    * @param tableName the name of the table
203    * @param htd the HTableDescriptor
204    */
205   void postModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
206       final TableName tableName, HTableDescriptor htd) throws IOException;
207 
208   /**
209    * Called prior to modifying a table's properties.  Called as part of modify
210    * table handler and it is async to the modify table RPC call.
211    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
212    * @param ctx the environment to interact with the framework and master
213    * @param tableName the name of the table
214    * @param htd the HTableDescriptor
215    */
216   void preModifyTableHandler(
217       final ObserverContext<MasterCoprocessorEnvironment> ctx,
218       final TableName tableName, HTableDescriptor htd) throws IOException;
219 
220   /**
221    * Called after to modifying a table's properties.  Called as part of modify
222    * table handler and it is async to the modify table RPC call.
223    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
224    * @param ctx the environment to interact with the framework and master
225    * @param tableName the name of the table
226    * @param htd the HTableDescriptor
227    */
228   void postModifyTableHandler(
229       final ObserverContext<MasterCoprocessorEnvironment> ctx,
230       final TableName tableName, HTableDescriptor htd) throws IOException;
231 
232   /**
233    * Called prior to adding a new column family to the table.  Called as part of
234    * add column RPC call.
235    * @param ctx the environment to interact with the framework and master
236    * @param tableName the name of the table
237    * @param columnFamily the HColumnDescriptor
238    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
239    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
240    *             Use {@link #preAddColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
241    */
242   @Deprecated
243   void preAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
244       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
245 
246   /**
247    * Called prior to adding a new column family to the table.  Called as part of
248    * add column RPC call.
249    *
250    * Implementation note: This replaces the deprecated
251    * {@link #preAddColumn(ObserverContext, TableName, HColumnDescriptor)} method.
252    * Make sure to implement only one of the two as both are called.
253    *
254    * @param ctx the environment to interact with the framework and master
255    * @param tableName the name of the table
256    * @param columnFamily the HColumnDescriptor
257    */
258   void preAddColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
259       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
260 
261   /**
262    * Called after the new column family has been created.  Called as part of
263    * add column RPC call.
264    * @param ctx the environment to interact with the framework and master
265    * @param tableName the name of the table
266    * @param columnFamily the HColumnDescriptor
267    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
268    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
269    *             Use {@link #postAddColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
270    */
271   @Deprecated
272   void postAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
273       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
274 
275   /**
276    * Called after the new column family has been created.  Called as part of
277    * add column RPC call.
278    *
279    * Implementation note: This replaces the deprecated
280    * {@link #postAddColumn(ObserverContext, TableName, HColumnDescriptor)} method.
281    * Make sure to implement only one of the two as both are called.
282    *
283    * @param ctx the environment to interact with the framework and master
284    * @param tableName the name of the table
285    * @param columnFamily the HColumnDescriptor
286    */
287   void postAddColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
288       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
289 
290   /**
291    * Called prior to adding a new column family to the table.  Called as part of
292    * add column handler.
293    * @param ctx the environment to interact with the framework and master
294    * @param tableName the name of the table
295    * @param columnFamily the HColumnDescriptor
296    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
297    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>). Use
298    *             {@link #preAddColumnFamilyHandler(ObserverContext, TableName, HColumnDescriptor)}.
299    */
300   @Deprecated
301   void preAddColumnHandler(
302       final ObserverContext<MasterCoprocessorEnvironment> ctx,
303       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
304 
305   /**
306    * Called prior to adding a new column family to the table.  Called as part of
307    * add column handler.
308    *
309    * Implementation note: This replaces the deprecated
310    * {@link #preAddColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method.
311    * Make sure to implement only one of the two as both are called.
312    *
313    * @param ctx the environment to interact with the framework and master
314    * @param tableName the name of the table
315    * @param columnFamily the HColumnDescriptor
316    */
317   void preAddColumnFamilyHandler(
318       final ObserverContext<MasterCoprocessorEnvironment> ctx,
319       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
320 
321 
322   /**
323    * Called after the new column family has been created.  Called as part of
324    * add column handler.
325    * @param ctx the environment to interact with the framework and master
326    * @param tableName the name of the table
327    * @param columnFamily the HColumnDescriptor
328    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
329    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>). Use
330    *             {@link #postAddColumnFamilyHandler(ObserverContext, TableName, HColumnDescriptor)}.
331    */
332   @Deprecated
333   void postAddColumnHandler(
334       final ObserverContext<MasterCoprocessorEnvironment> ctx,
335       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
336 
337   /**
338    * Called after the new column family has been created.  Called as part of
339    * add column handler.
340    *
341    * Implementation note: This replaces the deprecated
342    * {@link #postAddColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method.
343    * Make sure to implement only one of the two as both are called.
344    *
345    * @param ctx the environment to interact with the framework and master
346    * @param tableName the name of the table
347    * @param columnFamily the HColumnDescriptor
348    */
349   void postAddColumnFamilyHandler(
350       final ObserverContext<MasterCoprocessorEnvironment> ctx,
351       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
352 
353   /**
354    * Called prior to modifying a column family's attributes.  Called as part of
355    * modify column RPC call.
356    * @param ctx the environment to interact with the framework and master
357    * @param tableName the name of the table
358    * @param columnFamily the HColumnDescriptor
359    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
360    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
361    *             Use {@link #preModifyColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
362    */
363   @Deprecated
364   void preModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
365       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
366 
367   /**
368    * Called prior to modifying a column family's attributes.  Called as part of
369    * modify column RPC call.
370    *
371    * Implementation note: This replaces the deprecated
372    * {@link #preModifyColumn(ObserverContext, TableName, HColumnDescriptor)} method.
373    * Make sure to implement only one of the two as both are called.
374    *
375    * @param ctx the environment to interact with the framework and master
376    * @param tableName the name of the table
377    * @param columnFamily the HColumnDescriptor
378    */
379   void preModifyColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
380       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
381 
382   /**
383    * Called after the column family has been updated.  Called as part of modify
384    * column RPC call.
385    * @param ctx the environment to interact with the framework and master
386    * @param tableName the name of the table
387    * @param columnFamily the HColumnDescriptor
388    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
389    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
390    *             Use {@link #postModifyColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
391    */
392   @Deprecated
393   void postModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
394       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
395 
396   /**
397    * Called after the column family has been updated.  Called as part of modify
398    * column RPC call.
399    *
400    * Implementation note: This replaces the deprecated
401    * {@link #postModifyColumn(ObserverContext, TableName, HColumnDescriptor)} method.
402    * Make sure to implement only one of the two as both are called.
403    *
404    * @param ctx the environment to interact with the framework and master
405    * @param tableName the name of the table
406    * @param columnFamily the HColumnDescriptor
407    */
408   void postModifyColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
409       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
410 
411   /**
412    * Called prior to modifying a column family's attributes.  Called as part of
413    * modify column handler.
414    * @param ctx the environment to interact with the framework and master
415    * @param tableName the name of the table
416    * @param columnFamily the HColumnDescriptor
417    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
418    *       (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
419    *       Use {@link #preModifyColumnFamilyHandler(ObserverContext, TableName, HColumnDescriptor)}.
420    */
421   @Deprecated
422   void preModifyColumnHandler(
423       final ObserverContext<MasterCoprocessorEnvironment> ctx,
424       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
425 
426   /**
427    * Called prior to modifying a column family's attributes.  Called as part of
428    * modify column handler.
429    *
430    * Implementation note: This replaces the deprecated
431    * {@link #preModifyColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method.
432    * Make sure to implement only one of the two as both are called.
433    *
434    * @param ctx the environment to interact with the framework and master
435    * @param tableName the name of the table
436    * @param columnFamily the HColumnDescriptor
437    */
438   void preModifyColumnFamilyHandler(
439       final ObserverContext<MasterCoprocessorEnvironment> ctx,
440       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
441 
442   /**
443    * Called after the column family has been updated.  Called as part of modify
444    * column handler.
445    * @param ctx the environment to interact with the framework and master
446    * @param tableName the name of the table
447    * @param columnFamily the HColumnDescriptor
448    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
449    *      (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
450    *      Use {@link #postModifyColumnFamilyHandler(ObserverContext, TableName, HColumnDescriptor)}.
451    */
452   @Deprecated
453   void postModifyColumnHandler(
454       final ObserverContext<MasterCoprocessorEnvironment> ctx,
455       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
456 
457   /**
458    * Called after the column family has been updated.  Called as part of modify
459    * column handler.
460    *
461    * Implementation note: This replaces the deprecated
462    * {@link #postModifyColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method.
463    * Make sure to implement only one of the two as both are called.
464    *
465    * @param ctx the environment to interact with the framework and master
466    * @param tableName the name of the table
467    * @param columnFamily the HColumnDescriptor
468    */
469   void postModifyColumnFamilyHandler(
470       final ObserverContext<MasterCoprocessorEnvironment> ctx,
471       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
472 
473   /**
474    * Called prior to deleting the entire column family.  Called as part of
475    * delete column RPC call.
476    * @param ctx the environment to interact with the framework and master
477    * @param tableName the name of the table
478    * @param columnFamily the column family
479    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
480    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
481    *             Use {@link #preDeleteColumnFamily(ObserverContext, TableName, byte[])}.
482    */
483   @Deprecated
484   void preDeleteColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
485       final TableName tableName, final byte[] columnFamily) throws IOException;
486 
487   /**
488    * Called prior to deleting the entire column family.  Called as part of
489    * delete column RPC call.
490    *
491    * Implementation note: This replaces the deprecated
492    * {@link #preDeleteColumn(ObserverContext, TableName, byte[])} method.
493    * Make sure to implement only one of the two as both are called.
494    *
495    * @param ctx the environment to interact with the framework and master
496    * @param tableName the name of the table
497    * @param columnFamily the column
498    */
499   void preDeleteColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
500       final TableName tableName, final byte[] columnFamily) throws IOException;
501 
502   /**
503    * Called after the column family has been deleted.  Called as part of delete
504    * column RPC call.
505    * @param ctx the environment to interact with the framework and master
506    * @param tableName the name of the table
507    * @param columnFamily the column family
508    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
509    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
510    *             Use {@link #postDeleteColumnFamily(ObserverContext, TableName, byte[])}.
511    */
512   @Deprecated
513   void postDeleteColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
514       final TableName tableName, final byte[] columnFamily) throws IOException;
515 
516   /**
517    * Called after the column family has been deleted.  Called as part of delete
518    * column RPC call.
519    *
520    * Implementation note: This replaces the deprecated
521    * {@link #postDeleteColumn(ObserverContext, TableName, byte[])} method.
522    * Make sure to implement only one of the two as both are called.
523    *
524    * @param ctx the environment to interact with the framework and master
525    * @param tableName the name of the table
526    * @param columnFamily the column family
527    */
528   void postDeleteColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
529       final TableName tableName, final byte[] columnFamily) throws IOException;
530 
531   /**
532    * Called prior to deleting the entire column family.  Called as part of
533    * delete column handler.
534    * @param ctx the environment to interact with the framework and master
535    * @param tableName the name of the table
536    * @param columnFamily the column family
537    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
538    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
539    *             Use {@link #preDeleteColumnFamilyHandler(ObserverContext, TableName, byte[])}.
540    */
541   @Deprecated
542   void preDeleteColumnHandler(
543       final ObserverContext<MasterCoprocessorEnvironment> ctx,
544       final TableName tableName, final byte[] columnFamily) throws IOException;
545 
546   /**
547    * Called prior to deleting the entire column family.  Called as part of
548    * delete column handler.
549    *
550    * Implementation note: This replaces the deprecated
551    * {@link #preDeleteColumnHandler(ObserverContext, TableName, byte[])} method.
552    * Make sure to implement only one of the two as both are called.
553    *
554    * @param ctx the environment to interact with the framework and master
555    * @param tableName the name of the table
556    * @param columnFamily the column family
557    */
558   void preDeleteColumnFamilyHandler(
559       final ObserverContext<MasterCoprocessorEnvironment> ctx,
560       final TableName tableName, final byte[] columnFamily) throws IOException;
561 
562   /**
563    * Called after the column family has been deleted.  Called as part of
564    * delete column handler.
565    * @param ctx the environment to interact with the framework and master
566    * @param tableName the name of the table
567    * @param columnFamily the column family
568    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
569    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
570    *             Use {@link #postDeleteColumnFamilyHandler(ObserverContext, TableName, byte[])}.
571    */
572   @Deprecated
573   void postDeleteColumnHandler(
574       final ObserverContext<MasterCoprocessorEnvironment> ctx,
575       final TableName tableName, final byte[] columnFamily) throws IOException;
576 
577   /**
578    * Called after the column family has been deleted.  Called as part of
579    * delete column handler.
580    *
581    * Implementation note: This replaces the deprecated
582    * {@link #postDeleteColumnHandler(ObserverContext, TableName, byte[])} method.
583    * Make sure to implement only one of the two as both are called.
584    *
585    * @param ctx the environment to interact with the framework and master
586    * @param tableName the name of the table
587    * @param columnFamily the column family
588    */
589   void postDeleteColumnFamilyHandler(
590       final ObserverContext<MasterCoprocessorEnvironment> ctx,
591       final TableName tableName, final byte[] columnFamily) throws IOException;
592 
593   /**
594    * Called prior to enabling a table.  Called as part of enable table RPC call.
595    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
596    * @param ctx the environment to interact with the framework and master
597    * @param tableName the name of the table
598    */
599   void preEnableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
600       final TableName tableName) throws IOException;
601 
602   /**
603    * Called after the enableTable operation has been requested.  Called as part
604    * of enable table RPC call.
605    * @param ctx the environment to interact with the framework and master
606    * @param tableName the name of the table
607    */
608   void postEnableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
609       final TableName tableName) throws IOException;
610 
611   /**
612    * Called prior to enabling a table.  Called as part of enable table handler
613    * and it is async to the enable table RPC call.
614    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
615    * @param ctx the environment to interact with the framework and master
616    * @param tableName the name of the table
617    */
618   void preEnableTableHandler(
619       final ObserverContext<MasterCoprocessorEnvironment> ctx,
620       final TableName tableName) throws IOException;
621 
622   /**
623    * Called after the enableTable operation has been requested.  Called as part
624    * of enable table handler and it is async to the enable table RPC call.
625    * @param ctx the environment to interact with the framework and master
626    * @param tableName the name of the table
627    */
628   void postEnableTableHandler(
629       final ObserverContext<MasterCoprocessorEnvironment> ctx,
630       final TableName tableName) throws IOException;
631 
632   /**
633    * Called prior to disabling a table.  Called as part of disable table RPC
634    * call.
635    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
636    * @param ctx the environment to interact with the framework and master
637    * @param tableName the name of the table
638    */
639   void preDisableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
640       final TableName tableName) throws IOException;
641 
642   /**
643    * Called after the disableTable operation has been requested.  Called as part
644    * of disable table RPC call.
645    * @param ctx the environment to interact with the framework and master
646    * @param tableName the name of the table
647    */
648   void postDisableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
649       final TableName tableName) throws IOException;
650 
651   /**
652    * Called prior to disabling a table.  Called as part of disable table handler
653    * and it is asyn to the disable table RPC call.
654    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
655    * @param ctx the environment to interact with the framework and master
656    * @param tableName the name of the table
657    */
658   void preDisableTableHandler(
659       final ObserverContext<MasterCoprocessorEnvironment> ctx,
660       final TableName tableName) throws IOException;
661 
662   /**
663    * Called after the disableTable operation has been requested.  Called as part
664    * of disable table handler and it is asyn to the disable table RPC call.
665    * @param ctx the environment to interact with the framework and master
666    * @param tableName the name of the table
667    */
668   void postDisableTableHandler(
669       final ObserverContext<MasterCoprocessorEnvironment> ctx,
670       final TableName tableName) throws IOException;
671 
672   /**
673    * Called before a abortProcedure request has been processed.
674    * @param ctx the environment to interact with the framework and master
675    * @throws IOException
676    */
677   public void preAbortProcedure(
678       ObserverContext<MasterCoprocessorEnvironment> ctx,
679       final ProcedureExecutor<MasterProcedureEnv> procEnv,
680       final long procId) throws IOException;
681 
682   /**
683    * Called after a abortProcedure request has been processed.
684    * @param ctx the environment to interact with the framework and master
685    */
686   public void postAbortProcedure(ObserverContext<MasterCoprocessorEnvironment> ctx)
687       throws IOException;
688 
689   /**
690    * Called before a listProcedures request has been processed.
691    * @param ctx the environment to interact with the framework and master
692    * @throws IOException
693    */
694   void preListProcedures(ObserverContext<MasterCoprocessorEnvironment> ctx)
695       throws IOException;
696 
697   /**
698    * Called after a listProcedures request has been processed.
699    * @param ctx the environment to interact with the framework and master
700    * @param procInfoList the list of procedures about to be returned
701    */
702   void postListProcedures(
703       ObserverContext<MasterCoprocessorEnvironment> ctx,
704       List<ProcedureInfo> procInfoList) throws IOException;
705 
706   /**
707    * Called prior to moving a given region from one region server to another.
708    * @param ctx the environment to interact with the framework and master
709    * @param region the HRegionInfo
710    * @param srcServer the source ServerName
711    * @param destServer the destination ServerName
712    */
713   void preMove(final ObserverContext<MasterCoprocessorEnvironment> ctx,
714       final HRegionInfo region, final ServerName srcServer,
715       final ServerName destServer)
716     throws IOException;
717 
718   /**
719    * Called after the region move has been requested.
720    * @param ctx the environment to interact with the framework and master
721    * @param region the HRegionInfo
722    * @param srcServer the source ServerName
723    * @param destServer the destination ServerName
724    */
725   void postMove(final ObserverContext<MasterCoprocessorEnvironment> ctx,
726       final HRegionInfo region, final ServerName srcServer,
727       final ServerName destServer)
728     throws IOException;
729 
730   /**
731    * Called prior to assigning a specific region.
732    * @param ctx the environment to interact with the framework and master
733    * @param regionInfo the regionInfo of the region
734    */
735   void preAssign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
736       final HRegionInfo regionInfo) throws IOException;
737 
738   /**
739    * Called after the region assignment has been requested.
740    * @param ctx the environment to interact with the framework and master
741    * @param regionInfo the regionInfo of the region
742    */
743   void postAssign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
744       final HRegionInfo regionInfo) throws IOException;
745 
746   /**
747    * Called prior to unassigning a given region.
748    * @param ctx the environment to interact with the framework and master
749    * @param regionInfo
750    * @param force whether to force unassignment or not
751    */
752   void preUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
753       final HRegionInfo regionInfo, final boolean force) throws IOException;
754 
755   /**
756    * Called after the region unassignment has been requested.
757    * @param ctx the environment to interact with the framework and master
758    * @param regionInfo
759    * @param force whether to force unassignment or not
760    */
761   void postUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
762       final HRegionInfo regionInfo, final boolean force) throws IOException;
763 
764   /**
765    * Called prior to marking a given region as offline. <code>ctx.bypass()</code> will not have any
766    * impact on this hook.
767    * @param ctx the environment to interact with the framework and master
768    * @param regionInfo
769    */
770   void preRegionOffline(final ObserverContext<MasterCoprocessorEnvironment> ctx,
771       final HRegionInfo regionInfo) throws IOException;
772 
773   /**
774    * Called after the region has been marked offline.
775    * @param ctx the environment to interact with the framework and master
776    * @param regionInfo
777    */
778   void postRegionOffline(final ObserverContext<MasterCoprocessorEnvironment> ctx,
779       final HRegionInfo regionInfo) throws IOException;
780 
781   /**
782    * Called prior to requesting rebalancing of the cluster regions, though after
783    * the initial checks for regions in transition and the balance switch flag.
784    * @param ctx the environment to interact with the framework and master
785    */
786   void preBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx)
787       throws IOException;
788 
789   /**
790    * Called after the balancing plan has been submitted.
791    * @param ctx the environment to interact with the framework and master
792    * @param plans the RegionPlans which master has executed. RegionPlan serves as hint
793    * as for the final destination for the underlying region but may not represent the
794    * final state of assignment
795    */
796   void postBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx, List<RegionPlan> plans)
797       throws IOException;
798 
799   /**
800    * Called prior to modifying the flag used to enable/disable region balancing.
801    * @param ctx the coprocessor instance's environment
802    * @param newValue the new flag value submitted in the call
803    */
804   boolean preBalanceSwitch(final ObserverContext<MasterCoprocessorEnvironment> ctx,
805       final boolean newValue) throws IOException;
806 
807   /**
808    * Called after the flag to enable/disable balancing has changed.
809    * @param ctx the coprocessor instance's environment
810    * @param oldValue the previously set balanceSwitch value
811    * @param newValue the newly set balanceSwitch value
812    */
813   void postBalanceSwitch(final ObserverContext<MasterCoprocessorEnvironment> ctx,
814       final boolean oldValue, final boolean newValue) throws IOException;
815 
816   /**
817    * Called prior to shutting down the full HBase cluster, including this
818    * {@link org.apache.hadoop.hbase.master.HMaster} process.
819    */
820   void preShutdown(final ObserverContext<MasterCoprocessorEnvironment> ctx)
821       throws IOException;
822 
823 
824   /**
825    * Called immediately prior to stopping this
826    * {@link org.apache.hadoop.hbase.master.HMaster} process.
827    */
828   void preStopMaster(final ObserverContext<MasterCoprocessorEnvironment> ctx)
829       throws IOException;
830 
831   /**
832    * Called immediately after an active master instance has completed
833    * initialization.  Will not be called on standby master instances unless
834    * they take over the active role.
835    */
836   void postStartMaster(final ObserverContext<MasterCoprocessorEnvironment> ctx)
837       throws IOException;
838 
839   /**
840    * Call before the master initialization is set to true.
841    * {@link org.apache.hadoop.hbase.master.HMaster} process.
842    */
843   void preMasterInitialization(final ObserverContext<MasterCoprocessorEnvironment> ctx)
844       throws IOException;
845 
846   /**
847    * Called before a new snapshot is taken.
848    * Called as part of snapshot RPC call.
849    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
850    * @param ctx the environment to interact with the framework and master
851    * @param snapshot the SnapshotDescriptor for the snapshot
852    * @param hTableDescriptor the hTableDescriptor of the table to snapshot
853    * @throws IOException
854    */
855   void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
856       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
857       throws IOException;
858 
859   /**
860    * Called after the snapshot operation has been requested.
861    * Called as part of snapshot RPC call.
862    * @param ctx the environment to interact with the framework and master
863    * @param snapshot the SnapshotDescriptor for the snapshot
864    * @param hTableDescriptor the hTableDescriptor of the table to snapshot
865    * @throws IOException
866    */
867   void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
868       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
869       throws IOException;
870 
871   /**
872    * Called before listSnapshots request has been processed.
873    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
874    * @param ctx the environment to interact with the framework and master
875    * @param snapshot the SnapshotDescriptor of the snapshot to list
876    * @throws IOException
877    */
878   void preListSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
879       final SnapshotDescription snapshot) throws IOException;
880 
881   /**
882    * Called after listSnapshots request has been processed.
883    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
884    * @param ctx the environment to interact with the framework and master
885    * @param snapshot the SnapshotDescriptor of the snapshot to list
886    * @throws IOException
887    */
888   void postListSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
889       final SnapshotDescription snapshot) throws IOException;
890 
891   /**
892    * Called before a snapshot is cloned.
893    * Called as part of restoreSnapshot RPC call.
894    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
895    * @param ctx the environment to interact with the framework and master
896    * @param snapshot the SnapshotDescriptor for the snapshot
897    * @param hTableDescriptor the hTableDescriptor of the table to create
898    * @throws IOException
899    */
900   void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
901       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
902       throws IOException;
903 
904   /**
905    * Called after a snapshot clone operation has been requested.
906    * Called as part of restoreSnapshot RPC call.
907    * @param ctx the environment to interact with the framework and master
908    * @param snapshot the SnapshotDescriptor for the snapshot
909    * @param hTableDescriptor the hTableDescriptor of the table to create
910    * @throws IOException
911    */
912   void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
913       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
914       throws IOException;
915 
916   /**
917    * Called before a snapshot is restored.
918    * Called as part of restoreSnapshot RPC call.
919    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
920    * @param ctx the environment to interact with the framework and master
921    * @param snapshot the SnapshotDescriptor for the snapshot
922    * @param hTableDescriptor the hTableDescriptor of the table to restore
923    * @throws IOException
924    */
925   void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
926       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
927       throws IOException;
928 
929   /**
930    * Called after a snapshot restore operation has been requested.
931    * Called as part of restoreSnapshot RPC call.
932    * @param ctx the environment to interact with the framework and master
933    * @param snapshot the SnapshotDescriptor for the snapshot
934    * @param hTableDescriptor the hTableDescriptor of the table to restore
935    * @throws IOException
936    */
937   void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
938       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
939       throws IOException;
940 
941   /**
942    * Called before a snapshot is deleted.
943    * Called as part of deleteSnapshot RPC call.
944    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
945    * @param ctx the environment to interact with the framework and master
946    * @param snapshot the SnapshotDescriptor of the snapshot to delete
947    * @throws IOException
948    */
949   void preDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
950       final SnapshotDescription snapshot) throws IOException;
951 
952   /**
953    * Called after the delete snapshot operation has been requested.
954    * Called as part of deleteSnapshot RPC call.
955    * @param ctx the environment to interact with the framework and master
956    * @param snapshot the SnapshotDescriptor of the snapshot to delete
957    * @throws IOException
958    */
959   void postDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
960       final SnapshotDescription snapshot) throws IOException;
961 
962   /**
963    * Called before a getTableDescriptors request has been processed.
964    * @param ctx the environment to interact with the framework and master
965    * @param tableNamesList the list of table names, or null if querying for all
966    * @param descriptors an empty list, can be filled with what to return if bypassing
967    * @param regex regular expression used for filtering the table names
968    * @throws IOException
969    */
970   void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
971       List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
972       String regex) throws IOException;
973 
974   /**
975    * Called after a getTableDescriptors request has been processed.
976    * @param ctx the environment to interact with the framework and master
977    * @param tableNamesList the list of table names, or null if querying for all
978    * @param descriptors the list of descriptors about to be returned
979    * @param regex regular expression used for filtering the table names
980    * @throws IOException
981    */
982   void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
983       List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
984       String regex) throws IOException;
985 
986   /**
987    * Called before a getTableNames request has been processed.
988    * @param ctx the environment to interact with the framework and master
989    * @param descriptors an empty list, can be filled with what to return if bypassing
990    * @param regex regular expression used for filtering the table names
991    * @throws IOException
992    */
993   void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
994       List<HTableDescriptor> descriptors, String regex) throws IOException;
995 
996   /**
997    * Called after a getTableNames request has been processed.
998    * @param ctx the environment to interact with the framework and master
999    * @param descriptors the list of descriptors about to be returned
1000    * @param regex regular expression used for filtering the table names
1001    * @throws IOException
1002    */
1003   void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
1004       List<HTableDescriptor> descriptors, String regex) throws IOException;
1005 
1006 
1007 
1008   /**
1009    * Called before a new namespace is created by
1010    * {@link org.apache.hadoop.hbase.master.HMaster}.
1011    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1012    * @param ctx the environment to interact with the framework and master
1013    * @param ns the NamespaceDescriptor for the table
1014    * @throws IOException
1015    */
1016   void preCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1017       NamespaceDescriptor ns) throws IOException;
1018   /**
1019    * Called after the createNamespace operation has been requested.
1020    * @param ctx the environment to interact with the framework and master
1021    * @param ns the NamespaceDescriptor for the table
1022    * @throws IOException
1023    */
1024   void postCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1025        NamespaceDescriptor ns) throws IOException;
1026 
1027   /**
1028    * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
1029    * namespace
1030    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1031    * @param ctx the environment to interact with the framework and master
1032    * @param namespace the name of the namespace
1033    */
1034   void preDeleteNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1035       String namespace) throws IOException;
1036 
1037   /**
1038    * Called after the deleteNamespace operation has been requested.
1039    * @param ctx the environment to interact with the framework and master
1040    * @param namespace the name of the namespace
1041    */
1042   void postDeleteNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1043       String namespace) throws IOException;
1044 
1045   /**
1046    * Called prior to modifying a namespace's properties.
1047    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1048    * @param ctx the environment to interact with the framework and master
1049    * @param ns the NamespaceDescriptor
1050    */
1051   void preModifyNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1052       NamespaceDescriptor ns) throws IOException;
1053 
1054   /**
1055    * Called after the modifyNamespace operation has been requested.
1056    * @param ctx the environment to interact with the framework and master
1057    * @param ns the NamespaceDescriptor
1058    */
1059   void postModifyNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1060       NamespaceDescriptor ns) throws IOException;
1061 
1062   /**
1063    * Called before a getNamespaceDescriptor request has been processed.
1064    * @param ctx the environment to interact with the framework and master
1065    * @param namespace the name of the namespace
1066    * @throws IOException
1067    */
1068   void preGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
1069       String namespace) throws IOException;
1070 
1071   /**
1072    * Called after a getNamespaceDescriptor request has been processed.
1073    * @param ctx the environment to interact with the framework and master
1074    * @param ns the NamespaceDescriptor
1075    * @throws IOException
1076    */
1077   void postGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
1078       NamespaceDescriptor ns) throws IOException;
1079 
1080   /**
1081    * Called before a listNamespaceDescriptors request has been processed.
1082    * @param ctx the environment to interact with the framework and master
1083    * @param descriptors an empty list, can be filled with what to return if bypassing
1084    * @throws IOException
1085    */
1086   void preListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
1087       List<NamespaceDescriptor> descriptors) throws IOException;
1088 
1089   /**
1090    * Called after a listNamespaceDescriptors request has been processed.
1091    * @param ctx the environment to interact with the framework and master
1092    * @param descriptors the list of descriptors about to be returned
1093    * @throws IOException
1094    */
1095   void postListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
1096       List<NamespaceDescriptor> descriptors) throws IOException;
1097 
1098 
1099   /**
1100    * Called before the table memstore is flushed to disk.
1101    * @param ctx the environment to interact with the framework and master
1102    * @param tableName the name of the table
1103    * @throws IOException
1104    */
1105   void preTableFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1106       final TableName tableName) throws IOException;
1107 
1108   /**
1109    * Called after the table memstore is flushed to disk.
1110    * @param ctx the environment to interact with the framework and master
1111    * @param tableName the name of the table
1112    * @throws IOException
1113    */
1114   void postTableFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1115       final TableName tableName) throws IOException;
1116 
1117   /**
1118    * Called before the quota for the user is stored.
1119    * @param ctx the environment to interact with the framework and master
1120    * @param userName the name of user
1121    * @param quotas the quota settings
1122    * @throws IOException
1123    */
1124   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1125       final String userName, final Quotas quotas) throws IOException;
1126 
1127   /**
1128    * Called after the quota for the user is stored.
1129    * @param ctx the environment to interact with the framework and master
1130    * @param userName the name of user
1131    * @param quotas the quota settings
1132    * @throws IOException
1133    */
1134   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1135       final String userName, final Quotas quotas) throws IOException;
1136 
1137   /**
1138    * Called before the quota for the user on the specified table is stored.
1139    * @param ctx the environment to interact with the framework and master
1140    * @param userName the name of user
1141    * @param tableName the name of the table
1142    * @param quotas the quota settings
1143    * @throws IOException
1144    */
1145   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1146       final String userName, final TableName tableName, final Quotas quotas) throws IOException;
1147 
1148   /**
1149    * Called after the quota for the user on the specified table is stored.
1150    * @param ctx the environment to interact with the framework and master
1151    * @param userName the name of user
1152    * @param tableName the name of the table
1153    * @param quotas the quota settings
1154    * @throws IOException
1155    */
1156   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1157       final String userName, final TableName tableName, final Quotas quotas) throws IOException;
1158 
1159   /**
1160    * Called before the quota for the user on the specified namespace is stored.
1161    * @param ctx the environment to interact with the framework and master
1162    * @param userName the name of user
1163    * @param namespace the name of the namespace
1164    * @param quotas the quota settings
1165    * @throws IOException
1166    */
1167   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1168       final String userName, final String namespace, final Quotas quotas) throws IOException;
1169 
1170   /**
1171    * Called after the quota for the user on the specified namespace is stored.
1172    * @param ctx the environment to interact with the framework and master
1173    * @param userName the name of user
1174    * @param namespace the name of the namespace
1175    * @param quotas the quota settings
1176    * @throws IOException
1177    */
1178   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1179       final String userName, final String namespace, final Quotas quotas) throws IOException;
1180 
1181   /**
1182    * Called before the quota for the table is stored.
1183    * @param ctx the environment to interact with the framework and master
1184    * @param tableName the name of the table
1185    * @param quotas the quota settings
1186    * @throws IOException
1187    */
1188   void preSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1189       final TableName tableName, final Quotas quotas) throws IOException;
1190 
1191   /**
1192    * Called after the quota for the table is stored.
1193    * @param ctx the environment to interact with the framework and master
1194    * @param tableName the name of the table
1195    * @param quotas the quota settings
1196    * @throws IOException
1197    */
1198   void postSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1199       final TableName tableName, final Quotas quotas) throws IOException;
1200 
1201   /**
1202    * Called before the quota for the namespace is stored.
1203    * @param ctx the environment to interact with the framework and master
1204    * @param namespace the name of the namespace
1205    * @param quotas the quota settings
1206    * @throws IOException
1207    */
1208   void preSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1209       final String namespace, final Quotas quotas) throws IOException;
1210 
1211   /**
1212    * Called after the quota for the namespace is stored.
1213    * @param ctx the environment to interact with the framework and master
1214    * @param namespace the name of the namespace
1215    * @param quotas the quota settings
1216    * @throws IOException
1217    */
1218   void postSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1219       final String namespace, final Quotas quotas) throws IOException;
1220 
1221   /**
1222    * Called before dispatching region merge request. 
1223    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1224    * @param ctx coprocessor environment
1225    * @param regionA first region to be merged
1226    * @param regionB second region to be merged
1227    * @throws IOException if an error occurred on the coprocessor
1228    */
1229   public void preDispatchMerge(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1230       HRegionInfo regionA, HRegionInfo regionB) throws IOException;
1231   
1232   /**
1233    * called after dispatching the region merge request.
1234    * @param c coprocessor environment
1235    * @param regionA first region to be merged
1236    * @param regionB second region to be merged
1237    * @throws IOException if an error occurred on the coprocessor
1238    */
1239   void postDispatchMerge(final ObserverContext<MasterCoprocessorEnvironment> c,
1240       final HRegionInfo regionA, final HRegionInfo regionB) throws IOException;
1241 }