Permalink
Browse files

Pre-trunk-merging sync of trunk into snapshots branch

git-svn-id: https://svn.apache.org/repos/asf/hbase/branches/hbase-7290v2@1448497 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
2 parents d880a60 + 434d38a commit ca65f47aee238e6071dab5c9d4fd2323550ea82e @jmhsieh jmhsieh committed Feb 21, 2013
@@ -41,6 +41,8 @@
import org.apache.hadoop.hbase.regionserver.ScanType;
import org.apache.hadoop.hbase.regionserver.Store;
import org.apache.hadoop.hbase.regionserver.StoreFile;
+import org.apache.hadoop.hbase.regionserver.compactions.CompactSelection;
+import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.util.Pair;
@@ -135,28 +137,63 @@ public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironme
final Store store, final List<StoreFile> candidates) throws IOException { }
@Override
+ public void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
+ final Store store, final List<StoreFile> candidates, final CompactionRequest request)
+ throws IOException {
+ preCompactSelection(c, store, candidates);
+ }
+
+ @Override
public void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final ImmutableList<StoreFile> selected) { }
@Override
+ public void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
+ final Store store, final ImmutableList<StoreFile> selected, CompactionRequest request) {
+ postCompactSelection(c, store, selected);
+ }
+
+ @Override
public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
final Store store, final InternalScanner scanner, final ScanType scanType)
- throws IOException {
+ throws IOException {
return scanner;
}
@Override
- public InternalScanner preCompactScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
- final Store store, List<? extends KeyValueScanner> scanners, final ScanType scanType,
- final long earliestPutTs, final InternalScanner s) throws IOException {
+ public InternalScanner preCompact(ObserverContext<RegionCoprocessorEnvironment> e,
+ final Store store, final InternalScanner scanner, final ScanType scanType,
+ CompactionRequest request) throws IOException {
+ return preCompact(e, store, scanner, scanType);
+ }
+
+ @Override
+ public InternalScanner preCompactScannerOpen(
+ final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
+ List<? extends KeyValueScanner> scanners, final ScanType scanType, final long earliestPutTs,
+ final InternalScanner s) throws IOException {
return null;
}
@Override
+ public InternalScanner preCompactScannerOpen(
+ final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
+ List<? extends KeyValueScanner> scanners, final ScanType scanType, final long earliestPutTs,
+ final InternalScanner s, CompactionRequest request) throws IOException {
+ return preCompactScannerOpen(c, store, scanners, scanType, earliestPutTs, s);
+ }
+
+ @Override
public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, final Store store,
final StoreFile resultFile) throws IOException {
}
+@Override
+ public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, final Store store,
+ final StoreFile resultFile, CompactionRequest request) throws IOException {
+ postCompact(e, store, resultFile);
+ }
+
@Override
public void preGetClosestRowBefore(final ObserverContext<RegionCoprocessorEnvironment> e,
final byte [] row, final byte [] family, final Result result)
@@ -351,4 +388,4 @@ public boolean postBulkLoadHFile(ObserverContext<RegionCoprocessorEnvironment> c
List<Pair<byte[], String>> familyPaths, boolean hasLoaded) throws IOException {
return hasLoaded;
}
-}
+}
@@ -41,6 +41,7 @@
import org.apache.hadoop.hbase.regionserver.Store;
import org.apache.hadoop.hbase.regionserver.StoreFile;
import org.apache.hadoop.hbase.regionserver.StoreFileScanner;
+import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
@@ -126,87 +127,184 @@ void postFlush(final ObserverContext<RegionCoprocessorEnvironment> c, final Stor
final StoreFile resultFile) throws IOException;
/**
- * Called prior to selecting the {@link StoreFile}s to compact from the list
- * of available candidates. To alter the files used for compaction, you may
- * mutate the passed in list of candidates.
+ * Called prior to selecting the {@link StoreFile StoreFiles} to compact from the list of
+ * available candidates. To alter the files used for compaction, you may mutate the passed in list
+ * of candidates.
* @param c the environment provided by the region server
* @param store the store where compaction is being requested
* @param candidates the store files currently available for compaction
+ * @param request custom compaction request
* @throws IOException if an error occurred on the coprocessor
*/
void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
+ final Store store, final List<StoreFile> candidates, final CompactionRequest request)
+ throws IOException;
+
+ /**
+ * Called prior to selecting the {@link StoreFile}s to compact from the list of available
+ * candidates. To alter the files used for compaction, you may mutate the passed in list of
+ * candidates.
+ * @param c the environment provided by the region server
+ * @param store the store where compaction is being requested
+ * @param candidates the store files currently available for compaction
+ * @throws IOException if an error occurred on the coprocessor
+ * @deprecated Use {@link #preCompactSelection(ObserverContext, Store, List, Object)} instead
+ */
+ void preCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final List<StoreFile> candidates) throws IOException;
/**
- * Called after the {@link StoreFile}s to compact have been selected from the
- * available candidates.
+ * Called after the {@link StoreFile}s to compact have been selected from the available
+ * candidates.
* @param c the environment provided by the region server
* @param store the store being compacted
* @param selected the store files selected to compact
+ * @param request custom compaction request
*/
void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
+ final Store store, final ImmutableList<StoreFile> selected, CompactionRequest request);
+
+ /**
+ * Called after the {@link StoreFile}s to compact have been selected from the available
+ * candidates.
+ * @param c the environment provided by the region server
+ * @param store the store being compacted
+ * @param selected the store files selected to compact
+ * @param compactionAttributes custom attributes for the compaction
+ * @deprecated use {@link #postCompactSelection(ObserverContext, Store, ImmutableList, Object)}
+ * instead.
+ */
+ @Deprecated
+ void postCompactSelection(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, final ImmutableList<StoreFile> selected);
/**
- * Called prior to writing the {@link StoreFile}s selected for compaction into
- * a new {@code StoreFile}. To override or modify the compaction process,
- * implementing classes have two options:
+ * Called prior to writing the {@link StoreFile}s selected for compaction into a new
+ * {@code StoreFile}. To override or modify the compaction process, implementing classes have two
+ * options:
* <ul>
- * <li>Wrap the provided {@link InternalScanner} with a custom
- * implementation that is returned from this method. The custom scanner
- * can then inspect {@link KeyValue}s from the wrapped scanner, applying
- * its own policy to what gets written.</li>
- * <li>Call {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()}
- * and provide a custom implementation for writing of new
- * {@link StoreFile}s. <strong>Note: any implementations bypassing
- * core compaction using this approach must write out new store files
- * themselves or the existing data will no longer be available after
- * compaction.</strong></li>
+ * <li>Wrap the provided {@link InternalScanner} with a custom implementation that is returned
+ * from this method. The custom scanner can then inspect {@link KeyValue}s from the wrapped
+ * scanner, applying its own policy to what gets written.</li>
+ * <li>Call {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} and provide a
+ * custom implementation for writing of new {@link StoreFile}s. <strong>Note: any implementations
+ * bypassing core compaction using this approach must write out new store files themselves or the
+ * existing data will no longer be available after compaction.</strong></li>
* </ul>
* @param c the environment provided by the region server
* @param store the store being compacted
- * @param scanner the scanner over existing data used in the store file
- * rewriting
+ * @param scanner the scanner over existing data used in the store file rewriting
* @param scanType type of Scan
- * @return the scanner to use during compaction. Should not be {@code null}
- * unless the implementation is writing new store files on its own.
+ * @param request the requested compaction
+ * @return the scanner to use during compaction. Should not be {@code null} unless the
+ * implementation is writing new store files on its own.
* @throws IOException if an error occurred on the coprocessor
*/
InternalScanner preCompact(final ObserverContext<RegionCoprocessorEnvironment> c,
- final Store store, final InternalScanner scanner,
- final ScanType scanType) throws IOException;
+ final Store store, final InternalScanner scanner, final ScanType scanType,
+ CompactionRequest request) throws IOException;
/**
- * Called prior to writing the {@link StoreFile}s selected for compaction into
- * a new {@code StoreFile} and prior to creating the scanner used to read the
- * input files. To override or modify the compaction process,
- * implementing classes can return a new scanner to provide the KeyValues to be
- * stored into the new {@code StoreFile} or null to perform the default processing.
- * Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
+ * Called prior to writing the {@link StoreFile}s selected for compaction into a new
+ * {@code StoreFile}. To override or modify the compaction process, implementing classes have two
+ * options:
+ * <ul>
+ * <li>Wrap the provided {@link InternalScanner} with a custom implementation that is returned
+ * from this method. The custom scanner can then inspect {@link KeyValue}s from the wrapped
+ * scanner, applying its own policy to what gets written.</li>
+ * <li>Call {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} and provide a
+ * custom implementation for writing of new {@link StoreFile}s. <strong>Note: any implementations
+ * bypassing core compaction using this approach must write out new store files themselves or the
+ * existing data will no longer be available after compaction.</strong></li>
+ * </ul>
+ * @param c the environment provided by the region server
+ * @param store the store being compacted
+ * @param scanner the scanner over existing data used in the store file rewriting
+ * @param scanType type of Scan
+ * @param request the requested compaction
+ * @return the scanner to use during compaction. Should not be {@code null} unless the
+ * implementation is writing new store files on its own.
+ * @throws IOException if an error occurred on the coprocessor
+ * @deprecated use
+ * {@link #preCompact(ObserverContext, Store, InternalScanner, ScanType, CompactionRequest)}
+ * instead
+ */
+ @Deprecated
+ InternalScanner preCompact(final ObserverContext<RegionCoprocessorEnvironment> c,
+ final Store store, final InternalScanner scanner, final ScanType scanType) throws IOException;
+
+ /**
+ * Called prior to writing the {@link StoreFile}s selected for compaction into a new
+ * {@code StoreFile} and prior to creating the scanner used to read the input files. To override
+ * or modify the compaction process, implementing classes can return a new scanner to provide the
+ * KeyValues to be stored into the new {@code StoreFile} or null to perform the default
+ * processing. Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
* effect in this hook.
* @param c the environment provided by the region server
* @param store the store being compacted
* @param scanners the list {@link StoreFileScanner}s to be read from
* @param scanType the {@link ScanType} indicating whether this is a major or minor compaction
- * @param earliestPutTs timestamp of the earliest put that was found in any of the involved
- * store files
+ * @param earliestPutTs timestamp of the earliest put that was found in any of the involved store
+ * files
* @param s the base scanner, if not {@code null}, from previous RegionObserver in the chain
- * @return the scanner to use during compaction. {@code null} if the default implementation
- * is to be used.
+ * @param request the requested compaction
+ * @return the scanner to use during compaction. {@code null} if the default implementation is to
+ * be used.
* @throws IOException if an error occurred on the coprocessor
*/
InternalScanner preCompactScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
final Store store, List<? extends KeyValueScanner> scanners, final ScanType scanType,
+ final long earliestPutTs, final InternalScanner s, CompactionRequest request)
+ throws IOException;
+
+ /**
+ * Called prior to writing the {@link StoreFile}s selected for compaction into a new
+ * {@code StoreFile} and prior to creating the scanner used to read the input files. To override
+ * or modify the compaction process, implementing classes can return a new scanner to provide the
+ * KeyValues to be stored into the new {@code StoreFile} or null to perform the default
+ * processing. Calling {@link org.apache.hadoop.hbase.coprocessor.ObserverContext#bypass()} has no
+ * effect in this hook.
+ * @param c the environment provided by the region server
+ * @param store the store being compacted
+ * @param scanners the list {@link StoreFileScanner}s to be read from
+ * @param scanType the {@link ScanType} indicating whether this is a major or minor compaction
+ * @param earliestPutTs timestamp of the earliest put that was found in any of the involved store
+ * files
+ * @param s the base scanner, if not {@code null}, from previous RegionObserver in the chain
+ * @param request the requested compaction
+ * @return the scanner to use during compaction. {@code null} if the default implementation is to
+ * be used.
+ * @throws IOException if an error occurred on the coprocessor
+ * @deprecated Use
+ * {@link #preCompactScannerOpen(ObserverContext, Store, List, ScanType, long, InternalScanner, CompactionRequest)}
+ * instead.
+ */
+ @Deprecated
+ InternalScanner preCompactScannerOpen(final ObserverContext<RegionCoprocessorEnvironment> c,
+ final Store store, List<? extends KeyValueScanner> scanners, final ScanType scanType,
final long earliestPutTs, final InternalScanner s) throws IOException;
/**
- * Called after compaction has completed and the new store file has been
- * moved in to place.
+ * Called after compaction has completed and the new store file has been moved in to place.
+ * @param c the environment provided by the region server
+ * @param store the store being compacted
+ * @param resultFile the new store file written out during compaction
+ * @param request the requested compaction
+ * @throws IOException if an error occurred on the coprocessor
+ */
+ void postCompact(final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
+ StoreFile resultFile, CompactionRequest request) throws IOException;
+
+ /**
+ * Called after compaction has completed and the new store file has been moved in to place.
* @param c the environment provided by the region server
* @param store the store being compacted
* @param resultFile the new store file written out during compaction
* @throws IOException if an error occurred on the coprocessor
+ * @deprecated Use {@link #postCompact(ObserverContext, Store, StoreFile, CompactionRequest)}
+ * instead
*/
+ @Deprecated
void postCompact(final ObserverContext<RegionCoprocessorEnvironment> c, final Store store,
StoreFile resultFile) throws IOException;
Oops, something went wrong.

0 comments on commit ca65f47

Please sign in to comment.