use of org.apache.accumulo.tserver.Mutations in project accumulo by apache.
the class TabletServerLogger method logManyTablets.
public void logManyTablets(Map<CommitSession, Mutations> mutations) throws IOException {
final Map<CommitSession, Mutations> loggables = new HashMap<>(mutations);
for (Entry<CommitSession, Mutations> entry : mutations.entrySet()) {
if (entry.getValue().getDurability() == Durability.NONE) {
loggables.remove(entry.getKey());
}
}
if (loggables.size() == 0)
return;
write(loggables.keySet(), false, new Writer() {
@Override
public LoggerOperation write(DfsLogger logger) throws Exception {
List<TabletMutations> copy = new ArrayList<>(loggables.size());
for (Entry<CommitSession, Mutations> entry : loggables.entrySet()) {
CommitSession cs = entry.getKey();
Durability durability = entry.getValue().getDurability();
copy.add(new TabletMutations(cs.getLogId(), cs.getWALogSeq(), entry.getValue().getMutations(), durability));
}
return logger.logManyTablets(copy);
}
});
for (Mutations entry : loggables.values()) {
if (entry.getMutations().size() < 1) {
throw new IllegalArgumentException("logManyTablets: logging empty mutation list");
}
for (Mutation m : entry.getMutations()) {
logSizeEstimate.addAndGet(m.numBytes());
}
}
}
Aggregations