Repository navigation
Open
Labels
area:feeds-tasks-activityFeeds, threads, tasks, announcements, activity, conversations, suggestions, websockets.Feeds, threads, tasks, announcements, activity, conversations, suggestions, websockets.backendbugSomething isn't workingSomething isn't working
Description
Affected module
Backend (2.0 / main)
Describe the bug
The 2.0 activity feed refactor introduced activity_stream as a time-partitioned table (PARTITION BY RANGE (timestamp), monthly buckets) and shipped ActivityStreamPartitionManager to manage its lifecycle:
maintainPartitions(int monthsAhead, int retentionDays)
├── createPartitionIfNotExists(month) // pre-create next N monthly partitions
└── dropPartitionIfExists(oldMonth) // drop partitions past retention (looks back 24 months)maintainPartitions() has zero callers — no scheduled job, app hook, or startup path invokes it. Consequences:
- No retention for activity data.
ActivityStreamPublisherconverts every entity change event into activity rows, making this one of the fastest-growing tables on a busy instance, and nothing ever ages rows out. The Data Retention app does not cover this table either (by design — partition-drop is the intended mechanism, not row DELETEs). - The partitioning is inert. The 2.0 migration only creates catch-all partitions —
activity_stream_defaulton PostgreSQL,p_max VALUES LESS THAN MAXVALUEon MySQL. Since monthly partitions are never created, every row lands in the catch-all, so even oncemaintainPartitionsis wired up, dropping monthly partitions will not remove any existing data. - Remediation cost grows over time. On PostgreSQL,
CREATE TABLE ... PARTITION OF ... FOR VALUES FROM x TO yfails when the default partition already holds rows in that range, so accumulated rows must first be detached/moved out ofactivity_stream_default. On MySQL, splittingp_maxrequires an increasingly expensiveREORGANIZE PARTITION. The longer this stays unwired, the larger that one-off migration becomes.
To Reproduce
- Run a 2.0 instance with normal entity activity (ingestion, edits).
SELECT COUNT(*) FROM activity_stream_default;(Postgres) — all rows accumulate in the default partition indefinitely.- Observe no monthly
activity_stream_y*partitions exist and none are ever created or dropped.
Expected behavior
- Monthly partitions are pre-created ahead of time and expired partitions are dropped on a schedule, per the design documented in
ActivityStreamPartitionManager. - Activity retention period is configurable (e.g., alongside the Data Retention app's other periods, or
activity_stream_config).
Proposed fix
- Wire
maintainPartitions(monthsAhead, retentionDays)into a scheduled path — either as a step in the Data Retention app run or a dedicated Quartz job — with a configurable retention period. - Add a one-time remediation for instances that have accumulated rows in the catch-all partition (move rows into their monthly partitions, or accept dropping the default partition's contents past retention).
Additional context
Found while root-causing the Data Retention failure on 2.0 (#30332): that PR fixes the conversation-thread cleanup crash and intentionally leaves this partition-maintenance gap as a separate piece of work.
Version
- OpenMetadata version: 2.0.0-SNAPSHOT (main @ b4bc7a5)
Metadata
Metadata
Assignees
Labels
area:feeds-tasks-activityFeeds, threads, tasks, announcements, activity, conversations, suggestions, websockets.Feeds, threads, tasks, announcements, activity, conversations, suggestions, websockets.backendbugSomething isn't workingSomething isn't working
Type
Projects
- StatusShow more project fieldsRelease Backlog 🚧
Activity