Merge lp:~thumper/juju-core/fix-backlog-limits into lp:~go-bot/juju-core/trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Tim Penhey | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 2623 | ||||
Proposed branch: | lp:~thumper/juju-core/fix-backlog-limits | ||||
Merge into: | lp:~go-bot/juju-core/trunk | ||||
Prerequisite: | lp:~thumper/juju-core/debug-log-api | ||||
Diff against target: |
424 lines (+100/-84) 6 files modified
state/apiserver/debuglog.go (+24/-6) state/apiserver/debuglog_internal_test.go (+30/-35) state/apiserver/debuglog_test.go (+12/-0) utils/tailer/export_test.go (+4/-1) utils/tailer/tailer.go (+18/-38) utils/tailer/tailer_test.go (+12/-4) |
||||
To merge this branch: | bzr merge lp:~thumper/juju-core/fix-backlog-limits | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+215333@code.launchpad.net |
Commit message
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.
Description of the change
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.
Reviewers: mp+215333_ code.launchpad. net,
Message:
Please take a look.
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: /code.launchpad .net/~thumper/ juju-core/ debug-log- api/+merge/ 215323
https:/
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/85570045/
Affected files (+42, -10 lines): lxc/clonetempla te.go /debuglog. go /debuglog_ internal_ test.go /debuglog_ test.go tailer. go tailer_ test.go
A [revision details]
M container/
M state/apiserver
M state/apiserver
M state/apiserver
M utils/tailer/
M utils/tailer/
Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: <email address hidden>
+New revision: <email address hidden>
Index: container/ lxc/clonetempla te.go lxc/clonetempla te.go' lxc/clonetempla te.go 2014-04-04 03:46:13 +0000 lxc/clonetempla te.go 2014-04-11 01:57:45 +0000
=== modified file 'container/
--- container/
+++ container/
@@ -179,7 +179,7 @@
}
tailWriter := &logTail{tick: time.Now()} NewTailer( console, tailWriter, nil) NewTailer( console, tailWriter, nil, nil) Stop()
- consoleTailer := tailer.
+ consoleTailer := tailer.
defer consoleTailer.
// We should wait maybe 1 minute between output?
Index: state/apiserver /debuglog. go apiserver/ debuglog. go' /debuglog. go 2014-04-10 09:43:51 +0000 /debuglog. go 2014-04-11 01:54:49 +0000
=== modified file 'state/
--- state/apiserver
+++ state/apiserver
@@ -209,18 +209,23 @@
maxLines uint
lineCount uint
fromTheStart bool
+ started bool
}
// start the tailer listening to the logFile, and sending the matching NewTailer( logFile, writer, stream.filterLine) NewTailer( logFile, writer, stream.filterLine, NewTailerBacktr ack(logFile, writer, NewTailerBacktr ack(logFile, writer,
// lines to the writer.
func (stream *logStream) start(logFile io.ReadSeeker, writer io.Writer) {
if stream.fromTheStart {
- stream.logTailer = tailer.
+ stream.logTailer = tailer.
stream.tailStarted)
} else {
- stream.logTailer = tailer.
stream.backlog, stream.filterLine)
+ stream.logTailer = tailer.
stream.backlog, stream.filterLine, stream.tailStarted)
}
}
+func (stream *logStream) tailStarted() { checkIncludeMod ule(log) && exclude( log) && checkLevel( log)
+ stream.started = true
+}
+
// loop starts the tailer with the log file and the web socket.
func (stream *logStream) loop() error {
select {
@@ -239,7 +244,7 @@
stream.
!stream.
stream.
- if result && stream.maxLines > 0 {
+ if stream.started && result && stream.maxLines > 0 {
stream...