Skip to content

Commit

Permalink
Improve StreamBuf append (#35928)
Browse files Browse the repository at this point in the history
* Improve streambuf append

* Adding changelog comment

* Update CHANGELOG.next.asciidoc

Co-authored-by: Craig MacKenzie <[email protected]>

---------

Co-authored-by: Craig MacKenzie <[email protected]>
  • Loading branch information
jeniawhite and cmacknz authored Jul 12, 2023
1 parent 2dc3f67 commit 91bbccf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
- Upgraded apache arrow library used in x-pack/libbeat/reader/parquet from v11 to v12.0.1 in order to fix cross-compilation issues {pull}35640[35640]
- Fix panic when MaxRetryInterval is specified, but RetryInterval is not {pull}35820[35820]
- Do not print context cancelled error message when running under agent {pull}36006[36006]


- Fix recovering from invalid output configuration when running under Elastic-Agent {pull}36016[36016]
- Improve StreamBuf append to improve performance when reading long lines from files. {pull}35928[35928]

*Auditbeat*

Expand Down
4 changes: 3 additions & 1 deletion libbeat/common/streambuf/streambuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ func (b *Buffer) doAppend(data []byte, retainable bool, newCap int) error {
b.data = tmp
}
}
b.data = append(b.data, data...)
tBuf := bytes.NewBuffer(b.data)
tBuf.Write(data)
b.data = tBuf.Bytes()
}
b.available += len(data)

Expand Down

0 comments on commit 91bbccf

Please sign in to comment.