protected void updateSizeCounter(@Nullable PendingCompaction pendingCompaction) { if (pendingCompaction == null) { return; } long deltaSizeInBytes = 0L; for (Map.Entry<UUID, Delta> deltaEntry : pendingCompaction.getDeltasToArchive()) { long deltaSize = deltaEntry.getValue().size(); deltaSizeInBytes += deltaSize; _deltaSizeHistogram.update(deltaSize); } // One last check to make sure we don't violate transport protocol size limit // Delta History saves history for each compacted delta that includes // 1) Actual Delta, and 2) Complete resolved content as of that Delta // While we do have the size of actual deltas, we need to account for the resolved content that will get saved // with each delta history. To get that, we will assume that the actual content size for each delta is going to // be roughly the size of the final compacted delta literal. We do not want to resolve content for each delta // here. // TotalDeltaArchiveSize = deltaSize + ContentSize; long eachDeltaContentSize = pendingCompaction.getCompaction().getCompactedDelta().size(); long totalDeltaArchiveSize = deltaSizeInBytes + (pendingCompaction.getDeltasToArchive().size() * eachDeltaContentSize); if (totalDeltaArchiveSize >= MAX_TRANSPORT_SIZE) { _discardedDeltaHistory.mark(); throw new DeltaHistorySizeExceededException(); } _archiveDeltaSizeInMemory.inc(deltaSizeInBytes); }
protected void updateSizeCounter(@Nullable PendingCompaction pendingCompaction) { if (pendingCompaction == null) { return; } long deltaSizeInBytes = 0L; for (Map.Entry<UUID, Delta> deltaEntry : pendingCompaction.getDeltasToArchive()) { long deltaSize = deltaEntry.getValue().size(); deltaSizeInBytes += deltaSize; _deltaSizeHistogram.update(deltaSize); } // One last check to make sure we don't violate transport protocol size limit // Delta History saves history for each compacted delta that includes // 1) Actual Delta, and 2) Complete resolved content as of that Delta // While we do have the size of actual deltas, we need to account for the resolved content that will get saved // with each delta history. To get that, we will assume that the actual content size for each delta is going to // be roughly the size of the final compacted delta literal. We do not want to resolve content for each delta // here. // TotalDeltaArchiveSize = deltaSize + ContentSize; long eachDeltaContentSize = pendingCompaction.getCompaction().getCompactedDelta().size(); long totalDeltaArchiveSize = deltaSizeInBytes + (pendingCompaction.getDeltasToArchive().size() * eachDeltaContentSize); if (totalDeltaArchiveSize >= MAX_TRANSPORT_SIZE) { _discardedDeltaHistory.mark(); throw new DeltaHistorySizeExceededException(); } _archiveDeltaSizeInMemory.inc(deltaSizeInBytes); }
assert (compaction.getCompactedDelta().isConstant()) : "Compacted delta was not a literal"; cutoffDelta = compaction.getCompactedDelta(); initialCutoffDelta = compaction.getCompactedDelta();
assert (compaction.getCompactedDelta().isConstant()) : "Compacted delta was not a literal"; cutoffDelta = compaction.getCompactedDelta(); initialCutoffDelta = compaction.getCompactedDelta();
public DefaultResolver(MutableIntrinsics intrinsics, Compaction compaction) { this(intrinsics); _intrinsics.setVersion(compaction.getCount()); _intrinsics.setFirstUpdateAt(compaction.getFirst()); _intrinsics.setLastMutateAt(compaction.getFirst()); _intrinsics.setLastUpdateAt(compaction.getFirst()); _compactionCutoffId = compaction.getCutoff(); _compactionCutoffSignature = compaction.getCutoffSignature(); _lastCompactedMutationId = compaction.getLastMutation(); _lastMutationId = _lastCompactedMutationId; if (compaction.hasCompactedDelta()) { // We have compacted delta in this compaction. No cutoff delta was mutated as a part of this compaction. _content = DeltaEvaluator.eval(compaction.getCompactedDelta(), _content, _intrinsics); _lastAppliedTags = compaction.getLastTags(); _intrinsics.setDeleted(_content == Resolved.UNDEFINED); _intrinsics.setSignature(parseHash(_compactionCutoffSignature)); _intrinsics.setLastMutateAt(compaction.getLastContentMutation()); _intrinsics.setLastUpdateAt(compaction.getCutoff()); } }
public DefaultResolver(MutableIntrinsics intrinsics, Compaction compaction) { this(intrinsics); _intrinsics.setVersion(compaction.getCount()); _intrinsics.setFirstUpdateAt(compaction.getFirst()); _intrinsics.setLastMutateAt(compaction.getFirst()); _intrinsics.setLastUpdateAt(compaction.getFirst()); _compactionCutoffId = compaction.getCutoff(); _compactionCutoffSignature = compaction.getCutoffSignature(); _lastCompactedMutationId = compaction.getLastMutation(); _lastMutationId = _lastCompactedMutationId; if (compaction.hasCompactedDelta()) { // We have compacted delta in this compaction. No cutoff delta was mutated as a part of this compaction. _content = DeltaEvaluator.eval(compaction.getCompactedDelta(), _content, _intrinsics); _lastAppliedTags = compaction.getLastTags(); _intrinsics.setDeleted(_content == Resolved.UNDEFINED); _intrinsics.setSignature(parseHash(_compactionCutoffSignature)); _intrinsics.setLastMutateAt(compaction.getLastContentMutation()); _intrinsics.setLastUpdateAt(compaction.getCutoff()); } }