stream.truncateBefore(position);
}
@Timed("log_manager_append")
private Position appendAndGetPosition(LogEntry logEntry) throws CodingException {
Position firstPosition = null;
byte[][] entries = entrySerializer.serialize(logEntry);
synchronized (writeMutex) { // ensure all sub-entries are written as a unit
for (byte[] entry : entries) {
Position position = stream.append(entry);
if (firstPosition == null) {
firstPosition = position;
}
vars.bytesWritten.addAndGet(entry.length);
}