Skip to content

[stable33] perf(LogIterator): Read long lines in linear time - #2330

Merged
DerDreschner merged 1 commit into
stable33from
backport/2327/stable33
Oct 19, 2026
Merged

DerDreschner merged 1 commit into
stable33from
backport/2327/stable33

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.

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/stable33 branch from d38b04e to 086f524 Compare October 19, 2026 14:28
@DerDreschner
DerDreschner marked this pull request as ready for review October 19, 2026 14:29
@DerDreschner
DerDreschner merged commit 3b37f03 into stable33 Oct 19, 2026
30 of 33 checks passed
@DerDreschner
DerDreschner deleted the backport/2327/stable33 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