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.classification.InterfaceAudience;
26  import org.apache.hadoop.hbase.classification.InterfaceStability;
27  import org.apache.hadoop.hbase.Coprocessor;
28  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
29  import org.apache.hadoop.hbase.TableName;
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.ServerName;
35  import org.apache.hadoop.hbase.master.RegionPlan;
36  import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
37  import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.Quotas;
38  
39  /**
40   * Defines coprocessor hooks for interacting with operations on the
41   * {@link org.apache.hadoop.hbase.master.HMaster} process.
42   */
43  @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
44  @InterfaceStability.Evolving
45  public interface MasterObserver extends Coprocessor {
46  
47    /**
48     * Called before a new table is created by
49     * {@link org.apache.hadoop.hbase.master.HMaster}.  Called as part of create
50     * table RPC call.
51     * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
52     * @param ctx the environment to interact with the framework and master
53     * @param desc the HTableDescriptor for the table
54     * @param regions the initial regions created for the table
55     * @throws IOException
56     */
57    void preCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
58        HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
59  
60    /**
61     * Called after the createTable operation has been requested.  Called as part
62     * of create table RPC call.
63     * @param ctx the environment to interact with the framework and master
64     * @param desc the HTableDescriptor for the table
65     * @param regions the initial regions created for the table
66     * @throws IOException
67     */
68    void postCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
69        HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
70    /**
71     * Called before a new table is created by
72     * {@link org.apache.hadoop.hbase.master.HMaster}.  Called as part of create
73     * table handler and it is async to the create RPC call.
74     * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
75     * @param ctx the environment to interact with the framework and master
76     * @param desc the HTableDescriptor for the table
77     * @param regions the initial regions created for the table
78     * @throws IOException
79     */
80    void preCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
81        ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
82  
83    /**
84     * Called after the createTable operation has been requested.  Called as part
85     * of create table RPC call.  Called as part of create table handler and
86     * it is async to the create RPC call.
87     * @param ctx the environment to interact with the framework and master
88     * @param desc the HTableDescriptor for the table
89     * @param regions the initial regions created for the table
90     * @throws IOException
91     */
92    void postCreateTableHandler(final ObserverContext<MasterCoprocessorEnvironment>
93    ctx, HTableDescriptor desc, HRegionInfo[] regions) throws IOException;
94  
95    /**
96     * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
97     * table.  Called as part of delete table RPC call.
98     * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
99     * @param ctx the environment to interact with the framework and master
100    * @param tableName the name of the table
101    */
102   void preDeleteTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
103       TableName tableName) throws IOException;
104 
105   /**
106    * Called after the deleteTable operation has been requested.  Called as part
107    * of delete table RPC call.
108    * @param ctx the environment to interact with the framework and master
109    * @param tableName the name of the table
110    */
111   void postDeleteTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
112       TableName tableName) throws IOException;
113 
114   /**
115    * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
116    * table.  Called as part of delete table handler and
117    * it is async to the delete RPC call.
118    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
119    * @param ctx the environment to interact with the framework and master
120    * @param tableName the name of the table
121    */
122   void preDeleteTableHandler(
123       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
124       throws IOException;
125 
126   /**
127    * Called after {@link org.apache.hadoop.hbase.master.HMaster} deletes a
128    * table.  Called as part of delete table handler and it is async to the
129    * delete RPC call.
130    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
131    * @param ctx the environment to interact with the framework and master
132    * @param tableName the name of the table
133    */
134   void postDeleteTableHandler(
135       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
136       throws IOException;
137 
138 
139   /**
140    * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a
141    * table.  Called as part of truncate table RPC call.
142    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
143    * @param ctx the environment to interact with the framework and master
144    * @param tableName the name of the table
145    */
146   void preTruncateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
147       TableName tableName) throws IOException;
148 
149   /**
150    * Called after the truncateTable operation has been requested.  Called as part
151    * of truncate table RPC call.
152    * The truncate is synchronous, so this method will be called when the
153    * truncate operation is terminated.
154    * @param ctx the environment to interact with the framework and master
155    * @param tableName the name of the table
156    */
157   void postTruncateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
158       TableName tableName) throws IOException;
159 
160   /**
161    * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a
162    * table.  Called as part of truncate table handler and it is sync
163    * to the truncate RPC call.
164    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
165    * @param ctx the environment to interact with the framework and master
166    * @param tableName the name of the table
167    */
168   void preTruncateTableHandler(
169       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
170       throws IOException;
171 
172   /**
173    * Called after {@link org.apache.hadoop.hbase.master.HMaster} truncates a
174    * table.  Called as part of truncate table handler and it is sync to the
175    * truncate RPC call.
176    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
177    * @param ctx the environment to interact with the framework and master
178    * @param tableName the name of the table
179    */
180   void postTruncateTableHandler(
181       final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName)
182       throws IOException;
183 
184   /**
185    * Called prior to modifying a table's properties.  Called as part of modify
186    * table RPC call.
187    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
188    * @param ctx the environment to interact with the framework and master
189    * @param tableName the name of the table
190    * @param htd the HTableDescriptor
191    */
192   void preModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
193       final TableName tableName, HTableDescriptor htd) throws IOException;
194 
195   /**
196    * Called after the modifyTable operation has been requested.  Called as part
197    * of modify table RPC call.
198    * @param ctx the environment to interact with the framework and master
199    * @param tableName the name of the table
200    * @param htd the HTableDescriptor
201    */
202   void postModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
203       final TableName tableName, HTableDescriptor htd) throws IOException;
204 
205   /**
206    * Called prior to modifying a table's properties.  Called as part of modify
207    * table handler and it is async to the modify table RPC call.
208    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
209    * @param ctx the environment to interact with the framework and master
210    * @param tableName the name of the table
211    * @param htd the HTableDescriptor
212    */
213   void preModifyTableHandler(
214       final ObserverContext<MasterCoprocessorEnvironment> ctx,
215       final TableName tableName, HTableDescriptor htd) throws IOException;
216 
217   /**
218    * Called after to modifying a table's properties.  Called as part of modify
219    * table handler and it is async to the modify table RPC call.
220    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
221    * @param ctx the environment to interact with the framework and master
222    * @param tableName the name of the table
223    * @param htd the HTableDescriptor
224    */
225   void postModifyTableHandler(
226       final ObserverContext<MasterCoprocessorEnvironment> ctx,
227       final TableName tableName, HTableDescriptor htd) throws IOException;
228 
229   /**
230    * Called prior to adding a new column family to the table.  Called as part of
231    * add column RPC call.
232    * @param ctx the environment to interact with the framework and master
233    * @param tableName the name of the table
234    * @param column the HColumnDescriptor
235    */
236   void preAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
237       TableName tableName, HColumnDescriptor column) throws IOException;
238 
239   /**
240    * Called after the new column family has been created.  Called as part of
241    * add column RPC call.
242    * @param ctx the environment to interact with the framework and master
243    * @param tableName the name of the table
244    * @param column the HColumnDescriptor
245    */
246   void postAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
247       TableName tableName, HColumnDescriptor column) throws IOException;
248 
249   /**
250    * Called prior to adding a new column family to the table.  Called as part of
251    * add column handler.
252    * @param ctx the environment to interact with the framework and master
253    * @param tableName the name of the table
254    * @param column the HColumnDescriptor
255    */
256   void preAddColumnHandler(
257       final ObserverContext<MasterCoprocessorEnvironment> ctx,
258       TableName tableName, HColumnDescriptor column) throws IOException;
259 
260   /**
261    * Called after the new column family has been created.  Called as part of
262    * add column handler.
263    * @param ctx the environment to interact with the framework and master
264    * @param tableName the name of the table
265    * @param column the HColumnDescriptor
266    */
267   void postAddColumnHandler(
268       final ObserverContext<MasterCoprocessorEnvironment> ctx,
269       TableName tableName, HColumnDescriptor column) throws IOException;
270 
271   /**
272    * Called prior to modifying a column family's attributes.  Called as part of
273    * modify column RPC call.
274    * @param ctx the environment to interact with the framework and master
275    * @param tableName the name of the table
276    * @param descriptor the HColumnDescriptor
277    */
278   void preModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
279       TableName tableName, HColumnDescriptor descriptor) throws IOException;
280 
281   /**
282    * Called after the column family has been updated.  Called as part of modify
283    * column RPC call.
284    * @param ctx the environment to interact with the framework and master
285    * @param tableName the name of the table
286    * @param descriptor the HColumnDescriptor
287    */
288   void postModifyColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
289       TableName tableName, HColumnDescriptor descriptor) throws IOException;
290 
291   /**
292    * Called prior to modifying a column family's attributes.  Called as part of
293    * modify column handler.
294    * @param ctx the environment to interact with the framework and master
295    * @param tableName the name of the table
296    * @param descriptor the HColumnDescriptor
297    */
298   void preModifyColumnHandler(
299       final ObserverContext<MasterCoprocessorEnvironment> ctx,
300       TableName tableName, HColumnDescriptor descriptor) throws IOException;
301 
302   /**
303    * Called after the column family has been updated.  Called as part of modify
304    * column handler.
305    * @param ctx the environment to interact with the framework and master
306    * @param tableName the name of the table
307    * @param descriptor the HColumnDescriptor
308    */
309   void postModifyColumnHandler(
310       final ObserverContext<MasterCoprocessorEnvironment> ctx,
311       TableName tableName, HColumnDescriptor descriptor) throws IOException;
312 
313 
314   /**
315    * Called prior to deleting the entire column family.  Called as part of
316    * delete column RPC call.
317    * @param ctx the environment to interact with the framework and master
318    * @param tableName the name of the table
319    * @param c the column
320    */
321   void preDeleteColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
322       final TableName tableName, final byte[] c) throws IOException;
323 
324   /**
325    * Called after the column family has been deleted.  Called as part of delete
326    * column RPC call.
327    * @param ctx the environment to interact with the framework and master
328    * @param tableName the name of the table
329    * @param c the column
330    */
331   void postDeleteColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx,
332       final TableName tableName, final byte[] c) throws IOException;
333 
334   /**
335    * Called prior to deleting the entire column family.  Called as part of
336    * delete column handler.
337    * @param ctx the environment to interact with the framework and master
338    * @param tableName the name of the table
339    * @param c the column
340    */
341   void preDeleteColumnHandler(
342       final ObserverContext<MasterCoprocessorEnvironment> ctx,
343       final TableName tableName, final byte[] c) throws IOException;
344 
345   /**
346    * Called after the column family has been deleted.  Called as part of
347    * delete column handler.
348    * @param ctx the environment to interact with the framework and master
349    * @param tableName the name of the table
350    * @param c the column
351    */
352   void postDeleteColumnHandler(
353       final ObserverContext<MasterCoprocessorEnvironment> ctx,
354       final TableName tableName, final byte[] c) throws IOException;
355 
356   /**
357    * Called prior to enabling a table.  Called as part of enable table RPC call.
358    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
359    * @param ctx the environment to interact with the framework and master
360    * @param tableName the name of the table
361    */
362   void preEnableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
363       final TableName tableName) throws IOException;
364 
365   /**
366    * Called after the enableTable operation has been requested.  Called as part
367    * of enable table RPC call.
368    * @param ctx the environment to interact with the framework and master
369    * @param tableName the name of the table
370    */
371   void postEnableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
372       final TableName tableName) throws IOException;
373 
374   /**
375    * Called prior to enabling a table.  Called as part of enable table handler
376    * and it is async to the enable 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    */
381   void preEnableTableHandler(
382       final ObserverContext<MasterCoprocessorEnvironment> ctx,
383       final TableName tableName) throws IOException;
384 
385   /**
386    * Called after the enableTable operation has been requested.  Called as part
387    * of enable table handler and it is async to the enable table RPC call.
388    * @param ctx the environment to interact with the framework and master
389    * @param tableName the name of the table
390    */
391   void postEnableTableHandler(
392       final ObserverContext<MasterCoprocessorEnvironment> ctx,
393       final TableName tableName) throws IOException;
394 
395   /**
396    * Called prior to disabling a table.  Called as part of disable table RPC
397    * call.
398    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
399    * @param ctx the environment to interact with the framework and master
400    * @param tableName the name of the table
401    */
402   void preDisableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
403       final TableName tableName) throws IOException;
404 
405   /**
406    * Called after the disableTable operation has been requested.  Called as part
407    * of disable table RPC call.
408    * @param ctx the environment to interact with the framework and master
409    * @param tableName the name of the table
410    */
411   void postDisableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
412       final TableName tableName) throws IOException;
413 
414   /**
415    * Called prior to disabling a table.  Called as part of disable table handler
416    * and it is asyn to the disable table RPC call.
417    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
418    * @param ctx the environment to interact with the framework and master
419    * @param tableName the name of the table
420    */
421   void preDisableTableHandler(
422       final ObserverContext<MasterCoprocessorEnvironment> ctx,
423       final TableName tableName) throws IOException;
424 
425   /**
426    * Called after the disableTable operation has been requested.  Called as part
427    * of disable table handler and it is asyn to the disable table RPC call.
428    * @param ctx the environment to interact with the framework and master
429    * @param tableName the name of the table
430    */
431   void postDisableTableHandler(
432       final ObserverContext<MasterCoprocessorEnvironment> ctx,
433       final TableName tableName) throws IOException;
434 
435   /**
436    * Called prior to moving a given region from one region server to another.
437    * @param ctx the environment to interact with the framework and master
438    * @param region the HRegionInfo
439    * @param srcServer the source ServerName
440    * @param destServer the destination ServerName
441    */
442   void preMove(final ObserverContext<MasterCoprocessorEnvironment> ctx,
443       final HRegionInfo region, final ServerName srcServer,
444       final ServerName destServer)
445     throws IOException;
446 
447   /**
448    * Called after the region move has been requested.
449    * @param ctx the environment to interact with the framework and master
450    * @param region the HRegionInfo
451    * @param srcServer the source ServerName
452    * @param destServer the destination ServerName
453    */
454   void postMove(final ObserverContext<MasterCoprocessorEnvironment> ctx,
455       final HRegionInfo region, final ServerName srcServer,
456       final ServerName destServer)
457     throws IOException;
458 
459   /**
460    * Called prior to assigning a specific region.
461    * @param ctx the environment to interact with the framework and master
462    * @param regionInfo the regionInfo of the region
463    */
464   void preAssign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
465       final HRegionInfo regionInfo) throws IOException;
466 
467   /**
468    * Called after the region assignment has been requested.
469    * @param ctx the environment to interact with the framework and master
470    * @param regionInfo the regionInfo of the region
471    */
472   void postAssign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
473       final HRegionInfo regionInfo) throws IOException;
474 
475   /**
476    * Called prior to unassigning a given region.
477    * @param ctx the environment to interact with the framework and master
478    * @param regionInfo
479    * @param force whether to force unassignment or not
480    */
481   void preUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
482       final HRegionInfo regionInfo, final boolean force) throws IOException;
483 
484   /**
485    * Called after the region unassignment has been requested.
486    * @param ctx the environment to interact with the framework and master
487    * @param regionInfo
488    * @param force whether to force unassignment or not
489    */
490   void postUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
491       final HRegionInfo regionInfo, final boolean force) throws IOException;
492 
493   /**
494    * Called prior to marking a given region as offline. <code>ctx.bypass()</code> will not have any
495    * impact on this hook.
496    * @param ctx the environment to interact with the framework and master
497    * @param regionInfo
498    */
499   void preRegionOffline(final ObserverContext<MasterCoprocessorEnvironment> ctx,
500       final HRegionInfo regionInfo) throws IOException;
501 
502   /**
503    * Called after the region has been marked offline.
504    * @param ctx the environment to interact with the framework and master
505    * @param regionInfo
506    */
507   void postRegionOffline(final ObserverContext<MasterCoprocessorEnvironment> ctx,
508       final HRegionInfo regionInfo) throws IOException;
509 
510   /**
511    * Called prior to requesting rebalancing of the cluster regions, though after
512    * the initial checks for regions in transition and the balance switch flag.
513    * @param ctx the environment to interact with the framework and master
514    */
515   void preBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx)
516       throws IOException;
517 
518   /**
519    * Called after the balancing plan has been submitted.
520    * @param ctx the environment to interact with the framework and master
521    * @param plans the RegionPlans which master has executed. RegionPlan serves as hint
522    * as for the final destination for the underlying region but may not represent the
523    * final state of assignment
524    */
525   void postBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx, List<RegionPlan> plans)
526       throws IOException;
527 
528   /**
529    * Called prior to modifying the flag used to enable/disable region balancing.
530    * @param ctx the coprocessor instance's environment
531    * @param newValue the new flag value submitted in the call
532    */
533   boolean preBalanceSwitch(final ObserverContext<MasterCoprocessorEnvironment> ctx,
534       final boolean newValue) throws IOException;
535 
536   /**
537    * Called after the flag to enable/disable balancing has changed.
538    * @param ctx the coprocessor instance's environment
539    * @param oldValue the previously set balanceSwitch value
540    * @param newValue the newly set balanceSwitch value
541    */
542   void postBalanceSwitch(final ObserverContext<MasterCoprocessorEnvironment> ctx,
543       final boolean oldValue, final boolean newValue) throws IOException;
544 
545   /**
546    * Called prior to shutting down the full HBase cluster, including this
547    * {@link org.apache.hadoop.hbase.master.HMaster} process.
548    */
549   void preShutdown(final ObserverContext<MasterCoprocessorEnvironment> ctx)
550       throws IOException;
551 
552 
553   /**
554    * Called immediately prior to stopping this
555    * {@link org.apache.hadoop.hbase.master.HMaster} process.
556    */
557   void preStopMaster(final ObserverContext<MasterCoprocessorEnvironment> ctx)
558       throws IOException;
559 
560   /**
561    * Called immediately after an active master instance has completed
562    * initialization.  Will not be called on standby master instances unless
563    * they take over the active role.
564    */
565   void postStartMaster(final ObserverContext<MasterCoprocessorEnvironment> ctx)
566       throws IOException;
567 
568   /**
569    * Call before the master initialization is set to true.
570    * {@link org.apache.hadoop.hbase.master.HMaster} process.
571    */
572   void preMasterInitialization(final ObserverContext<MasterCoprocessorEnvironment> ctx)
573       throws IOException;
574 
575   /**
576    * Called before a new snapshot is taken.
577    * Called as part of snapshot RPC call.
578    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
579    * @param ctx the environment to interact with the framework and master
580    * @param snapshot the SnapshotDescriptor for the snapshot
581    * @param hTableDescriptor the hTableDescriptor of the table to snapshot
582    * @throws IOException
583    */
584   void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
585       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
586       throws IOException;
587 
588   /**
589    * Called after the snapshot operation has been requested.
590    * Called as part of snapshot RPC call.
591    * @param ctx the environment to interact with the framework and master
592    * @param snapshot the SnapshotDescriptor for the snapshot
593    * @param hTableDescriptor the hTableDescriptor of the table to snapshot
594    * @throws IOException
595    */
596   void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
597       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
598       throws IOException;
599 
600   /**
601    * Called before a snapshot is cloned.
602    * Called as part of restoreSnapshot RPC call.
603    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
604    * @param ctx the environment to interact with the framework and master
605    * @param snapshot the SnapshotDescriptor for the snapshot
606    * @param hTableDescriptor the hTableDescriptor of the table to create
607    * @throws IOException
608    */
609   void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
610       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
611       throws IOException;
612 
613   /**
614    * Called after a snapshot clone operation has been requested.
615    * Called as part of restoreSnapshot RPC call.
616    * @param ctx the environment to interact with the framework and master
617    * @param snapshot the SnapshotDescriptor for the snapshot
618    * @param hTableDescriptor the hTableDescriptor of the table to create
619    * @throws IOException
620    */
621   void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
622       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
623       throws IOException;
624 
625   /**
626    * Called before a snapshot is restored.
627    * Called as part of restoreSnapshot RPC call.
628    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
629    * @param ctx the environment to interact with the framework and master
630    * @param snapshot the SnapshotDescriptor for the snapshot
631    * @param hTableDescriptor the hTableDescriptor of the table to restore
632    * @throws IOException
633    */
634   void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
635       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
636       throws IOException;
637 
638   /**
639    * Called after a snapshot restore operation has been requested.
640    * Called as part of restoreSnapshot RPC call.
641    * @param ctx the environment to interact with the framework and master
642    * @param snapshot the SnapshotDescriptor for the snapshot
643    * @param hTableDescriptor the hTableDescriptor of the table to restore
644    * @throws IOException
645    */
646   void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
647       final SnapshotDescription snapshot, final HTableDescriptor hTableDescriptor)
648       throws IOException;
649 
650   /**
651    * Called before a snapshot is deleted.
652    * Called as part of deleteSnapshot RPC call.
653    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
654    * @param ctx the environment to interact with the framework and master
655    * @param snapshot the SnapshotDescriptor of the snapshot to delete
656    * @throws IOException
657    */
658   void preDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
659       final SnapshotDescription snapshot) throws IOException;
660 
661   /**
662    * Called after the delete snapshot operation has been requested.
663    * Called as part of deleteSnapshot RPC call.
664    * @param ctx the environment to interact with the framework and master
665    * @param snapshot the SnapshotDescriptor of the snapshot to delete
666    * @throws IOException
667    */
668   void postDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
669       final SnapshotDescription snapshot) throws IOException;
670 
671   /**
672    * Called before a getTableDescriptors request has been processed.
673    * @param ctx the environment to interact with the framework and master
674    * @param tableNamesList the list of table names, or null if querying for all
675    * @param descriptors an empty list, can be filled with what to return if bypassing
676    * @throws IOException
677    */
678   void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
679       List<TableName> tableNamesList,
680       List<HTableDescriptor> descriptors) throws IOException;
681 
682   /**
683    * Called after a getTableDescriptors request has been processed.
684    * @param ctx the environment to interact with the framework and master
685    * @param descriptors the list of descriptors about to be returned
686    * @throws IOException
687    */
688   void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
689       List<HTableDescriptor> descriptors) throws IOException;
690 
691   /**
692    * Called before a new namespace is created by
693    * {@link org.apache.hadoop.hbase.master.HMaster}.
694    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
695    * @param ctx the environment to interact with the framework and master
696    * @param ns the NamespaceDescriptor for the table
697    * @throws IOException
698    */
699   void preCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
700       NamespaceDescriptor ns) throws IOException;
701   /**
702    * Called after the createNamespace operation has been requested.
703    * @param ctx the environment to interact with the framework and master
704    * @param ns the NamespaceDescriptor for the table
705    * @throws IOException
706    */
707   void postCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
708        NamespaceDescriptor ns) throws IOException;
709 
710   /**
711    * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a
712    * namespace
713    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
714    * @param ctx the environment to interact with the framework and master
715    * @param namespace the name of the namespace
716    */
717   void preDeleteNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
718       String namespace) throws IOException;
719 
720   /**
721    * Called after the deleteNamespace operation has been requested.
722    * @param ctx the environment to interact with the framework and master
723    * @param namespace the name of the namespace
724    */
725   void postDeleteNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
726       String namespace) throws IOException;
727 
728   /**
729    * Called prior to modifying a namespace's properties.
730    * It can't bypass the default action, e.g., ctx.bypass() won't have effect.
731    * @param ctx the environment to interact with the framework and master
732    * @param ns the NamespaceDescriptor
733    */
734   void preModifyNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
735       NamespaceDescriptor ns) throws IOException;
736 
737   /**
738    * Called after the modifyNamespace operation has been requested.
739    * @param ctx the environment to interact with the framework and master
740    * @param ns the NamespaceDescriptor
741    */
742   void postModifyNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
743       NamespaceDescriptor ns) throws IOException;
744 
745   /**
746    * Called before the table memstore is flushed to disk.
747    * @param ctx the environment to interact with the framework and master
748    * @param tableName the name of the table
749    * @throws IOException
750    */
751   void preTableFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx,
752       final TableName tableName) throws IOException;
753 
754   /**
755    * Called after the table memstore is flushed to disk.
756    * @param ctx the environment to interact with the framework and master
757    * @param tableName the name of the table
758    * @throws IOException
759    */
760   void postTableFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx,
761       final TableName tableName) throws IOException;
762 
763   /**
764    * Called before the quota for the user is stored.
765    * @param ctx the environment to interact with the framework and master
766    * @param userName the name of user
767    * @param quotas the quota settings
768    * @throws IOException
769    */
770   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
771       final String userName, final Quotas quotas) throws IOException;
772 
773   /**
774    * Called after the quota for the user is stored.
775    * @param ctx the environment to interact with the framework and master
776    * @param userName the name of user
777    * @param quotas the quota settings
778    * @throws IOException
779    */
780   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
781       final String userName, final Quotas quotas) throws IOException;
782 
783   /**
784    * Called before the quota for the user on the specified table is stored.
785    * @param ctx the environment to interact with the framework and master
786    * @param userName the name of user
787    * @param tableName the name of the table
788    * @param quotas the quota settings
789    * @throws IOException
790    */
791   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
792       final String userName, final TableName tableName, final Quotas quotas) throws IOException;
793 
794   /**
795    * Called after the quota for the user on the specified table is stored.
796    * @param ctx the environment to interact with the framework and master
797    * @param userName the name of user
798    * @param tableName the name of the table
799    * @param quotas the quota settings
800    * @throws IOException
801    */
802   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
803       final String userName, final TableName tableName, final Quotas quotas) throws IOException;
804 
805   /**
806    * Called before the quota for the user on the specified namespace is stored.
807    * @param ctx the environment to interact with the framework and master
808    * @param userName the name of user
809    * @param namespace the name of the namespace
810    * @param quotas the quota settings
811    * @throws IOException
812    */
813   void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
814       final String userName, final String namespace, final Quotas quotas) throws IOException;
815 
816   /**
817    * Called after the quota for the user on the specified namespace is stored.
818    * @param ctx the environment to interact with the framework and master
819    * @param userName the name of user
820    * @param namespace the name of the namespace
821    * @param quotas the quota settings
822    * @throws IOException
823    */
824   void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
825       final String userName, final String namespace, final Quotas quotas) throws IOException;
826 
827   /**
828    * Called before the quota for the table is stored.
829    * @param ctx the environment to interact with the framework and master
830    * @param tableName the name of the table
831    * @param quotas the quota settings
832    * @throws IOException
833    */
834   void preSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
835       final TableName tableName, final Quotas quotas) throws IOException;
836 
837   /**
838    * Called after the quota for the table is stored.
839    * @param ctx the environment to interact with the framework and master
840    * @param tableName the name of the table
841    * @param quotas the quota settings
842    * @throws IOException
843    */
844   void postSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
845       final TableName tableName, final Quotas quotas) throws IOException;
846 
847   /**
848    * Called before the quota for the namespace is stored.
849    * @param ctx the environment to interact with the framework and master
850    * @param namespace the name of the namespace
851    * @param quotas the quota settings
852    * @throws IOException
853    */
854   void preSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
855       final String namespace, final Quotas quotas) throws IOException;
856 
857   /**
858    * Called after the quota for the namespace is stored.
859    * @param ctx the environment to interact with the framework and master
860    * @param namespace the name of the namespace
861    * @param quotas the quota settings
862    * @throws IOException
863    */
864   void postSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
865       final String namespace, final Quotas quotas) throws IOException;
866 }