View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.regionserver;
20  
21  import java.io.IOException;
22  import java.util.List;
23  
24  import org.apache.hadoop.hbase.classification.InterfaceAudience;
25  import org.apache.hadoop.hbase.client.Scan;
26  
27  /**
28   * Scanner scans the MOB Store. Coalesce KeyValue stream into List<KeyValue>
29   * for a single row. It's only used in the compaction of mob-enabled columns.
30   * It outputs the normal cells and delete markers when outputDeleteMarkers is set as true.
31   */
32  @InterfaceAudience.Private
33  public class MobCompactionStoreScanner extends StoreScanner {
34  
35    /*
36     * The delete markers are probably contained in the output of the scanner, for instance the
37     * minor compaction. If outputDeleteMarkers is set as true, these delete markers could be
38     * written to the del file, otherwise it's not allowed.
39     */
40    protected boolean outputDeleteMarkers;
41  
42    /**
43     * Used for compactions.<p>
44     *
45     * Opens a scanner across specified StoreFiles.
46     * @param store who we scan
47     * @param scan the spec
48     * @param scanners ancillary scanners
49     * @param smallestReadPoint the readPoint that we should use for tracking
50     *          versions
51     */
52    public MobCompactionStoreScanner(Store store, ScanInfo scanInfo, Scan scan,
53        List<? extends KeyValueScanner> scanners, ScanType scanType, long smallestReadPoint,
54        long earliestPutTs, boolean outputDeleteMarkers) throws IOException {
55      super(store, scanInfo, scan, scanners, scanType, smallestReadPoint, earliestPutTs);
56      this.outputDeleteMarkers = outputDeleteMarkers;
57    }
58  
59    /**
60     * Gets whether the delete markers could be written to the del files.
61     * @return True if the delete markers could be written del files, false if it's not allowed.
62     */
63    public boolean isOutputDeleteMarkers() {
64      return this.outputDeleteMarkers;
65    }
66  }