Skip to content

[Backport 5.1] OF-3364: Limit MUC history reload query at the database level - #3488

Merged
guusdk merged 1 commit into
5.1from
backport-3487-to-5.1
Sep 8, 2026
Merged

[Backport 5.1] OF-3364: Limit MUC history reload query at the database level#3488
guusdk merged 1 commit into
5.1from
backport-3487-to-5.1

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Description

Backport of #3487 to 5.1.

MUCPersistenceManager#loadHistory previously fetched all rows since the configured reload window and then scrolled/trimmed the ResultSet client-side to keep only the last maxNumber messages.

This relied on scrollable, TYPE_SCROLL_INSENSITIVE result sets, which are not reliably supported across all database backends (e.g. disabled outright for CockroachDB), and could transfer far more data than was ultimately retained for rooms with long histories.

Instead, build the query dynamically using DbConnectionManager's result-set-limit facilities (LIMIT / TOP / FETCH FIRST ... ROWS ONLY, per database type) so the limit is pushed down to the database.

Also adds debug logging around the reload window and returned row count to make future over-fetching easier to spot.

(cherry picked from commit 69b8f1d)
@guusdk
guusdk merged commit 930ea4c into 5.1 Sep 8, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant