001/** 002 * 003 * Licensed to the Apache Software Foundation (ASF) under one 004 * or more contributor license agreements. See the NOTICE file 005 * distributed with this work for additional information 006 * regarding copyright ownership. The ASF licenses this file 007 * to you under the Apache License, Version 2.0 (the 008 * "License"); you may not use this file except in compliance 009 * with the License. You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 */ 019package org.apache.hadoop.hbase.regionserver; 020 021import org.apache.yetus.audience.InterfaceAudience; 022import org.apache.hadoop.hbase.util.ClassSize; 023 024/** 025 * CSLMImmutableSegment is an abstract class that extends the API supported by a {@link Segment}, 026 * and {@link ImmutableSegment}. This immutable segment is working with CellSet with 027 * ConcurrentSkipListMap (CSLM) delegatee. 028 */ 029@InterfaceAudience.Private 030public class CSLMImmutableSegment extends ImmutableSegment { 031 public static final long DEEP_OVERHEAD_CSLM = 032 ImmutableSegment.DEEP_OVERHEAD + ClassSize.CONCURRENT_SKIPLISTMAP; 033 034 /**------------------------------------------------------------------------ 035 * Copy C-tor to be used when new CSLMImmutableSegment is being built from a Mutable one. 036 * This C-tor should be used when active MutableSegment is pushed into the compaction 037 * pipeline and becomes an ImmutableSegment. 038 */ 039 protected CSLMImmutableSegment(Segment segment, MemStoreSizing memstoreSizing) { 040 super(segment); 041 // update the segment metadata heap size 042 long indexOverhead = -MutableSegment.DEEP_OVERHEAD + DEEP_OVERHEAD_CSLM; 043 incMemStoreSize(0, indexOverhead, 0, 0); // CSLM is always on-heap 044 if (memstoreSizing != null) { 045 memstoreSizing.incMemStoreSize(0, indexOverhead, 0, 0); 046 } 047 } 048 049 @Override 050 protected long indexEntrySize() { 051 return ClassSize.CONCURRENT_SKIPLISTMAP_ENTRY; 052 } 053 054 @Override protected boolean canBeFlattened() { 055 return true; 056 } 057}