Skip to content

[stable34] perf(LogIterator): Read long lines in linear time - #2329

Merged
DerDreschner merged 1 commit into
stable34from
backport/2327/stable34
Oct 19, 2026
Merged

DerDreschner merged 1 commit into
stable34from
backport/2327/stable34

Conversation

@backportbot

@backportbot backportbot Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Backport of #2327

Warning, This backport's changes differ from the original and might be incomplete 鈿狅笍

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

@backportbot backportbot Bot added this to the Nextcloud 34.0.6 milestone Oct 19, 2026
@DerDreschner
DerDreschner force-pushed the backport/2327/stable34 branch from 3b72ba4 to 9c4a9b4 Compare October 19, 2026 14:24
@DerDreschner
DerDreschner marked this pull request as ready for review October 19, 2026 14:24
LogIterator reads the log backwards in chunks of 8 KB. When a line spans
several chunks, every chunk is prepended to the whole buffer before the
whole buffer is searched for a newline again. Reading a line of length L
therefore takes O(L虏) time. Such long lines can be written, for example
by occ upgrade, which forces the debug log level. A log with a few of
them stalls the "Errors in the log" setup check and the log viewer.

Remember where the line ends, only search the newly read chunk for its
start, and then read the whole line at once. This reduces the time to
O(L).

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: David Dreschner <david.dreschner@nextcloud.com>
@DerDreschner
DerDreschner force-pushed the backport/2327/stable34 branch from 9c4a9b4 to c57f714 Compare October 19, 2026 14:30
@DerDreschner
DerDreschner merged commit cfd4a39 into stable34 Oct 19, 2026
27 checks passed
@DerDreschner
DerDreschner deleted the backport/2327/stable34 branch October 19, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant