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