.../hbase/regionserver/FlushStoreScanner.java | 88 ++++++++++++++++++++++ .../hadoop/hbase/regionserver/StoreFlusher.java | 3 +- .../hadoop/hbase/regionserver/StoreScanner.java | 2 +- 3 files changed, 91 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/FlushStoreScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/FlushStoreScanner.java new file mode 100644 index 0000000..01fc563 --- /dev/null +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/FlushStoreScanner.java @@ -0,0 +1,88 @@ +/** + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.hbase.regionserver; + +import java.io.IOException; +import java.util.List; + +import org.apache.hadoop.hbase.Cell; +import org.apache.hadoop.hbase.KeyValueUtil; +import org.apache.hadoop.hbase.classification.InterfaceAudience; +import org.apache.hadoop.hbase.client.Scan; +import org.apache.hadoop.hbase.regionserver.ScannerContext.NextState; + +/** + * Special extension of StoreScanner that does not have the overhead of checking if the matcher has + * reached the nextRow. It just works on the fact that we keep iterating the KVHeap till the block + * size is reached and if so we return those results or if already the end is reached we return + * those results + */ +@InterfaceAudience.Private +public class FlushStoreScanner extends StoreScanner { + + private long sizeLimit; + /** + * Used for flushes. + *
+ * Opens a scanner across all memstore segments in the snapshot.
+ * @param store who we scan
+ * @param scan the spec
+ * @param scanners ancillary scanners
+ * @param smallestReadPoint the readPoint that we should use for tracking versions
+ */
+ public FlushStoreScanner(Store store, ScanInfo scanInfo, Scan scan,
+ List extends KeyValueScanner> scanners, ScanType scanType, long smallestReadPoint,
+ long earliestPutTs) throws IOException {
+ super(store, scanInfo, scan, scanners, scanType, smallestReadPoint, earliestPutTs);
+ this.sizeLimit = this.store.getFamily().getBlocksize();
+ }
+
+ @Override
+ public boolean next(List