-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fix Promtail journal seeking known position #2111
Fix Promtail journal seeking known position #2111
Conversation
49d61e4
to
cf52796
Compare
This bug is probably due to not calling What I see is, when without @rfratto need your help here |
Codecov Report
@@ Coverage Diff @@
## master #2111 +/- ##
==========================================
- Coverage 61.25% 61.20% -0.05%
==========================================
Files 146 146
Lines 11193 11196 +3
==========================================
- Hits 6856 6853 -3
- Misses 3791 3796 +5
- Partials 546 547 +1
|
Thanks for looking into this @adityacs! I'm looking at the systemd docs for this, and while it seems like calling Next or Previous should work, I think we want to use I'd also like to see some comments explaining why we have to do the call before calling GetEntry, could you add those? |
@rfratto Sure, will add the comments. What I thought was If there is no entry after the cursor, calling How should we handle this? |
Right, so calling Next in this case would be valid, but it would be set to the EOF. I think getting the entry would just return the last entry before EOF, but it's not clear (sorry, my C skills aren't what they used to be). Even if that's wrong and getting the entry fails, I think that's ok; trying to restore the position is best-effort. Your PR here will help a lot with the majority of issues, but I think there's always going to be the possibility of some edge case that's going to prevent us from restoring. That being said, I think the real question here is agreeing what the behavior should be when we do fail to read the saved entry, and it's either:
Currently I'm using the first approach and IMO I think that's the right thing to do, even if the 4xxs might raise some red flags when we fail to read the entry. |
Yes, this makes sense. According to this doc
So, if it is EOF, it will return So, in cases where we get error, it's good to reread from the max age as you mentioned |
cf52796
to
d42cdb4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
…ana#2111) * Removed extra empty lines in imports. Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com> * Added section on Go files formatting Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
What this PR does / why we need it:
Fix Promtail journal seeking known position
Which issue(s) this PR fixes:
Fixes #2104