@Override public Map<Cell, byte[]> getIgnoringLocalWrites(TableReference tableRef, Set<Cell> cells) { checkGetPreconditions(tableRef); if (Iterables.isEmpty(cells)) { return ImmutableMap.of(); } hasReads = true; Map<Cell, byte[]> result = getFromKeyValueService(tableRef, cells); validatePreCommitRequirementsOnReadIfNecessary(tableRef, getStartTimestamp()); return Maps.filterValues(result, Predicates.not(Value.IS_EMPTY)); }
@Override public Map<Cell, byte[]> get(TableReference tableRef, Set<Cell> cells) { Timer.Context timer = getTimer("get").time(); checkGetPreconditions(tableRef); if (Iterables.isEmpty(cells)) { return ImmutableMap.of(); } hasReads = true; Map<Cell, byte[]> result = Maps.newHashMap(); SortedMap<Cell, byte[]> writes = writesByTable.get(tableRef); if (writes != null) { for (Cell cell : cells) { if (writes.containsKey(cell)) { result.put(cell, writes.get(cell)); } } } // We don't need to read any cells that were written locally. result.putAll(getFromKeyValueService(tableRef, Sets.difference(cells, result.keySet()))); long getMillis = TimeUnit.NANOSECONDS.toMillis(timer.stop()); if (perfLogger.isDebugEnabled()) { perfLogger.debug("get({}, {} cells) found {} cells (some possibly deleted), took {} ms", tableRef, cells.size(), result.size(), getMillis); } validatePreCommitRequirementsOnReadIfNecessary(tableRef, getStartTimestamp()); return Maps.filterValues(result, Predicates.not(Value.IS_EMPTY)); }
@Override public Map<Cell, byte[]> getIgnoringLocalWrites(TableReference tableRef, Set<Cell> cells) { checkGetPreconditions(tableRef); if (Iterables.isEmpty(cells)) { return ImmutableMap.of(); } hasReads = true; Map<Cell, byte[]> result = getFromKeyValueService(tableRef, cells); validatePreCommitRequirementsOnReadIfNecessary(tableRef, getStartTimestamp()); return Maps.filterValues(result, Predicates.not(Value.IS_EMPTY)); }
@Override public Map<Cell, byte[]> get(TableReference tableRef, Set<Cell> cells) { Timer.Context timer = getTimer("get").time(); checkGetPreconditions(tableRef); if (Iterables.isEmpty(cells)) { return ImmutableMap.of(); } hasReads = true; Map<Cell, byte[]> result = Maps.newHashMap(); SortedMap<Cell, byte[]> writes = writesByTable.get(tableRef); if (writes != null) { for (Cell cell : cells) { if (writes.containsKey(cell)) { result.put(cell, writes.get(cell)); } } } // We don't need to read any cells that were written locally. result.putAll(getFromKeyValueService(tableRef, Sets.difference(cells, result.keySet()))); long getMillis = TimeUnit.NANOSECONDS.toMillis(timer.stop()); if (perfLogger.isDebugEnabled()) { perfLogger.debug("get({}, {} cells) found {} cells (some possibly deleted), took {} ms", tableRef, cells.size(), result.size(), getMillis); } validatePreCommitRequirementsOnReadIfNecessary(tableRef, getStartTimestamp()); return Maps.filterValues(result, Predicates.not(Value.IS_EMPTY)); }