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