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