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