View Javadoc

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