Skip to content

Commit

Permalink
Improve StreamBuf append (elastic#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 <craig.mackenzie@elastic.co>

---------

Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
  • Loading branch information
2 people authored and Scholar-Li committed Feb 5, 2024
1 parent b7be9e4 commit 9e30351
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 9e30351

Please sign in to comment.