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.classification.InterfaceAudience;
23  import org.apache.hadoop.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    * WARNING: please override preGetOp instead of this method.  This is to maintain some
480    * compatibility and to ease the transition from 0.94 -> 0.96.
481    */
482   @Deprecated
483   void preGet(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
484       final List<KeyValue> result)
485     throws IOException;
486 
487   /**
488    * Called after the client performs a Get
489    * <p>
490    * Call CoprocessorEnvironment#complete to skip any subsequent chained
491    * coprocessors
492    * @param c the environment provided by the region server
493    * @param get the Get request
494    * @param result the result to return to the client, modify as necessary
495    * @throws IOException if an error occurred on the coprocessor
496    */
497   void postGetOp(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
498       final List<Cell> result)
499     throws IOException;
500 
501   /**
502    * WARNING: please override postGetOp instead of this method.  This is to maintain some
503    * compatibility and to ease the transition from 0.94 -> 0.96.
504    */
505   @Deprecated
506   void postGet(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
507       final List<KeyValue> result)
508     throws IOException;
509 
510   /**
511    * Called before the client tests for existence using a Get.
512    * <p>
513    * Call CoprocessorEnvironment#bypass to skip default actions
514    * <p>
515    * Call CoprocessorEnvironment#complete to skip any subsequent chained
516    * coprocessors
517    * @param c the environment provided by the region server
518    * @param get the Get request
519    * @param exists
520    * @return the value to return to the client if bypassing default processing
521    * @throws IOException if an error occurred on the coprocessor
522    */
523   boolean preExists(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
524       final boolean exists)
525     throws IOException;
526 
527   /**
528    * Called after the client tests for existence using a Get.
529    * <p>
530    * Call CoprocessorEnvironment#complete to skip any subsequent chained
531    * coprocessors
532    * @param c the environment provided by the region server
533    * @param get the Get request
534    * @param exists the result returned by the region server
535    * @return the result to return to the client
536    * @throws IOException if an error occurred on the coprocessor
537    */
538   boolean postExists(final ObserverContext<RegionCoprocessorEnvironment> c, final Get get,
539       final boolean exists)
540     throws IOException;
541 
542   /**
543    * Called before the client stores a value.
544    * <p>
545    * Call CoprocessorEnvironment#bypass to skip default actions
546    * <p>
547    * Call CoprocessorEnvironment#complete to skip any subsequent chained
548    * coprocessors
549    * @param c the environment provided by the region server
550    * @param put The Put object
551    * @param edit The WALEdit object that will be written to the wal
552    * @param durability Persistence guarantee for this Put
553    * @throws IOException if an error occurred on the coprocessor
554    */
555   void prePut(final ObserverContext<RegionCoprocessorEnvironment> c, 
556       final Put put, final WALEdit edit, final Durability durability)
557     throws IOException;
558 
559   /**
560    * Called after the client stores a value.
561    * <p>
562    * Call CoprocessorEnvironment#complete to skip any subsequent chained
563    * coprocessors
564    * @param c the environment provided by the region server
565    * @param put The Put object
566    * @param edit The WALEdit object for the wal
567    * @param durability Persistence guarantee for this Put
568    * @throws IOException if an error occurred on the coprocessor
569    */
570   void postPut(final ObserverContext<RegionCoprocessorEnvironment> c, 
571       final Put put, final WALEdit edit, final Durability durability)
572     throws IOException;
573 
574   /**
575    * Called before the client deletes a value.
576    * <p>
577    * Call CoprocessorEnvironment#bypass to skip default actions
578    * <p>
579    * Call CoprocessorEnvironment#complete to skip any subsequent chained
580    * coprocessors
581    * @param c the environment provided by the region server
582    * @param delete The Delete object
583    * @param edit The WALEdit object for the wal
584    * @param durability Persistence guarantee for this Delete
585    * @throws IOException if an error occurred on the coprocessor
586    */
587   void preDelete(final ObserverContext<RegionCoprocessorEnvironment> c, 
588       final Delete delete, final WALEdit edit, final Durability durability)
589     throws IOException;
590 /**
591  * Called before the server updates the timestamp for version delete with latest timestamp.
592  * <p>
593  * Call CoprocessorEnvironment#bypass to skip default actions
594  * <p>
595  * Call CoprocessorEnvironment#complete to skip any subsequent chained
596  * coprocessors
597  * @param c the environment provided by the region server
598  * @param mutation - the parent mutation associated with this delete cell
599  * @param cell - The deleteColumn with latest version cell
600  * @param byteNow - timestamp bytes
601  * @param get - the get formed using the current cell's row.
602  * Note that the get does not specify the family and qualifier
603  * @throws IOException
604  */
605   void prePrepareTimeStampForDeleteVersion(final ObserverContext<RegionCoprocessorEnvironment> c,
606       final Mutation mutation, final Cell cell, final byte[] byteNow,
607       final Get get) throws IOException;
608 
609   /**
610    * Called after the client deletes a value.
611    * <p>
612    * Call CoprocessorEnvironment#complete to skip any subsequent chained
613    * coprocessors
614    * @param c the environment provided by the region server
615    * @param delete The Delete object
616    * @param edit The WALEdit object for the wal
617    * @param durability Persistence guarantee for this Delete
618    * @throws IOException if an error occurred on the coprocessor
619    */
620   void postDelete(final ObserverContext<RegionCoprocessorEnvironment> c,
621       final Delete delete, final WALEdit edit, final Durability durability)
622     throws IOException;
623   
624   /**
625    * This will be called for every batch mutation operation happening at the server. This will be
626    * called after acquiring the locks on the mutating rows and after applying the proper timestamp
627    * for each Mutation at the server. The batch may contain Put/Delete. By setting OperationStatus
628    * of Mutations ({@link MiniBatchOperationInProgress#setOperationStatus(int, OperationStatus)}),
629    * {@link RegionObserver} can make HRegion to skip these Mutations.
630    * @param c the environment provided by the region server
631    * @param miniBatchOp batch of Mutations getting applied to region.
632    * @throws IOException if an error occurred on the coprocessor
633    */
634   void preBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
635       final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException;
636 
637   /**
638    * This will be called after applying a batch of Mutations on a region. The Mutations are added to
639    * memstore and WAL.
640    * @param c the environment provided by the region server
641    * @param miniBatchOp batch of Mutations applied to region.
642    * @throws IOException if an error occurred on the coprocessor
643    */
644   void postBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
645       final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException;
646 
647   /**
648    * This will be called for region operations where read lock is acquired in
649    * {@link HRegion#startRegionOperation()}.
650    * @param ctx
651    * @param operation The operation is about to be taken on the region
652    * @throws IOException
653    */
654   void postStartRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
655       Operation operation) throws IOException;
656 
657   /**
658    * Called after releasing read lock in {@link HRegion#closeRegionOperation(Operation)}.
659    * @param ctx
660    * @param operation
661    * @throws IOException
662    */
663   void postCloseRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
664       Operation operation) throws IOException;
665 
666   /**
667    * Called after the completion of batch put/delete and will be called even if the batch operation
668    * fails
669    * @param ctx
670    * @param miniBatchOp 
671    * @param success true if batch operation is successful otherwise false.
672    * @throws IOException
673    */
674   void postBatchMutateIndispensably(final ObserverContext<RegionCoprocessorEnvironment> ctx,
675       MiniBatchOperationInProgress<Mutation> miniBatchOp, final boolean success) throws IOException;
676 
677   /**
678    * Called before checkAndPut.
679    * <p>
680    * Call CoprocessorEnvironment#bypass to skip default actions
681    * <p>
682    * Call CoprocessorEnvironment#complete to skip any subsequent chained
683    * coprocessors
684    * @param c the environment provided by the region server
685    * @param row row to check
686    * @param family column family
687    * @param qualifier column qualifier
688    * @param compareOp the comparison operation
689    * @param comparator the comparator
690    * @param put data to put if check succeeds
691    * @param result 
692    * @return the return value to return to client if bypassing default
693    * processing
694    * @throws IOException if an error occurred on the coprocessor
695    */
696   boolean preCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> c,
697       final byte [] row, final byte [] family, final byte [] qualifier,
698       final CompareOp compareOp, final ByteArrayComparable comparator,
699       final Put put, final boolean result)
700     throws IOException;
701 
702   /**
703    * Called before checkAndPut but after acquiring rowlock.
704    * <p>
705    * <b>Note:</b> Caution to be taken for not doing any long time operation in this hook. 
706    * Row will be locked for longer time. Trying to acquire lock on another row, within this, 
707    * can lead to potential deadlock.
708    * <p>
709    * Call CoprocessorEnvironment#bypass to skip default actions
710    * <p>
711    * Call CoprocessorEnvironment#complete to skip any subsequent chained
712    * coprocessors
713    * @param c the environment provided by the region server
714    * @param row row to check
715    * @param family column family
716    * @param qualifier column qualifier
717    * @param compareOp the comparison operation
718    * @param comparator the comparator
719    * @param put data to put if check succeeds
720    * @param result 
721    * @return the return value to return to client if bypassing default
722    * processing
723    * @throws IOException if an error occurred on the coprocessor
724    */
725   boolean preCheckAndPutAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
726       final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp,
727       final ByteArrayComparable comparator, final Put put, 
728       final boolean result) throws IOException;
729 
730   /**
731    * Called after checkAndPut
732    * <p>
733    * Call CoprocessorEnvironment#complete to skip any subsequent chained
734    * coprocessors
735    * @param c the environment provided by the region server
736    * @param row row to check
737    * @param family column family
738    * @param qualifier column qualifier
739    * @param compareOp the comparison operation
740    * @param comparator the comparator
741    * @param put data to put if check succeeds
742    * @param result from the checkAndPut
743    * @return the possibly transformed return value to return to client
744    * @throws IOException if an error occurred on the coprocessor
745    */
746   boolean postCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> c,
747       final byte [] row, final byte [] family, final byte [] qualifier,
748       final CompareOp compareOp, final ByteArrayComparable comparator,
749       final Put put, final boolean result)
750     throws IOException;
751 
752   /**
753    * Called before checkAndDelete.
754    * <p>
755    * Call CoprocessorEnvironment#bypass to skip default actions
756    * <p>
757    * Call CoprocessorEnvironment#complete to skip any subsequent chained
758    * coprocessors
759    * @param c the environment provided by the region server
760    * @param row row to check
761    * @param family column family
762    * @param qualifier column qualifier
763    * @param compareOp the comparison operation
764    * @param comparator the comparator
765    * @param delete delete to commit if check succeeds
766    * @param result 
767    * @return the value to return to client if bypassing default processing
768    * @throws IOException if an error occurred on the coprocessor
769    */
770   boolean preCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> c,
771       final byte [] row, final byte [] family, final byte [] qualifier,
772       final CompareOp compareOp, final ByteArrayComparable comparator,
773       final Delete delete, final boolean result)
774     throws IOException;
775 
776   /**
777    * Called before checkAndDelete but after acquiring rowock.
778    * <p>
779    * <b>Note:</b> Caution to be taken for not doing any long time operation in this hook. 
780    * Row will be locked for longer time. Trying to acquire lock on another row, within this, 
781    * can lead to potential deadlock.
782    * <p>
783    * Call CoprocessorEnvironment#bypass to skip default actions
784    * <p>
785    * Call CoprocessorEnvironment#complete to skip any subsequent chained
786    * coprocessors
787    * @param c the environment provided by the region server
788    * @param row row to check
789    * @param family column family
790    * @param qualifier column qualifier
791    * @param compareOp the comparison operation
792    * @param comparator the comparator
793    * @param delete delete to commit if check succeeds
794    * @param result 
795    * @return the value to return to client if bypassing default processing
796    * @throws IOException if an error occurred on the coprocessor
797    */
798   boolean preCheckAndDeleteAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
799       final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp,
800       final ByteArrayComparable comparator, final Delete delete,
801       final boolean result) throws IOException;
802 
803   /**
804    * Called after checkAndDelete
805    * <p>
806    * Call CoprocessorEnvironment#complete to skip any subsequent chained
807    * coprocessors
808    * @param c the environment provided by the region server
809    * @param row row to check
810    * @param family column family
811    * @param qualifier column qualifier
812    * @param compareOp the comparison operation
813    * @param comparator the comparator
814    * @param delete delete to commit if check succeeds
815    * @param result from the CheckAndDelete
816    * @return the possibly transformed returned value to return to client
817    * @throws IOException if an error occurred on the coprocessor
818    */
819   boolean postCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> c,
820       final byte [] row, final byte [] family, final byte [] qualifier,
821       final CompareOp compareOp, final ByteArrayComparable comparator,
822       final Delete delete, final boolean result)
823     throws IOException;
824 
825   /**
826    * Called before incrementColumnValue
827    * <p>
828    * Call CoprocessorEnvironment#bypass to skip default actions
829    * <p>
830    * Call CoprocessorEnvironment#complete to skip any subsequent chained
831    * coprocessors
832    * @param c the environment provided by the region server
833    * @param row row to check
834    * @param family column family
835    * @param qualifier column qualifier
836    * @param amount long amount to increment
837    * @param writeToWAL true if the change should be written to the WAL
838    * @return value to return to the client if bypassing default processing
839    * @throws IOException if an error occurred on the coprocessor
840    * @deprecated This hook is no longer called by the RegionServer
841    */
842   @Deprecated
843   long preIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> c,
844       final byte [] row, final byte [] family, final byte [] qualifier,
845       final long amount, final boolean writeToWAL)
846     throws IOException;
847 
848   /**
849    * Called after incrementColumnValue
850    * <p>
851    * Call CoprocessorEnvironment#complete to skip any subsequent chained
852    * coprocessors
853    * @param c the environment provided by the region server
854    * @param row row to check
855    * @param family column family
856    * @param qualifier column qualifier
857    * @param amount long amount to increment
858    * @param writeToWAL true if the change should be written to the WAL
859    * @param result the result returned by incrementColumnValue
860    * @return the result to return to the client
861    * @throws IOException if an error occurred on the coprocessor
862    * @deprecated This hook is no longer called by the RegionServer
863    */
864   @Deprecated
865   long postIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> c,
866       final byte [] row, final byte [] family, final byte [] qualifier,
867       final long amount, final boolean writeToWAL, final long result)
868     throws IOException;
869 
870   /**
871    * Called before Append.
872    * <p>
873    * Call CoprocessorEnvironment#bypass to skip default actions
874    * <p>
875    * Call CoprocessorEnvironment#complete to skip any subsequent chained
876    * coprocessors
877    * @param c the environment provided by the region server
878    * @param append Append object
879    * @return result to return to the client if bypassing default processing
880    * @throws IOException if an error occurred on the coprocessor
881    */
882   Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> c,
883       final Append append)
884     throws IOException;
885 
886   /**
887    * Called before Append but after acquiring rowlock.
888    * <p>
889    * <b>Note:</b> Caution to be taken for not doing any long time operation in this hook. 
890    * Row will be locked for longer time. Trying to acquire lock on another row, within this, 
891    * can lead to potential deadlock.
892    * <p>
893    * Call CoprocessorEnvironment#bypass to skip default actions
894    * <p>
895    * Call CoprocessorEnvironment#complete to skip any subsequent chained
896    * coprocessors
897    * @param c the environment provided by the region server
898    * @param append Append object
899    * @return result to return to the client if bypassing default processing
900    * @throws IOException if an error occurred on the coprocessor
901    */
902   Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
903       final Append append) throws IOException;
904 
905   /**
906    * Called after Append
907    * <p>
908    * Call CoprocessorEnvironment#complete to skip any subsequent chained
909    * coprocessors
910    * @param c the environment provided by the region server
911    * @param append Append object
912    * @param result the result returned by increment
913    * @return the result to return to the client
914    * @throws IOException if an error occurred on the coprocessor
915    */
916   Result postAppend(final ObserverContext<RegionCoprocessorEnvironment> c,
917       final Append append, final Result result)
918     throws IOException;
919 
920   /**
921    * Called before Increment.
922    * <p>
923    * Call CoprocessorEnvironment#bypass to skip default actions
924    * <p>
925    * Call CoprocessorEnvironment#complete to skip any subsequent chained
926    * coprocessors
927    * @param c the environment provided by the region server
928    * @param increment increment object
929    * @return result to return to the client if bypassing default processing
930    * @throws IOException if an error occurred on the coprocessor
931    */
932   Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> c,
933       final Increment increment)
934     throws IOException;
935 
936   /**
937    * Called before Increment but after acquiring rowlock.
938    * <p>
939    * <b>Note:</b> Caution to be taken for not doing any long time operation in this hook. 
940    * Row will be locked for longer time. Trying to acquire lock on another row, within this, 
941    * can lead to potential deadlock.
942    * <p>
943    * Call CoprocessorEnvironment#bypass to skip default actions
944    * <p>
945    * Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
946    * 
947    * @param c
948    *          the environment provided by the region server
949    * @param increment
950    *          increment object
951    * @return result to return to the client if bypassing default processing
952    * @throws IOException
953    *           if an error occurred on the coprocessor
954    */
955   Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> c,
956       final Increment increment) throws IOException;
957 
958   /**
959    * Called after increment
960    * <p>
961    * Call CoprocessorEnvironment#complete to skip any subsequent chained
962    * coprocessors
963    * @param c the environment provided by the region server
964    * @param increment increment object
965    * @param result the result returned by increment
966    * @return the result to return to the client
967    * @throws IOException if an error occurred on the coprocessor
968    */
969   Result postIncrement(final ObserverContext<RegionCoprocessorEnvironment> c,
970       final Increment increment, final Result result)
971     throws IOException;
972 
973   /**
974    * Called before the client opens a new scanner.
975    * <p>
976    * Call CoprocessorEnvironment#bypass to skip default actions
977    * <p>
978    * Call CoprocessorEnvironment#complete to skip any subsequent chained
979    * coprocessors
980    * @param c the environment provided by the region server
981    * @param scan the Scan specification
982    * @param s if not null, the base scanner
983    * @return an RegionScanner instance to use instead of the base scanner if
984    * overriding default behavior, null otherwise
985    * @throws IOException if an error occurred on the coprocessor
986    */
987   RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
988       final Scan scan, final RegionScanner s)
989     throws IOException;
990 
991   /**
992    * Called before a store opens a new scanner.
993    * This hook is called when a "user" scanner is opened.
994    * <p>
995    * See {@link #preFlushScannerOpen(ObserverContext, Store, KeyValueScanner, InternalScanner)}
996    * and {@link #preCompactScannerOpen(ObserverContext,
997    *  Store, List, ScanType, long, InternalScanner)}
998    * to override scanners created for flushes or compactions, resp.
999    * <p>
1000    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1001    * coprocessors.
1002    * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
1003    * effect in this hook.
1004    * @param c the environment provided by the region server
1005    * @param store the store being scanned
1006    * @param scan the Scan specification
1007    * @param targetCols columns to be used in the scanner
1008    * @param s the base scanner, if not {@code null}, from previous RegionObserver in the chain
1009    * @return a KeyValueScanner instance to use or {@code null} to use the default implementation
1010    * @throws IOException if an error occurred on the coprocessor
1011    */
1012   KeyValueScanner preStoreScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
1013       final Store store, final Scan scan, final NavigableSet<byte[]> targetCols,
1014       final KeyValueScanner s) throws IOException;
1015 
1016   /**
1017    * Called after the client opens a new scanner.
1018    * <p>
1019    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1020    * coprocessors
1021    * @param c the environment provided by the region server
1022    * @param scan the Scan specification
1023    * @param s if not null, the base scanner
1024    * @return the scanner instance to use
1025    * @throws IOException if an error occurred on the coprocessor
1026    */
1027   RegionScanner postScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
1028       final Scan scan, final RegionScanner s)
1029     throws IOException;
1030 
1031   /**
1032    * Called before the client asks for the next row on a scanner.
1033    * <p>
1034    * Call CoprocessorEnvironment#bypass to skip default actions
1035    * <p>
1036    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1037    * coprocessors
1038    * @param c the environment provided by the region server
1039    * @param s the scanner
1040    * @param result The result to return to the client if default processing
1041    * is bypassed. Can be modified. Will not be returned if default processing
1042    * is not bypassed.
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 preScannerNext(final ObserverContext<RegionCoprocessorEnvironment> c,
1049       final InternalScanner s, final List<Result> result,
1050       final int limit, final boolean hasNext)
1051     throws IOException;
1052 
1053   /**
1054    * Called after the client asks for the next row on a scanner.
1055    * <p>
1056    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1057    * coprocessors
1058    * @param c the environment provided by the region server
1059    * @param s the scanner
1060    * @param result the result to return to the client, can be modified
1061    * @param limit the maximum number of results to return
1062    * @param hasNext the 'has more' indication
1063    * @return 'has more' indication that should be sent to client
1064    * @throws IOException if an error occurred on the coprocessor
1065    */
1066   boolean postScannerNext(final ObserverContext<RegionCoprocessorEnvironment> c,
1067       final InternalScanner s, final List<Result> result, final int limit,
1068       final boolean hasNext)
1069     throws IOException;
1070 
1071   /**
1072    * This will be called by the scan flow when the current scanned row is being filtered out by the
1073    * filter. The filter may be filtering out the row via any of the below scenarios
1074    * <ol>
1075    * <li>
1076    * <code>boolean filterRowKey(byte [] buffer, int offset, int length)</code> returning true</li>
1077    * <li>
1078    * <code>boolean filterRow()</code> returning true</li>
1079    * <li>
1080    * <code>void filterRow(List<KeyValue> kvs)</code> removing all the kvs from the passed List</li>
1081    * </ol>
1082    * @param c the environment provided by the region server
1083    * @param s the scanner
1084    * @param currentRow The current rowkey which got filtered out
1085    * @param offset offset to rowkey
1086    * @param length length of rowkey
1087    * @param hasMore the 'has more' indication
1088    * @return whether more rows are available for the scanner or not
1089    * @throws IOException
1090    */
1091   boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> c,
1092       final InternalScanner s, final byte[] currentRow, final int offset, final short length,
1093       final boolean hasMore) throws IOException;
1094   
1095   /**
1096    * Called before the client closes a scanner.
1097    * <p>
1098    * Call CoprocessorEnvironment#bypass to skip default actions
1099    * <p>
1100    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1101    * coprocessors
1102    * @param c the environment provided by the region server
1103    * @param s the scanner
1104    * @throws IOException if an error occurred on the coprocessor
1105    */
1106   void preScannerClose(final ObserverContext<RegionCoprocessorEnvironment> c,
1107       final InternalScanner s)
1108     throws IOException;
1109 
1110   /**
1111    * Called after the client closes a scanner.
1112    * <p>
1113    * Call CoprocessorEnvironment#complete to skip any subsequent chained
1114    * coprocessors
1115    * @param c the environment provided by the region server
1116    * @param s the scanner
1117    * @throws IOException if an error occurred on the coprocessor
1118    */
1119   void postScannerClose(final ObserverContext<RegionCoprocessorEnvironment> c,
1120       final InternalScanner s)
1121     throws IOException;
1122 
1123   /**
1124    * Called before a {@link org.apache.hadoop.hbase.regionserver.wal.WALEdit}
1125    * replayed for this region.
1126    *
1127    * @param ctx
1128    * @param info
1129    * @param logKey
1130    * @param logEdit
1131    * @throws IOException
1132    */
1133   void preWALRestore(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1134       HRegionInfo info, HLogKey logKey, WALEdit logEdit) throws IOException;
1135 
1136   /**
1137    * Called after a {@link org.apache.hadoop.hbase.regionserver.wal.WALEdit}
1138    * replayed for this region.
1139    *
1140    * @param ctx
1141    * @param info
1142    * @param logKey
1143    * @param logEdit
1144    * @throws IOException
1145    */
1146   void postWALRestore(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1147       HRegionInfo info, HLogKey logKey, WALEdit logEdit) throws IOException;
1148 
1149   /**
1150    * Called before bulkLoadHFile. Users can create a StoreFile instance to
1151    * access the contents of a HFile.
1152    *
1153    * @param ctx
1154    * @param familyPaths pairs of { CF, HFile path } submitted for bulk load. Adding
1155    * or removing from this list will add or remove HFiles to be bulk loaded.
1156    * @throws IOException
1157    */
1158   void preBulkLoadHFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1159     List<Pair<byte[], String>> familyPaths) throws IOException;
1160 
1161   /**
1162    * Called after bulkLoadHFile.
1163    *
1164    * @param ctx
1165    * @param familyPaths pairs of { CF, HFile path } submitted for bulk load
1166    * @param hasLoaded whether the bulkLoad was successful
1167    * @return the new value of hasLoaded
1168    * @throws IOException
1169    */
1170   boolean postBulkLoadHFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1171     List<Pair<byte[], String>> familyPaths, boolean hasLoaded) throws IOException;
1172 
1173   /**
1174    * Called before creation of Reader for a store file.
1175    * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
1176    * effect in this hook.
1177    * 
1178    * @param ctx the environment provided by the region server
1179    * @param fs fileystem to read from
1180    * @param p path to the file
1181    * @param in {@link FSDataInputStreamWrapper}
1182    * @param size Full size of the file
1183    * @param cacheConf
1184    * @param r original reference file. This will be not null only when reading a split file.
1185    * @param reader the base reader, if not {@code null}, from previous RegionObserver in the chain
1186    * @return a Reader instance to use instead of the base reader if overriding
1187    * default behavior, null otherwise
1188    * @throws IOException
1189    */
1190   StoreFile.Reader preStoreFileReaderOpen(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 the creation of Reader for a store file.
1196    * 
1197    * @param ctx the environment provided by the region server
1198    * @param fs fileystem to read from
1199    * @param p path to the file
1200    * @param in {@link FSDataInputStreamWrapper}
1201    * @param size Full size of the file
1202    * @param cacheConf
1203    * @param r original reference file. This will be not null only when reading a split file.
1204    * @param reader the base reader instance
1205    * @return The reader to use
1206    * @throws IOException
1207    */
1208   StoreFile.Reader postStoreFileReaderOpen(final ObserverContext<RegionCoprocessorEnvironment> ctx,
1209       final FileSystem fs, final Path p, final FSDataInputStreamWrapper in, long size,
1210       final CacheConfig cacheConf, final Reference r, StoreFile.Reader reader) throws IOException;
1211 
1212   /**
1213    * Called after a new cell has been created during an increment operation, but before
1214    * it is committed to the WAL or memstore.
1215    * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
1216    * effect in this hook.
1217    * @param ctx the environment provided by the region server
1218    * @param opType the operation type
1219    * @param mutation the current mutation
1220    * @param oldCell old cell containing previous value
1221    * @param newCell the new cell containing the computed value
1222    * @return the new cell, possibly changed
1223    * @throws IOException
1224    */
1225   Cell postMutationBeforeWAL(ObserverContext<RegionCoprocessorEnvironment> ctx,
1226       MutationType opType, Mutation mutation, Cell oldCell, Cell newCell) throws IOException;
1227 
1228   /**
1229    * Called after the ScanQueryMatcher creates ScanDeleteTracker. Implementing
1230    * this hook would help in creating customised DeleteTracker and returning
1231    * the newly created DeleteTracker
1232    *
1233    * @param ctx the environment provided by the region server
1234    * @param delTracker the deleteTracker that is created by the QueryMatcher
1235    * @return the Delete Tracker
1236    * @throws IOException
1237    */
1238   DeleteTracker postInstantiateDeleteTracker(
1239       final ObserverContext<RegionCoprocessorEnvironment> ctx, DeleteTracker delTracker)
1240       throws IOException;
1241 }