Skip to content

Document TotalCompactions() running-counter semantics - #17

Open
devthedeveloper wants to merge 1 commit into
loop-eng:mainfrom
devthedeveloper:document-compactions-semantics
Open

Document TotalCompactions() running-counter semantics#17
devthedeveloper wants to merge 1 commit into
loop-eng:mainfrom
devthedeveloper:document-compactions-semantics

Conversation

@devthedeveloper

Copy link
Copy Markdown

Closes #12

ContextState.Compactions is a cumulative running counter, not a per-iteration count — the demo trace generator writes it as 0 → 1 → 4 across iterations. Given that, TotalCompactions() taking the max across iterations is correct: the max of a running counter is the total. Renaming to MaxCompactions() would be misleading, so this PR takes the issue's other option and documents the semantics instead.

  • Doc comment on TotalCompactions() explaining why max (not sum, not last iteration) is used
  • Comment on the ContextState.Compactions field and the matching LTF wire-format field in the parser
  • New test asserting counters 0,1,4 → total 4, so a future "fix" to sum (which would give 5) fails CI

ContextState.Compactions is a cumulative counter (compactions so far in
the loop), so max across iterations is the correct total. Document this
on the metric, the field, and the LTF wire format, and add a test that
locks the max-not-sum behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TotalCompactions() returns max not sum — name is misleading

2 participants