/** * The process of merging assumes all cells are allocated on mslab. * There is a rare case in which the first immutable segment, * participating in a merge, is a CSLM. * Since the CSLM hasn't been flattened yet, and there is no point in flattening it (since it is * going to be merged), its big cells (for whom size > maxAlloc) must be copied into mslab. * This method copies the passed cell into the first mslab in the mslabs list, * returning either a new cell instance over the copied data, * or null when this cell cannt be copied. */ @Override public Cell forceCopyOfBigCellInto(Cell cell) { MemStoreLAB mslab = this.mslabs.get(0); return mslab.forceCopyOfBigCellInto(cell); }
/** * If the segment has a memory allocator the cell is being cloned to this space, and returned; * otherwise the given cell is returned * * When a cell's size is too big (bigger than maxAlloc), it is not allocated on MSLAB. * Since the process of flattening to CellChunkMap assumes that all cells * are allocated on MSLAB, during this process, the input parameter * forceCloneOfBigCell is set to 'true' and the cell is copied into MSLAB. * * @return either the given cell or its clone */ public Cell maybeCloneWithAllocator(Cell cell, boolean forceCloneOfBigCell) { if (this.memStoreLAB == null) { return cell; } Cell cellFromMslab; if (forceCloneOfBigCell) { cellFromMslab = this.memStoreLAB.forceCopyOfBigCellInto(cell); } else { cellFromMslab = this.memStoreLAB.copyCellInto(cell); } return (cellFromMslab != null) ? cellFromMslab : cell; }