baseoffsetsDate: 2026-05-29
Time: 13:40
I'll work from the observations provided. They contain the first 200 lines of the implementation — enough to cover both truncate and compact_partition in full.
partitioned_log.py:Topic.read — How the linear scan handles offset gaps left by compaction, and whether this becomes a performance concern at scalepartitionedlog.py (lines 200–481) — The Broker class likely contains the retention enforcement loop that calls truncate based on retentionms and maxlogsizepartitionedlog.py:Topic.append — How offset assignment (log[-1].offset + 1 if log else self.base_offsets[partition]) stays correct after compaction creates gapsconcurrent-compaction-safety — Whether any external caller (Broker, background thread) could trigger both truncate and compact_partition on the same partition simultaneously, and what breaks if sotestpartitionedlog.py:testlogcompaction — Likely exists in the untested portion (lines 200+) and would show expected behavior when both operations interacttruncate-advances-base-offset-additively — Topic.truncate updates baseoffsets[partition] with += actual, a relative shift, because it only removes a contiguous prefixcompact-sets-base-offset-absolutely — Topic.compactpartition overwrites base_offsets[partition] with the first surviving message's offset, discarding whatever the previous base wascompaction-preserves-original-offsets — After compact_partition, surviving messages retain their original offset values, creating non-contiguous gaps in the offset sequenceread-uses-linear-scan-for-offset-gaps — Topic.read finds the start position by scanning for msg.offset >= offset rather than computing an array index, which is necessary because compaction creates offset holesno-concurrency-protection-on-base-offsets — Neither truncate nor compactpartition holds a lock; concurrent calls on the same partition would race on both partitions and baseoffsets