1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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.CoprocessorEnvironment;
32 import org.apache.hadoop.hbase.HBaseInterfaceAudience;
33 import org.apache.hadoop.hbase.HRegionInfo;
34 import org.apache.hadoop.hbase.client.Append;
35 import org.apache.hadoop.hbase.client.Delete;
36 import org.apache.hadoop.hbase.client.Durability;
37 import org.apache.hadoop.hbase.client.Get;
38 import org.apache.hadoop.hbase.client.Increment;
39 import org.apache.hadoop.hbase.client.Mutation;
40 import org.apache.hadoop.hbase.client.Put;
41 import org.apache.hadoop.hbase.client.Result;
42 import org.apache.hadoop.hbase.client.Scan;
43 import org.apache.hadoop.hbase.filter.ByteArrayComparable;
44 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
45 import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
46 import org.apache.hadoop.hbase.io.Reference;
47 import org.apache.hadoop.hbase.io.hfile.CacheConfig;
48 import org.apache.hadoop.hbase.regionserver.DeleteTracker;
49 import org.apache.hadoop.hbase.regionserver.InternalScanner;
50 import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
51 import org.apache.hadoop.hbase.regionserver.MiniBatchOperationInProgress;
52 import org.apache.hadoop.hbase.regionserver.Region;
53 import org.apache.hadoop.hbase.regionserver.Region.Operation;
54 import org.apache.hadoop.hbase.regionserver.RegionScanner;
55 import org.apache.hadoop.hbase.regionserver.ScanType;
56 import org.apache.hadoop.hbase.regionserver.Store;
57 import org.apache.hadoop.hbase.regionserver.StoreFile;
58 import org.apache.hadoop.hbase.regionserver.StoreFile.Reader;
59 import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
60 import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
61 import org.apache.hadoop.hbase.wal.WALKey;
62 import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
63 import org.apache.hadoop.hbase.util.Pair;
64
65 import com.google.common.collect.ImmutableList;
66
67
68
69
70
71
72 @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
73 @InterfaceStability.Evolving
74 public class BaseRegionObserver implements RegionObserver {
75 @Override
76 public void start(CoprocessorEnvironment e) throws IOException { }
77
78 @Override
79 public void stop(CoprocessorEnvironment e) throws IOException { }
80
81 @Override
82 public void preOpen(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException { }
83
84 @Override
85 public void postOpen(ObserverContext<RegionCoprocessorEnvironment> e) { }
86
87 @Override
88 public void postLogReplay(ObserverContext<RegionCoprocessorEnvironment> e) { }
89
90 @Override
91 public void preClose(ObserverContext<RegionCoprocessorEnvironment> c, boolean abortRequested)
92 throws IOException { }
93
94 @Override
95 public void postClose(ObserverContext<RegionCoprocessorEnvironment> e,
96 boolean abortRequested) { }
97
98 @Override
99 public InternalScanner preFlushScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
100 final Store store, final KeyValueScanner memstoreScanner, final InternalScanner s)
101 throws IOException {
102 return s;
103 }
104
105 @Override
106 public InternalScanner preFlushScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
107 final Store store, final KeyValueScanner memstoreScanner, final InternalScanner s,
108 final long readPoint) throws IOException {
109 return preFlushScannerOpen(c, store, memstoreScanner, s);
110 }
111
112 @Override
113 public void preFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
114 }
115
116 @Override
117 public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
118 }
119
120 @Override
121 public InternalScanner preFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
122 InternalScanner scanner) throws IOException {
123 return scanner;
124 }
125
126 @Override
127 public void postFlush(ObserverContext<RegionCoprocessorEnvironment> e, Store store,
128 StoreFile resultFile) throws IOException {
129 }
130
131 @Override
132 public void preSplit(ObserverContext<RegionCoprocessorEnvironment> e) throws IOException {
133 }
134
135 @Override
136 public void preSplit(ObserverContext<RegionCoprocessorEnvironment> c,
137 byte[] splitRow) throws IOException {
138 }
139
140 @Override
141 public void preSplitBeforePONR(ObserverContext<RegionCoprocessorEnvironment> ctx,
142 byte[] splitKey, List<Mutation> metaEntries) throws IOException {
143 }
144
145 @Override
146 public void preSplitAfterPONR(
147 ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
148 }
149
150 @Override
151 public void preRollBackSplit(ObserverContext<RegionCoprocessorEnvironment> ctx)
152 throws IOException {
153 }
154
155 @Override
156 public void postRollBackSplit(
157 ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
158 }
159
160 @Override
161 public void postCompleteSplit(
162 ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException {
163 }
164
165 @Override
166 public void postSplit(ObserverContext<RegionCoprocessorEnvironment> e, Region l, Region r)
167 throws IOException {
168 }
169
170 @Override
171 public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
172 final Store store, final List<StoreFile> candidates) throws IOException { }
173
174 @Override
175 public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
176 final Store store, final List<StoreFile> candidates, final CompactionRequest request)
177 throws IOException {
178 preCompactSelection(c, store, candidates);
179 }
180
181 @Override
182 public void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
183 final Store store, final ImmutableList<StoreFile> selected) { }
184
185 @Override
186 public void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
187 final Store store, final ImmutableList<StoreFile> selected, CompactionRequest request) {
188 postCompactSelection(c, store, selected);
189 }
190
191 @Override
192 public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
193 final Store store, final InternalScanner scanner, final ScanType scanType)
194 throws IOException {
195 return scanner;
196 }
197
198 @Override
199 public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
200 final Store store, final InternalScanner scanner, final ScanType scanType,
201 CompactionRequest request) throws IOException {
202 return preCompact(e, store, scanner, scanType);
203 }
204
205 @Override
206 public InternalScanner preCompactScannerOpen(
207 final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
208 List<? extends KeyValueScanner> scanners, final ScanType scanType, final long earliestPutTs,
209 final InternalScanner s) throws IOException {
210 return s;
211 }
212
213 @Override
214 public InternalScanner preCompactScannerOpen(
215 final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
216 List<? extends KeyValueScanner> scanners, final ScanType scanType, final long earliestPutTs,
217 final InternalScanner s, CompactionRequest request) throws IOException {
218 return preCompactScannerOpen(c, store, scanners, scanType, earliestPutTs, s);
219 }
220
221 @Override
222 public InternalScanner preCompactScannerOpen(ObserverContext<RegionCoprocessorEnvironment> c,
223 Store store, List<? extends KeyValueScanner> scanners, ScanType scanType, long earliestPutTs,
224 InternalScanner s, CompactionRequest request, long readPoint) throws IOException {
225 return preCompactScannerOpen(c, store, scanners, scanType, earliestPutTs, s, request);
226 }
227
228 @Override
229 public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, final Store store,
230 final StoreFile resultFile) throws IOException {
231 }
232
233 @Override
234 public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, final Store store,
235 final StoreFile resultFile, CompactionRequest request) throws IOException {
236 postCompact(e, store, resultFile);
237 }
238
239 @Override
240 public void preGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> e,
241 final byte [] row, final byte [] family, final Result result)
242 throws IOException {
243 }
244
245 @Override
246 public void postGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> e,
247 final byte [] row, final byte [] family, final Result result)
248 throws IOException {
249 }
250
251 @Override
252 public void preGetOp(final ObserverContext<RegionCoprocessorEnvironment> e,
253 final Get get, final List<Cell> results) throws IOException {
254 }
255
256 @Override
257 public void postGetOp(final ObserverContext<RegionCoprocessorEnvironment> e,
258 final Get get, final List<Cell> results) throws IOException {
259 }
260
261 @Override
262 public boolean preExists(final ObserverContext<RegionCoprocessorEnvironment> e,
263 final Get get, final boolean exists) throws IOException {
264 return exists;
265 }
266
267 @Override
268 public boolean postExists(final ObserverContext<RegionCoprocessorEnvironment> e,
269 final Get get, boolean exists) throws IOException {
270 return exists;
271 }
272
273 @Override
274 public void prePut(final ObserverContext<RegionCoprocessorEnvironment> e,
275 final Put put, final WALEdit edit, final Durability durability) throws IOException {
276 }
277
278 @Override
279 public void postPut(final ObserverContext<RegionCoprocessorEnvironment> e,
280 final Put put, final WALEdit edit, final Durability durability) throws IOException {
281 }
282
283 @Override
284 public void preDelete(final ObserverContext<RegionCoprocessorEnvironment> e, final Delete delete,
285 final WALEdit edit, final Durability durability) throws IOException {
286 }
287
288 @Override
289 public void prePrepareTimeStampForDeleteVersion(
290 final ObserverContext<RegionCoprocessorEnvironment> e, final Mutation delete,
291 final Cell cell, final byte[] byteNow, final Get get) throws IOException {
292 }
293
294 @Override
295 public void postDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
296 final Delete delete, final WALEdit edit, final Durability durability)
297 throws IOException {
298 }
299
300 @Override
301 public void preBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
302 final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
303 }
304
305 @Override
306 public void postBatchMutate(final ObserverContext<RegionCoprocessorEnvironment> c,
307 final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
308 }
309
310 @Override
311 public void postBatchMutateIndispensably(final ObserverContext<RegionCoprocessorEnvironment> ctx,
312 MiniBatchOperationInProgress<Mutation> miniBatchOp, final boolean success) throws IOException {
313 }
314
315 @Override
316 public boolean preCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> e,
317 final byte [] row, final byte [] family, final byte [] qualifier,
318 final CompareOp compareOp, final ByteArrayComparable comparator,
319 final Put put, final boolean result) throws IOException {
320 return result;
321 }
322
323 @Override
324 public boolean preCheckAndPutAfterRowLock(
325 final ObserverContext<RegionCoprocessorEnvironment> e,
326 final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp,
327 final ByteArrayComparable comparator, final Put put,
328 final boolean result) throws IOException {
329 return result;
330 }
331
332 @Override
333 public boolean postCheckAndPut(final ObserverContext<RegionCoprocessorEnvironment> e,
334 final byte [] row, final byte [] family, final byte [] qualifier,
335 final CompareOp compareOp, final ByteArrayComparable comparator,
336 final Put put, final boolean result) throws IOException {
337 return result;
338 }
339
340 @Override
341 public boolean preCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
342 final byte [] row, final byte [] family, final byte [] qualifier,
343 final CompareOp compareOp, final ByteArrayComparable comparator,
344 final Delete delete, final boolean result) throws IOException {
345 return result;
346 }
347
348 @Override
349 public boolean preCheckAndDeleteAfterRowLock(
350 final ObserverContext<RegionCoprocessorEnvironment> e,
351 final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp,
352 final ByteArrayComparable comparator, final Delete delete,
353 final boolean result) throws IOException {
354 return result;
355 }
356
357 @Override
358 public boolean postCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> e,
359 final byte [] row, final byte [] family, final byte [] qualifier,
360 final CompareOp compareOp, final ByteArrayComparable comparator,
361 final Delete delete, final boolean result) throws IOException {
362 return result;
363 }
364
365 @Override
366 public Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> e,
367 final Append append) throws IOException {
368 return null;
369 }
370
371 @Override
372 public Result preAppendAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> e,
373 final Append append) throws IOException {
374 return null;
375 }
376
377 @Override
378 public Result postAppend(final ObserverContext<RegionCoprocessorEnvironment> e,
379 final Append append, final Result result) throws IOException {
380 return result;
381 }
382
383 @Override
384 public long preIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> e,
385 final byte [] row, final byte [] family, final byte [] qualifier,
386 final long amount, final boolean writeToWAL) throws IOException {
387 return amount;
388 }
389
390 @Override
391 public long postIncrementColumnValue(final ObserverContext<RegionCoprocessorEnvironment> e,
392 final byte [] row, final byte [] family, final byte [] qualifier,
393 final long amount, final boolean writeToWAL, long result)
394 throws IOException {
395 return result;
396 }
397
398 @Override
399 public Result preIncrement(final ObserverContext<RegionCoprocessorEnvironment> e,
400 final Increment increment) throws IOException {
401 return null;
402 }
403
404 @Override
405 public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEnvironment> e,
406 final Increment increment) throws IOException {
407 return null;
408 }
409
410 @Override
411 public Result postIncrement(final ObserverContext<RegionCoprocessorEnvironment> e,
412 final Increment increment, final Result result) throws IOException {
413 return result;
414 }
415
416 @Override
417 public RegionScanner preScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,
418 final Scan scan, final RegionScanner s) throws IOException {
419 return s;
420 }
421
422 @Override
423 public KeyValueScanner preStoreScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
424 final Store store, final Scan scan, final NavigableSet<byte[]> targetCols,
425 final KeyValueScanner s) throws IOException {
426 return s;
427 }
428
429 @Override
430 public RegionScanner postScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> e,
431 final Scan scan, final RegionScanner s) throws IOException {
432 return s;
433 }
434
435 @Override
436 public boolean preScannerNext(final ObserverContext<RegionCoprocessorEnvironment> e,
437 final InternalScanner s, final List<Result> results,
438 final int limit, final boolean hasMore) throws IOException {
439 return hasMore;
440 }
441
442 @Override
443 public boolean postScannerNext(final ObserverContext<RegionCoprocessorEnvironment> e,
444 final InternalScanner s, final List<Result> results, final int limit,
445 final boolean hasMore) throws IOException {
446 return hasMore;
447 }
448
449 @Override
450 public boolean postScannerFilterRow(final ObserverContext<RegionCoprocessorEnvironment> e,
451 final InternalScanner s, final byte[] currentRow, final int offset, final short length,
452 final boolean hasMore) throws IOException {
453 return hasMore;
454 }
455
456 @Override
457 public void preScannerClose(final ObserverContext<RegionCoprocessorEnvironment> e,
458 final InternalScanner s) throws IOException {
459 }
460
461 @Override
462 public void postScannerClose(final ObserverContext<RegionCoprocessorEnvironment> e,
463 final InternalScanner s) throws IOException {
464 }
465
466
467
468
469 @Override
470 public void preWALRestore(ObserverContext<? extends RegionCoprocessorEnvironment> env,
471 HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
472 }
473
474 @Override
475 public void preWALRestore(ObserverContext<RegionCoprocessorEnvironment> env, HRegionInfo info,
476 HLogKey logKey, WALEdit logEdit) throws IOException {
477 preWALRestore(env, info, (WALKey)logKey, logEdit);
478 }
479
480
481
482
483 @Override
484 public void postWALRestore(ObserverContext<? extends RegionCoprocessorEnvironment> env,
485 HRegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException {
486 }
487
488 @Override
489 public void postWALRestore(ObserverContext<RegionCoprocessorEnvironment> env,
490 HRegionInfo info, HLogKey logKey, WALEdit logEdit) throws IOException {
491 postWALRestore(env, info, (WALKey)logKey, logEdit);
492 }
493
494 @Override
495 public void preBulkLoadHFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
496 List<Pair<byte[], String>> familyPaths) throws IOException {
497 }
498
499 @Override
500 public void preCommitStoreFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
501 final byte[] family, final List<Pair<Path, Path>> pairs) throws IOException {
502 }
503
504 @Override
505 public void postCommitStoreFile(final ObserverContext<RegionCoprocessorEnvironment> ctx,
506 final byte[] family, Path srcPath, Path dstPath) throws IOException {
507 }
508
509 @Override
510 public boolean postBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> ctx,
511 List<Pair<byte[], String>> familyPaths, boolean hasLoaded) throws IOException {
512 return hasLoaded;
513 }
514
515 @Override
516 public Reader preStoreFileReaderOpen(ObserverContext<RegionCoprocessorEnvironment> ctx,
517 FileSystem fs, Path p, FSDataInputStreamWrapper in, long size, CacheConfig cacheConf,
518 Reference r, Reader reader) throws IOException {
519 return reader;
520 }
521
522 @Override
523 public Reader postStoreFileReaderOpen(ObserverContext<RegionCoprocessorEnvironment> ctx,
524 FileSystem fs, Path p, FSDataInputStreamWrapper in, long size, CacheConfig cacheConf,
525 Reference r, Reader reader) throws IOException {
526 return reader;
527 }
528
529 @Override
530 public Cell postMutationBeforeWAL(ObserverContext<RegionCoprocessorEnvironment> ctx,
531 MutationType opType, Mutation mutation, Cell oldCell, Cell newCell) throws IOException {
532 return newCell;
533 }
534
535 @Override
536 public void postStartRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
537 Operation op) throws IOException {
538 }
539
540 @Override
541 public void postCloseRegionOperation(final ObserverContext<RegionCoprocessorEnvironment> ctx,
542 Operation op) throws IOException {
543 }
544
545 @Override
546 public DeleteTracker postInstantiateDeleteTracker(
547 final ObserverContext<RegionCoprocessorEnvironment> ctx, DeleteTracker delTracker)
548 throws IOException {
549 return delTracker;
550 }
551
552 @Override
553 public void preWALAppend(ObserverContext<RegionCoprocessorEnvironment> ctx, WALKey key,
554 WALEdit edit) throws IOException {
555
556 }
557 }