001/*
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase.coprocessor;
019
020import java.io.IOException;
021import java.util.List;
022import java.util.Map;
023import java.util.Set;
024import org.apache.hadoop.conf.Configuration;
025import org.apache.hadoop.hbase.ClusterMetrics;
026import org.apache.hadoop.hbase.HBaseInterfaceAudience;
027import org.apache.hadoop.hbase.MetaMutationAnnotation;
028import org.apache.hadoop.hbase.NamespaceDescriptor;
029import org.apache.hadoop.hbase.ServerName;
030import org.apache.hadoop.hbase.TableName;
031import org.apache.hadoop.hbase.client.BalanceRequest;
032import org.apache.hadoop.hbase.client.BalanceResponse;
033import org.apache.hadoop.hbase.client.MasterSwitchType;
034import org.apache.hadoop.hbase.client.Mutation;
035import org.apache.hadoop.hbase.client.RegionInfo;
036import org.apache.hadoop.hbase.client.SnapshotDescription;
037import org.apache.hadoop.hbase.client.TableDescriptor;
038import org.apache.hadoop.hbase.master.RegionPlan;
039import org.apache.hadoop.hbase.net.Address;
040import org.apache.hadoop.hbase.quotas.GlobalQuotaSettings;
041import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
042import org.apache.hadoop.hbase.replication.SyncReplicationState;
043import org.apache.hadoop.hbase.security.access.Permission;
044import org.apache.hadoop.hbase.security.access.UserPermission;
045import org.apache.yetus.audience.InterfaceAudience;
046import org.apache.yetus.audience.InterfaceStability;
047
048/**
049 * Defines coprocessor hooks for interacting with operations on the
050 * {@link org.apache.hadoop.hbase.master.HMaster} process. <br>
051 * <br>
052 * Since most implementations will be interested in only a subset of hooks, this class uses
053 * 'default' functions to avoid having to add unnecessary overrides. When the functions are
054 * non-empty, it's simply to satisfy the compiler by returning value of expected (non-void) type. It
055 * is done in a way that these default definitions act as no-op. So our suggestion to implementation
056 * would be to not call these 'default' methods from overrides. <br>
057 * <br>
058 * <h3>Exception Handling</h3> For all functions, exception handling is done as follows:
059 * <ul>
060 * <li>Exceptions of type {@link IOException} are reported back to client.</li>
061 * <li>For any other kind of exception:
062 * <ul>
063 * <li>If the configuration {@link CoprocessorHost#ABORT_ON_ERROR_KEY} is set to true, then the
064 * server aborts.</li>
065 * <li>Otherwise, coprocessor is removed from the server and
066 * {@link org.apache.hadoop.hbase.DoNotRetryIOException} is returned to the client.</li>
067 * </ul>
068 * </li>
069 * </ul>
070 */
071@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
072@InterfaceStability.Evolving
073public interface MasterObserver {
074
075  /**
076   * Called before we create the region infos for this table. Called as part of create table RPC
077   * call.
078   * @param ctx  the environment to interact with the framework and master
079   * @param desc the TableDescriptor for the table
080   * @return the TableDescriptor used to create the table. Default is the one passed in. Return
081   *         {@code null} means cancel the creation.
082   */
083  default TableDescriptor preCreateTableRegionsInfos(
084    final ObserverContext<MasterCoprocessorEnvironment> ctx, TableDescriptor desc)
085    throws IOException {
086    return desc;
087  }
088
089  /**
090   * Called before a new table is created by {@link org.apache.hadoop.hbase.master.HMaster}. Called
091   * as part of create table RPC call.
092   * @param ctx     the environment to interact with the framework and master
093   * @param desc    the TableDescriptor for the table
094   * @param regions the initial regions created for the table
095   */
096  default void preCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
097    TableDescriptor desc, RegionInfo[] regions) throws IOException {
098  }
099
100  /**
101   * Called after the createTable operation has been requested. Called as part of create table RPC
102   * call.
103   * @param ctx     the environment to interact with the framework and master
104   * @param desc    the TableDescriptor for the table
105   * @param regions the initial regions created for the table
106   */
107  default void postCreateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
108    TableDescriptor desc, RegionInfo[] regions) throws IOException {
109  }
110
111  /**
112   * Called before a new table is created by {@link org.apache.hadoop.hbase.master.HMaster}. Called
113   * as part of create table procedure and it is async to the create RPC call.
114   * @param ctx     the environment to interact with the framework and master
115   * @param desc    the TableDescriptor for the table
116   * @param regions the initial regions created for the table
117   */
118  default void preCreateTableAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
119    final TableDescriptor desc, final RegionInfo[] regions) throws IOException {
120  }
121
122  /**
123   * Called after the createTable operation has been requested. Called as part of create table RPC
124   * call. Called as part of create table procedure and it is async to the create RPC call.
125   * @param ctx     the environment to interact with the framework and master
126   * @param desc    the TableDescriptor for the table
127   * @param regions the initial regions created for the table
128   */
129  default void postCompletedCreateTableAction(
130    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableDescriptor desc,
131    final RegionInfo[] regions) throws IOException {
132  }
133
134  /**
135   * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a table. Called as part of
136   * delete table RPC call.
137   * @param ctx       the environment to interact with the framework and master
138   * @param tableName the name of the table
139   */
140  default void preDeleteTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
141    TableName tableName) throws IOException {
142  }
143
144  /**
145   * Called after the deleteTable operation has been requested. Called as part of delete table RPC
146   * call.
147   * @param ctx       the environment to interact with the framework and master
148   * @param tableName the name of the table
149   */
150  default void postDeleteTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
151    TableName tableName) throws IOException {
152  }
153
154  /**
155   * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a table. Called as part of
156   * delete table procedure and it is async to the delete RPC call.
157   * @param ctx       the environment to interact with the framework and master
158   * @param tableName the name of the table
159   */
160  default void preDeleteTableAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
161    final TableName tableName) throws IOException {
162  }
163
164  /**
165   * Called after {@link org.apache.hadoop.hbase.master.HMaster} deletes a table. Called as part of
166   * delete table procedure and it is async to the delete RPC call.
167   * @param ctx       the environment to interact with the framework and master
168   * @param tableName the name of the table
169   */
170  default void postCompletedDeleteTableAction(
171    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
172    throws IOException {
173  }
174
175  /**
176   * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a table. Called as part
177   * of truncate table RPC call.
178   * @param ctx       the environment to interact with the framework and master
179   * @param tableName the name of the table
180   */
181  default void preTruncateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
182    TableName tableName) throws IOException {
183  }
184
185  /**
186   * Called after the truncateTable operation has been requested. Called as part of truncate table
187   * RPC call. The truncate is synchronous, so this method will be called when the truncate
188   * operation is terminated.
189   * @param ctx       the environment to interact with the framework and master
190   * @param tableName the name of the table
191   */
192  default void postTruncateTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
193    TableName tableName) throws IOException {
194  }
195
196  /**
197   * Called before {@link org.apache.hadoop.hbase.master.HMaster} truncates a table. Called as part
198   * of truncate table procedure and it is async to the truncate RPC call.
199   * @param ctx       the environment to interact with the framework and master
200   * @param tableName the name of the table
201   */
202  default void preTruncateTableAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
203    final TableName tableName) throws IOException {
204  }
205
206  /**
207   * Called after {@link org.apache.hadoop.hbase.master.HMaster} truncates a table. Called as part
208   * of truncate table procedure and it is async to the truncate RPC call.
209   * @param ctx       the environment to interact with the framework and master
210   * @param tableName the name of the table
211   */
212  default void postCompletedTruncateTableAction(
213    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
214    throws IOException {
215  }
216
217  /**
218   * Called prior to modifying a table's properties. Called as part of modify table RPC call.
219   * @param ctx               the environment to interact with the framework and master
220   * @param tableName         the name of the table
221   * @param currentDescriptor current TableDescriptor of the table
222   * @param newDescriptor     after modify operation, table will have this descriptor
223   */
224  default TableDescriptor preModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
225    final TableName tableName, TableDescriptor currentDescriptor, TableDescriptor newDescriptor)
226    throws IOException {
227    return newDescriptor;
228  }
229
230  /**
231   * Called after the modifyTable operation has been requested. Called as part of modify table RPC
232   * call.
233   * @param ctx               the environment to interact with the framework and master
234   * @param tableName         the name of the table
235   * @param oldDescriptor     descriptor of table before modify operation happened
236   * @param currentDescriptor current TableDescriptor of the table
237   */
238  default void postModifyTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
239    final TableName tableName, TableDescriptor oldDescriptor, TableDescriptor currentDescriptor)
240    throws IOException {
241  }
242
243  /**
244   * Called prior to modifying a table's store file tracker. Called as part of modify table store
245   * file tracker RPC call.
246   * @param ctx       the environment to interact with the framework and master
247   * @param tableName the name of the table
248   * @param dstSFT    the store file tracker
249   * @return the store file tracker
250   */
251  default String preModifyTableStoreFileTracker(
252    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName,
253    String dstSFT) throws IOException {
254    return dstSFT;
255  }
256
257  /**
258   * Called after modifying a table's store file tracker. Called as part of modify table store file
259   * tracker RPC call.
260   * @param ctx       the environment to interact with the framework and master
261   * @param tableName the name of the table
262   * @param dstSFT    the store file tracker
263   */
264  default void postModifyTableStoreFileTracker(
265    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName,
266    String dstSFT) throws IOException {
267  }
268
269  /**
270   * Called prior to modifying a family's store file tracker. Called as part of modify family store
271   * file tracker RPC call.
272   * @param ctx       the environment to interact with the framework and master
273   * @param tableName the name of the table
274   * @param family    the column family
275   * @param dstSFT    the store file tracker
276   * @return the store file tracker
277   */
278  default String preModifyColumnFamilyStoreFileTracker(
279    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName,
280    final byte[] family, String dstSFT) throws IOException {
281    return dstSFT;
282  }
283
284  /**
285   * Called after modifying a family store file tracker. Called as part of modify family store file
286   * tracker RPC call.
287   * @param ctx       the environment to interact with the framework and master
288   * @param tableName the name of the table
289   * @param family    the column family
290   * @param dstSFT    the store file tracker
291   */
292  default void postModifyColumnFamilyStoreFileTracker(
293    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName,
294    final byte[] family, String dstSFT) throws IOException {
295  }
296
297  /**
298   * Called prior to modifying a table's properties. Called as part of modify table procedure and it
299   * is async to the modify table RPC call.
300   * @param ctx               the environment to interact with the framework and master
301   * @param tableName         the name of the table
302   * @param currentDescriptor current TableDescriptor of the table
303   * @param newDescriptor     after modify operation, table will have this descriptor
304   */
305  default void preModifyTableAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
306    final TableName tableName, final TableDescriptor currentDescriptor,
307    final TableDescriptor newDescriptor) throws IOException {
308  }
309
310  /**
311   * Called after to modifying a table's properties. Called as part of modify table procedure and it
312   * is async to the modify table RPC call.
313   * @param ctx               the environment to interact with the framework and master
314   * @param tableName         the name of the table
315   * @param oldDescriptor     descriptor of table before modify operation happened
316   * @param currentDescriptor current TableDescriptor of the table
317   */
318  default void postCompletedModifyTableAction(
319    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName,
320    final TableDescriptor oldDescriptor, final TableDescriptor currentDescriptor)
321    throws IOException {
322  }
323
324  /**
325   * Called prior to enabling a table. Called as part of enable table RPC call.
326   * @param ctx       the environment to interact with the framework and master
327   * @param tableName the name of the table
328   */
329  default void preEnableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
330    final TableName tableName) throws IOException {
331  }
332
333  /**
334   * Called after the enableTable operation has been requested. Called as part of enable table RPC
335   * call.
336   * @param ctx       the environment to interact with the framework and master
337   * @param tableName the name of the table
338   */
339  default void postEnableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
340    final TableName tableName) throws IOException {
341  }
342
343  /**
344   * Called prior to enabling a table. Called as part of enable table procedure and it is async to
345   * the enable table RPC call.
346   * @param ctx       the environment to interact with the framework and master
347   * @param tableName the name of the table
348   */
349  default void preEnableTableAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
350    final TableName tableName) throws IOException {
351  }
352
353  /**
354   * Called after the enableTable operation has been requested. Called as part of enable table
355   * procedure and it is async to the enable table RPC call.
356   * @param ctx       the environment to interact with the framework and master
357   * @param tableName the name of the table
358   */
359  default void postCompletedEnableTableAction(
360    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
361    throws IOException {
362  }
363
364  /**
365   * Called prior to disabling a table. Called as part of disable table RPC call.
366   * @param ctx       the environment to interact with the framework and master
367   * @param tableName the name of the table
368   */
369  default void preDisableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
370    final TableName tableName) throws IOException {
371  }
372
373  /**
374   * Called after the disableTable operation has been requested. Called as part of disable table RPC
375   * call.
376   * @param ctx       the environment to interact with the framework and master
377   * @param tableName the name of the table
378   */
379  default void postDisableTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
380    final TableName tableName) throws IOException {
381  }
382
383  /**
384   * Called prior to disabling a table. Called as part of disable table procedure and it is asyn to
385   * the disable table RPC call.
386   * @param ctx       the environment to interact with the framework and master
387   * @param tableName the name of the table
388   */
389  default void preDisableTableAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
390    final TableName tableName) throws IOException {
391  }
392
393  /**
394   * Called after the disableTable operation has been requested. Called as part of disable table
395   * procedure and it is asyn to the disable table RPC call.
396   * @param ctx       the environment to interact with the framework and master
397   * @param tableName the name of the table
398   */
399  default void postCompletedDisableTableAction(
400    final ObserverContext<MasterCoprocessorEnvironment> ctx, final TableName tableName)
401    throws IOException {
402  }
403
404  /**
405   * Called before a abortProcedure request has been processed.
406   * @param ctx    the environment to interact with the framework and master
407   * @param procId the Id of the procedure
408   */
409  default void preAbortProcedure(ObserverContext<MasterCoprocessorEnvironment> ctx,
410    final long procId) throws IOException {
411  }
412
413  /**
414   * Called after a abortProcedure request has been processed.
415   * @param ctx the environment to interact with the framework and master
416   */
417  default void postAbortProcedure(ObserverContext<MasterCoprocessorEnvironment> ctx)
418    throws IOException {
419  }
420
421  /**
422   * Called before a getProcedures request has been processed.
423   * @param ctx the environment to interact with the framework and master
424   */
425  default void preGetProcedures(ObserverContext<MasterCoprocessorEnvironment> ctx)
426    throws IOException {
427  }
428
429  /**
430   * Called after a getProcedures request has been processed.
431   * @param ctx the environment to interact with the framework and master
432   */
433  default void postGetProcedures(ObserverContext<MasterCoprocessorEnvironment> ctx)
434    throws IOException {
435  }
436
437  /**
438   * Called before a getLocks request has been processed.
439   * @param ctx the environment to interact with the framework and master
440   * @throws IOException if something went wrong
441   */
442  default void preGetLocks(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
443  }
444
445  /**
446   * Called after a getLocks request has been processed.
447   * @param ctx the environment to interact with the framework and master
448   * @throws IOException if something went wrong
449   */
450  default void postGetLocks(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
451  }
452
453  /**
454   * Called prior to moving a given region from one region server to another.
455   * @param ctx        the environment to interact with the framework and master
456   * @param region     the RegionInfo
457   * @param srcServer  the source ServerName
458   * @param destServer the destination ServerName
459   */
460  default void preMove(final ObserverContext<MasterCoprocessorEnvironment> ctx,
461    final RegionInfo region, final ServerName srcServer, final ServerName destServer)
462    throws IOException {
463  }
464
465  /**
466   * Called after the region move has been requested.
467   * @param ctx        the environment to interact with the framework and master
468   * @param region     the RegionInfo
469   * @param srcServer  the source ServerName
470   * @param destServer the destination ServerName
471   */
472  default void postMove(final ObserverContext<MasterCoprocessorEnvironment> ctx,
473    final RegionInfo region, final ServerName srcServer, final ServerName destServer)
474    throws IOException {
475  }
476
477  /**
478   * Called prior to assigning a specific region.
479   * @param ctx        the environment to interact with the framework and master
480   * @param regionInfo the regionInfo of the region
481   */
482  default void preAssign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
483    final RegionInfo regionInfo) throws IOException {
484  }
485
486  /**
487   * Called after the region assignment has been requested.
488   * @param ctx        the environment to interact with the framework and master
489   * @param regionInfo the regionInfo of the region
490   */
491  default void postAssign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
492    final RegionInfo regionInfo) throws IOException {
493  }
494
495  /**
496   * Called prior to unassigning a given region.
497   * @param ctx the environment to interact with the framework and master
498   */
499  default void preUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
500    final RegionInfo regionInfo) throws IOException {
501  }
502
503  /**
504   * Called after the region unassignment has been requested.
505   * @param ctx the environment to interact with the framework and master
506   */
507  default void postUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
508    final RegionInfo regionInfo) throws IOException {
509  }
510
511  /**
512   * Called prior to marking a given region as offline.
513   * @param ctx the environment to interact with the framework and master
514   */
515  default void preRegionOffline(final ObserverContext<MasterCoprocessorEnvironment> ctx,
516    final RegionInfo regionInfo) throws IOException {
517  }
518
519  /**
520   * Called after the region has been marked offline.
521   * @param ctx the environment to interact with the framework and master
522   */
523  default void postRegionOffline(final ObserverContext<MasterCoprocessorEnvironment> ctx,
524    final RegionInfo regionInfo) throws IOException {
525  }
526
527  /**
528   * Called prior to requesting rebalancing of the cluster regions, though after the initial checks
529   * for regions in transition and the balance switch flag.
530   * @param ctx     the environment to interact with the framework and master
531   * @param request the request used to trigger the balancer
532   */
533  default void preBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx,
534    BalanceRequest request) throws IOException {
535  }
536
537  /**
538   * Called after the balancing plan has been submitted.
539   * @param ctx     the environment to interact with the framework and master
540   * @param request the request used to trigger the balance
541   * @param plans   the RegionPlans which master has executed. RegionPlan serves as hint as for the
542   *                final destination for the underlying region but may not represent the final
543   *                state of assignment
544   */
545  default void postBalance(final ObserverContext<MasterCoprocessorEnvironment> ctx,
546    BalanceRequest request, List<RegionPlan> plans) throws IOException {
547  }
548
549  /**
550   * Called prior to setting split / merge switch Supports Coprocessor 'bypass'.
551   * @param ctx        the coprocessor instance's environment
552   * @param newValue   the new value submitted in the call
553   * @param switchType type of switch
554   */
555  default void preSetSplitOrMergeEnabled(final ObserverContext<MasterCoprocessorEnvironment> ctx,
556    final boolean newValue, final MasterSwitchType switchType) throws IOException {
557  }
558
559  /**
560   * Called after setting split / merge switch
561   * @param ctx        the coprocessor instance's environment
562   * @param newValue   the new value submitted in the call
563   * @param switchType type of switch
564   */
565  default void postSetSplitOrMergeEnabled(final ObserverContext<MasterCoprocessorEnvironment> ctx,
566    final boolean newValue, final MasterSwitchType switchType) throws IOException {
567  }
568
569  /**
570   * Called before the split region procedure is called.
571   * @param c         the environment to interact with the framework and master
572   * @param tableName the table where the region belongs to
573   * @param splitRow  split point
574   */
575  default void preSplitRegion(final ObserverContext<MasterCoprocessorEnvironment> c,
576    final TableName tableName, final byte[] splitRow) throws IOException {
577  }
578
579  /**
580   * Called before the region is split.
581   * @param c         the environment to interact with the framework and master
582   * @param tableName the table where the region belongs to
583   * @param splitRow  split point
584   */
585  default void preSplitRegionAction(final ObserverContext<MasterCoprocessorEnvironment> c,
586    final TableName tableName, final byte[] splitRow) throws IOException {
587  }
588
589  /**
590   * Called before the region is truncated.
591   * @param c          The environment to interact with the framework and master
592   * @param regionInfo The Region being truncated
593   */
594  @SuppressWarnings("unused")
595  default void preTruncateRegionAction(final ObserverContext<MasterCoprocessorEnvironment> c,
596    final RegionInfo regionInfo) {
597  }
598
599  /**
600   * Called before the truncate region procedure is called.
601   * @param c          The environment to interact with the framework and master
602   * @param regionInfo The Region being truncated
603   */
604  @SuppressWarnings("unused")
605  default void preTruncateRegion(final ObserverContext<MasterCoprocessorEnvironment> c,
606    RegionInfo regionInfo) {
607  }
608
609  /**
610   * Called after the truncate region procedure is called.
611   * @param c          The environment to interact with the framework and master
612   * @param regionInfo The Region being truncated
613   */
614  @SuppressWarnings("unused")
615  default void postTruncateRegion(final ObserverContext<MasterCoprocessorEnvironment> c,
616    RegionInfo regionInfo) {
617  }
618
619  /**
620   * Called post the region is truncated.
621   * @param c          The environment to interact with the framework and master
622   * @param regionInfo The Region To be truncated
623   */
624  @SuppressWarnings("unused")
625  default void postTruncateRegionAction(final ObserverContext<MasterCoprocessorEnvironment> c,
626    final RegionInfo regionInfo) {
627  }
628
629  /**
630   * Called after the region is split.
631   * @param c           the environment to interact with the framework and master
632   * @param regionInfoA the left daughter region
633   * @param regionInfoB the right daughter region
634   */
635  default void postCompletedSplitRegionAction(final ObserverContext<MasterCoprocessorEnvironment> c,
636    final RegionInfo regionInfoA, final RegionInfo regionInfoB) throws IOException {
637  }
638
639  /**
640   * This will be called before update META step as part of split transaction.
641   * @param ctx the environment to interact with the framework and master
642   */
643  default void preSplitRegionBeforeMETAAction(
644    final ObserverContext<MasterCoprocessorEnvironment> ctx, final byte[] splitKey,
645    final List<Mutation> metaEntries) throws IOException {
646  }
647
648  /**
649   * This will be called after update META step as part of split transaction
650   * @param ctx the environment to interact with the framework and master
651   */
652  default void preSplitRegionAfterMETAAction(
653    final ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
654  }
655
656  /**
657   * This will be called after the roll back of the split region is completed
658   * @param ctx the environment to interact with the framework and master
659   */
660  default void postRollBackSplitRegionAction(
661    final ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
662  }
663
664  /**
665   * Called before the regions merge.
666   * @param ctx the environment to interact with the framework and master
667   */
668  default void preMergeRegionsAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
669    final RegionInfo[] regionsToMerge) throws IOException {
670  }
671
672  /**
673   * called after the regions merge.
674   * @param ctx the environment to interact with the framework and master
675   */
676  default void postCompletedMergeRegionsAction(
677    final ObserverContext<MasterCoprocessorEnvironment> ctx, final RegionInfo[] regionsToMerge,
678    final RegionInfo mergedRegion) throws IOException {
679  }
680
681  /**
682   * This will be called before update META step as part of regions merge transaction.
683   * @param ctx         the environment to interact with the framework and master
684   * @param metaEntries mutations to execute on hbase:meta atomically with regions merge updates.
685   *                    Any puts or deletes to execute on hbase:meta can be added to the mutations.
686   */
687  default void preMergeRegionsCommitAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
688    final RegionInfo[] regionsToMerge, @MetaMutationAnnotation List<Mutation> metaEntries)
689    throws IOException {
690  }
691
692  /**
693   * This will be called after META step as part of regions merge transaction.
694   * @param ctx the environment to interact with the framework and master
695   */
696  default void postMergeRegionsCommitAction(final ObserverContext<MasterCoprocessorEnvironment> ctx,
697    final RegionInfo[] regionsToMerge, final RegionInfo mergedRegion) throws IOException {
698  }
699
700  /**
701   * This will be called after the roll back of the regions merge.
702   * @param ctx the environment to interact with the framework and master
703   */
704  default void postRollBackMergeRegionsAction(
705    final ObserverContext<MasterCoprocessorEnvironment> ctx, final RegionInfo[] regionsToMerge)
706    throws IOException {
707  }
708
709  /**
710   * Called prior to modifying the flag used to enable/disable region balancing.
711   * @param ctx the coprocessor instance's environment
712   */
713  default void preBalanceSwitch(final ObserverContext<MasterCoprocessorEnvironment> ctx,
714    final boolean newValue) throws IOException {
715  }
716
717  /**
718   * Called after the flag to enable/disable balancing has changed.
719   * @param ctx      the coprocessor instance's environment
720   * @param oldValue the previously set balanceSwitch value
721   * @param newValue the newly set balanceSwitch value
722   */
723  default void postBalanceSwitch(final ObserverContext<MasterCoprocessorEnvironment> ctx,
724    final boolean oldValue, final boolean newValue) throws IOException {
725  }
726
727  /**
728   * Called prior to shutting down the full HBase cluster, including this
729   * {@link org.apache.hadoop.hbase.master.HMaster} process.
730   */
731  default void preShutdown(final ObserverContext<MasterCoprocessorEnvironment> ctx)
732    throws IOException {
733  }
734
735  /**
736   * Called immediately prior to stopping this {@link org.apache.hadoop.hbase.master.HMaster}
737   * process.
738   */
739  default void preStopMaster(final ObserverContext<MasterCoprocessorEnvironment> ctx)
740    throws IOException {
741  }
742
743  /**
744   * Called immediately after an active master instance has completed initialization. Will not be
745   * called on standby master instances unless they take over the active role.
746   */
747  default void postStartMaster(final ObserverContext<MasterCoprocessorEnvironment> ctx)
748    throws IOException {
749  }
750
751  /**
752   * Call before the master initialization is set to true.
753   * {@link org.apache.hadoop.hbase.master.HMaster} process.
754   */
755  default void preMasterInitialization(final ObserverContext<MasterCoprocessorEnvironment> ctx)
756    throws IOException {
757  }
758
759  /**
760   * Called before a new snapshot is taken. Called as part of snapshot RPC call.
761   * @param ctx             the environment to interact with the framework and master
762   * @param snapshot        the SnapshotDescriptor for the snapshot
763   * @param tableDescriptor the TableDescriptor of the table to snapshot
764   */
765  default void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
766    final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {
767  }
768
769  /**
770   * Called after the snapshot operation has been requested. Called as part of snapshot RPC call.
771   * @param ctx             the environment to interact with the framework and master
772   * @param snapshot        the SnapshotDescriptor for the snapshot
773   * @param tableDescriptor the TableDescriptor of the table to snapshot
774   */
775  default void postSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
776    final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {
777  }
778
779  /**
780   * Called after the snapshot operation has been completed.
781   * @param ctx             the environment to interact with the framework and master
782   * @param snapshot        the SnapshotDescriptor for the snapshot
783   * @param tableDescriptor the TableDescriptor of the table to snapshot
784   */
785  default void postCompletedSnapshotAction(ObserverContext<MasterCoprocessorEnvironment> ctx,
786    SnapshotDescription snapshot, TableDescriptor tableDescriptor) throws IOException {
787  }
788
789  /**
790   * Called before listSnapshots request has been processed.
791   * @param ctx      the environment to interact with the framework and master
792   * @param snapshot the SnapshotDescriptor of the snapshot to list
793   */
794  default void preListSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
795    final SnapshotDescription snapshot) throws IOException {
796  }
797
798  /**
799   * Called after listSnapshots request has been processed.
800   * @param ctx      the environment to interact with the framework and master
801   * @param snapshot the SnapshotDescriptor of the snapshot to list
802   */
803  default void postListSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
804    final SnapshotDescription snapshot) throws IOException {
805  }
806
807  /**
808   * Called before a snapshot is cloned. Called as part of restoreSnapshot RPC call.
809   * @param ctx             the environment to interact with the framework and master
810   * @param snapshot        the SnapshotDescriptor for the snapshot
811   * @param tableDescriptor the TableDescriptor of the table to create
812   */
813  default void preCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
814    final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {
815  }
816
817  /**
818   * Called after a snapshot clone operation has been requested. Called as part of restoreSnapshot
819   * RPC call.
820   * @param ctx             the environment to interact with the framework and master
821   * @param snapshot        the SnapshotDescriptor for the snapshot
822   * @param tableDescriptor the v of the table to create
823   */
824  default void postCloneSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
825    final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {
826  }
827
828  /**
829   * Called before a snapshot is restored. Called as part of restoreSnapshot RPC call.
830   * @param ctx             the environment to interact with the framework and master
831   * @param snapshot        the SnapshotDescriptor for the snapshot
832   * @param tableDescriptor the TableDescriptor of the table to restore
833   */
834  default void preRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
835    final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {
836  }
837
838  /**
839   * Called after a snapshot restore operation has been requested. Called as part of restoreSnapshot
840   * RPC call.
841   * @param ctx             the environment to interact with the framework and master
842   * @param snapshot        the SnapshotDescriptor for the snapshot
843   * @param tableDescriptor the TableDescriptor of the table to restore
844   */
845  default void postRestoreSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
846    final SnapshotDescription snapshot, final TableDescriptor tableDescriptor) throws IOException {
847  }
848
849  /**
850   * Called before a snapshot is deleted. Called as part of deleteSnapshot RPC call.
851   * @param ctx      the environment to interact with the framework and master
852   * @param snapshot the SnapshotDescriptor of the snapshot to delete
853   */
854  default void preDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
855    final SnapshotDescription snapshot) throws IOException {
856  }
857
858  /**
859   * Called after the delete snapshot operation has been requested. Called as part of deleteSnapshot
860   * RPC call.
861   * @param ctx      the environment to interact with the framework and master
862   * @param snapshot the SnapshotDescriptor of the snapshot to delete
863   */
864  default void postDeleteSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx,
865    final SnapshotDescription snapshot) throws IOException {
866  }
867
868  /**
869   * Called before a getTableDescriptors request has been processed.
870   * @param ctx            the environment to interact with the framework and master
871   * @param tableNamesList the list of table names, or null if querying for all
872   * @param descriptors    an empty list, can be filled with what to return in coprocessor
873   * @param regex          regular expression used for filtering the table names
874   */
875  default void preGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
876    List<TableName> tableNamesList, List<TableDescriptor> descriptors, String regex)
877    throws IOException {
878  }
879
880  /**
881   * Called after a getTableDescriptors request has been processed.
882   * @param ctx            the environment to interact with the framework and master
883   * @param tableNamesList the list of table names, or null if querying for all
884   * @param descriptors    the list of descriptors about to be returned
885   * @param regex          regular expression used for filtering the table names
886   */
887  default void postGetTableDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
888    List<TableName> tableNamesList, List<TableDescriptor> descriptors, String regex)
889    throws IOException {
890  }
891
892  /**
893   * Called before a getTableNames request has been processed.
894   * @param ctx         the environment to interact with the framework and master
895   * @param descriptors an empty list, can be filled with what to return by coprocessor
896   * @param regex       regular expression used for filtering the table names
897   */
898  default void preGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
899    List<TableDescriptor> descriptors, String regex) throws IOException {
900  }
901
902  /**
903   * Called after a getTableNames request has been processed.
904   * @param ctx         the environment to interact with the framework and master
905   * @param descriptors the list of descriptors about to be returned
906   * @param regex       regular expression used for filtering the table names
907   */
908  default void postGetTableNames(ObserverContext<MasterCoprocessorEnvironment> ctx,
909    List<TableDescriptor> descriptors, String regex) throws IOException {
910  }
911
912  /**
913   * Called before a new namespace is created by {@link org.apache.hadoop.hbase.master.HMaster}.
914   * @param ctx the environment to interact with the framework and master
915   * @param ns  the NamespaceDescriptor for the table
916   */
917  default void preCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
918    NamespaceDescriptor ns) throws IOException {
919  }
920
921  /**
922   * Called after the createNamespace operation has been requested.
923   * @param ctx the environment to interact with the framework and master
924   * @param ns  the NamespaceDescriptor for the table
925   */
926  default void postCreateNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
927    NamespaceDescriptor ns) throws IOException {
928  }
929
930  /**
931   * Called before {@link org.apache.hadoop.hbase.master.HMaster} deletes a namespace
932   * @param ctx       the environment to interact with the framework and master
933   * @param namespace the name of the namespace
934   */
935  default void preDeleteNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
936    String namespace) throws IOException {
937  }
938
939  /**
940   * Called after the deleteNamespace operation has been requested.
941   * @param ctx       the environment to interact with the framework and master
942   * @param namespace the name of the namespace
943   */
944  default void postDeleteNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
945    String namespace) throws IOException {
946  }
947
948  /**
949   * Called prior to modifying a namespace's properties.
950   * @param ctx                 the environment to interact with the framework and master
951   * @param currentNsDescriptor current NamespaceDescriptor of the namespace
952   * @param newNsDescriptor     after modify operation, namespace will have this descriptor
953   */
954  default void preModifyNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
955    NamespaceDescriptor currentNsDescriptor, NamespaceDescriptor newNsDescriptor)
956    throws IOException {
957  }
958
959  /**
960   * Called after the modifyNamespace operation has been requested.
961   * @param ctx                 the environment to interact with the framework and master
962   * @param oldNsDescriptor     descriptor of namespace before modify operation happened
963   * @param currentNsDescriptor current NamespaceDescriptor of the namespace
964   */
965  default void postModifyNamespace(final ObserverContext<MasterCoprocessorEnvironment> ctx,
966    NamespaceDescriptor oldNsDescriptor, NamespaceDescriptor currentNsDescriptor)
967    throws IOException {
968  }
969
970  /**
971   * Called before a getNamespaceDescriptor request has been processed.
972   * @param ctx       the environment to interact with the framework and master
973   * @param namespace the name of the namespace
974   */
975  default void preGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
976    String namespace) throws IOException {
977  }
978
979  /**
980   * Called after a getNamespaceDescriptor request has been processed.
981   * @param ctx the environment to interact with the framework and master
982   * @param ns  the NamespaceDescriptor
983   */
984  default void postGetNamespaceDescriptor(ObserverContext<MasterCoprocessorEnvironment> ctx,
985    NamespaceDescriptor ns) throws IOException {
986  }
987
988  /**
989   * Called before a listNamespaces request has been processed.
990   * @param ctx        the environment to interact with the framework and master
991   * @param namespaces an empty list, can be filled with what to return if bypassing
992   * @throws IOException if something went wrong
993   */
994  default void preListNamespaces(ObserverContext<MasterCoprocessorEnvironment> ctx,
995    List<String> namespaces) throws IOException {
996  }
997
998  /**
999   * Called after a listNamespaces request has been processed.
1000   * @param ctx        the environment to interact with the framework and master
1001   * @param namespaces the list of namespaces about to be returned
1002   * @throws IOException if something went wrong
1003   */
1004  default void postListNamespaces(ObserverContext<MasterCoprocessorEnvironment> ctx,
1005    List<String> namespaces) throws IOException {
1006  };
1007
1008  /**
1009   * Called before a listNamespaceDescriptors request has been processed.
1010   * @param ctx         the environment to interact with the framework and master
1011   * @param descriptors an empty list, can be filled with what to return by coprocessor
1012   */
1013  default void preListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
1014    List<NamespaceDescriptor> descriptors) throws IOException {
1015  }
1016
1017  /**
1018   * Called after a listNamespaceDescriptors request has been processed.
1019   * @param ctx         the environment to interact with the framework and master
1020   * @param descriptors the list of descriptors about to be returned
1021   */
1022  default void postListNamespaceDescriptors(ObserverContext<MasterCoprocessorEnvironment> ctx,
1023    List<NamespaceDescriptor> descriptors) throws IOException {
1024  }
1025
1026  /**
1027   * Called before the table memstore is flushed to disk.
1028   * @param ctx       the environment to interact with the framework and master
1029   * @param tableName the name of the table
1030   */
1031  default void preTableFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1032    final TableName tableName) throws IOException {
1033  }
1034
1035  /**
1036   * Called after the table memstore is flushed to disk.
1037   * @param ctx       the environment to interact with the framework and master
1038   * @param tableName the name of the table
1039   */
1040  default void postTableFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1041    final TableName tableName) throws IOException {
1042  }
1043
1044  /**
1045   * Called before the master local region memstore is flushed to disk.
1046   * @param ctx the environment to interact with the framework and master
1047   */
1048  default void preMasterStoreFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1049    throws IOException {
1050  }
1051
1052  /**
1053   * Called after the master local region memstore is flushed to disk.
1054   * @param ctx the environment to interact with the framework and master
1055   */
1056  default void postMasterStoreFlush(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1057    throws IOException {
1058  }
1059
1060  /**
1061   * Called before the quota for the user is stored.
1062   * @param ctx      the environment to interact with the framework and master
1063   * @param userName the name of user
1064   * @param quotas   the current quota for the user
1065   */
1066  default void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1067    final String userName, final GlobalQuotaSettings quotas) throws IOException {
1068  }
1069
1070  /**
1071   * Called after the quota for the user is stored.
1072   * @param ctx      the environment to interact with the framework and master
1073   * @param userName the name of user
1074   * @param quotas   the resulting quota for the user
1075   */
1076  default void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1077    final String userName, final GlobalQuotaSettings quotas) throws IOException {
1078  }
1079
1080  /**
1081   * Called before the quota for the user on the specified table is stored.
1082   * @param ctx       the environment to interact with the framework and master
1083   * @param userName  the name of user
1084   * @param tableName the name of the table
1085   * @param quotas    the current quota for the user on the table
1086   */
1087  default void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1088    final String userName, final TableName tableName, final GlobalQuotaSettings quotas)
1089    throws IOException {
1090  }
1091
1092  /**
1093   * Called after the quota for the user on the specified table is stored.
1094   * @param ctx       the environment to interact with the framework and master
1095   * @param userName  the name of user
1096   * @param tableName the name of the table
1097   * @param quotas    the resulting quota for the user on the table
1098   */
1099  default void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1100    final String userName, final TableName tableName, final GlobalQuotaSettings quotas)
1101    throws IOException {
1102  }
1103
1104  /**
1105   * Called before the quota for the user on the specified namespace is stored.
1106   * @param ctx       the environment to interact with the framework and master
1107   * @param userName  the name of user
1108   * @param namespace the name of the namespace
1109   * @param quotas    the current quota for the user on the namespace
1110   */
1111  default void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1112    final String userName, final String namespace, final GlobalQuotaSettings quotas)
1113    throws IOException {
1114  }
1115
1116  /**
1117   * Called after the quota for the user on the specified namespace is stored.
1118   * @param ctx       the environment to interact with the framework and master
1119   * @param userName  the name of user
1120   * @param namespace the name of the namespace
1121   * @param quotas    the resulting quota for the user on the namespace
1122   */
1123  default void postSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1124    final String userName, final String namespace, final GlobalQuotaSettings quotas)
1125    throws IOException {
1126  }
1127
1128  /**
1129   * Called before the quota for the table is stored.
1130   * @param ctx       the environment to interact with the framework and master
1131   * @param tableName the name of the table
1132   * @param quotas    the current quota for the table
1133   */
1134  default void preSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1135    final TableName tableName, final GlobalQuotaSettings quotas) throws IOException {
1136  }
1137
1138  /**
1139   * Called after the quota for the table is stored.
1140   * @param ctx       the environment to interact with the framework and master
1141   * @param tableName the name of the table
1142   * @param quotas    the resulting quota for the table
1143   */
1144  default void postSetTableQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1145    final TableName tableName, final GlobalQuotaSettings quotas) throws IOException {
1146  }
1147
1148  /**
1149   * Called before the quota for the namespace is stored.
1150   * @param ctx       the environment to interact with the framework and master
1151   * @param namespace the name of the namespace
1152   * @param quotas    the current quota for the namespace
1153   */
1154  default void preSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1155    final String namespace, final GlobalQuotaSettings quotas) throws IOException {
1156  }
1157
1158  /**
1159   * Called after the quota for the namespace is stored.
1160   * @param ctx       the environment to interact with the framework and master
1161   * @param namespace the name of the namespace
1162   * @param quotas    the resulting quota for the namespace
1163   */
1164  default void postSetNamespaceQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1165    final String namespace, final GlobalQuotaSettings quotas) throws IOException {
1166  }
1167
1168  /**
1169   * Called before the quota for the region server is stored.
1170   * @param ctx          the environment to interact with the framework and master
1171   * @param regionServer the name of the region server
1172   * @param quotas       the current quota for the region server
1173   */
1174  default void preSetRegionServerQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1175    final String regionServer, final GlobalQuotaSettings quotas) throws IOException {
1176  }
1177
1178  /**
1179   * Called after the quota for the region server is stored.
1180   * @param ctx          the environment to interact with the framework and master
1181   * @param regionServer the name of the region server
1182   * @param quotas       the resulting quota for the region server
1183   */
1184  default void postSetRegionServerQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1185    final String regionServer, final GlobalQuotaSettings quotas) throws IOException {
1186  }
1187
1188  /**
1189   * Called before merge regions request.
1190   * @param ctx            coprocessor environment
1191   * @param regionsToMerge regions to be merged
1192   */
1193  default void preMergeRegions(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1194    final RegionInfo[] regionsToMerge) throws IOException {
1195  }
1196
1197  /**
1198   * called after merge regions request.
1199   * @param c              coprocessor environment
1200   * @param regionsToMerge regions to be merged
1201   */
1202  default void postMergeRegions(final ObserverContext<MasterCoprocessorEnvironment> c,
1203    final RegionInfo[] regionsToMerge) throws IOException {
1204  }
1205
1206  /**
1207   * Called before servers are moved to target region server group
1208   * @param ctx         the environment to interact with the framework and master
1209   * @param servers     set of servers to move
1210   * @param targetGroup destination group
1211   */
1212  default void preMoveServersAndTables(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1213    Set<Address> servers, Set<TableName> tables, String targetGroup) throws IOException {
1214  }
1215
1216  /**
1217   * Called after servers are moved to target region server group
1218   * @param ctx         the environment to interact with the framework and master
1219   * @param servers     set of servers to move
1220   * @param targetGroup name of group
1221   */
1222  default void postMoveServersAndTables(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1223    Set<Address> servers, Set<TableName> tables, String targetGroup) throws IOException {
1224  }
1225
1226  /**
1227   * Called before servers are moved to target region server group
1228   * @param ctx         the environment to interact with the framework and master
1229   * @param servers     set of servers to move
1230   * @param targetGroup destination group
1231   */
1232  default void preMoveServers(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1233    Set<Address> servers, String targetGroup) throws IOException {
1234  }
1235
1236  /**
1237   * Called after servers are moved to target region server group
1238   * @param ctx         the environment to interact with the framework and master
1239   * @param servers     set of servers to move
1240   * @param targetGroup name of group
1241   */
1242  default void postMoveServers(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1243    Set<Address> servers, String targetGroup) throws IOException {
1244  }
1245
1246  /**
1247   * Called before tables are moved to target region server group
1248   * @param ctx         the environment to interact with the framework and master
1249   * @param tables      set of tables to move
1250   * @param targetGroup name of group
1251   */
1252  default void preMoveTables(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1253    Set<TableName> tables, String targetGroup) throws IOException {
1254  }
1255
1256  /**
1257   * Called after servers are moved to target region server group
1258   * @param ctx         the environment to interact with the framework and master
1259   * @param tables      set of tables to move
1260   * @param targetGroup name of group
1261   */
1262  default void postMoveTables(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1263    Set<TableName> tables, String targetGroup) throws IOException {
1264  }
1265
1266  /**
1267   * Called before a new region server group is added
1268   * @param ctx  the environment to interact with the framework and master
1269   * @param name group name
1270   */
1271  default void preAddRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
1272    throws IOException {
1273  }
1274
1275  /**
1276   * Called after a new region server group is added
1277   * @param ctx  the environment to interact with the framework and master
1278   * @param name group name
1279   */
1280  default void postAddRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx, String name)
1281    throws IOException {
1282  }
1283
1284  /**
1285   * Called before a region server group is removed
1286   * @param ctx  the environment to interact with the framework and master
1287   * @param name group name
1288   */
1289  default void preRemoveRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1290    String name) throws IOException {
1291  }
1292
1293  /**
1294   * Called after a region server group is removed
1295   * @param ctx  the environment to interact with the framework and master
1296   * @param name group name
1297   */
1298  default void postRemoveRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1299    String name) throws IOException {
1300  }
1301
1302  /**
1303   * Called before a region server group is removed
1304   * @param ctx       the environment to interact with the framework and master
1305   * @param groupName group name
1306   */
1307  default void preBalanceRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1308    String groupName, BalanceRequest request) throws IOException {
1309  }
1310
1311  /**
1312   * Called after a region server group is removed
1313   * @param ctx       the environment to interact with the framework and master
1314   * @param groupName group name
1315   * @param request   the request sent to the balancer
1316   * @param response  the response returned by the balancer
1317   */
1318  default void postBalanceRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1319    String groupName, BalanceRequest request, BalanceResponse response) throws IOException {
1320  }
1321
1322  /**
1323   * Called before servers are removed from rsgroup
1324   * @param ctx     the environment to interact with the framework and master
1325   * @param servers set of decommissioned servers to remove
1326   */
1327  default void preRemoveServers(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1328    Set<Address> servers) throws IOException {
1329  }
1330
1331  /**
1332   * Called after servers are removed from rsgroup
1333   * @param ctx     the environment to interact with the framework and master
1334   * @param servers set of servers to remove
1335   */
1336  default void postRemoveServers(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1337    Set<Address> servers) throws IOException {
1338  }
1339
1340  /**
1341   * Called before getting region server group info of the passed groupName.
1342   * @param ctx       the environment to interact with the framework and master
1343   * @param groupName name of the group to get RSGroupInfo for
1344   */
1345  default void preGetRSGroupInfo(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1346    final String groupName) throws IOException {
1347  }
1348
1349  /**
1350   * Called after getting region server group info of the passed groupName.
1351   * @param ctx       the environment to interact with the framework and master
1352   * @param groupName name of the group to get RSGroupInfo for
1353   */
1354  default void postGetRSGroupInfo(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1355    final String groupName) throws IOException {
1356  }
1357
1358  /**
1359   * Called before getting region server group info of the passed tableName.
1360   * @param ctx       the environment to interact with the framework and master
1361   * @param tableName name of the table to get RSGroupInfo for
1362   */
1363  default void preGetRSGroupInfoOfTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1364    final TableName tableName) throws IOException {
1365  }
1366
1367  /**
1368   * Called after getting region server group info of the passed tableName.
1369   * @param ctx       the environment to interact with the framework and master
1370   * @param tableName name of the table to get RSGroupInfo for
1371   */
1372  default void postGetRSGroupInfoOfTable(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1373    final TableName tableName) throws IOException {
1374  }
1375
1376  /**
1377   * Called before listing region server group information.
1378   * @param ctx the environment to interact with the framework and master
1379   */
1380  default void preListRSGroups(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1381    throws IOException {
1382  }
1383
1384  /**
1385   * Called after listing region server group information.
1386   * @param ctx the environment to interact with the framework and master
1387   */
1388  default void postListRSGroups(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1389    throws IOException {
1390  }
1391
1392  /**
1393   * Called before listing all tables in the region server group.
1394   * @param ctx       the environment to interact with the framework and master
1395   * @param groupName name of the region server group
1396   */
1397  default void preListTablesInRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1398    final String groupName) throws IOException {
1399  }
1400
1401  /**
1402   * Called after listing all tables in the region server group.
1403   * @param ctx       the environment to interact with the framework and master
1404   * @param groupName name of the region server group
1405   */
1406  default void postListTablesInRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1407    final String groupName) throws IOException {
1408  }
1409
1410  /**
1411   * Called before rename rsgroup.
1412   * @param ctx     the environment to interact with the framework and master
1413   * @param oldName old rsgroup name
1414   * @param newName new rsgroup name
1415   */
1416  default void preRenameRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1417    final String oldName, final String newName) throws IOException {
1418  }
1419
1420  /**
1421   * Called after rename rsgroup.
1422   * @param ctx     the environment to interact with the framework and master
1423   * @param oldName old rsgroup name
1424   * @param newName new rsgroup name
1425   */
1426  default void postRenameRSGroup(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1427    final String oldName, final String newName) throws IOException {
1428  }
1429
1430  /**
1431   * Called before update rsgroup config.
1432   * @param ctx           the environment to interact with the framework and master
1433   * @param groupName     the group name
1434   * @param configuration new configuration of the group name to be set
1435   */
1436  default void preUpdateRSGroupConfig(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1437    final String groupName, final Map<String, String> configuration) throws IOException {
1438  }
1439
1440  /**
1441   * Called after update rsgroup config.
1442   * @param ctx           the environment to interact with the framework and master
1443   * @param groupName     the group name
1444   * @param configuration new configuration of the group name to be set
1445   */
1446  default void postUpdateRSGroupConfig(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1447    final String groupName, final Map<String, String> configuration) throws IOException {
1448  }
1449
1450  /**
1451   * Called before getting the configured namespaces and tables in the region server group.
1452   * @param ctx       the environment to interact with the framework and master
1453   * @param groupName name of the region server group
1454   */
1455  default void preGetConfiguredNamespacesAndTablesInRSGroup(
1456    final ObserverContext<MasterCoprocessorEnvironment> ctx, final String groupName)
1457    throws IOException {
1458  }
1459
1460  /**
1461   * Called after getting the configured namespaces and tables in the region server group.
1462   * @param ctx       the environment to interact with the framework and master
1463   * @param groupName name of the region server group
1464   */
1465  default void postGetConfiguredNamespacesAndTablesInRSGroup(
1466    final ObserverContext<MasterCoprocessorEnvironment> ctx, final String groupName)
1467    throws IOException {
1468  }
1469
1470  /**
1471   * Called before getting region server group info of the passed server.
1472   * @param ctx    the environment to interact with the framework and master
1473   * @param server server to get RSGroupInfo for
1474   */
1475  default void preGetRSGroupInfoOfServer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1476    final Address server) throws IOException {
1477  }
1478
1479  /**
1480   * Called after getting region server group info of the passed server.
1481   * @param ctx    the environment to interact with the framework and master
1482   * @param server server to get RSGroupInfo for
1483   */
1484  default void postGetRSGroupInfoOfServer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1485    final Address server) throws IOException {
1486  }
1487
1488  /**
1489   * Called before add a replication peer
1490   * @param ctx        the environment to interact with the framework and master
1491   * @param peerId     a short name that identifies the peer
1492   * @param peerConfig configuration for the replication peer
1493   */
1494  default void preAddReplicationPeer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1495    String peerId, ReplicationPeerConfig peerConfig) throws IOException {
1496  }
1497
1498  /**
1499   * Called after add a replication peer
1500   * @param ctx        the environment to interact with the framework and master
1501   * @param peerId     a short name that identifies the peer
1502   * @param peerConfig configuration for the replication peer
1503   */
1504  default void postAddReplicationPeer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1505    String peerId, ReplicationPeerConfig peerConfig) throws IOException {
1506  }
1507
1508  /**
1509   * Called before remove a replication peer
1510   * @param peerId a short name that identifies the peer
1511   */
1512  default void preRemoveReplicationPeer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1513    String peerId) throws IOException {
1514  }
1515
1516  /**
1517   * Called after remove a replication peer
1518   * @param peerId a short name that identifies the peer
1519   */
1520  default void postRemoveReplicationPeer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1521    String peerId) throws IOException {
1522  }
1523
1524  /**
1525   * Called before enable a replication peer
1526   * @param peerId a short name that identifies the peer
1527   */
1528  default void preEnableReplicationPeer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1529    String peerId) throws IOException {
1530  }
1531
1532  /**
1533   * Called after enable a replication peer
1534   * @param peerId a short name that identifies the peer
1535   */
1536  default void postEnableReplicationPeer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1537    String peerId) throws IOException {
1538  }
1539
1540  /**
1541   * Called before disable a replication peer
1542   * @param peerId a short name that identifies the peer
1543   */
1544  default void preDisableReplicationPeer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1545    String peerId) throws IOException {
1546  }
1547
1548  /**
1549   * Called after disable a replication peer
1550   * @param peerId a short name that identifies the peer
1551   */
1552  default void postDisableReplicationPeer(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1553    String peerId) throws IOException {
1554  }
1555
1556  /**
1557   * Called before get the configured ReplicationPeerConfig for the specified peer
1558   * @param peerId a short name that identifies the peer
1559   */
1560  default void preGetReplicationPeerConfig(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1561    String peerId) throws IOException {
1562  }
1563
1564  /**
1565   * Called after get the configured ReplicationPeerConfig for the specified peer
1566   * @param peerId a short name that identifies the peer
1567   */
1568  default void postGetReplicationPeerConfig(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1569    String peerId) throws IOException {
1570  }
1571
1572  /**
1573   * Called before update peerConfig for the specified peer
1574   * @param peerId a short name that identifies the peer
1575   */
1576  default void preUpdateReplicationPeerConfig(
1577    final ObserverContext<MasterCoprocessorEnvironment> ctx, String peerId,
1578    ReplicationPeerConfig peerConfig) throws IOException {
1579  }
1580
1581  /**
1582   * Called after update peerConfig for the specified peer
1583   * @param ctx    the environment to interact with the framework and master
1584   * @param peerId a short name that identifies the peer
1585   */
1586  default void postUpdateReplicationPeerConfig(
1587    final ObserverContext<MasterCoprocessorEnvironment> ctx, String peerId,
1588    ReplicationPeerConfig peerConfig) throws IOException {
1589  }
1590
1591  /**
1592   * Called before list replication peers.
1593   * @param ctx   the environment to interact with the framework and master
1594   * @param regex The regular expression to match peer id
1595   */
1596  default void preListReplicationPeers(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1597    String regex) throws IOException {
1598  }
1599
1600  /**
1601   * Called after list replication peers.
1602   * @param ctx   the environment to interact with the framework and master
1603   * @param regex The regular expression to match peer id
1604   */
1605  default void postListReplicationPeers(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1606    String regex) throws IOException {
1607  }
1608
1609  /**
1610   * Called before transit current cluster state for the specified synchronous replication peer
1611   * @param ctx    the environment to interact with the framework and master
1612   * @param peerId a short name that identifies the peer
1613   * @param state  the new state
1614   */
1615  default void preTransitReplicationPeerSyncReplicationState(
1616    final ObserverContext<MasterCoprocessorEnvironment> ctx, String peerId,
1617    SyncReplicationState state) throws IOException {
1618  }
1619
1620  /**
1621   * Called after transit current cluster state for the specified synchronous replication peer
1622   * @param ctx    the environment to interact with the framework and master
1623   * @param peerId a short name that identifies the peer
1624   * @param from   the old state
1625   * @param to     the new state
1626   */
1627  default void postTransitReplicationPeerSyncReplicationState(
1628    final ObserverContext<MasterCoprocessorEnvironment> ctx, String peerId,
1629    SyncReplicationState from, SyncReplicationState to) throws IOException {
1630  }
1631
1632  /**
1633   * Called before new LockProcedure is queued.
1634   * @param ctx the environment to interact with the framework and master
1635   */
1636  default void preRequestLock(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace,
1637    TableName tableName, RegionInfo[] regionInfos, String description) throws IOException {
1638  }
1639
1640  /**
1641   * Called after new LockProcedure is queued.
1642   * @param ctx the environment to interact with the framework and master
1643   */
1644  default void postRequestLock(ObserverContext<MasterCoprocessorEnvironment> ctx, String namespace,
1645    TableName tableName, RegionInfo[] regionInfos, String description) throws IOException {
1646  }
1647
1648  /**
1649   * Called before heartbeat to a lock.
1650   * @param ctx the environment to interact with the framework and master
1651   */
1652  default void preLockHeartbeat(ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tn,
1653    String description) throws IOException {
1654  }
1655
1656  /**
1657   * Called after heartbeat to a lock.
1658   * @param ctx the environment to interact with the framework and master
1659   */
1660  default void postLockHeartbeat(ObserverContext<MasterCoprocessorEnvironment> ctx)
1661    throws IOException {
1662  }
1663
1664  /**
1665   * Called before get cluster status.
1666   */
1667  default void preGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment> ctx)
1668    throws IOException {
1669  }
1670
1671  /**
1672   * Called after get cluster status.
1673   */
1674  default void postGetClusterMetrics(ObserverContext<MasterCoprocessorEnvironment> ctx,
1675    ClusterMetrics status) throws IOException {
1676  }
1677
1678  /**
1679   * Called before clear dead region servers.
1680   */
1681  default void preClearDeadServers(ObserverContext<MasterCoprocessorEnvironment> ctx)
1682    throws IOException {
1683  }
1684
1685  /**
1686   * Called after clear dead region servers.
1687   */
1688  default void postClearDeadServers(ObserverContext<MasterCoprocessorEnvironment> ctx,
1689    List<ServerName> servers, List<ServerName> notClearedServers) throws IOException {
1690  }
1691
1692  /**
1693   * Called before decommission region servers.
1694   */
1695  default void preDecommissionRegionServers(ObserverContext<MasterCoprocessorEnvironment> ctx,
1696    List<ServerName> servers, boolean offload) throws IOException {
1697  }
1698
1699  /**
1700   * Called after decommission region servers.
1701   */
1702  default void postDecommissionRegionServers(ObserverContext<MasterCoprocessorEnvironment> ctx,
1703    List<ServerName> servers, boolean offload) throws IOException {
1704  }
1705
1706  /**
1707   * Called before list decommissioned region servers.
1708   */
1709  default void preListDecommissionedRegionServers(ObserverContext<MasterCoprocessorEnvironment> ctx)
1710    throws IOException {
1711  }
1712
1713  /**
1714   * Called after list decommissioned region servers.
1715   */
1716  default void postListDecommissionedRegionServers(
1717    ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException {
1718  }
1719
1720  /**
1721   * Called before recommission region server.
1722   */
1723  default void preRecommissionRegionServer(ObserverContext<MasterCoprocessorEnvironment> ctx,
1724    ServerName server, List<byte[]> encodedRegionNames) throws IOException {
1725  }
1726
1727  /**
1728   * Called after recommission region server.
1729   */
1730  default void postRecommissionRegionServer(ObserverContext<MasterCoprocessorEnvironment> ctx,
1731    ServerName server, List<byte[]> encodedRegionNames) throws IOException {
1732  }
1733
1734  /**
1735   * Called before switching rpc throttle enabled state.
1736   * @param ctx    the coprocessor instance's environment
1737   * @param enable the rpc throttle value
1738   */
1739  default void preSwitchRpcThrottle(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1740    final boolean enable) throws IOException {
1741  }
1742
1743  /**
1744   * Called after switching rpc throttle enabled state.
1745   * @param ctx      the coprocessor instance's environment
1746   * @param oldValue the previously rpc throttle value
1747   * @param newValue the newly rpc throttle value
1748   */
1749  default void postSwitchRpcThrottle(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1750    final boolean oldValue, final boolean newValue) throws IOException {
1751  }
1752
1753  /**
1754   * Called before getting if is rpc throttle enabled.
1755   * @param ctx the coprocessor instance's environment
1756   */
1757  default void preIsRpcThrottleEnabled(final ObserverContext<MasterCoprocessorEnvironment> ctx)
1758    throws IOException {
1759  }
1760
1761  /**
1762   * Called after getting if is rpc throttle enabled.
1763   * @param ctx                the coprocessor instance's environment
1764   * @param rpcThrottleEnabled the rpc throttle enabled value
1765   */
1766  default void postIsRpcThrottleEnabled(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1767    final boolean rpcThrottleEnabled) throws IOException {
1768  }
1769
1770  /**
1771   * Called before switching exceed throttle quota state.
1772   * @param ctx    the coprocessor instance's environment
1773   * @param enable the exceed throttle quota value
1774   */
1775  default void preSwitchExceedThrottleQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
1776    final boolean enable) throws IOException {
1777  }
1778
1779  /**
1780   * Called after switching exceed throttle quota state.
1781   * @param ctx      the coprocessor instance's environment
1782   * @param oldValue the previously exceed throttle quota value
1783   * @param newValue the newly exceed throttle quota value
1784   */
1785  default void postSwitchExceedThrottleQuota(
1786    final ObserverContext<MasterCoprocessorEnvironment> ctx, final boolean oldValue,
1787    final boolean newValue) throws IOException {
1788  }
1789
1790  /**
1791   * Called before granting user permissions.
1792   * @param ctx                      the coprocessor instance's environment
1793   * @param userPermission           the user and permissions
1794   * @param mergeExistingPermissions True if merge with previous granted permissions
1795   */
1796  default void preGrant(ObserverContext<MasterCoprocessorEnvironment> ctx,
1797    UserPermission userPermission, boolean mergeExistingPermissions) throws IOException {
1798  }
1799
1800  /**
1801   * Called after granting user permissions.
1802   * @param ctx                      the coprocessor instance's environment
1803   * @param userPermission           the user and permissions
1804   * @param mergeExistingPermissions True if merge with previous granted permissions
1805   */
1806  default void postGrant(ObserverContext<MasterCoprocessorEnvironment> ctx,
1807    UserPermission userPermission, boolean mergeExistingPermissions) throws IOException {
1808  }
1809
1810  /**
1811   * Called before revoking user permissions.
1812   * @param ctx            the coprocessor instance's environment
1813   * @param userPermission the user and permissions
1814   */
1815  default void preRevoke(ObserverContext<MasterCoprocessorEnvironment> ctx,
1816    UserPermission userPermission) throws IOException {
1817  }
1818
1819  /**
1820   * Called after revoking user permissions.
1821   * @param ctx            the coprocessor instance's environment
1822   * @param userPermission the user and permissions
1823   */
1824  default void postRevoke(ObserverContext<MasterCoprocessorEnvironment> ctx,
1825    UserPermission userPermission) throws IOException {
1826  }
1827
1828  /**
1829   * Called before getting user permissions.
1830   * @param ctx       the coprocessor instance's environment
1831   * @param userName  the user name, null if get all user permissions
1832   * @param namespace the namespace, null if don't get namespace permission
1833   * @param tableName the table name, null if don't get table permission
1834   * @param family    the table column family, null if don't get table family permission
1835   * @param qualifier the table column qualifier, null if don't get table qualifier permission
1836   * @throws IOException if something went wrong
1837   */
1838  default void preGetUserPermissions(ObserverContext<MasterCoprocessorEnvironment> ctx,
1839    String userName, String namespace, TableName tableName, byte[] family, byte[] qualifier)
1840    throws IOException {
1841  }
1842
1843  /**
1844   * Called after getting user permissions.
1845   * @param ctx       the coprocessor instance's environment
1846   * @param userName  the user name, null if get all user permissions
1847   * @param namespace the namespace, null if don't get namespace permission
1848   * @param tableName the table name, null if don't get table permission
1849   * @param family    the table column family, null if don't get table family permission
1850   * @param qualifier the table column qualifier, null if don't get table qualifier permission
1851   * @throws IOException if something went wrong
1852   */
1853  default void postGetUserPermissions(ObserverContext<MasterCoprocessorEnvironment> ctx,
1854    String userName, String namespace, TableName tableName, byte[] family, byte[] qualifier)
1855    throws IOException {
1856  }
1857
1858  /*
1859   * Called before checking if user has permissions.
1860   * @param ctx the coprocessor instance's environment
1861   * @param userName the user name
1862   * @param permissions the permission list
1863   */
1864  default void preHasUserPermissions(ObserverContext<MasterCoprocessorEnvironment> ctx,
1865    String userName, List<Permission> permissions) throws IOException {
1866  }
1867
1868  /**
1869   * Called after checking if user has permissions.
1870   * @param ctx         the coprocessor instance's environment
1871   * @param userName    the user name
1872   * @param permissions the permission list
1873   */
1874  default void postHasUserPermissions(ObserverContext<MasterCoprocessorEnvironment> ctx,
1875    String userName, List<Permission> permissions) throws IOException {
1876  }
1877
1878  /**
1879   * Called before reloading the HMaster's {@link Configuration} from disk
1880   * @param ctx           the coprocessor instance's environment
1881   * @param preReloadConf the {@link Configuration} in use prior to reload
1882   * @throws IOException if you need to signal an IO error
1883   */
1884  default void preUpdateMasterConfiguration(ObserverContext<MasterCoprocessorEnvironment> ctx,
1885    Configuration preReloadConf) throws IOException {
1886  }
1887
1888  /**
1889   * Called after reloading the HMaster's {@link Configuration} from disk
1890   * @param ctx            the coprocessor instance's environment
1891   * @param postReloadConf the {@link Configuration} that was loaded
1892   * @throws IOException if you need to signal an IO error
1893   */
1894  default void postUpdateMasterConfiguration(ObserverContext<MasterCoprocessorEnvironment> ctx,
1895    Configuration postReloadConf) throws IOException {
1896  }
1897}