Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[agg] Use timestamp (not start aligned) for expiring forward versions #3922

Merged
merged 2 commits into from
Nov 16, 2021

Conversation

ryanhall07
Copy link
Collaborator

The forward_writer uses a version map indexed by timestamp, which is not
start aligned. When the flusher passes the set of times to expire, it
needs to convert the start aligned time to a timestamp.

This manifests as a significant memory leak for sparse workloads where
the timestamp of N != start aligned time of N+1. In those cases the
versions are never GCd when they expire out of the buffer.

What this PR does / why we need it:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:


Does this PR require updating code package or user-facing documentation?:


The forward_writer uses a version map indexed by timestamp, which is not
start aligned. When the flusher passes the set of times to expire, it
needs to convert the start aligned time to a timestamp.

This manifests as a significant memory leak for sparse workloads where
the timestamp of N != start aligned time of N+1. In those cases the
versions are never GCd when they expire out of the buffer.
@@ -3275,5 +3286,9 @@ func verifyOnForwardedFlushResult(t *testing.T, expected, actual []testOnForward
require.Equal(t, len(expected), len(actual))
for i := 0; i < len(expected); i++ {
require.True(t, expected[i].aggregationKey.Equal(actual[i].aggregationKey))
require.Equal(t, len(expected[i].expiredTimes), len(actual[i].expiredTimes))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and forgot to mention, this assertion would have exposed the bug (tests failed without the code change).

@codecov
Copy link

codecov bot commented Nov 16, 2021

Codecov Report

Merging #3922 (1ebbf21) into master (d2d4306) will decrease coverage by 0.0%.
The diff coverage is n/a.

❗ Current head 1ebbf21 differs from pull request most recent head 012e473. Consider uploading reports for the commit 012e473 to get more accurate results

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #3922     +/-   ##
========================================
- Coverage    56.7%   56.7%   -0.1%     
========================================
  Files         555     555             
  Lines       63347   63347             
========================================
- Hits        35931   35919     -12     
- Misses      24218   24232     +14     
+ Partials     3198    3196      -2     
Flag Coverage Δ
aggregator 62.4% <ø> (+<0.1%) ⬆️
cluster ∅ <ø> (∅)
collector 58.4% <ø> (ø)
dbnode 60.4% <ø> (-0.1%) ⬇️
m3em 46.4% <ø> (ø)
metrics 19.7% <ø> (ø)
msg 74.6% <ø> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d2d4306...012e473. Read the comment docs.

@ryanhall07 ryanhall07 enabled auto-merge (squash) November 16, 2021 01:01
@ryanhall07 ryanhall07 merged commit a4f7af1 into master Nov 16, 2021
@ryanhall07 ryanhall07 deleted the rhall-leak-version branch November 16, 2021 01:16
soundvibe added a commit that referenced this pull request Nov 16, 2021
* master:
  [agg] Use timestamp (not start aligned) for expiring forward versions (#3922)
  [tests] Add support for calls to label APIs in resources.Coordinator (#3916)
  [tests] Convert repair_and_replication Docker Integration Test to In-process (#3903)
  Always Close the conn if failed to write acks (#3855)
  [m3msg] Add receive and handle latency to consumers (#3920)
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.

2 participants