/** * Update the current TimestampRange to include the timestamp from <code>cell</code>. * If the Key is of type DeleteColumn or DeleteFamily, it includes the * entire time range from 0 to timestamp of the key. * @param cell the Cell to include */ public void includeTimestamp(final Cell cell) { includeTimestamp(cell.getTimestamp()); if (PrivateCellUtil.isDeleteColumnOrFamily(cell)) { includeTimestamp(0); } }
@Override public void run() { for (long key : data.keys) { trt.includeTimestamp(key); } } }
@Override public void run() { int offset = Integer.parseInt(getName()); boolean even = offset % 2 == 0; if (even) { for (int i = (offset * calls); i < calls; i++) trr.includeTimestamp(i); } else { int base = offset * calls; for (int i = base + calls; i >= base; i--) trr.includeTimestamp(i); } } };
/** * Record the earlest Put timestamp. * * If the timeRangeTracker is not set, * update TimeRangeTracker to include the timestamp of this key */ public void trackTimestamps(final Cell cell) { if (KeyValue.Type.Put.getCode() == cell.getTypeByte()) { earliestPutTs = Math.min(earliestPutTs, cell.getTimestamp()); } timeRangeTracker.includeTimestamp(cell); }
public CompositeImmutableSegment(CellComparator comparator, List<ImmutableSegment> segments) { super(comparator, segments); this.segments = segments; for (ImmutableSegment s : segments) { this.timeRangeTracker.includeTimestamp(s.getTimeRangeTracker().getMax()); this.timeRangeTracker.includeTimestamp(s.getTimeRangeTracker().getMin()); this.keySize += s.getDataSize(); } }
@Test public void testAlwaysDecrementingSetsMaximum() { TimeRangeTracker trr = getTimeRangeTracker(); trr.includeTimestamp(3); trr.includeTimestamp(2); trr.includeTimestamp(1); assertTrue(trr.getMin() != TimeRangeTracker.INITIAL_MIN_TIMESTAMP); assertTrue(trr.getMax() != -1 /*The initial max value*/); }
@Test public void testSimpleInRange() { TimeRangeTracker trr = getTimeRangeTracker(); trr.includeTimestamp(0); trr.includeTimestamp(2); assertTrue(trr.includesTimeRange(new TimeRange(1))); }
protected void updateMetaInfo(Cell cellToAdd, boolean succ, boolean mslabUsed, MemStoreSizing memstoreSizing, boolean sizeAddedPreOperation) { long delta = 0; long cellSize = getCellLength(cellToAdd); int cellsCount = succ ? 1 : 0; // If there's already a same cell in the CellSet and we are using MSLAB, we must count in the // MSLAB allocation size as well, or else there will be memory leak (occupied heap size larger // than the counted number) if (succ || mslabUsed) { delta = cellSize; } if (sizeAddedPreOperation) { delta -= cellSize; } long heapSize = heapSizeChange(cellToAdd, succ || mslabUsed); long offHeapSize = offHeapSizeChange(cellToAdd, succ || mslabUsed); incMemStoreSize(delta, heapSize, offHeapSize, cellsCount); if (memstoreSizing != null) { memstoreSizing.incMemStoreSize(delta, heapSize, offHeapSize, cellsCount); } getTimeRangeTracker().includeTimestamp(cellToAdd); minSequenceId = Math.min(minSequenceId, cellToAdd.getSequenceId()); // In no tags case this NoTagsKeyValue.getTagsLength() is a cheap call. // When we use ACL CP or Visibility CP which deals with Tags during // mutation, the TagRewriteCell.getTagsLength() is a cheaper call. We do not // parse the byte[] to identify the tags length. if (cellToAdd.getTagsLength() > 0) { tagsPresent = true; } }
@Test public void testExtreme() { TimeRange tr = TimeRange.allTime(); assertTrue(tr.includesTimeRange(TimeRange.allTime())); TimeRangeTracker trt = getTimeRangeTracker(); assertFalse(trt.includesTimeRange(TimeRange.allTime())); trt.includeTimestamp(1); trt.includeTimestamp(10); assertTrue(trt.includesTimeRange(TimeRange.allTime())); }
/** * Update the current TimestampRange to include the timestamp from KeyValue * If the Key is of type DeleteColumn or DeleteFamily, it includes the * entire time range from 0 to timestamp of the key. * @param kv the KeyValue to include */ public void includeTimestamp(final KeyValue kv) { includeTimestamp(kv.getTimestamp()); if (kv.isDeleteColumnOrFamily()) { includeTimestamp(0); } }
@Override public void run() { for (long key : data.keys) { trt.includeTimestamp(key); } } }
/** * Update the current TimestampRange to include the timestamp from Cell * If the Key is of type DeleteColumn or DeleteFamily, it includes the * entire time range from 0 to timestamp of the key. * @param cell the Cell to include */ public void includeTimestamp(final Cell cell) { includeTimestamp(cell.getTimestamp()); if (CellUtil.isDeleteColumnOrFamily(cell)) { includeTimestamp(0); } }
/** * Internal version of add() that doesn't clone Cells with the * allocator, and doesn't take the lock. * * Callers should ensure they already have the read lock taken */ private long internalAdd(final Cell toAdd) { long s = heapSizeChange(toAdd, addToCellSet(toAdd)); timeRangeTracker.includeTimestamp(toAdd); this.size.addAndGet(s); return s; }
/** * Update the current TimestampRange to include the timestamp from Key. * If the Key is of type DeleteColumn or DeleteFamily, it includes the * entire time range from 0 to timestamp of the key. * @param key */ public void includeTimestamp(final byte[] key) { includeTimestamp(Bytes.toLong(key,key.length-KeyValue.TIMESTAMP_TYPE_SIZE)); int type = key[key.length - 1]; if (type == Type.DeleteColumn.getCode() || type == Type.DeleteFamily.getCode()) { includeTimestamp(0); } }
/** * Internal version of add() that doesn't clone KVs with the * allocator, and doesn't take the lock. * * Callers should ensure they already have the read lock taken */ private long internalAdd(final KeyValue toAdd) { long s = heapSizeChange(toAdd, this.kvset.add(toAdd)); timeRangeTracker.includeTimestamp(toAdd); this.size.addAndGet(s); return s; }
@Override public void run() { int offset = Integer.parseInt(getName()); boolean even = offset % 2 == 0; if (even) { for (int i = (offset * calls); i < calls; i++) trr.includeTimestamp(i); } else { int base = offset * calls; for (int i = base + calls; i >= base; i--) trr.includeTimestamp(i); } } };
@Override public void write(Object row, Cell cell) throws IOException { KeyValue copy = KeyValue.cloneAndAddTags(cell, ImmutableList.<Tag>of()); if (copy.getTimestamp() == HConstants.LATEST_TIMESTAMP) { copy.updateLatestStamp(now); } writer.append(copy); trt.includeTimestamp(copy); }
@Test public void testAlwaysDecrementingSetsMaximum() { TimeRangeTracker trr = getTimeRangeTracker(); trr.includeTimestamp(3); trr.includeTimestamp(2); trr.includeTimestamp(1); assertTrue(trr.getMin() != TimeRangeTracker.INITIAL_MIN_TIMESTAMP); assertTrue(trr.getMax() != -1 /*The initial max value*/); }
@Test public void testSimpleInRange() { TimeRangeTracker trr = getTimeRangeTracker(); trr.includeTimestamp(0); trr.includeTimestamp(2); assertTrue(trr.includesTimeRange(new TimeRange(1))); }
@Test public void testExtreme() { TimeRange tr = TimeRange.allTime(); assertTrue(tr.includesTimeRange(TimeRange.allTime())); TimeRangeTracker trt = getTimeRangeTracker(); assertFalse(trt.includesTimeRange(TimeRange.allTime())); trt.includeTimestamp(1); trt.includeTimestamp(10); assertTrue(trt.includesTimeRange(TimeRange.allTime())); }