Skip to content

Commit

Permalink
[libbeat] Clarify field name / remove redundant semaphore creation (e…
Browse files Browse the repository at this point in the history
…lastic#17622)

(cherry picked from commit bf3eb4c)
  • Loading branch information
faec committed Apr 9, 2020
1 parent 5808399 commit b287d86
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
- `queue.Eventer` has been renamed to `queue.ACKListener` {pull}16691[16691]
- Require logger as first parameter for `outputs.elasticsearch.client#BulkReadItemStatus`. {pull}16761[16761]
- Extract Elasticsearch client logic from `outputs/elasticsearch` package into new `esclientleg` package. {pull}16150[16150]
- Rename `queue.BufferConfig.Events` to `queue.BufferConfig.MaxEvents`. {pull}17622[17622]

==== Bugfixes

Expand Down
6 changes: 1 addition & 5 deletions libbeat/publisher/pipeline/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,7 @@ func New(
return nil, err
}

if count := p.queue.BufferConfig().Events; count > 0 {
p.eventSema = newSema(count)
}

maxEvents := p.queue.BufferConfig().Events
maxEvents := p.queue.BufferConfig().MaxEvents
if maxEvents <= 0 {
// Maximum number of events until acker starts blocking.
// Only active if pipeline can drop events.
Expand Down
2 changes: 1 addition & 1 deletion libbeat/publisher/queue/memqueue/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (b *broker) Close() error {

func (b *broker) BufferConfig() queue.BufferConfig {
return queue.BufferConfig{
Events: b.bufSize,
MaxEvents: b.bufSize,
}
}

Expand Down
4 changes: 3 additions & 1 deletion libbeat/publisher/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ type Queue interface {
// but still dropping events, the pipeline can use the buffer information,
// to define an upper bound of events being active in the pipeline.
type BufferConfig struct {
Events int // can be <= 0, if queue can not determine limit
// MaxEvents is the maximum number of events the queue can hold at capacity.
// A value <= 0 means there is no fixed limit.
MaxEvents int
}

// ProducerConfig as used by the Pipeline to configure some custom callbacks
Expand Down
2 changes: 1 addition & 1 deletion libbeat/publisher/queue/spool/spool.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (s *diskSpool) Close() error {

// BufferConfig returns the queue initial buffer settings.
func (s *diskSpool) BufferConfig() queue.BufferConfig {
return queue.BufferConfig{Events: -1}
return queue.BufferConfig{MaxEvents: -1}
}

// Producer creates a new queue producer for publishing events.
Expand Down

0 comments on commit b287d86

Please sign in to comment.