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