Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

when adding new point to aggregate, always see if we can flush #1425

Merged
merged 3 commits into from
Aug 13, 2019

Conversation

Dieterbe
Copy link
Contributor

e.g. when flushing every 10s and we reach a timestamp like 12:34:10
we can always flush, because any next point will always go into
the next bucket. We already did this but only in the case of already
having data in the bucket. In the case of an unfortunate mismatch
between aggergation and series (e.g. aggregate across 10s but the
data itself comes every 10s or even less frequent), we can also
just flush in this case, rather than waiting.

e.g. when flushing every 10s and we reach a timestamp like 12:34:10
we can always flush, because any next point will always go into
the next bucket.  We already did this but only in the case of already
having data in the bucket. In the case of an unfortunate mismatch
between aggergation and series (e.g. aggregate across 10s but the
data itself comes every 10s or even less frequent), we can also
just flush in this case, rather than waiting.
@Dieterbe Dieterbe requested a review from fkaleo August 12, 2019 17:55
Copy link
Member

@woodsaj woodsaj left a comment

Choose a reason for hiding this comment

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

This code needs more comments. It is extremely hard to understand what is happening and why the logic is the way it is.

@fkaleo
Copy link
Contributor

fkaleo commented Aug 13, 2019

It does not pass the unit tests TestGetAggregated and TestGetAggregatedIngestFrom

@fkaleo
Copy link
Contributor

fkaleo commented Aug 13, 2019

This code needs more comments. It is extremely hard to understand what is happening and why the logic is the way it is.

I admit I am a little lost after 10 minutes of going through it with various scenarii in mind and thinking I understood it but I don't.

@Dieterbe
Copy link
Contributor Author

how does it look now?

@fkaleo
Copy link
Contributor

fkaleo commented Aug 13, 2019

how does it look now?

Much better. Is it possible that Aggregator.Add(ts, val) could be called twice with the same ts? Specifically, twice with a ts that is a boundary? Do we have code guarding against that?

@Dieterbe
Copy link
Contributor Author

it's possible. we (you actually IIRC) recently made a change to how we deal we deal with duplicate points in general. if we decided on first write wins, this should not be an issue. if we decided last write wins, than we have a problem with the approach here.

@fkaleo
Copy link
Contributor

fkaleo commented Aug 13, 2019

it's possible. we (you actually IIRC) recently made a change to how we deal we deal with duplicate points in general. if we decided on first write wins, this should not be an issue. if we decided last write wins, than we have a problem with the approach here.

It was me indeed, and we had subsequent writes with identical timestamps to fail, so it's first write wins. So yes we have code guarding us against it.

Copy link
Contributor

@fkaleo fkaleo left a comment

Choose a reason for hiding this comment

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

Good for me now.

@Dieterbe Dieterbe merged commit f1fb97d into master Aug 13, 2019
@Dieterbe Dieterbe deleted the flush-boundary-in-both-cases branch August 13, 2019 15:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants