Skip to content

Commit

Permalink
limit compaction size by absolute size, not relative size (#273)
Browse files Browse the repository at this point in the history
* compaction size should be limited by absolute size, not relative size

* update minimum for compaction area size
  • Loading branch information
sebastianburckhardt authored Jul 7, 2023
1 parent ebda6e7 commit a909cc7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/DurableTask.Netherite/StorageLayer/Faster/FasterKV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,11 +456,10 @@ long MinimalLogSize
var stats = (StatsState) this.singletons[(int)TrackedObjectKey.Stats.ObjectType];
long actualLogSize = this.fht.Log.TailAddress - this.fht.Log.BeginAddress;
long minimalLogSize = this.MinimalLogSize;
long compactionAreaSize = (long)(0.5 * (this.fht.Log.SafeReadOnlyAddress - this.fht.Log.BeginAddress));
long mutableSectionSize = (this.fht.Log.TailAddress - this.fht.Log.SafeReadOnlyAddress);
long compactionAreaSize = Math.Min(50000, this.fht.Log.SafeReadOnlyAddress - this.fht.Log.BeginAddress);

if (actualLogSize > 2 * minimalLogSize // there must be significant bloat
&& mutableSectionSize < compactionAreaSize) // the potential size reduction must outweigh the cost of a foldover
&& compactionAreaSize >= 5000) // and enough compaction area to justify the overhead
{
return this.fht.Log.BeginAddress + compactionAreaSize;
}
Expand Down

0 comments on commit a909cc7

Please sign in to comment.