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