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 com.google.common.net.HostAndPort;
23  
24  import java.io.IOException;
25  import java.util.List;
26  import java.util.Set;
27  
28  import org.apache.hadoop.hbase.Coprocessor;
29  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
30  import org.apache.hadoop.hbase.HColumnDescriptor;
31  import org.apache.hadoop.hbase.HRegionInfo;
32  import org.apache.hadoop.hbase.HTableDescriptor;
33  import org.apache.hadoop.hbase.NamespaceDescriptor;
34  import org.apache.hadoop.hbase.ProcedureInfo;
35  import org.apache.hadoop.hbase.ServerName;
36  import org.apache.hadoop.hbase.TableName;
37  import org.apache.hadoop.hbase.classification.InterfaceAudience;
38  import org.apache.hadoop.hbase.classification.InterfaceStability;
39  import org.apache.hadoop.hbase.client.MasterSwitchType;
40  import org.apache.hadoop.hbase.master.RegionPlan;
41  import org.apache.hadoop.hbase.master.procedure.MasterProcedureEnv;
42  import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
43  import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
44  import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Quotas;
45  
46  /**
47   * Defines coprocessor hooks for interacting with operations on the
48   * {@link org.apache.hadoop.hbase.master.HMaster} process.
49   */
50  @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
51  @InterfaceStability.Evolving
52  public interface MasterObserver extends Coprocessor {
53  
54    /**
55     * Called before a new table is created by
56     * {@link org.apache.hadoop.hbase.master.HMaster}.  Called as part of create
57     * table RPC call.
58     * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
59     * @param ctx the environment to interact with the framework and master
60     * @param desc the HTableDescriptor for the table
61     * @param regions the initial regions created for the table
62     * @throws IOException if something went wrong
63     */
64    void preCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
65        HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
66  
67    /**
68     * Called after the createTable operation has been requested.  Called as part
69     * of create table RPC call.
70     * @param ctx the environment to interact with the framework and master
71     * @param desc the HTableDescriptor for the table
72     * @param regions the initial regions created for the table
73     * @throws IOException if something went wrong
74     */
75    void postCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
76        HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
77
78    /**
79     * Called before a new table is created by
80     * {@link org.apache.hadoop.hbase.master.HMaster}.  Called as part of create
81     * table handler and it is async to the create RPC call.
82     * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
83     * @param ctx the environment to interact with the framework and master
84     * @param desc the HTableDescriptor for the table
85     * @param regions the initial regions created for the table
86     * @throws IOException if something went wrong
87     * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
88     *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
89     *     Use {@link #preCreateTableAction(ObserverContext, HTableDescriptor, HRegionInfo[])}.
90     */
91    @Deprecated
92    void preCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
93        ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
94
95    /**
96     * Called after the createTable operation has been requested.  Called as part
97     * of create table RPC call.  Called as part of create table handler and
98     * it is async to the create RPC call.
99     * @param ctx the environment to interact with the framework and master
100    * @param desc the HTableDescriptor for the table
101    * @param regions the initial regions created for the table
102    * @throws IOException if something went wrong
103    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
104    *   (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
105    *   Use {@link #postCompletedCreateTableAction(ObserverContext, HTableDescriptor, HRegionInfo[])}
106    */
107   @Deprecated
108   void postCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
109   ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
110
111   /**
112    * Called before a new table is created by
113    * {@link org.apache.hadoop.hbase.master.HMaster}.  Called as part of create
114    * table procedure and it is async to the create RPC call.
115    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
116    *
117    * Implementation note: This replaces the deprecated
118    * {@link #preCreateTableHandler(ObserverContext, HTableDescriptor, HRegionInfo[])} method.
119    * Make sure to implement only one of the two as both are called.
120    *
121    * @param ctx the environment to interact with the framework and master
122    * @param desc the HTableDescriptor for the table
123    * @param regions the initial regions created for the table
124    * @throws IOException if something went wrong
125    */
126   void preCreateTableAction(
127       final ObserverContext<MasterCoprocessorEnvironment> ctx,
128       final HTableDescriptor desc,
129       final HRegionInfo[] regions) throws IOException;
130
131   /**
132    * Called after the createTable operation has been requested.  Called as part
133    * of create table RPC call.  Called as part of create table procedure and
134    * it is async to the create RPC call.
135    *
136    * Implementation note: This replaces the deprecated
137    * {@link #postCreateTableHandler(ObserverContext, HTableDescriptor, HRegionInfo[])} method.
138    * Make sure to implement only one of the two as both are called.
139    *
140    * @param ctx the environment to interact with the framework and master
141    * @param desc the HTableDescriptor for the table
142    * @param regions the initial regions created for the table
143    * @throws IOException if something went wrong
144    */
145   void postCompletedCreateTableAction(
146       final ObserverContext<MasterCoprocessorEnvironment> ctx,
147       final HTableDescriptor desc,
148       final HRegionInfo[] regions) throws IOException;
149
150   /**
151    * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
152    * table.  Called as part of delete table RPC call.
153    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
154    * @param ctx the environment to interact with the framework and master
155    * @param tableName the name of the table
156    * @throws IOException if something went wrong
157    */
158   void preDeleteTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
159       TableName tableName) throws IOException;
160
161   /**
162    * Called after the deleteTable operation has been requested.  Called as part
163    * of delete table RPC call.
164    * @param ctx the environment to interact with the framework and master
165    * @param tableName the name of the table
166    * @throws IOException if something went wrong
167    */
168   void postDeleteTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
169       TableName tableName) throws IOException;
170
171   /**
172    * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
173    * table.  Called as part of delete table handler and
174    * it is async to the delete RPC call.
175    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
176    * @param ctx the environment to interact with the framework and master
177    * @param tableName the name of the table
178    * @throws IOException if something went wrong
179    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
180    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
181    *     Use {@link #preDeleteTableAction(ObserverContext, TableName)}.
182    */
183   @Deprecated
184   void preDeleteTableHandler(
185       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
186       throws IOException;
187
188   /**
189    * Called after {@link org.apache.hadoop.hbase.master.HMaster} deletes a
190    * table.  Called as part of delete table handler and it is async to the
191    * delete RPC call.
192    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
193    * @param ctx the environment to interact with the framework and master
194    * @param tableName the name of the table
195    * @throws IOException if something went wrong
196    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
197    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
198    *     Use {@link #postCompletedDeleteTableAction(ObserverContext, TableName)}.
199    */
200   @Deprecated
201   void postDeleteTableHandler(
202       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
203       throws IOException;
204
205   /**
206    * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
207    * table.  Called as part of delete table procedure and
208    * it is async to the delete RPC call.
209    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
210    *
211    * Implementation note: This replaces the deprecated
212    * {@link #preDeleteTableHandler(ObserverContext, TableName)} method.
213    * Make sure to implement only one of the two as both are called.
214    *
215    * @param ctx the environment to interact with the framework and master
216    * @param tableName the name of the table
217    * @throws IOException if something went wrong
218    */
219   void preDeleteTableAction(
220       final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
221       throws IOException;
222
223   /**
224    * Called after {@link org.apache.hadoop.hbase.master.HMaster} deletes a
225    * table.  Called as part of delete table procedure and it is async to the
226    * delete RPC call.
227    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
228    *
229    * Implementation note: This replaces the deprecated
230    * {@link #postDeleteTableHandler(ObserverContext, TableName)} method.
231    * Make sure to implement only one of the two as both are called.
232    *
233    * @param ctx the environment to interact with the framework and master
234    * @param tableName the name of the table
235    * @throws IOException if something went wrong
236    */
237   void postCompletedDeleteTableAction(
238       final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
239       throws IOException;
240
241   /**
242    * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a
243    * table.  Called as part of truncate table RPC call.
244    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
245    * @param ctx the environment to interact with the framework and master
246    * @param tableName the name of the table
247    * @throws IOException if something went wrong
248    */
249   void preTruncateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
250       TableName tableName) throws IOException;
251
252   /**
253    * Called after the truncateTable operation has been requested.  Called as part
254    * of truncate table RPC call.
255    * The truncate is synchronous, so this method will be called when the
256    * truncate operation is terminated.
257    * @param ctx the environment to interact with the framework and master
258    * @param tableName the name of the table
259    * @throws IOException if something went wrong
260    */
261   void postTruncateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
262       TableName tableName) throws IOException;
263
264   /**
265    * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a
266    * table.  Called as part of truncate table handler and it is sync
267    * to the truncate RPC call.
268    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
269    * @param ctx the environment to interact with the framework and master
270    * @param tableName the name of the table
271    * @throws IOException if something went wrong
272    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
273    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
274    *     Use {@link #preTruncateTableAction(ObserverContext, TableName)}.
275    */
276   @Deprecated
277   void preTruncateTableHandler(
278       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
279       throws IOException;
280
281   /**
282    * Called after {@link org.apache.hadoop.hbase.master.HMaster} truncates a
283    * table.  Called as part of truncate table handler and it is sync to the
284    * truncate RPC call.
285    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
286    * @param ctx the environment to interact with the framework and master
287    * @param tableName the name of the table
288    * @throws IOException if something went wrong
289    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
290    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
291    *     Use {@link #postCompletedTruncateTableAction(ObserverContext, TableName)}.
292    */
293   @Deprecated
294   void postTruncateTableHandler(
295       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
296       throws IOException;
297
298   /**
299    * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a
300    * table.  Called as part of truncate table procedure and it is async
301    * to the truncate RPC call.
302    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
303    *
304    * Implementation note: This replaces the deprecated
305    * {@link #preTruncateTableHandler(ObserverContext, TableName)} method.
306    * Make sure to implement only one of the two as both are called.
307    *
308    * @param ctx the environment to interact with the framework and master
309    * @param tableName the name of the table
310    * @throws IOException if something went wrong
311    */
312   void preTruncateTableAction(
313       final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
314       throws IOException;
315
316   /**
317    * Called after {@link org.apache.hadoop.hbase.master.HMaster} truncates a
318    * table.  Called as part of truncate table procedure and it is async to the
319    * truncate RPC call.
320    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
321    *
322    * Implementation note: This replaces the deprecated
323    * {@link #postTruncateTableHandler(ObserverContext, TableName)} method.
324    * Make sure to implement only one of the two as both are called.
325    *
326    * @param ctx the environment to interact with the framework and master
327    * @param tableName the name of the table
328    * @throws IOException if something went wrong
329    */
330   void postCompletedTruncateTableAction(
331       final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
332       throws IOException;
333
334   /**
335    * Called prior to modifying a table's properties.  Called as part of modify
336    * table RPC call.
337    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
338    * @param ctx the environment to interact with the framework and master
339    * @param tableName the name of the table
340    * @param htd the HTableDescriptor
341    * @throws IOException if something went wrong
342    */
343   void preModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
344       final TableName tableName, HTableDescriptor htd) throws IOException;
345
346   /**
347    * Called after the modifyTable operation has been requested.  Called as part
348    * of modify table RPC call.
349    * @param ctx the environment to interact with the framework and master
350    * @param tableName the name of the table
351    * @param htd the HTableDescriptor
352    * @throws IOException if something went wrong
353    */
354   void postModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
355       final TableName tableName, HTableDescriptor htd) throws IOException;
356 
357   /**
358    * Called prior to modifying a table's properties.  Called as part of modify
359    * table handler and it is async to the modify table RPC call.
360    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
361    * @param ctx the environment to interact with the framework and master
362    * @param tableName the name of the table
363    * @param htd the HTableDescriptor
364    * @throws IOException if something went wrong
365    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
366    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
367    *     Use {@link #preModifyTableAction(ObserverContext, TableName, HTableDescriptor)}.
368    */
369   @Deprecated
370   void preModifyTableHandler(
371       final ObserverContext<MasterCoprocessorEnvironment> ctx,
372       final TableName tableName, HTableDescriptor htd) throws IOException;
373
374   /**
375    * Called after to modifying a table's properties.  Called as part of modify
376    * table handler and it is async to the modify table RPC call.
377    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
378    * @param ctx the environment to interact with the framework and master
379    * @param tableName the name of the table
380    * @param htd the HTableDescriptor
381    * @throws IOException if something went wrong
382    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
383    *     (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
384    *     Use {@link #postCompletedModifyTableAction(ObserverContext, TableName, HTableDescriptor)}.
385    */
386   @Deprecated
387   void postModifyTableHandler(
388       final ObserverContext<MasterCoprocessorEnvironment> ctx,
389       final TableName tableName, HTableDescriptor htd) throws IOException;
390
391   /**
392    * Called prior to modifying a table's properties.  Called as part of modify
393    * table procedure and it is async to the modify table RPC call.
394    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
395    *
396    * Implementation note: This replaces the deprecated
397    * {@link #preModifyTableHandler(ObserverContext, TableName, HTableDescriptor)} method.
398    * Make sure to implement only one of the two as both are called.
399    *
400    * @param ctx the environment to interact with the framework and master
401    * @param tableName the name of the table
402    * @param htd the HTableDescriptor
403    * @throws IOException if something went wrong
404    */
405   void preModifyTableAction(
406       final ObserverContext<MasterCoprocessorEnvironment> ctx,
407       final TableName tableName,
408       final HTableDescriptor htd) throws IOException;
409
410   /**
411    * Called after to modifying a table's properties.  Called as part of modify
412    * table procedure and it is async to the modify table RPC call.
413    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
414    *
415    * Implementation note: This replaces the deprecated
416    * {@link #postModifyTableHandler(ObserverContext, TableName, HTableDescriptor)} method.
417    * Make sure to implement only one of the two as both are called.
418    *
419    * @param ctx the environment to interact with the framework and master
420    * @param tableName the name of the table
421    * @param htd the HTableDescriptor
422    * @throws IOException if something went wrong
423    */
424   void postCompletedModifyTableAction(
425       final ObserverContext<MasterCoprocessorEnvironment> ctx,
426       final TableName tableName,
427       final HTableDescriptor htd) throws IOException;
428
429   /**
430    * Called prior to adding a new column family to the table.  Called as part of
431    * add column RPC call.
432    * @param ctx the environment to interact with the framework and master
433    * @param tableName the name of the table
434    * @param columnFamily the HColumnDescriptor
435    * @throws IOException if something went wrong
436    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
437    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
438    *             Use {@link #preAddColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
439    */
440   @Deprecated
441   void preAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
442       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
443
444   /**
445    * Called prior to adding a new column family to the table.  Called as part of
446    * add column RPC call.
447    *
448    * Implementation note: This replaces the deprecated
449    * {@link #preAddColumn(ObserverContext, TableName, HColumnDescriptor)} method.
450    * Make sure to implement only one of the two as both are called.
451    *
452    * @param ctx the environment to interact with the framework and master
453    * @param tableName the name of the table
454    * @param columnFamily the HColumnDescriptor
455    * @throws IOException if something went wrong
456    */
457   void preAddColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
458       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
459
460   /**
461    * Called after the new column family has been created.  Called as part of
462    * add column RPC call.
463    * @param ctx the environment to interact with the framework and master
464    * @param tableName the name of the table
465    * @param columnFamily the HColumnDescriptor
466    * @throws IOException if something went wrong
467    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
468    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
469    *             Use {@link #postAddColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
470    */
471   @Deprecated
472   void postAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
473       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
474
475   /**
476    * Called after the new column family has been created.  Called as part of
477    * add column RPC call.
478    *
479    * Implementation note: This replaces the deprecated
480    * {@link #postAddColumn(ObserverContext, TableName, HColumnDescriptor)} method.
481    * Make sure to implement only one of the two as both are called.
482    *
483    * @param ctx the environment to interact with the framework and master
484    * @param tableName the name of the table
485    * @param columnFamily the HColumnDescriptor
486    * @throws IOException if something went wrong
487    */
488   void postAddColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
489       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
490 
491   /**
492    * Called prior to adding a new column family to the table.  Called as part of
493    * add column handler.
494    * @param ctx the environment to interact with the framework and master
495    * @param tableName the name of the table
496    * @param columnFamily the HColumnDescriptor
497    * @throws IOException if something went wrong
498    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
499    *          (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>). Use
500    *          {@link #preAddColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}.
501    */
502   @Deprecated
503   void preAddColumnHandler(
504       final ObserverContext<MasterCoprocessorEnvironment> ctx,
505       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
506
507   /**
508    * Called prior to adding a new column family to the table.  Called as part of
509    * add column procedure.
510    *
511    * Implementation note: This replaces the deprecated
512    * {@link #preAddColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method.
513    * Make sure to implement only one of the two as both are called.
514    *
515    * @param ctx the environment to interact with the framework and master
516    * @param tableName the name of the table
517    * @param columnFamily the HColumnDescriptor
518    * @throws IOException if something went wrong
519    */
520   void preAddColumnFamilyAction(
521       final ObserverContext<MasterCoprocessorEnvironment> ctx,
522       final TableName tableName,
523       final HColumnDescriptor columnFamily) throws IOException;
524
525   /**
526    * Called after the new column family has been created.  Called as part of
527    * add column handler.
528    * @param ctx the environment to interact with the framework and master
529    * @param tableName the name of the table
530    * @param columnFamily the HColumnDescriptor
531    * @throws IOException if something went wrong
532    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
533    *     (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>). Use
534    *     {@link #postCompletedAddColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}.
535    */
536   @Deprecated
537   void postAddColumnHandler(
538       final ObserverContext<MasterCoprocessorEnvironment> ctx,
539       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
540
541   /**
542    * Called after the new column family has been created.  Called as part of
543    * add column procedure.
544    *
545    * Implementation note: This replaces the deprecated
546    * {@link #postAddColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method.
547    * Make sure to implement only one of the two as both are called.
548    *
549    * @param ctx the environment to interact with the framework and master
550    * @param tableName the name of the table
551    * @param columnFamily the HColumnDescriptor
552    * @throws IOException if something went wrong
553    */
554   void postCompletedAddColumnFamilyAction(
555       final ObserverContext<MasterCoprocessorEnvironment> ctx,
556       final TableName tableName,
557       final HColumnDescriptor columnFamily) throws IOException;
558
559   /**
560    * Called prior to modifying a column family's attributes.  Called as part of
561    * modify column RPC call.
562    * @param ctx the environment to interact with the framework and master
563    * @param tableName the name of the table
564    * @param columnFamily the HColumnDescriptor
565    * @throws IOException if something went wrong
566    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
567    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
568    *             Use {@link #preModifyColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
569    */
570   @Deprecated
571   void preModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
572       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
573
574   /**
575    * Called prior to modifying a column family's attributes.  Called as part of
576    * modify column RPC call.
577    *
578    * Implementation note: This replaces the deprecated
579    * {@link #preModifyColumn(ObserverContext, TableName, HColumnDescriptor)} method.
580    * Make sure to implement only one of the two as both are called.
581    *
582    * @param ctx the environment to interact with the framework and master
583    * @param tableName the name of the table
584    * @param columnFamily the HColumnDescriptor
585    * @throws IOException if something went wrong
586    */
587   void preModifyColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
588       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
589
590   /**
591    * Called after the column family has been updated.  Called as part of modify
592    * column RPC call.
593    * @param ctx the environment to interact with the framework and master
594    * @param tableName the name of the table
595    * @param columnFamily the HColumnDescriptor
596    * @throws IOException if something went wrong
597    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
598    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
599    *             Use {@link #postModifyColumnFamily(ObserverContext, TableName, HColumnDescriptor)}.
600    */
601   @Deprecated
602   void postModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
603       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
604
605   /**
606    * Called after the column family has been updated.  Called as part of modify
607    * column RPC call.
608    *
609    * Implementation note: This replaces the deprecated
610    * {@link #postModifyColumn(ObserverContext, TableName, HColumnDescriptor)} method.
611    * Make sure to implement only one of the two as both are called.
612    *
613    * @param ctx the environment to interact with the framework and master
614    * @param tableName the name of the table
615    * @param columnFamily the HColumnDescriptor
616    * @throws IOException if something went wrong
617    */
618   void postModifyColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
619       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
620
621   /**
622    * Called prior to modifying a column family's attributes.  Called as part of
623    * modify column handler.
624    * @param ctx the environment to interact with the framework and master
625    * @param tableName the name of the table
626    * @param columnFamily the HColumnDescriptor
627    * @throws IOException if something went wrong
628    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
629    *     (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
630    *     Use {@link #preModifyColumnFamilyAction(ObserverContext, TableName, HColumnDescriptor)}.
631    */
632   @Deprecated
633   void preModifyColumnHandler(
634       final ObserverContext<MasterCoprocessorEnvironment> ctx,
635       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
636
637   /**
638    * Called prior to modifying a column family's attributes.  Called as part of
639    * modify column procedure.
640    *
641    * Implementation note: This replaces the deprecated
642    * {@link #preModifyColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method.
643    * Make sure to implement only one of the two as both are called.
644    *
645    * @param ctx the environment to interact with the framework and master
646    * @param tableName the name of the table
647    * @param columnFamily the HColumnDescriptor
648    * @throws IOException if something went wrong
649    */
650   void preModifyColumnFamilyAction(
651       final ObserverContext<MasterCoprocessorEnvironment> ctx,
652       final TableName tableName,
653       final HColumnDescriptor columnFamily) throws IOException;
654 
655   /**
656    * Called after the column family has been updated.  Called as part of modify
657    * column handler.
658    * @param ctx the environment to interact with the framework and master
659    * @param tableName the name of the table
660    * @param columnFamily the HColumnDescriptor
661    * @throws IOException if something went wrong
662    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
663    *   (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>). Use
664    *   {@link #postCompletedModifyColumnFamilyAction(ObserverContext,TableName,HColumnDescriptor)}.
665    */
666   @Deprecated
667   void postModifyColumnHandler(
668       final ObserverContext<MasterCoprocessorEnvironment> ctx,
669       TableName tableName, HColumnDescriptor columnFamily) throws IOException;
670
671   /**
672    * Called after the column family has been updated.  Called as part of modify
673    * column procedure.
674    *
675    * Implementation note: This replaces the deprecated
676    * {@link #postModifyColumnHandler(ObserverContext, TableName, HColumnDescriptor)} method.
677    * Make sure to implement only one of the two as both are called.
678    *
679    * @param ctx the environment to interact with the framework and master
680    * @param tableName the name of the table
681    * @param columnFamily the HColumnDescriptor
682    * @throws IOException if something went wrong
683    */
684   void postCompletedModifyColumnFamilyAction(
685       final ObserverContext<MasterCoprocessorEnvironment> ctx,
686       final TableName tableName,
687       final HColumnDescriptor columnFamily) throws IOException;
688
689   /**
690    * Called prior to deleting the entire column family.  Called as part of
691    * delete column RPC call.
692    * @param ctx the environment to interact with the framework and master
693    * @param tableName the name of the table
694    * @param columnFamily the column family
695    * @throws IOException if something went wrong
696    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
697    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
698    *             Use {@link #preDeleteColumnFamily(ObserverContext, TableName, byte[])}.
699    */
700   @Deprecated
701   void preDeleteColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
702       final TableName tableName, final byte[] columnFamily) throws IOException;
703
704   /**
705    * Called prior to deleting the entire column family.  Called as part of
706    * delete column RPC call.
707    *
708    * Implementation note: This replaces the deprecated
709    * {@link #preDeleteColumn(ObserverContext, TableName, byte[])} method.
710    * Make sure to implement only one of the two as both are called.
711    *
712    * @param ctx the environment to interact with the framework and master
713    * @param tableName the name of the table
714    * @param columnFamily the column
715    * @throws IOException if something went wrong
716    */
717   void preDeleteColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
718       final TableName tableName, final byte[] columnFamily) throws IOException;
719
720   /**
721    * Called after the column family has been deleted.  Called as part of delete
722    * column RPC call.
723    * @param ctx the environment to interact with the framework and master
724    * @param tableName the name of the table
725    * @param columnFamily the column family
726    * @throws IOException if something went wrong
727    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
728    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
729    *             Use {@link #postDeleteColumnFamily(ObserverContext, TableName, byte[])}.
730    */
731   @Deprecated
732   void postDeleteColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
733       final TableName tableName, final byte[] columnFamily) throws IOException;
734
735   /**
736    * Called after the column family has been deleted.  Called as part of delete
737    * column RPC call.
738    *
739    * Implementation note: This replaces the deprecated
740    * {@link #postDeleteColumn(ObserverContext, TableName, byte[])} method.
741    * Make sure to implement only one of the two as both are called.
742    *
743    * @param ctx the environment to interact with the framework and master
744    * @param tableName the name of the table
745    * @param columnFamily the column family
746    * @throws IOException if something went wrong
747    */
748   void postDeleteColumnFamily(final ObserverContext<MasterCoprocessorEnvironment> ctx,
749       final TableName tableName, final byte[] columnFamily) throws IOException;
750
751   /**
752    * Called prior to deleting the entire column family.  Called as part of
753    * delete column handler.
754    * @param ctx the environment to interact with the framework and master
755    * @param tableName the name of the table
756    * @param columnFamily the column family
757    * @throws IOException if something went wrong
758    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
759    *             (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
760    *             Use {@link #preDeleteColumnFamilyAction(ObserverContext, TableName, byte[])}.
761    */
762   @Deprecated
763   void preDeleteColumnHandler(
764       final ObserverContext<MasterCoprocessorEnvironment> ctx,
765       final TableName tableName, final byte[] columnFamily) throws IOException;
766
767   /**
768    * Called prior to deleting the entire column family.  Called as part of
769    * delete column procedure.
770    *
771    * Implementation note: This replaces the deprecated
772    * {@link #preDeleteColumnHandler(ObserverContext, TableName, byte[])} method.
773    * Make sure to implement only one of the two as both are called.
774    *
775    * @param ctx the environment to interact with the framework and master
776    * @param tableName the name of the table
777    * @param columnFamily the column family
778    * @throws IOException if something went wrong
779    */
780   void preDeleteColumnFamilyAction(
781       final ObserverContext<MasterCoprocessorEnvironment> ctx,
782       final TableName tableName, final byte[] columnFamily) throws IOException;
783
784   /**
785    * Called after the column family has been deleted.  Called as part of
786    * delete column handler.
787    * @param ctx the environment to interact with the framework and master
788    * @param tableName the name of the table
789    * @param columnFamily the column family
790    * @throws IOException if something went wrong
791    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
792    *         (<a href="https://issues.apache.org/jira/browse/HBASE-13645">HBASE-13645</a>).
793    *         Use {@link #postCompletedDeleteColumnFamilyAction(ObserverContext, TableName, byte[])}.
794    */
795   @Deprecated
796   void postDeleteColumnHandler(
797       final ObserverContext<MasterCoprocessorEnvironment> ctx,
798       final TableName tableName, final byte[] columnFamily) throws IOException;
799
800   /**
801    * Called after the column family has been deleted.  Called as part of
802    * delete column procedure.
803    *
804    * Implementation note: This replaces the deprecated
805    * {@link #postDeleteColumnHandler(ObserverContext, TableName, byte[])} method.
806    * Make sure to implement only one of the two as both are called.
807    *
808    * @param ctx the environment to interact with the framework and master
809    * @param tableName the name of the table
810    * @param columnFamily the column family
811    * @throws IOException if something went wrong
812    */
813   void postCompletedDeleteColumnFamilyAction(
814       final ObserverContext<MasterCoprocessorEnvironment> ctx,
815       final TableName tableName, final byte[] columnFamily) throws IOException;
816
817   /**
818    * Called prior to enabling a table.  Called as part of enable table RPC call.
819    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
820    * @param ctx the environment to interact with the framework and master
821    * @param tableName the name of the table
822    * @throws IOException if something went wrong
823    */
824   void preEnableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
825       final TableName tableName) throws IOException;
826
827   /**
828    * Called after the enableTable operation has been requested.  Called as part
829    * of enable table RPC call.
830    * @param ctx the environment to interact with the framework and master
831    * @param tableName the name of the table
832    * @throws IOException if something went wrong
833    */
834   void postEnableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
835       final TableName tableName) throws IOException;
836
837   /**
838    * Called prior to enabling a table.  Called as part of enable table handler
839    * and it is async to the enable table RPC call.
840    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
841    * @param ctx the environment to interact with the framework and master
842    * @param tableName the name of the table
843    * @throws IOException if something went wrong
844    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
845    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
846    *     Use {@link #preEnableTableAction(ObserverContext, TableName)}.
847    */
848   @Deprecated
849   void preEnableTableHandler(
850       final ObserverContext<MasterCoprocessorEnvironment> ctx,
851       final TableName tableName) throws IOException;
852 
853   /**
854    * Called after the enableTable operation has been requested.  Called as part
855    * of enable table handler and it is async to the enable table RPC call.
856    * @param ctx the environment to interact with the framework and master
857    * @param tableName the name of the table
858    * @throws IOException if something went wrong
859    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
860    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
861    *     Use {@link #postCompletedEnableTableAction(ObserverContext, TableName)}.
862    */
863   @Deprecated
864   void postEnableTableHandler(
865       final ObserverContext<MasterCoprocessorEnvironment> ctx,
866       final TableName tableName) throws IOException;
867 
868   /**
869    * Called prior to enabling a table.  Called as part of enable table procedure
870    * and it is async to the enable table RPC call.
871    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
872    *
873    * Implementation note: This replaces the deprecated
874    * {@link #preEnableTableHandler(ObserverContext, TableName)} method.
875    * Make sure to implement only one of the two as both are called.
876    *
877    * @param ctx the environment to interact with the framework and master
878    * @param tableName the name of the table
879    * @throws IOException if something went wrong
880    */
881   void preEnableTableAction(
882       final ObserverContext<MasterCoprocessorEnvironment> ctx,
883       final TableName tableName) throws IOException;
884
885   /**
886    * Called after the enableTable operation has been requested.  Called as part
887    * of enable table procedure and it is async to the enable table RPC call.
888    *
889    * Implementation note: This replaces the deprecated
890    * {@link #postEnableTableHandler(ObserverContext, TableName)} method.
891    * Make sure to implement only one of the two as both are called.
892    *
893    * @param ctx the environment to interact with the framework and master
894    * @param tableName the name of the table
895    * @throws IOException if something went wrong
896    */
897   void postCompletedEnableTableAction(
898       final ObserverContext<MasterCoprocessorEnvironment> ctx,
899       final TableName tableName) throws IOException;
900
901   /**
902    * Called prior to disabling a table.  Called as part of disable table RPC
903    * call.
904    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
905    * @param ctx the environment to interact with the framework and master
906    * @param tableName the name of the table
907    * @throws IOException if something went wrong
908    */
909   void preDisableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
910       final TableName tableName) throws IOException;
911
912   /**
913    * Called after the disableTable operation has been requested.  Called as part
914    * of disable table RPC call.
915    * @param ctx the environment to interact with the framework and master
916    * @param tableName the name of the table
917    * @throws IOException if something went wrong
918    */
919   void postDisableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
920       final TableName tableName) throws IOException;
921
922   /**
923    * Called prior to disabling a table.  Called as part of disable table handler
924    * and it is asyn to the disable table RPC call.
925    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
926    * @param ctx the environment to interact with the framework and master
927    * @param tableName the name of the table
928    * @throws IOException if something went wrong
929    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
930    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
931    *     Use {@link #preDisableTableAction(ObserverContext, TableName)}.
932    */
933   @Deprecated
934   void preDisableTableHandler(
935       final ObserverContext<MasterCoprocessorEnvironment> ctx,
936       final TableName tableName) throws IOException;
937 
938   /**
939    * Called after the disableTable operation has been requested.  Called as part
940    * of disable table handler and it is asyn to the disable table RPC call.
941    * @param ctx the environment to interact with the framework and master
942    * @param tableName the name of the table
943    * @throws IOException if something went wrong
944    * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
945    *     (<a href="https://issues.apache.org/jira/browse/HBASE-15575">HBASE-15575</a>).
946    *     Use {@link #postCompletedDisableTableAction(ObserverContext, TableName)}.
947    */
948   @Deprecated
949   void postDisableTableHandler(
950       final ObserverContext<MasterCoprocessorEnvironment> ctx,
951       final TableName tableName) throws IOException;
952
953   /**
954    * Called prior to disabling a table.  Called as part of disable table procedure
955    * and it is asyn to the disable table RPC call.
956    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
957    *
958    * Implementation note: This replaces the deprecated
959    * {@link #preDisableTableHandler(ObserverContext, TableName)} method.
960    * Make sure to implement only one of the two as both are called.
961    *
962    * @param ctx the environment to interact with the framework and master
963    * @param tableName the name of the table
964    * @throws IOException if something went wrong
965    */
966   void preDisableTableAction(
967       final ObserverContext<MasterCoprocessorEnvironment> ctx,
968       final TableName tableName) throws IOException;
969
970   /**
971    * Called after the disableTable operation has been requested.  Called as part
972    * of disable table procedure and it is asyn to the disable table RPC call.
973    *
974    * Implementation note: This replaces the deprecated
975    * {@link #postDisableTableHandler(ObserverContext, TableName)} method.
976    * Make sure to implement only one of the two as both are called.
977    *
978    * @param ctx the environment to interact with the framework and master
979    * @param tableName the name of the table
980    * @throws IOException if something went wrong
981    */
982   void postCompletedDisableTableAction(
983       final ObserverContext<MasterCoprocessorEnvironment> ctx,
984       final TableName tableName) throws IOException;
985
986   /**
987    * Called before a abortProcedure request has been processed.
988    * @param ctx the environment to interact with the framework and master
989    * @param procEnv procedure executor
990    * @param procId the Id of the procedure
991    * @throws IOException if something went wrong
992    */
993   public void preAbortProcedure(
994       ObserverContext<MasterCoprocessorEnvironment> ctx,
995       final ProcedureExecutor<MasterProcedureEnv> procEnv,
996       final long procId) throws IOException;
997
998   /**
999    * Called after a abortProcedure request has been processed.
1000    * @param ctx the environment to interact with the framework and master
1001    * @throws IOException if something went wrong
1002    */
1003   public void postAbortProcedure(ObserverContext<MasterCoprocessorEnvironment> ctx)
1004       throws IOException;
1005
1006   /**
1007    * Called before a listProcedures request has been processed.
1008    * @param ctx the environment to interact with the framework and master
1009    * @throws IOException if something went wrong
1010    */
1011   void preListProcedures(ObserverContext<MasterCoprocessorEnvironment> ctx)
1012       throws IOException;
1013
1014   /**
1015    * Called after a listProcedures request has been processed.
1016    * @param ctx the environment to interact with the framework and master
1017    * @param procInfoList the list of procedures about to be returned
1018    * @throws IOException if something went wrong
1019    */
1020   void postListProcedures(
1021       ObserverContext<MasterCoprocessorEnvironment> ctx,
1022       List<ProcedureInfo> procInfoList) throws IOException;
1023
1024   /**
1025    * Called prior to moving a given region from one region server to another.
1026    * @param ctx the environment to interact with the framework and master
1027    * @param region the HRegionInfo
1028    * @param srcServer the source ServerName
1029    * @param destServer the destination ServerName
1030    */
1031   void preMove(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1032       final HRegionInfo region, final ServerName srcServer,
1033       final ServerName destServer)
1034     throws IOException;
1035
1036   /**
1037    * Called after the region move has been requested.
1038    * @param ctx the environment to interact with the framework and master
1039    * @param region the HRegionInfo
1040    * @param srcServer the source ServerName
1041    * @param destServer the destination ServerName
1042    */
1043   void postMove(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1044       final HRegionInfo region, final ServerName srcServer,
1045       final ServerName destServer)
1046     throws IOException;
1047
1048   /**
1049    * Called prior to assigning a specific region.
1050    * @param ctx the environment to interact with the framework and master
1051    * @param regionInfo the regionInfo of the region
1052    */
1053   void preAssign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1054       final HRegionInfo regionInfo) throws IOException;
1055
1056   /**
1057    * Called after the region assignment has been requested.
1058    * @param ctx the environment to interact with the framework and master
1059    * @param regionInfo the regionInfo of the region
1060    */
1061   void postAssign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1062       final HRegionInfo regionInfo) throws IOException;
1063
1064   /**
1065    * Called prior to unassigning a given region.
1066    * @param ctx the environment to interact with the framework and master
1067    * @param regionInfo
1068    * @param force whether to force unassignment or not
1069    */
1070   void preUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1071       final HRegionInfo regionInfo, final boolean force) throws IOException;
1072
1073   /**
1074    * Called after the region unassignment has been requested.
1075    * @param ctx the environment to interact with the framework and master
1076    * @param regionInfo
1077    * @param force whether to force unassignment or not
1078    */
1079   void postUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1080       final HRegionInfo regionInfo, final boolean force) throws IOException;
1081
1082   /**
1083    * Called prior to marking a given region as offline. <code>ctx.bypass()</code> will not have any
1084    * impact on this hook.
1085    * @param ctx the environment to interact with the framework and master
1086    * @param regionInfo
1087    */
1088   void preRegionOffline(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1089       final HRegionInfo regionInfo) throws IOException;
1090
1091   /**
1092    * Called after the region has been marked offline.
1093    * @param ctx the environment to interact with the framework and master
1094    * @param regionInfo
1095    */
1096   void postRegionOffline(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1097       final HRegionInfo regionInfo) throws IOException;
1098
1099   /**
1100    * Called prior to requesting rebalancing of the cluster regions, though after
1101    * the initial checks for regions in transition and the balance switch flag.
1102    * @param ctx the environment to interact with the framework and master
1103    */
1104   void preBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1105       throws IOException;
1106
1107   /**
1108    * Called after the balancing plan has been submitted.
1109    * @param ctx the environment to interact with the framework and master
1110    * @param plans the RegionPlans which master has executed. RegionPlan serves as hint
1111    * as for the final destination for the underlying region but may not represent the
1112    * final state of assignment
1113    */
1114   void postBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx, List<RegionPlan> plans)
1115       throws IOException;
1116
1117   /**
1118    * Called prior to setting split / merge switch
1119    * @param ctx the coprocessor instance's environment
1120    * @param newValue the new value submitted in the call
1121    * @param switchType type of switch
1122    */
1123   boolean preSetSplitOrMergeEnabled(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1124       final boolean newValue, final MasterSwitchType switchType) throws IOException;
1125
1126   /**
1127    * Called after setting split / merge switch
1128    * @param ctx the coprocessor instance's environment
1129    * @param newValue the new value submitted in the call
1130    * @param switchType type of switch
1131    */
1132   void postSetSplitOrMergeEnabled(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1133       final boolean newValue, final MasterSwitchType switchType) throws IOException;
1134
1135   /**
1136    * Called prior to modifying the flag used to enable/disable region balancing.
1137    * @param ctx the coprocessor instance's environment
1138    * @param newValue the new flag value submitted in the call
1139    */
1140   boolean preBalanceSwitch(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1141       final boolean newValue) throws IOException;
1142
1143   /**
1144    * Called after the flag to enable/disable balancing has changed.
1145    * @param ctx the coprocessor instance's environment
1146    * @param oldValue the previously set balanceSwitch value
1147    * @param newValue the newly set balanceSwitch value
1148    */
1149   void postBalanceSwitch(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1150       final boolean oldValue, final boolean newValue) throws IOException;
1151
1152   /**
1153    * Called prior to shutting down the full HBase cluster, including this
1154    * {@link org.apache.hadoop.hbase.master.HMaster} process.
1155    */
1156   void preShutdown(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1157       throws IOException;
1158 
1159
1160   /**
1161    * Called immediately prior to stopping this
1162    * {@link org.apache.hadoop.hbase.master.HMaster} process.
1163    */
1164   void preStopMaster(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1165       throws IOException;
1166
1167   /**
1168    * Called immediately after an active master instance has completed
1169    * initialization.  Will not be called on standby master instances unless
1170    * they take over the active role.
1171    */
1172   void postStartMaster(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1173       throws IOException;
1174
1175   /**
1176    * Call before the master initialization is set to true.
1177    * {@link org.apache.hadoop.hbase.master.HMaster} process.
1178    */
1179   void preMasterInitialization(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1180       throws IOException;
1181
1182   /**
1183    * Called before a new snapshot is taken.
1184    * Called as part of snapshot RPC call.
1185    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1186    * @param ctx the environment to interact with the framework and master
1187    * @param snapshot the SnapshotDescriptor for the snapshot
1188    * @param hTableDescriptor the hTableDescriptor of the table to snapshot
1189    * @throws IOException if something went wrong
1190    */
1191   void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1192       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
1193       throws IOException;
1194
1195   /**
1196    * Called after the snapshot operation has been requested.
1197    * Called as part of snapshot RPC call.
1198    * @param ctx the environment to interact with the framework and master
1199    * @param snapshot the SnapshotDescriptor for the snapshot
1200    * @param hTableDescriptor the hTableDescriptor of the table to snapshot
1201    * @throws IOException if something went wrong
1202    */
1203   void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1204       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
1205       throws IOException;
1206
1207   /**
1208    * Called before listSnapshots request has been processed.
1209    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1210    * @param ctx the environment to interact with the framework and master
1211    * @param snapshot the SnapshotDescriptor of the snapshot to list
1212    * @throws IOException if something went wrong
1213    */
1214   void preListSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1215       final SnapshotDescription snapshot) throws IOException;
1216
1217   /**
1218    * Called after listSnapshots request has been processed.
1219    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1220    * @param ctx the environment to interact with the framework and master
1221    * @param snapshot the SnapshotDescriptor of the snapshot to list
1222    * @throws IOException if something went wrong
1223    */
1224   void postListSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1225       final SnapshotDescription snapshot) throws IOException;
1226
1227   /**
1228    * Called before a snapshot is cloned.
1229    * Called as part of restoreSnapshot RPC call.
1230    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1231    * @param ctx the environment to interact with the framework and master
1232    * @param snapshot the SnapshotDescriptor for the snapshot
1233    * @param hTableDescriptor the hTableDescriptor of the table to create
1234    * @throws IOException if something went wrong
1235    */
1236   void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1237       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
1238       throws IOException;
1239
1240   /**
1241    * Called after a snapshot clone operation has been requested.
1242    * Called as part of restoreSnapshot RPC call.
1243    * @param ctx the environment to interact with the framework and master
1244    * @param snapshot the SnapshotDescriptor for the snapshot
1245    * @param hTableDescriptor the hTableDescriptor of the table to create
1246    * @throws IOException if something went wrong
1247    */
1248   void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1249       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
1250       throws IOException;
1251
1252   /**
1253    * Called before a snapshot is restored.
1254    * Called as part of restoreSnapshot RPC call.
1255    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1256    * @param ctx the environment to interact with the framework and master
1257    * @param snapshot the SnapshotDescriptor for the snapshot
1258    * @param hTableDescriptor the hTableDescriptor of the table to restore
1259    * @throws IOException if something went wrong
1260    */
1261   void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1262       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
1263       throws IOException;
1264
1265   /**
1266    * Called after a snapshot restore operation has been requested.
1267    * Called as part of restoreSnapshot RPC call.
1268    * @param ctx the environment to interact with the framework and master
1269    * @param snapshot the SnapshotDescriptor for the snapshot
1270    * @param hTableDescriptor the hTableDescriptor of the table to restore
1271    * @throws IOException if something went wrong
1272    */
1273   void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1274       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
1275       throws IOException;
1276
1277   /**
1278    * Called before a snapshot is deleted.
1279    * Called as part of deleteSnapshot RPC call.
1280    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1281    * @param ctx the environment to interact with the framework and master
1282    * @param snapshot the SnapshotDescriptor of the snapshot to delete
1283    * @throws IOException if something went wrong
1284    */
1285   void preDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1286       final SnapshotDescription snapshot) throws IOException;
1287
1288   /**
1289    * Called after the delete snapshot operation has been requested.
1290    * Called as part of deleteSnapshot RPC call.
1291    * @param ctx the environment to interact with the framework and master
1292    * @param snapshot the SnapshotDescriptor of the snapshot to delete
1293    * @throws IOException if something went wrong
1294    */
1295   void postDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1296       final SnapshotDescription snapshot) throws IOException;
1297
1298   /**
1299    * Called before a getTableDescriptors request has been processed.
1300    * @param ctx the environment to interact with the framework and master
1301    * @param tableNamesList the list of table names, or null if querying for all
1302    * @param descriptors an empty list, can be filled with what to return if bypassing
1303    * @param regex regular expression used for filtering the table names
1304    * @throws IOException if something went wrong
1305    */
1306   void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
1307       List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
1308       String regex) throws IOException;
1309
1310   /**
1311    * Called after a getTableDescriptors request has been processed.
1312    * @param ctx the environment to interact with the framework and master
1313    * @param tableNamesList the list of table names, or null if querying for all
1314    * @param descriptors the list of descriptors about to be returned
1315    * @param regex regular expression used for filtering the table names
1316    * @throws IOException if something went wrong
1317    */
1318   void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
1319       List<TableName> tableNamesList, List<HTableDescriptor> descriptors,
1320       String regex) throws IOException;
1321 
1322   /**
1323    * Called before a getTableNames request has been processed.
1324    * @param ctx the environment to interact with the framework and master
1325    * @param descriptors an empty list, can be filled with what to return if bypassing
1326    * @param regex regular expression used for filtering the table names
1327    * @throws IOException if something went wrong
1328    */
1329   void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
1330       List<HTableDescriptor> descriptors, String regex) throws IOException;
1331
1332   /**
1333    * Called after a getTableNames request has been processed.
1334    * @param ctx the environment to interact with the framework and master
1335    * @param descriptors the list of descriptors about to be returned
1336    * @param regex regular expression used for filtering the table names
1337    * @throws IOException if something went wrong
1338    */
1339   void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
1340       List<HTableDescriptor> descriptors, String regex) throws IOException;
1341
1342
1343
1344   /**
1345    * Called before a new namespace is created by
1346    * {@link org.apache.hadoop.hbase.master.HMaster}.
1347    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1348    * @param ctx the environment to interact with the framework and master
1349    * @param ns the NamespaceDescriptor for the table
1350    * @throws IOException if something went wrong
1351    */
1352   void preCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1353       NamespaceDescriptor ns) throws IOException;
1354   /**
1355    * Called after the createNamespace operation has been requested.
1356    * @param ctx the environment to interact with the framework and master
1357    * @param ns the NamespaceDescriptor for the table
1358    * @throws IOException if something went wrong
1359    */
1360   void postCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1361        NamespaceDescriptor ns) throws IOException;
1362
1363   /**
1364    * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
1365    * namespace
1366    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1367    * @param ctx the environment to interact with the framework and master
1368    * @param namespace the name of the namespace
1369    * @throws IOException if something went wrong
1370    */
1371   void preDeleteNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1372       String namespace) throws IOException;
1373
1374   /**
1375    * Called after the deleteNamespace operation has been requested.
1376    * @param ctx the environment to interact with the framework and master
1377    * @param namespace the name of the namespace
1378    * @throws IOException if something went wrong
1379    */
1380   void postDeleteNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1381       String namespace) throws IOException;
1382
1383   /**
1384    * Called prior to modifying a namespace's properties.
1385    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1386    * @param ctx the environment to interact with the framework and master
1387    * @param ns the NamespaceDescriptor
1388    * @throws IOException if something went wrong
1389    */
1390   void preModifyNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1391       NamespaceDescriptor ns) throws IOException;
1392
1393   /**
1394    * Called after the modifyNamespace operation has been requested.
1395    * @param ctx the environment to interact with the framework and master
1396    * @param ns the NamespaceDescriptor
1397    * @throws IOException if something went wrong
1398    */
1399   void postModifyNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1400       NamespaceDescriptor ns) throws IOException;
1401
1402   /**
1403    * Called before a getNamespaceDescriptor request has been processed.
1404    * @param ctx the environment to interact with the framework and master
1405    * @param namespace the name of the namespace
1406    * @throws IOException if something went wrong
1407    */
1408   void preGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
1409       String namespace) throws IOException;
1410
1411   /**
1412    * Called after a getNamespaceDescriptor request has been processed.
1413    * @param ctx the environment to interact with the framework and master
1414    * @param ns the NamespaceDescriptor
1415    * @throws IOException if something went wrong
1416    */
1417   void postGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
1418       NamespaceDescriptor ns) throws IOException;
1419
1420   /**
1421    * Called before a listNamespaceDescriptors request has been processed.
1422    * @param ctx the environment to interact with the framework and master
1423    * @param descriptors an empty list, can be filled with what to return if bypassing
1424    * @throws IOException if something went wrong
1425    */
1426   void preListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
1427       List<NamespaceDescriptor> descriptors) throws IOException;
1428
1429   /**
1430    * Called after a listNamespaceDescriptors request has been processed.
1431    * @param ctx the environment to interact with the framework and master
1432    * @param descriptors the list of descriptors about to be returned
1433    * @throws IOException if something went wrong
1434    */
1435   void postListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
1436       List<NamespaceDescriptor> descriptors) throws IOException;
1437
1438
1439   /**
1440    * Called before the table memstore is flushed to disk.
1441    * @param ctx the environment to interact with the framework and master
1442    * @param tableName the name of the table
1443    * @throws IOException if something went wrong
1444    */
1445   void preTableFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1446       final TableName tableName) throws IOException;
1447
1448   /**
1449    * Called after the table memstore is flushed to disk.
1450    * @param ctx the environment to interact with the framework and master
1451    * @param tableName the name of the table
1452    * @throws IOException if something went wrong
1453    */
1454   void postTableFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1455       final TableName tableName) throws IOException;
1456
1457   /**
1458    * Called before the quota for the user is stored.
1459    * @param ctx the environment to interact with the framework and master
1460    * @param userName the name of user
1461    * @param quotas the quota settings
1462    * @throws IOException if something went wrong
1463    */
1464   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1465       final String userName, final Quotas quotas) throws IOException;
1466
1467   /**
1468    * Called after the quota for the user is stored.
1469    * @param ctx the environment to interact with the framework and master
1470    * @param userName the name of user
1471    * @param quotas the quota settings
1472    * @throws IOException if something went wrong
1473    */
1474   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1475       final String userName, final Quotas quotas) throws IOException;
1476
1477   /**
1478    * Called before the quota for the user on the specified table is stored.
1479    * @param ctx the environment to interact with the framework and master
1480    * @param userName the name of user
1481    * @param tableName the name of the table
1482    * @param quotas the quota settings
1483    * @throws IOException if something went wrong
1484    */
1485   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1486       final String userName, final TableName tableName, final Quotas quotas) throws IOException;
1487
1488   /**
1489    * Called after the quota for the user on the specified table is stored.
1490    * @param ctx the environment to interact with the framework and master
1491    * @param userName the name of user
1492    * @param tableName the name of the table
1493    * @param quotas the quota settings
1494    * @throws IOException if something went wrong
1495    */
1496   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1497       final String userName, final TableName tableName, final Quotas quotas) throws IOException;
1498
1499   /**
1500    * Called before the quota for the user on the specified namespace is stored.
1501    * @param ctx the environment to interact with the framework and master
1502    * @param userName the name of user
1503    * @param namespace the name of the namespace
1504    * @param quotas the quota settings
1505    * @throws IOException if something went wrong
1506    */
1507   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1508       final String userName, final String namespace, final Quotas quotas) throws IOException;
1509
1510   /**
1511    * Called after the quota for the user on the specified namespace is stored.
1512    * @param ctx the environment to interact with the framework and master
1513    * @param userName the name of user
1514    * @param namespace the name of the namespace
1515    * @param quotas the quota settings
1516    * @throws IOException if something went wrong
1517    */
1518   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1519       final String userName, final String namespace, final Quotas quotas) throws IOException;
1520
1521   /**
1522    * Called before the quota for the table is stored.
1523    * @param ctx the environment to interact with the framework and master
1524    * @param tableName the name of the table
1525    * @param quotas the quota settings
1526    * @throws IOException if something went wrong
1527    */
1528   void preSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1529       final TableName tableName, final Quotas quotas) throws IOException;
1530
1531   /**
1532    * Called after the quota for the table is stored.
1533    * @param ctx the environment to interact with the framework and master
1534    * @param tableName the name of the table
1535    * @param quotas the quota settings
1536    * @throws IOException if something went wrong
1537    */
1538   void postSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1539       final TableName tableName, final Quotas quotas) throws IOException;
1540
1541   /**
1542    * Called before the quota for the namespace is stored.
1543    * @param ctx the environment to interact with the framework and master
1544    * @param namespace the name of the namespace
1545    * @param quotas the quota settings
1546    * @throws IOException if something went wrong
1547    */
1548   void preSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1549       final String namespace, final Quotas quotas) throws IOException;
1550
1551   /**
1552    * Called after the quota for the namespace is stored.
1553    * @param ctx the environment to interact with the framework and master
1554    * @param namespace the name of the namespace
1555    * @param quotas the quota settings
1556    * @throws IOException if something went wrong
1557    */
1558   void postSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1559       final String namespace, final Quotas quotas) throws IOException;
1560
1561   /**
1562    * Called before dispatching region merge request. 
1563    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
1564    * @param ctx coprocessor environment
1565    * @param regionA first region to be merged
1566    * @param regionB second region to be merged
1567    * @throws IOException if an error occurred on the coprocessor
1568    */
1569   public void preDispatchMerge(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1570       HRegionInfo regionA, HRegionInfo regionB) throws IOException;
1571
1572   /**
1573    * called after dispatching the region merge request.
1574    * @param c coprocessor environment
1575    * @param regionA first region to be merged
1576    * @param regionB second region to be merged
1577    * @throws IOException if an error occurred on the coprocessor
1578    */
1579   void postDispatchMerge(final ObserverContext<MasterCoprocessorEnvironment> c,
1580       final HRegionInfo regionA, final HRegionInfo regionB) throws IOException;
1581
1582   /**
1583    * Called before servers are moved to target region server group
1584    * @param ctx the environment to interact with the framework and master
1585    * @param servers set of servers to move
1586    * @param targetGroup destination group
1587    * @throws IOException on failure
1588    */
1589   void preMoveServers(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1590                       Set<HostAndPort> servers, String targetGroup) throws IOException;
1591
1592   /**
1593    * Called after servers are moved to target region server group
1594    * @param ctx the environment to interact with the framework and master
1595    * @param servers set of servers to move
1596    * @param targetGroup name of group
1597    * @throws IOException on failure
1598    */
1599   void postMoveServers(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1600                        Set<HostAndPort> servers, String targetGroup) throws IOException;
1601
1602   /**
1603    * Called before tables are moved to target region server group
1604    * @param ctx the environment to interact with the framework and master
1605    * @param tables set of tables to move
1606    * @param targetGroup name of group
1607    * @throws IOException on failure
1608    */
1609   void preMoveTables(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1610                      Set<TableName> tables, String targetGroup) throws IOException;
1611
1612   /**
1613    * Called after servers are moved to target region server group
1614    * @param ctx the environment to interact with the framework and master
1615    * @param tables set of tables to move
1616    * @param targetGroup name of group
1617    * @throws IOException on failure
1618    */
1619   void postMoveTables(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1620                       Set<TableName> tables, String targetGroup) throws IOException;
1621
1622   /**
1623    * Called before a new region server group is added
1624    * @param ctx the environment to interact with the framework and master
1625    * @param name group name
1626    * @throws IOException on failure
1627    */
1628   void preAddRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1629                      String name) throws IOException;
1630
1631   /**
1632    * Called after a new region server group is added
1633    * @param ctx the environment to interact with the framework and master
1634    * @param name group name
1635    * @throws IOException on failure
1636    */
1637   void postAddRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1638                       String name) throws IOException;
1639
1640   /**
1641    * Called before a region server group is removed
1642    * @param ctx the environment to interact with the framework and master
1643    * @param name group name
1644    * @throws IOException on failure
1645    */
1646   void preRemoveRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1647                         String name) throws IOException;
1648
1649   /**
1650    * Called after a region server group is removed
1651    * @param ctx the environment to interact with the framework and master
1652    * @param name group name
1653    * @throws IOException on failure
1654    */
1655   void postRemoveRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1656                          String name) throws IOException;
1657
1658   /**
1659    * Called before a region server group is removed
1660    * @param ctx the environment to interact with the framework and master
1661    * @param groupName group name
1662    * @throws IOException on failure
1663    */
1664   void preBalanceRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1665                          String groupName) throws IOException;
1666
1667   /**
1668    * Called after a region server group is removed
1669    * @param ctx the environment to interact with the framework and master
1670    * @param groupName group name
1671    * @throws IOException on failure
1672    */
1673   void postBalanceRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1674                           String groupName, boolean balancerRan) throws IOException;
1675
1676 }