View Javadoc

1   /*
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  package org.apache.hadoop.hbase.coprocessor;
17  
18  import java.io.IOException;
19  import java.util.List;
20  import java.util.NavigableSet;
21  
22  import org.apache.hadoop.hbase.classification.InterfaceAudience;
23  import org.apache.hadoop.hbase.classification.InterfaceStability;
24  import org.apache.hadoop.fs.FileSystem;
25  import org.apache.hadoop.fs.Path;
26  import org.apache.hadoop.hbase.Cell;
27  import org.apache.hadoop.hbase.Coprocessor;
28  import org.apache.hadoop.hbase.HBaseInterfaceAudience;
29  import org.apache.hadoop.hbase.HRegionInfo;
30  import org.apache.hadoop.hbase.KeyValue;
31  import org.apache.hadoop.hbase.client.Append;
32  import org.apache.hadoop.hbase.client.Delete;
33  import org.apache.hadoop.hbase.client.Durability;
34  import org.apache.hadoop.hbase.client.Get;
35  import org.apache.hadoop.hbase.client.Increment;
36  import org.apache.hadoop.hbase.client.Mutation;
37  import org.apache.hadoop.hbase.client.Put;
38  import org.apache.hadoop.hbase.client.Result;
39  import org.apache.hadoop.hbase.client.Scan;
40  import org.apache.hadoop.hbase.filter.ByteArrayComparable;
41  import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
42  import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
43  import org.apache.hadoop.hbase.io.Reference;
44  import org.apache.hadoop.hbase.io.hfile.CacheConfig;
45  import org.apache.hadoop.hbase.regionserver.DeleteTracker;
46  import org.apache.hadoop.hbase.regionserver.HRegion;
47  import org.apache.hadoop.hbase.regionserver.HRegion.Operation;
48  import org.apache.hadoop.hbase.regionserver.InternalScanner;
49  import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
50  import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
51  import org.apache.hadoop.hbase.regionserver.OperationStatus;
52  import org.apache.hadoop.hbase.regionserver.RegionScanner;
53  import org.apache.hadoop.hbase.regionserver.ScanType;
54  import org.apache.hadoop.hbase.regionserver.Store;
55  import org.apache.hadoop.hbase.regionserver.StoreFile;
56  import org.apache.hadoop.hbase.regionserver.StoreFileScanner;
57  import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
58  import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
59  import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
60  import org.apache.hadoop.hbase.util.Pair;
61  
62  import com.google.common.collect.ImmutableList;
63  
64  /**
65   * Coprocessors implement this interface to observe and mediate client actions
66   * on the region.
67   */
68  @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
69  @InterfaceStability.Evolving
70  public interface RegionObserver extends Coprocessor {
71  
72    /** Mutation type for postMutationBeforeWAL hook */
73    public enum MutationType {
74      APPEND, INCREMENT
75    }
76  
77    /**
78     * Called before the region is reported as open to the master.
79     * @param c the environment provided by the region server
80     * @throws IOException if an error occurred on the coprocessor
81     */
82    void preOpen(final ObserverContext<RegionCoprocessorEnvironment> c) throws IOException;
83  
84    /**
85     * Called after the region is reported as open to the master.
86     * @param c the environment provided by the region server
87     */
88    void postOpen(final ObserverContext<RegionCoprocessorEnvironment> c);
89  
90    /**
91     * Called after the log replay on the region is over.
92     * @param c the environment provided by the region server
93     */
94    void postLogReplay(final ObserverContext<RegionCoprocessorEnvironment> c);
95  
96    /**
97     * Called before a memstore is flushed to disk and prior to creating the scanner to read from
98     * the memstore.  To override or modify how a memstore is flushed,
99     * implementing classes can return a new scanner to provide the KeyValues to be
100    * stored into the new {@code StoreFile} or null to perform the default processing.
101    * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
102    * effect in this hook.
103    * @param c the environment provided by the region server
104    * @param store the store being flushed
105    * @param memstoreScanner the scanner for the memstore that is flushed
106    * @param s the base scanner, if not {@code null}, from previous RegionObserver in the chain
107    * @return the scanner to use during the flush.  {@code null} if the default implementation
108    * is to be used.
109    * @throws IOException if an error occurred on the coprocessor
110    */
111   InternalScanner preFlushScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
112       final Store store, final KeyValueScanner memstoreScanner, final InternalScanner s)
113       throws IOException;
114 
115   /**
116    * Called before the memstore is flushed to disk.
117    * @param c the environment provided by the region server
118    * @throws IOException if an error occurred on the coprocessor
119    * @deprecated use {@link #preFlush(ObserverContext, Store, InternalScanner)} instead
120    */
121   @Deprecated
122   void preFlush(final ObserverContext<RegionCoprocessorEnvironment> c) throws IOException;
123 
124   /**
125    * Called before a Store's memstore is flushed to disk.
126    * @param c the environment provided by the region server
127    * @param store the store where compaction is being requested
128    * @param scanner the scanner over existing data used in the store file
129    * @return the scanner to use during compaction.  Should not be {@code null}
130    * unless the implementation is writing new store files on its own.
131    * @throws IOException if an error occurred on the coprocessor
132    */
133   InternalScanner preFlush(final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
134       final InternalScanner scanner) throws IOException;
135 
136   /**
137    * Called after the memstore is flushed to disk.
138    * @param c the environment provided by the region server
139    * @throws IOException if an error occurred on the coprocessor
140    * @deprecated use {@link #preFlush(ObserverContext, Store, InternalScanner)} instead.
141    */
142   @Deprecated
143   void postFlush(final ObserverContext<RegionCoprocessorEnvironment> c) throws IOException;
144 
145   /**
146    * Called after a Store's memstore is flushed to disk.
147    * @param c the environment provided by the region server
148    * @param store the store being flushed
149    * @param resultFile the new store file written out during compaction
150    * @throws IOException if an error occurred on the coprocessor
151    */
152   void postFlush(final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
153       final StoreFile resultFile) throws IOException;
154 
155   /**
156    * Called prior to selecting the {@link StoreFile StoreFiles} to compact from the list of
157    * available candidates. To alter the files used for compaction, you may mutate the passed in list
158    * of candidates.
159    * @param c the environment provided by the region server
160    * @param store the store where compaction is being requested
161    * @param candidates the store files currently available for compaction
162    * @param request custom compaction request
163    * @throws IOException if an error occurred on the coprocessor
164    */
165   void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
166       final Store store, final List<StoreFile> candidates, final CompactionRequest request)
167       throws IOException;
168 
169   /**
170    * Called prior to selecting the {@link StoreFile}s to compact from the list of available
171    * candidates. To alter the files used for compaction, you may mutate the passed in list of
172    * candidates.
173    * @param c the environment provided by the region server
174    * @param store the store where compaction is being requested
175    * @param candidates the store files currently available for compaction
176    * @throws IOException if an error occurred on the coprocessor
177    * @deprecated Use {@link #preCompactSelection(ObserverContext, Store, List, CompactionRequest)}
178    *             instead
179    */
180   @Deprecated
181   void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
182       final Store store, final List<StoreFile> candidates) throws IOException;
183 
184   /**
185    * Called after the {@link StoreFile}s to compact have been selected from the available
186    * candidates.
187    * @param c the environment provided by the region server
188    * @param store the store being compacted
189    * @param selected the store files selected to compact
190    * @param request custom compaction request
191    */
192   void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
193       final Store store, final ImmutableList<StoreFile> selected, CompactionRequest request);
194 
195   /**
196    * Called after the {@link StoreFile}s to compact have been selected from the available
197    * candidates.
198    * @param c the environment provided by the region server
199    * @param store the store being compacted
200    * @param selected the store files selected to compact
201    * @deprecated use {@link #postCompactSelection(ObserverContext, Store, ImmutableList,
202    *             CompactionRequest)} instead.
203    */
204   @Deprecated
205   void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
206       final Store store, final ImmutableList<StoreFile> selected);
207 
208   /**
209    * Called prior to writing the {@link StoreFile}s selected for compaction into a new
210    * {@code StoreFile}. To override or modify the compaction process, implementing classes have two
211    * options:
212    * <ul>
213    * <li>Wrap the provided {@link InternalScanner} with a custom implementation that is returned
214    * from this method. The custom scanner can then inspect {@link KeyValue}s from the wrapped
215    * scanner, applying its own policy to what gets written.</li>
216    * <li>Call {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} and provide a
217    * custom implementation for writing of new {@link StoreFile}s. <strong>Note: any implementations
218    * bypassing core compaction using this approach must write out new store files themselves or the
219    * existing data will no longer be available after compaction.</strong></li>
220    * </ul>
221    * @param c the environment provided by the region server
222    * @param store the store being compacted
223    * @param scanner the scanner over existing data used in the store file rewriting
224    * @param scanType type of Scan
225    * @param request the requested compaction
226    * @return the scanner to use during compaction. Should not be {@code null} unless the
227    *         implementation is writing new store files on its own.
228    * @throws IOException if an error occurred on the coprocessor
229    */
230   InternalScanner preCompact(final ObserverContext<RegionCoprocessorEnvironment> c,
231       final Store store, final InternalScanner scanner, final ScanType scanType,
232       CompactionRequest request) throws IOException;
233 
234   /**
235    * Called prior to writing the {@link StoreFile}s selected for compaction into a new
236    * {@code StoreFile}. To override or modify the compaction process, implementing classes have two
237    * options:
238    * <ul>
239    * <li>Wrap the provided {@link InternalScanner} with a custom implementation that is returned
240    * from this method. The custom scanner can then inspect {@link KeyValue}s from the wrapped
241    * scanner, applying its own policy to what gets written.</li>
242    * <li>Call {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} and provide a
243    * custom implementation for writing of new {@link StoreFile}s. <strong>Note: any implementations
244    * bypassing core compaction using this approach must write out new store files themselves or the
245    * existing data will no longer be available after compaction.</strong></li>
246    * </ul>
247    * @param c the environment provided by the region server
248    * @param store the store being compacted
249    * @param scanner the scanner over existing data used in the store file rewriting
250    * @param scanType type of Scan
251    * @return the scanner to use during compaction. Should not be {@code null} unless the
252    *         implementation is writing new store files on its own.
253    * @throws IOException if an error occurred on the coprocessor
254    * @deprecated use
255    *             {@link #preCompact(ObserverContext, Store, InternalScanner,
256    *             ScanType, CompactionRequest)} instead
257    */
258   @Deprecated
259   InternalScanner preCompact(final ObserverContext<RegionCoprocessorEnvironment> c,
260       final Store store, final InternalScanner scanner, final ScanType scanType) throws IOException;
261 
262   /**
263    * Called prior to writing the {@link StoreFile}s selected for compaction into a new
264    * {@code StoreFile} and prior to creating the scanner used to read the input files. To override
265    * or modify the compaction process, implementing classes can return a new scanner to provide the
266    * KeyValues to be stored into the new {@code StoreFile} or null to perform the default
267    * processing. Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
268    * effect in this hook.
269    * @param c the environment provided by the region server
270    * @param store the store being compacted
271    * @param scanners the list {@link StoreFileScanner}s to be read from
272    * @param scanType the {@link ScanType} indicating whether this is a major or minor compaction
273    * @param earliestPutTs timestamp of the earliest put that was found in any of the involved store
274    *          files
275    * @param s the base scanner, if not {@code null}, from previous RegionObserver in the chain
276    * @param request the requested compaction
277    * @return the scanner to use during compaction. {@code null} if the default implementation is to
278    *         be used.
279    * @throws IOException if an error occurred on the coprocessor
280    */
281   InternalScanner preCompactScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
282       final Store store, List<? extends KeyValueScanner> scanners, final ScanType scanType,
283       final long earliestPutTs, final InternalScanner s, CompactionRequest request)
284       throws IOException;
285 
286   /**
287    * Called prior to writing the {@link StoreFile}s selected for compaction into a new
288    * {@code StoreFile} and prior to creating the scanner used to read the input files. To override
289    * or modify the compaction process, implementing classes can return a new scanner to provide the
290    * KeyValues to be stored into the new {@code StoreFile} or null to perform the default
291    * processing. Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
292    * effect in this hook.
293    * @param c the environment provided by the region server
294    * @param store the store being compacted
295    * @param scanners the list {@link StoreFileScanner}s to be read from
296    * @param scanType the {@link ScanType} indicating whether this is a major or minor compaction
297    * @param earliestPutTs timestamp of the earliest put that was found in any of the involved store
298    *          files
299    * @param s the base scanner, if not {@code null}, from previous RegionObserver in the chain
300    * @return the scanner to use during compaction. {@code null} if the default implementation is to
301    *         be used.
302    * @throws IOException if an error occurred on the coprocessor
303    * @deprecated Use
304    *             {@link #preCompactScannerOpen(ObserverContext, Store, List, ScanType, long,
305    *             InternalScanner, CompactionRequest)} instead.
306    */
307   @Deprecated
308   InternalScanner preCompactScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
309       final Store store, List<? extends KeyValueScanner> scanners, final ScanType scanType,
310       final long earliestPutTs, final InternalScanner s) throws IOException;
311 
312   /**
313    * Called after compaction has completed and the new store file has been moved in to place.
314    * @param c the environment provided by the region server
315    * @param store the store being compacted
316    * @param resultFile the new store file written out during compaction
317    * @param request the requested compaction
318    * @throws IOException if an error occurred on the coprocessor
319    */
320   void postCompact(final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
321       StoreFile resultFile, CompactionRequest request) throws IOException;
322 
323   /**
324    * Called after compaction has completed and the new store file has been moved in to place.
325    * @param c the environment provided by the region server
326    * @param store the store being compacted
327    * @param resultFile the new store file written out during compaction
328    * @throws IOException if an error occurred on the coprocessor
329    * @deprecated Use {@link #postCompact(ObserverContext, Store, StoreFile, CompactionRequest)}
330    *             instead
331    */
332   @Deprecated
333   void postCompact(final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
334       StoreFile resultFile) throws IOException;
335 
336   /**
337    * Called before the region is split.
338    * @param c the environment provided by the region server
339    * (e.getRegion() returns the parent region)
340    * @throws IOException if an error occurred on the coprocessor
341    * @deprecated Use preSplit(
342    *    final ObserverContext<RegionCoprocessorEnvironment> c, byte[] splitRow)
343    */
344   @Deprecated
345   void preSplit(final ObserverContext<RegionCoprocessorEnvironment> c) throws IOException;
346 
347   /**
348    * Called before the region is split.
349    * @param c the environment provided by the region server
350    * (e.getRegion() returns the parent region)
351    * @throws IOException if an error occurred on the coprocessor
352    */
353   void preSplit(final ObserverContext<RegionCoprocessorEnvironment> c, byte[] splitRow)
354       throws IOException;
355 
356   /**
357    * Called after the region is split.
358    * @param c the environment provided by the region server
359    * (e.getRegion() returns the parent region)
360    * @param l the left daughter region
361    * @param r the right daughter region
362    * @throws IOException if an error occurred on the coprocessor
363    * @deprecated Use postCompleteSplit() instead
364    */
365   @Deprecated
366   void postSplit(final ObserverContext<RegionCoprocessorEnvironment> c, final HRegion l,
367       final HRegion r) throws IOException;
368 
369   /**
370    * This will be called before PONR step as part of split transaction. Calling
371    * {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} rollback the split
372    * @param ctx
373    * @param splitKey
374    * @param metaEntries
375    * @throws IOException
376    */
377   void preSplitBeforePONR(final ObserverContext<RegionCoprocessorEnvironment> ctx,
378       byte[] splitKey, List<Mutation> metaEntries) throws IOException;
379 
380   
381   /**
382    * This will be called after PONR step as part of split transaction
383    * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
384    * effect in this hook.
385    * @param ctx
386    * @throws IOException
387    */
388   void preSplitAfterPONR(final ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException;
389   
390   /**
391    * This will be called before the roll back of the split region is completed 
392    * @param ctx
393    * @throws IOException
394    */
395   void preRollBackSplit(final ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException;
396 
397   /**
398    * This will be called after the roll back of the split region is completed
399    * @param ctx
400    * @throws IOException
401    */
402   void postRollBackSplit(final ObserverContext<RegionCoprocessorEnvironment> ctx)
403     throws IOException;
404 
405   /**
406    * Called after any split request is processed.  This will be called irrespective of success or
407    * failure of the split.
408    * @param ctx
409    * @throws IOException
410    */
411   void postCompleteSplit(final ObserverContext<RegionCoprocessorEnvironment> ctx)
412     throws IOException;
413   /**
414    * Called before the region is reported as closed to the master.
415    * @param c the environment provided by the region server
416    * @param abortRequested true if the region server is aborting
417    * @throws IOException 
418    */
419   void preClose(final ObserverContext<RegionCoprocessorEnvironment> c,
420       boolean abortRequested) throws IOException;
421 
422   /**
423    * Called after the region is reported as closed to the master.
424    * @param c the environment provided by the region server
425    * @param abortRequested true if the region server is aborting
426    */
427   void postClose(final ObserverContext<RegionCoprocessorEnvironment> c,
428       boolean abortRequested);
429 
430   /**
431    * Called before a client makes a GetClosestRowBefore request.
432    * <p>
433    * Call CoprocessorEnvironment#bypass to skip default actions
434    * <p>
435    * Call CoprocessorEnvironment#complete to skip any subsequent chained
436    * coprocessors
437    * @param c the environment provided by the region server
438    * @param row the row
439    * @param family the family
440    * @param result The result to return to the client if default processing
441    * is bypassed. Can be modified. Will not be used if default processing
442    * is not bypassed.
443    * @throws IOException if an error occurred on the coprocessor
444    */
445   void preGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> c,
446       final byte [] row, final byte [] family, final Result result)
447     throws IOException;
448 
449   /**
450    * Called after a client makes a GetClosestRowBefore request.
451    * <p>
452    * Call CoprocessorEnvironment#complete to skip any subsequent chained
453    * coprocessors
454    * @param c the environment provided by the region server
455    * @param row the row
456    * @param family the desired family
457    * @param result the result to return to the client, modify as necessary
458    * @throws IOException if an error occurred on the coprocessor
459    */
460   void postGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> c,
461       final byte [] row, final byte [] family, final Result result)
462     throws IOException;
463 
464   /**
465    * Called before the client performs a Get
466    * <p>
467    * Call CoprocessorEnvironment#bypass to skip default actions
468    * <p>
469    * Call CoprocessorEnvironment#complete to skip any subsequent chained
470    * coprocessors
471    * @param c the environment provided by the region server
472    * @param get the Get request
473    * @param result The result to return to the client if default processing
474    * is bypassed. Can be modified. Will not be used if default processing
475    * is not bypassed.
476    * @throws IOException if an error occurred on the coprocessor
477    */
478   void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
479       final List<Cell> result)
480     throws IOException;
481 
482   /**
483    * Called after the client performs a Get
484    * <p>
485    * Call CoprocessorEnvironment#complete to skip any subsequent chained
486    * coprocessors
487    * @param c the environment provided by the region server
488    * @param get the Get request
489    * @param result the result to return to the client, modify as necessary
490    * @throws IOException if an error occurred on the coprocessor
491    */
492   void postGetOp(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
493       final List<Cell> result)
494     throws IOException;
495 
496   /**
497    * Called before the client tests for existence using a Get.
498    * <p>
499    * Call CoprocessorEnvironment#bypass to skip default actions
500    * <p>
501    * Call CoprocessorEnvironment#complete to skip any subsequent chained
502    * coprocessors
503    * @param c the environment provided by the region server
504    * @param get the Get request
505    * @param exists
506    * @return the value to return to the client if bypassing default processing
507    * @throws IOException if an error occurred on the coprocessor
508    */
509   boolean preExists(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
510       final boolean exists)
511     throws IOException;
512 
513   /**
514    * Called after the client tests for existence using a Get.
515    * <p>
516    * Call CoprocessorEnvironment#complete to skip any subsequent chained
517    * coprocessors
518    * @param c the environment provided by the region server
519    * @param get the Get request
520    * @param exists the result returned by the region server
521    * @return the result to return to the client
522    * @throws IOException if an error occurred on the coprocessor
523    */
524   boolean postExists(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
525       final boolean exists)
526     throws IOException;
527 
528   /**
529    * Called before the client stores a value.
530    * <p>
531    * Call CoprocessorEnvironment#bypass to skip default actions
532    * <p>
533    * Call CoprocessorEnvironment#complete to skip any subsequent chained
534    * coprocessors
535    * @param c the environment provided by the region server
536    * @param put The Put object
537    * @param edit The WALEdit object that will be written to the wal
538    * @param durability Persistence guarantee for this Put
539    * @throws IOException if an error occurred on the coprocessor
540    */
541   void prePut(final ObserverContext<RegionCoprocessorEnvironment> c, 
542       final Put put, final WALEdit edit, final Durability durability)
543     throws IOException;
544 
545   /**
546    * Called after the client stores a value.
547    * <p>
548    * Call CoprocessorEnvironment#complete to skip any subsequent chained
549    * coprocessors
550    * @param c the environment provided by the region server
551    * @param put The Put object
552    * @param edit The WALEdit object for the wal
553    * @param durability Persistence guarantee for this Put
554    * @throws IOException if an error occurred on the coprocessor
555    */
556   void postPut(final ObserverContext<RegionCoprocessorEnvironment> c, 
557       final Put put, final WALEdit edit, final Durability durability)
558     throws IOException;
559 
560   /**
561    * Called before the client deletes a value.
562    * <p>
563    * Call CoprocessorEnvironment#bypass to skip default actions
564    * <p>
565    * Call CoprocessorEnvironment#complete to skip any subsequent chained
566    * coprocessors
567    * @param c the environment provided by the region server
568    * @param delete The Delete object
569    * @param edit The WALEdit object for the wal
570    * @param durability Persistence guarantee for this Delete
571    * @throws IOException if an error occurred on the coprocessor
572    */
573   void preDelete(final ObserverContext<RegionCoprocessorEnvironment> c, 
574       final Delete delete, final WALEdit edit, final Durability durability)
575     throws IOException;
576 /**
577  * Called before the server updates the timestamp for version delete with latest timestamp.
578  * <p>
579  * Call CoprocessorEnvironment#bypass to skip default actions
580  * <p>
581  * Call CoprocessorEnvironment#complete to skip any subsequent chained
582  * coprocessors
583  * @param c the environment provided by the region server
584  * @param mutation - the parent mutation associated with this delete cell
585  * @param cell - The deleteColumn with latest version cell
586  * @param byteNow - timestamp bytes
587  * @param get - the get formed using the current cell's row.
588  * Note that the get does not specify the family and qualifier
589  * @throws IOException
590  */
591   void prePrepareTimeStampForDeleteVersion(final ObserverContext<RegionCoprocessorEnvironment> c,
592       final Mutation mutation, final Cell cell, final byte[] byteNow,
593       final Get get) throws IOException;
594 
595   /**
596    * Called after the client deletes a value.
597    * <p>
598    * Call CoprocessorEnvironment#complete to skip any subsequent chained
599    * coprocessors
600    * @param c the environment provided by the region server
601    * @param delete The Delete object
602    * @param edit The WALEdit object for the wal
603    * @param durability Persistence guarantee for this Delete
604    * @throws IOException if an error occurred on the coprocessor
605    */
606   void postDelete(final ObserverContext<RegionCoprocessorEnvironment> c,
607       final Delete delete, final WALEdit edit, final Durability durability)
608     throws IOException;
609   
610   /**
611    * This will be called for every batch mutation operation happening at the server. This will be
612    * called after acquiring the locks on the mutating rows and after applying the proper timestamp
613    * for each Mutation at the server. The batch may contain Put/Delete. By setting OperationStatus
614    * of Mutations ({@link MiniBatchOperationInProgress#setOperationStatus(int, OperationStatus)}),
615    * {@link RegionObserver} can make HRegion to skip these Mutations.
616    * @param c the environment provided by the region server
617    * @param miniBatchOp batch of Mutations getting applied to region.
618    * @throws IOException if an error occurred on the coprocessor
619    */
620   void preBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
621       final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException;
622 
623   /**
624    * This will be called after applying a batch of Mutations on a region. The Mutations are added to
625    * memstore and WAL.
626    * @param c the environment provided by the region server
627    * @param miniBatchOp batch of Mutations applied to region.
628    * @throws IOException if an error occurred on the coprocessor
629    */
630   void postBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
631       final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException;
632 
633   /**
634    * This will be called for region operations where read lock is acquired in
635    * {@link HRegion#startRegionOperation()}.
636    * @param ctx
637    * @param operation The operation is about to be taken on the region
638    * @throws IOException
639    */
640   void postStartRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
641       Operation operation) throws IOException;
642 
643   /**
644    * Called after releasing read lock in {@link HRegion#closeRegionOperation(Operation)}.
645    * @param ctx
646    * @param operation
647    * @throws IOException
648    */
649   void postCloseRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
650       Operation operation) throws IOException;
651 
652   /**
653    * Called after the completion of batch put/delete and will be called even if the batch operation
654    * fails
655    * @param ctx
656    * @param miniBatchOp 
657    * @param success true if batch operation is successful otherwise false.
658    * @throws IOException
659    */
660   void postBatchMutateIndispensably(final ObserverContext<RegionCoprocessorEnvironment> ctx,
661       MiniBatchOperationInProgress<Mutation> miniBatchOp, final boolean success) throws IOException;
662 
663   /**
664    * Called before checkAndPut.
665    * <p>
666    * Call CoprocessorEnvironment#bypass to skip default actions
667    * <p>
668    * Call CoprocessorEnvironment#complete to skip any subsequent chained
669    * coprocessors
670    * @param c the environment provided by the region server
671    * @param row row to check
672    * @param family column family
673    * @param qualifier column qualifier
674    * @param compareOp the comparison operation
675    * @param comparator the comparator
676    * @param put data to put if check succeeds
677    * @param result 
678    * @return the return value to return to client if bypassing default
679    * processing
680    * @throws IOException if an error occurred on the coprocessor
681    */
682   boolean preCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> c,
683       final byte [] row, final byte [] family, final byte [] qualifier,
684       final CompareOp compareOp, final ByteArrayComparable comparator,
685       final Put put, final boolean result)
686     throws IOException;
687 
688   /**
689    * Called before checkAndPut but after acquiring rowlock.
690    * <p>
691    * <b>Note:</b> Caution to be taken for not doing any long time operation in this hook. 
692    * Row will be locked for longer time. Trying to acquire lock on another row, within this, 
693    * can lead to potential deadlock.
694    * <p>
695    * Call CoprocessorEnvironment#bypass to skip default actions
696    * <p>
697    * Call CoprocessorEnvironment#complete to skip any subsequent chained
698    * coprocessors
699    * @param c the environment provided by the region server
700    * @param row row to check
701    * @param family column family
702    * @param qualifier column qualifier
703    * @param compareOp the comparison operation
704    * @param comparator the comparator
705    * @param put data to put if check succeeds
706    * @param result 
707    * @return the return value to return to client if bypassing default
708    * processing
709    * @throws IOException if an error occurred on the coprocessor
710    */
711   boolean preCheckAndPutAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
712       final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp,
713       final ByteArrayComparable comparator, final Put put, 
714       final boolean result) throws IOException;
715 
716   /**
717    * Called after checkAndPut
718    * <p>
719    * Call CoprocessorEnvironment#complete to skip any subsequent chained
720    * coprocessors
721    * @param c the environment provided by the region server
722    * @param row row to check
723    * @param family column family
724    * @param qualifier column qualifier
725    * @param compareOp the comparison operation
726    * @param comparator the comparator
727    * @param put data to put if check succeeds
728    * @param result from the checkAndPut
729    * @return the possibly transformed return value to return to client
730    * @throws IOException if an error occurred on the coprocessor
731    */
732   boolean postCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> c,
733       final byte [] row, final byte [] family, final byte [] qualifier,
734       final CompareOp compareOp, final ByteArrayComparable comparator,
735       final Put put, final boolean result)
736     throws IOException;
737 
738   /**
739    * Called before checkAndDelete.
740    * <p>
741    * Call CoprocessorEnvironment#bypass to skip default actions
742    * <p>
743    * Call CoprocessorEnvironment#complete to skip any subsequent chained
744    * coprocessors
745    * @param c the environment provided by the region server
746    * @param row row to check
747    * @param family column family
748    * @param qualifier column qualifier
749    * @param compareOp the comparison operation
750    * @param comparator the comparator
751    * @param delete delete to commit if check succeeds
752    * @param result 
753    * @return the value to return to client if bypassing default processing
754    * @throws IOException if an error occurred on the coprocessor
755    */
756   boolean preCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> c,
757       final byte [] row, final byte [] family, final byte [] qualifier,
758       final CompareOp compareOp, final ByteArrayComparable comparator,
759       final Delete delete, final boolean result)
760     throws IOException;
761 
762   /**
763    * Called before checkAndDelete but after acquiring rowock.
764    * <p>
765    * <b>Note:</b> Caution to be taken for not doing any long time operation in this hook. 
766    * Row will be locked for longer time. Trying to acquire lock on another row, within this, 
767    * can lead to potential deadlock.
768    * <p>
769    * Call CoprocessorEnvironment#bypass to skip default actions
770    * <p>
771    * Call CoprocessorEnvironment#complete to skip any subsequent chained
772    * coprocessors
773    * @param c the environment provided by the region server
774    * @param row row to check
775    * @param family column family
776    * @param qualifier column qualifier
777    * @param compareOp the comparison operation
778    * @param comparator the comparator
779    * @param delete delete to commit if check succeeds
780    * @param result 
781    * @return the value to return to client if bypassing default processing
782    * @throws IOException if an error occurred on the coprocessor
783    */
784   boolean preCheckAndDeleteAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
785       final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp,
786       final ByteArrayComparable comparator, final Delete delete,
787       final boolean result) throws IOException;
788 
789   /**
790    * Called after checkAndDelete
791    * <p>
792    * Call CoprocessorEnvironment#complete to skip any subsequent chained
793    * coprocessors
794    * @param c the environment provided by the region server
795    * @param row row to check
796    * @param family column family
797    * @param qualifier column qualifier
798    * @param compareOp the comparison operation
799    * @param comparator the comparator
800    * @param delete delete to commit if check succeeds
801    * @param result from the CheckAndDelete
802    * @return the possibly transformed returned value to return to client
803    * @throws IOException if an error occurred on the coprocessor
804    */
805   boolean postCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> c,
806       final byte [] row, final byte [] family, final byte [] qualifier,
807       final CompareOp compareOp, final ByteArrayComparable comparator,
808       final Delete delete, final boolean result)
809     throws IOException;
810 
811   /**
812    * Called before incrementColumnValue
813    * <p>
814    * Call CoprocessorEnvironment#bypass to skip default actions
815    * <p>
816    * Call CoprocessorEnvironment#complete to skip any subsequent chained
817    * coprocessors
818    * @param c the environment provided by the region server
819    * @param row row to check
820    * @param family column family
821    * @param qualifier column qualifier
822    * @param amount long amount to increment
823    * @param writeToWAL true if the change should be written to the WAL
824    * @return value to return to the client if bypassing default processing
825    * @throws IOException if an error occurred on the coprocessor
826    * @deprecated This hook is no longer called by the RegionServer
827    */
828   @Deprecated
829   long preIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> c,
830       final byte [] row, final byte [] family, final byte [] qualifier,
831       final long amount, final boolean writeToWAL)
832     throws IOException;
833 
834   /**
835    * Called after incrementColumnValue
836    * <p>
837    * Call CoprocessorEnvironment#complete to skip any subsequent chained
838    * coprocessors
839    * @param c the environment provided by the region server
840    * @param row row to check
841    * @param family column family
842    * @param qualifier column qualifier
843    * @param amount long amount to increment
844    * @param writeToWAL true if the change should be written to the WAL
845    * @param result the result returned by incrementColumnValue
846    * @return the result to return to the client
847    * @throws IOException if an error occurred on the coprocessor
848    * @deprecated This hook is no longer called by the RegionServer
849    */
850   @Deprecated
851   long postIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> c,
852       final byte [] row, final byte [] family, final byte [] qualifier,
853       final long amount, final boolean writeToWAL, final long result)
854     throws IOException;
855 
856   /**
857    * Called before Append.
858    * <p>
859    * Call CoprocessorEnvironment#bypass to skip default actions
860    * <p>
861    * Call CoprocessorEnvironment#complete to skip any subsequent chained
862    * coprocessors
863    * @param c the environment provided by the region server
864    * @param append Append object
865    * @return result to return to the client if bypassing default processing
866    * @throws IOException if an error occurred on the coprocessor
867    */
868   Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> c,
869       final Append append)
870     throws IOException;
871 
872   /**
873    * Called before Append but after acquiring rowlock.
874    * <p>
875    * <b>Note:</b> Caution to be taken for not doing any long time operation in this hook. 
876    * Row will be locked for longer time. Trying to acquire lock on another row, within this, 
877    * can lead to potential deadlock.
878    * <p>
879    * Call CoprocessorEnvironment#bypass to skip default actions
880    * <p>
881    * Call CoprocessorEnvironment#complete to skip any subsequent chained
882    * coprocessors
883    * @param c the environment provided by the region server
884    * @param append Append object
885    * @return result to return to the client if bypassing default processing
886    * @throws IOException if an error occurred on the coprocessor
887    */
888   Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
889       final Append append) throws IOException;
890 
891   /**
892    * Called after Append
893    * <p>
894    * Call CoprocessorEnvironment#complete to skip any subsequent chained
895    * coprocessors
896    * @param c the environment provided by the region server
897    * @param append Append object
898    * @param result the result returned by increment
899    * @return the result to return to the client
900    * @throws IOException if an error occurred on the coprocessor
901    */
902   Result postAppend(final ObserverContext<RegionCoprocessorEnvironment> c,
903       final Append append, final Result result)
904     throws IOException;
905 
906   /**
907    * Called before Increment.
908    * <p>
909    * Call CoprocessorEnvironment#bypass to skip default actions
910    * <p>
911    * Call CoprocessorEnvironment#complete to skip any subsequent chained
912    * coprocessors
913    * @param c the environment provided by the region server
914    * @param increment increment object
915    * @return result to return to the client if bypassing default processing
916    * @throws IOException if an error occurred on the coprocessor
917    */
918   Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> c,
919       final Increment increment)
920     throws IOException;
921 
922   /**
923    * Called before Increment but after acquiring rowlock.
924    * <p>
925    * <b>Note:</b> Caution to be taken for not doing any long time operation in this hook. 
926    * Row will be locked for longer time. Trying to acquire lock on another row, within this, 
927    * can lead to potential deadlock.
928    * <p>
929    * Call CoprocessorEnvironment#bypass to skip default actions
930    * <p>
931    * Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
932    * 
933    * @param c
934    *          the environment provided by the region server
935    * @param increment
936    *          increment object
937    * @return result to return to the client if bypassing default processing
938    * @throws IOException
939    *           if an error occurred on the coprocessor
940    */
941   Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
942       final Increment increment) throws IOException;
943 
944   /**
945    * Called after increment
946    * <p>
947    * Call CoprocessorEnvironment#complete to skip any subsequent chained
948    * coprocessors
949    * @param c the environment provided by the region server
950    * @param increment increment object
951    * @param result the result returned by increment
952    * @return the result to return to the client
953    * @throws IOException if an error occurred on the coprocessor
954    */
955   Result postIncrement(final ObserverContext<RegionCoprocessorEnvironment> c,
956       final Increment increment, final Result result)
957     throws IOException;
958 
959   /**
960    * Called before the client opens a new scanner.
961    * <p>
962    * Call CoprocessorEnvironment#bypass to skip default actions
963    * <p>
964    * Call CoprocessorEnvironment#complete to skip any subsequent chained
965    * coprocessors
966    * @param c the environment provided by the region server
967    * @param scan the Scan specification
968    * @param s if not null, the base scanner
969    * @return an RegionScanner instance to use instead of the base scanner if
970    * overriding default behavior, null otherwise
971    * @throws IOException if an error occurred on the coprocessor
972    */
973   RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
974       final Scan scan, final RegionScanner s)
975     throws IOException;
976 
977   /**
978    * Called before a store opens a new scanner.
979    * This hook is called when a "user" scanner is opened.
980    * <p>
981    * See {@link #preFlushScannerOpen(ObserverContext, Store, KeyValueScanner, InternalScanner)}
982    * and {@link #preCompactScannerOpen(ObserverContext,
983    *  Store, List, ScanType, long, InternalScanner)}
984    * to override scanners created for flushes or compactions, resp.
985    * <p>
986    * Call CoprocessorEnvironment#complete to skip any subsequent chained
987    * coprocessors.
988    * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
989    * effect in this hook.
990    * @param c the environment provided by the region server
991    * @param store the store being scanned
992    * @param scan the Scan specification
993    * @param targetCols columns to be used in the scanner
994    * @param s the base scanner, if not {@code null}, from previous RegionObserver in the chain
995    * @return a KeyValueScanner instance to use or {@code null} to use the default implementation
996    * @throws IOException if an error occurred on the coprocessor
997    */
998   KeyValueScanner preStoreScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
999       final Store store, final Scan scan, final NavigableSet<byte[]> targetCols,
1000       final KeyValueScanner s) throws IOException;
1001 
1002   /**
1003    * Called after the client opens a new scanner.
1004    * <p>
1005    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1006    * coprocessors
1007    * @param c the environment provided by the region server
1008    * @param scan the Scan specification
1009    * @param s if not null, the base scanner
1010    * @return the scanner instance to use
1011    * @throws IOException if an error occurred on the coprocessor
1012    */
1013   RegionScanner postScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
1014       final Scan scan, final RegionScanner s)
1015     throws IOException;
1016 
1017   /**
1018    * Called before the client asks for the next row on a scanner.
1019    * <p>
1020    * Call CoprocessorEnvironment#bypass to skip default actions
1021    * <p>
1022    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1023    * coprocessors
1024    * @param c the environment provided by the region server
1025    * @param s the scanner
1026    * @param result The result to return to the client if default processing
1027    * is bypassed. Can be modified. Will not be returned if default processing
1028    * is not bypassed.
1029    * @param limit the maximum number of results to return
1030    * @param hasNext the 'has more' indication
1031    * @return 'has more' indication that should be sent to client
1032    * @throws IOException if an error occurred on the coprocessor
1033    */
1034   boolean preScannerNext(final ObserverContext<RegionCoprocessorEnvironment> c,
1035       final InternalScanner s, final List<Result> result,
1036       final int limit, final boolean hasNext)
1037     throws IOException;
1038 
1039   /**
1040    * Called after the client asks for the next row on a scanner.
1041    * <p>
1042    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1043    * coprocessors
1044    * @param c the environment provided by the region server
1045    * @param s the scanner
1046    * @param result the result to return to the client, can be modified
1047    * @param limit the maximum number of results to return
1048    * @param hasNext the 'has more' indication
1049    * @return 'has more' indication that should be sent to client
1050    * @throws IOException if an error occurred on the coprocessor
1051    */
1052   boolean postScannerNext(final ObserverContext<RegionCoprocessorEnvironment> c,
1053       final InternalScanner s, final List<Result> result, final int limit,
1054       final boolean hasNext)
1055     throws IOException;
1056 
1057   /**
1058    * This will be called by the scan flow when the current scanned row is being filtered out by the
1059    * filter. The filter may be filtering out the row via any of the below scenarios
1060    * <ol>
1061    * <li>
1062    * <code>boolean filterRowKey(byte [] buffer, int offset, int length)</code> returning true</li>
1063    * <li>
1064    * <code>boolean filterRow()</code> returning true</li>
1065    * <li>
1066    * <code>void filterRow(List<KeyValue> kvs)</code> removing all the kvs from the passed List</li>
1067    * </ol>
1068    * @param c the environment provided by the region server
1069    * @param s the scanner
1070    * @param currentRow The current rowkey which got filtered out
1071    * @param offset offset to rowkey
1072    * @param length length of rowkey
1073    * @param hasMore the 'has more' indication
1074    * @return whether more rows are available for the scanner or not
1075    * @throws IOException
1076    */
1077   boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> c,
1078       final InternalScanner s, final byte[] currentRow, final int offset, final short length,
1079       final boolean hasMore) throws IOException;
1080   
1081   /**
1082    * Called before the client closes a scanner.
1083    * <p>
1084    * Call CoprocessorEnvironment#bypass to skip default actions
1085    * <p>
1086    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1087    * coprocessors
1088    * @param c the environment provided by the region server
1089    * @param s the scanner
1090    * @throws IOException if an error occurred on the coprocessor
1091    */
1092   void preScannerClose(final ObserverContext<RegionCoprocessorEnvironment> c,
1093       final InternalScanner s)
1094     throws IOException;
1095 
1096   /**
1097    * Called after the client closes a scanner.
1098    * <p>
1099    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1100    * coprocessors
1101    * @param c the environment provided by the region server
1102    * @param s the scanner
1103    * @throws IOException if an error occurred on the coprocessor
1104    */
1105   void postScannerClose(final ObserverContext<RegionCoprocessorEnvironment> c,
1106       final InternalScanner s)
1107     throws IOException;
1108 
1109   /**
1110    * Called before a {@link org.apache.hadoop.hbase.regionserver.wal.WALEdit}
1111    * replayed for this region.
1112    *
1113    * @param ctx
1114    * @param info
1115    * @param logKey
1116    * @param logEdit
1117    * @throws IOException
1118    */
1119   void preWALRestore(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1120       HRegionInfo info, HLogKey logKey, WALEdit logEdit) throws IOException;
1121 
1122   /**
1123    * Called after a {@link org.apache.hadoop.hbase.regionserver.wal.WALEdit}
1124    * replayed for this region.
1125    *
1126    * @param ctx
1127    * @param info
1128    * @param logKey
1129    * @param logEdit
1130    * @throws IOException
1131    */
1132   void postWALRestore(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1133       HRegionInfo info, HLogKey logKey, WALEdit logEdit) throws IOException;
1134 
1135   /**
1136    * Called before bulkLoadHFile. Users can create a StoreFile instance to
1137    * access the contents of a HFile.
1138    *
1139    * @param ctx
1140    * @param familyPaths pairs of { CF, HFile path } submitted for bulk load. Adding
1141    * or removing from this list will add or remove HFiles to be bulk loaded.
1142    * @throws IOException
1143    */
1144   void preBulkLoadHFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1145     List<Pair<byte[], String>> familyPaths) throws IOException;
1146 
1147   /**
1148    * Called after bulkLoadHFile.
1149    *
1150    * @param ctx
1151    * @param familyPaths pairs of { CF, HFile path } submitted for bulk load
1152    * @param hasLoaded whether the bulkLoad was successful
1153    * @return the new value of hasLoaded
1154    * @throws IOException
1155    */
1156   boolean postBulkLoadHFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1157     List<Pair<byte[], String>> familyPaths, boolean hasLoaded) throws IOException;
1158 
1159   /**
1160    * Called before creation of Reader for a store file.
1161    * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
1162    * effect in this hook.
1163    * 
1164    * @param ctx the environment provided by the region server
1165    * @param fs fileystem to read from
1166    * @param p path to the file
1167    * @param in {@link FSDataInputStreamWrapper}
1168    * @param size Full size of the file
1169    * @param cacheConf
1170    * @param r original reference file. This will be not null only when reading a split file.
1171    * @param reader the base reader, if not {@code null}, from previous RegionObserver in the chain
1172    * @return a Reader instance to use instead of the base reader if overriding
1173    * default behavior, null otherwise
1174    * @throws IOException
1175    */
1176   StoreFile.Reader preStoreFileReaderOpen(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1177       final FileSystem fs, final Path p, final FSDataInputStreamWrapper in, long size,
1178       final CacheConfig cacheConf, final Reference r, StoreFile.Reader reader) throws IOException;
1179 
1180   /**
1181    * Called after the creation of Reader for a store file.
1182    * 
1183    * @param ctx the environment provided by the region server
1184    * @param fs fileystem to read from
1185    * @param p path to the file
1186    * @param in {@link FSDataInputStreamWrapper}
1187    * @param size Full size of the file
1188    * @param cacheConf
1189    * @param r original reference file. This will be not null only when reading a split file.
1190    * @param reader the base reader instance
1191    * @return The reader to use
1192    * @throws IOException
1193    */
1194   StoreFile.Reader postStoreFileReaderOpen(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1195       final FileSystem fs, final Path p, final FSDataInputStreamWrapper in, long size,
1196       final CacheConfig cacheConf, final Reference r, StoreFile.Reader reader) throws IOException;
1197 
1198   /**
1199    * Called after a new cell has been created during an increment operation, but before
1200    * it is committed to the WAL or memstore.
1201    * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
1202    * effect in this hook.
1203    * @param ctx the environment provided by the region server
1204    * @param opType the operation type
1205    * @param mutation the current mutation
1206    * @param oldCell old cell containing previous value
1207    * @param newCell the new cell containing the computed value
1208    * @return the new cell, possibly changed
1209    * @throws IOException
1210    */
1211   Cell postMutationBeforeWAL(ObserverContext<RegionCoprocessorEnvironment> ctx,
1212       MutationType opType, Mutation mutation, Cell oldCell, Cell newCell) throws IOException;
1213 
1214   /**
1215    * Called after the ScanQueryMatcher creates ScanDeleteTracker. Implementing
1216    * this hook would help in creating customised DeleteTracker and returning
1217    * the newly created DeleteTracker
1218    *
1219    * @param ctx the environment provided by the region server
1220    * @param delTracker the deleteTracker that is created by the QueryMatcher
1221    * @return the Delete Tracker
1222    * @throws IOException
1223    */
1224   DeleteTracker postInstantiateDeleteTracker(
1225       final ObserverContext<RegionCoprocessorEnvironment> ctx, DeleteTracker delTracker)
1226       throws IOException;
1227 }