Skip to content

Fix: Fix continuous event analytics export#23837

Merged
jason-p-pickering merged 5 commits into
2.42from
fix/event-analytics-continuous-run
May 8, 2026
Merged

Fix: Fix continuous event analytics export#23837
jason-p-pickering merged 5 commits into
2.42from
fix/event-analytics-continuous-run

Conversation

@jason-p-pickering

@jason-p-pickering jason-p-pickering commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes two bugs in JdbcEventAnalyticsTableManager that affect event analytics table updates.

Bug 1 (regression, critical): removeUpdatedData() was deleting from the staging master table (analytics_event_temp) instead of the live master
(analytics_event
). Because the staging table is the parent of _0_temp, the delete cascaded to the partition that had just been populated, thereby leaving it empty before the swap. The result was that newly created or updated events never appeared in analytics after a continuous (latest) run; only a full rebuild would surface them. Fix: use table.getMainName() instead of table.getName().

Bug 2 (dormant): The isSkipPrograms() ternary in getRegularAnalyticsTables() was inverted. When a skip list was provided the function returned all programs, and when no skip list was provided it attempted to filter. Fix: swap the ternary branches to match the correct logic already present in getLatestAnalyticsTables().

Tests

Added two unit tests to JdbcEventAnalyticsTableManagerTest:

  • removeUpdatedDataTargetsLiveTable: verifies the DELETE SQL targets the live table, not the staging table
  • getRegularAnalyticsTablesExcludesSkippedPrograms: verifies programs in skipPrograms are excluded from a regular analytics run

@maikelarabori maikelarabori added the run-api-analytics-tests Enables analytics e2e tests label May 7, 2026

@maikelarabori maikelarabori left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @jason-p-pickering, just a minor suggestion.
Thx

and ev.lastupdated < '${endDate}');""",
Map.of(
"tableName", qualify(table.getName()),
"tableName", qualify(table.getMainName()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"tableName", qualify(table.getMainName()),
"tableName", sqlBuilder.qualifyTable(getAnalyticsTableType().getTableName())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My suggestion follows the same standard already in use in the other "*AnalyticsTableManager" classes.
I believe it's more consistent.

@sonarqubecloud

sonarqubecloud Bot commented May 8, 2026

Copy link
Copy Markdown

@jason-p-pickering
jason-p-pickering merged commit 4615de9 into 2.42 May 8, 2026
14 checks passed
@jason-p-pickering
jason-p-pickering deleted the fix/event-analytics-continuous-run branch May 8, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-api-analytics-tests Enables analytics e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants