Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(167)

Issue 85570045: Fix the limit for the debug-log calls.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by thumper
Modified:
10 years ago
Reviewers:
axw, mp+215333, rog
Visibility:
Public.

Description

Fix the limit for the debug-log calls. Unbeknownst to me, the filter method was being called during the backlog iteration as well. This fix introduces a callback that the tailer calls when it starts the forward filtering. This allows us to count the filter calls only when the filter is being called to write out the results. We cannot count the write calls because the tailer uses buffered i/o there. https://code.launchpad.net/~thumper/juju-core/fix-backlog-limits/+merge/215333 Requires: https://code.launchpad.net/~thumper/juju-core/debug-log-api/+merge/215323 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 2

Patch Set 2 : Fix the limit for the debug-log calls. #

Total comments: 7
Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -74 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M state/apiserver/debuglog.go View 1 3 chunks +22 lines, -6 lines 4 comments Download
M state/apiserver/debuglog_internal_test.go View 1 6 chunks +21 lines, -25 lines 0 comments Download
M state/apiserver/debuglog_test.go View 1 chunk +12 lines, -0 lines 0 comments Download
M utils/tailer/export_test.go View 1 1 chunk +4 lines, -1 line 0 comments Download
M utils/tailer/tailer.go View 1 9 chunks +22 lines, -38 lines 3 comments Download
M utils/tailer/tailer_test.go View 1 4 chunks +12 lines, -4 lines 0 comments Download

Messages

Total messages: 7
thumper
Please take a look.
10 years ago (2014-04-11 02:11:13 UTC) #1
axw
https://codereview.appspot.com/85570045/diff/1/utils/tailer/tailer.go File utils/tailer/tailer.go (right): https://codereview.appspot.com/85570045/diff/1/utils/tailer/tailer.go#newcode56 utils/tailer/tailer.go:56: filter TailerFilterFunc, callback TailerFilterStartedFunc) *Tailer { Rather than adding ...
10 years ago (2014-04-11 08:07:45 UTC) #2
rog
As far as I can see, this makes a nice Tailer API into a not-so-nice ...
10 years ago (2014-04-11 08:20:14 UTC) #3
thumper
Due to the buffered i/o in the tailer, I'd prefer to keep the line parsing ...
10 years ago (2014-04-14 01:14:00 UTC) #4
thumper
Please take a look.
10 years ago (2014-04-14 02:10:45 UTC) #5
axw
LGTM with a few suggestions https://codereview.appspot.com/85570045/diff/20001/state/apiserver/debuglog.go File state/apiserver/debuglog.go (right): https://codereview.appspot.com/85570045/diff/20001/state/apiserver/debuglog.go#newcode225 state/apiserver/debuglog.go:225: err := tailer.SeekLastLines(logFile, stream.backlog, ...
10 years ago (2014-04-14 03:52:39 UTC) #6
rog
10 years ago (2014-04-14 07:11:09 UTC) #7
> Due to the buffered i/o in the tailer, I'd prefer to keep the line parsing
> functionality in the server side.

I don't quite understand this remark (the buffer is flushed whenever we get to
the end of the file, so it shouldn't make any significant difference), but
splitting out the backtracking code makes me much happier.

LGTM with a couple of trivial suggestions below.

https://codereview.appspot.com/85570045/diff/20001/state/apiserver/debuglog.go
File state/apiserver/debuglog.go (right):

https://codereview.appspot.com/85570045/diff/20001/state/apiserver/debuglog.g...
state/apiserver/debuglog.go:224: if !stream.fromTheStart {
if stream.fromTheStart {
    return nil
}
...

saves a negative and a level of indentation.

https://codereview.appspot.com/85570045/diff/20001/state/apiserver/debuglog.g...
state/apiserver/debuglog.go:258: if stream.started && result && stream.maxLines
> 0 {
On 2014/04/14 03:52:40, axw wrote:
> It would be better to just split filterLine into something non-counting and
> counting, where the latter calls the former and adds the linecount check. Then
> you don't need the boolean.

+1

https://codereview.appspot.com/85570045/diff/20001/utils/tailer/tailer.go
File utils/tailer/tailer.go (right):

https://codereview.appspot.com/85570045/diff/20001/utils/tailer/tailer.go#new...
utils/tailer/tailer.go:31: // TailerFilterStartedFunc is a callback that is
called when the filtering is
On 2014/04/14 03:52:40, axw wrote:
> Delete this?

+1

https://codereview.appspot.com/85570045/diff/20001/utils/tailer/tailer.go#new...
utils/tailer/tailer.go:132: // wanted number of filtered lines before the end.
// If filter is non-nil, only lines for which filter returns
// true will be counted.

?
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b