1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.hadoop.hbase.coprocessor;
17
18 import java.util.List;
19 import java.util.NavigableSet;
20
21 import com.google.common.collect.ImmutableList;
22
23 import org.apache.hadoop.classification.InterfaceAudience;
24 import org.apache.hadoop.classification.InterfaceStability;
25 import org.apache.hadoop.hbase.CoprocessorEnvironment;
26 import org.apache.hadoop.hbase.HRegionInfo;
27 import org.apache.hadoop.hbase.KeyValue;
28 import org.apache.hadoop.hbase.client.Append;
29 import org.apache.hadoop.hbase.client.Delete;
30 import org.apache.hadoop.hbase.client.Get;
31 import org.apache.hadoop.hbase.client.Increment;
32 import org.apache.hadoop.hbase.client.Mutation;
33 import org.apache.hadoop.hbase.client.Put;
34 import org.apache.hadoop.hbase.client.Result;
35 import org.apache.hadoop.hbase.client.Scan;
36 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
37 import org.apache.hadoop.hbase.filter.ByteArrayComparable;
38 import org.apache.hadoop.hbase.regionserver.HRegion;
39 import org.apache.hadoop.hbase.regionserver.InternalScanner;
40 import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
41 import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
42 import org.apache.hadoop.hbase.regionserver.RegionScanner;
43 import org.apache.hadoop.hbase.regionserver.ScanType;
44 import org.apache.hadoop.hbase.regionserver.Store;
45 import org.apache.hadoop.hbase.regionserver.StoreFile;
46 import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
47 import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
48 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
49 import org.apache.hadoop.hbase.util.Pair;
50
51 import java.io.IOException;
52
53
54
55
56
57
58 @InterfaceAudience.Public
59 @InterfaceStability.Evolving
60 public abstract class BaseRegionObserver implements RegionObserver {
61 @Override
62 public void start(CoprocessorEnvironment e) throws IOException { }
63
64 @Override
65 public void stop(CoprocessorEnvironment e) throws IOException { }
66
67 @Override
68 public void preOpen(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException { }
69
70 @Override
71 public void postOpen(ObserverContext<RegionCoprocessorEnvironment> e) { }
72
73 @Override
74 public void preClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested)
75 throws IOException { }
76
77 @Override
78 public void postClose(ObserverContext<RegionCoprocessorEnvironment> e,
79 boolean abortRequested) { }
80
81 @Override
82 public InternalScanner preFlushScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
83 final Store store, final KeyValueScanner memstoreScanner, final InternalScanner s)
84 throws IOException {
85 return null;
86 }
87
88 @Override
89 public void preFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
90 }
91
92 @Override
93 public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
94 }
95
96 @Override
97 public InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
98 InternalScanner scanner) throws IOException {
99 return scanner;
100 }
101
102 @Override
103 public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
104 StoreFile resultFile) throws IOException {
105 }
106
107 @Override
108 public void preSplit(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
109 }
110
111 @Override
112 public void preSplit(ObserverContext<RegionCoprocessorEnvironment> c,
113 byte[] splitRow) throws IOException {
114 }
115
116 @Override
117 public void preRollBackSplit(ObserverContext<RegionCoprocessorEnvironment> ctx)
118 throws IOException {
119 }
120
121 @Override
122 public void postRollBackSplit(
123 ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
124 }
125
126 @Override
127 public void postCompleteSplit(
128 ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
129 }
130
131 @Override
132 public void postSplit(ObserverContext<RegionCoprocessorEnvironment> e, HRegion l, HRegion r)
133 throws IOException {
134 }
135
136 @Override
137 public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
138 final Store store, final List<StoreFile> candidates) throws IOException { }
139
140 @Override
141 public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
142 final Store store, final List<StoreFile> candidates, final CompactionRequest request)
143 throws IOException {
144 preCompactSelection(c, store, candidates);
145 }
146
147 @Override
148 public void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
149 final Store store, final ImmutableList<StoreFile> selected) { }
150
151 @Override
152 public void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
153 final Store store, final ImmutableList<StoreFile> selected, CompactionRequest request) {
154 postCompactSelection(c, store, selected);
155 }
156
157 @Override
158 public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
159 final Store store, final InternalScanner scanner, final ScanType scanType)
160 throws IOException {
161 return scanner;
162 }
163
164 @Override
165 public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
166 final Store store, final InternalScanner scanner, final ScanType scanType,
167 CompactionRequest request) throws IOException {
168 return preCompact(e, store, scanner, scanType);
169 }
170
171 @Override
172 public InternalScanner preCompactScannerOpen(
173 final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
174 List<? extends KeyValueScanner> scanners, final ScanType scanType, final long earliestPutTs,
175 final InternalScanner s) throws IOException {
176 return null;
177 }
178
179 @Override
180 public InternalScanner preCompactScannerOpen(
181 final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
182 List<? extends KeyValueScanner> scanners, final ScanType scanType, final long earliestPutTs,
183 final InternalScanner s, CompactionRequest request) throws IOException {
184 return preCompactScannerOpen(c, store, scanners, scanType, earliestPutTs, s);
185 }
186
187 @Override
188 public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, final Store store,
189 final StoreFile resultFile) throws IOException {
190 }
191
192 @Override
193 public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, final Store store,
194 final StoreFile resultFile, CompactionRequest request) throws IOException {
195 postCompact(e, store, resultFile);
196 }
197
198 @Override
199 public void preGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> e,
200 final byte [] row, final byte [] family, final Result result)
201 throws IOException {
202 }
203
204 @Override
205 public void postGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> e,
206 final byte [] row, final byte [] family, final Result result)
207 throws IOException {
208 }
209
210 @Override
211 public void preGet(final ObserverContext<RegionCoprocessorEnvironment> e,
212 final Get get, final List<KeyValue> results) throws IOException {
213 }
214
215 @Override
216 public void postGet(final ObserverContext<RegionCoprocessorEnvironment> e,
217 final Get get, final List<KeyValue> results) throws IOException {
218 }
219
220 @Override
221 public boolean preExists(final ObserverContext<RegionCoprocessorEnvironment> e,
222 final Get get, final boolean exists) throws IOException {
223 return exists;
224 }
225
226 @Override
227 public boolean postExists(final ObserverContext<RegionCoprocessorEnvironment> e,
228 final Get get, boolean exists) throws IOException {
229 return exists;
230 }
231
232 @Override
233 public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e,
234 final Put put, final WALEdit edit, final boolean writeToWAL) throws IOException {
235 }
236
237 @Override
238 public void postPut(final ObserverContext<RegionCoprocessorEnvironment> e,
239 final Put put, final WALEdit edit, final boolean writeToWAL) throws IOException {
240 }
241
242 @Override
243 public void preDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
244 final Delete delete, final WALEdit edit, final boolean writeToWAL) throws IOException {
245 }
246
247 @Override
248 public void postDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
249 final Delete delete, final WALEdit edit, final boolean writeToWAL) throws IOException {
250 }
251
252 @Override
253 public void preBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
254 final MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) throws IOException {
255 }
256
257 @Override
258 public void postBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
259 final MiniBatchOperationInProgress<Pair<Mutation, Integer>> miniBatchOp) throws IOException {
260 }
261
262 @Override
263 public boolean preCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> e,
264 final byte [] row, final byte [] family, final byte [] qualifier,
265 final CompareOp compareOp, final ByteArrayComparable comparator,
266 final Put put, final boolean result) throws IOException {
267 return result;
268 }
269
270 @Override
271 public boolean postCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> e,
272 final byte [] row, final byte [] family, final byte [] qualifier,
273 final CompareOp compareOp, final ByteArrayComparable comparator,
274 final Put put, final boolean result) throws IOException {
275 return result;
276 }
277
278 @Override
279 public boolean preCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
280 final byte [] row, final byte [] family, final byte [] qualifier,
281 final CompareOp compareOp, final ByteArrayComparable comparator,
282 final Delete delete, final boolean result) throws IOException {
283 return result;
284 }
285
286 @Override
287 public boolean postCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
288 final byte [] row, final byte [] family, final byte [] qualifier,
289 final CompareOp compareOp, final ByteArrayComparable comparator,
290 final Delete delete, final boolean result) throws IOException {
291 return result;
292 }
293
294 @Override
295 public Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> e,
296 final Append append) throws IOException {
297 return null;
298 }
299
300 @Override
301 public Result postAppend(final ObserverContext<RegionCoprocessorEnvironment> e,
302 final Append append, final Result result) throws IOException {
303 return result;
304 }
305
306 @Override
307 public long preIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> e,
308 final byte [] row, final byte [] family, final byte [] qualifier,
309 final long amount, final boolean writeToWAL) throws IOException {
310 return amount;
311 }
312
313 @Override
314 public long postIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> e,
315 final byte [] row, final byte [] family, final byte [] qualifier,
316 final long amount, final boolean writeToWAL, long result)
317 throws IOException {
318 return result;
319 }
320
321 @Override
322 public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> e,
323 final Increment increment) throws IOException {
324 return null;
325 }
326
327 @Override
328 public Result postIncrement(final ObserverContext<RegionCoprocessorEnvironment> e,
329 final Increment increment, final Result result) throws IOException {
330 return result;
331 }
332
333 @Override
334 public RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,
335 final Scan scan, final RegionScanner s) throws IOException {
336 return s;
337 }
338
339 @Override
340 public KeyValueScanner preStoreScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
341 final Store store, final Scan scan, final NavigableSet<byte[]> targetCols,
342 final KeyValueScanner s) throws IOException {
343 return null;
344 }
345
346 @Override
347 public RegionScanner postScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,
348 final Scan scan, final RegionScanner s) throws IOException {
349 return s;
350 }
351
352 @Override
353 public boolean preScannerNext(final ObserverContext<RegionCoprocessorEnvironment> e,
354 final InternalScanner s, final List<Result> results,
355 final int limit, final boolean hasMore) throws IOException {
356 return hasMore;
357 }
358
359 @Override
360 public boolean postScannerNext(final ObserverContext<RegionCoprocessorEnvironment> e,
361 final InternalScanner s, final List<Result> results, final int limit,
362 final boolean hasMore) throws IOException {
363 return hasMore;
364 }
365
366 @Override
367 public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e,
368 final InternalScanner s, final byte[] currentRow, final boolean hasMore) throws IOException {
369 return hasMore;
370 }
371
372 @Override
373 public void preScannerClose(final ObserverContext<RegionCoprocessorEnvironment> e,
374 final InternalScanner s) throws IOException {
375 }
376
377 @Override
378 public void postScannerClose(final ObserverContext<RegionCoprocessorEnvironment> e,
379 final InternalScanner s) throws IOException {
380 }
381
382 @Override
383 public void preWALRestore(ObserverContext<RegionCoprocessorEnvironment> env, HRegionInfo info,
384 HLogKey logKey, WALEdit logEdit) throws IOException {
385 }
386
387 @Override
388 public void postWALRestore(ObserverContext<RegionCoprocessorEnvironment> env,
389 HRegionInfo info, HLogKey logKey, WALEdit logEdit) throws IOException {
390 }
391
392 @Override
393 public void preBulkLoadHFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
394 List<Pair<byte[], String>> familyPaths) throws IOException {
395 }
396
397 @Override
398 public boolean postBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx,
399 List<Pair<byte[], String>> familyPaths, boolean hasLoaded) throws IOException {
400 return hasLoaded;
401 }
402 }