Skip to content

Fix statistics errors caused by channel ID scoping - #516

Open
mgaffigan wants to merge 1 commit into
OpenIntegrationEngine:mainfrom
mgaffigan:fix/statistics-channel-scoping
Open

mgaffigan wants to merge 1 commit into
OpenIntegrationEngine:mainfrom
mgaffigan:fix/statistics-channel-scoping

Conversation

@mgaffigan

Copy link
Copy Markdown
Contributor

Fixes a bug where getChannelStatistics will return other than the requested channel's statistics.

Caught in #449
Closes #456
Related to #457

Issue: OpenIntegrationEngine#456
Issue: OpenIntegrationEngine#457
Signed-off-by: Mitch Gaffigan <mitch.gaffigan@comcast.net>
@github-actions

Copy link
Copy Markdown

Test Results

129 files  ±0  129 suites  ±0   3m 8s ⏱️ +27s
737 tests ±0  737 ✅ ±0  0 💤 ±0  0 ❌ ±0 
827 runs  ±0  821 ✅ ±0  6 💤 ±0  0 ❌ ±0 

Results for commit 730c395. ± Comparison against base commit fbda474.

@gibson9583 gibson9583 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 safe to merge.

@tonygermano tonygermano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not approved yet. #567 merged the same getDashboardChannels fix for #456, with a test, so this PR now conflicts with main. Scoping the storage reads to the requested channels is still worth merging once these are done:

  1. Rebase onto main. Drop the getDashboardChannels change and the requested() helper (#567 covers them), and remove the Issue: …/issues/456 trailer. Also expect conflicts from TimedDao being deleted (a178dfb), so drop its changes, and from the JdbcDao statistics loop now using try-with-resources (60c77bc), so re-apply the filter there.
  2. Update the PR description. Drop "closes #456" and say #457 is only partly fixed, e.g.: "Partially addresses #457: requests scoped to specific channels only read those channels' statistics tables. Unscoped requests can still fail while a channel is being removed; that remains open in #457."
  3. Comment the early returns in getUndeployedDashboardStatuses and getUndeployedChannelStatistics. Correctness depends on them, because an empty set means every channel further down. Suggested: // Required, not just a shortcut: an empty set means every channel to getStatisticsFromStorage.
  4. Drop the "Paranoia" check in ChannelStatisticsServlet.getStatistics(String). With #567's filter it's unreachable, and if it did trigger the client would get a bare 500. #567's test guards against a regression.
  5. Make the old overloads delegate to the new ones. Turn DonkeyDao.getChannelStatistics(String) and getChannelTotalStatistics(String) into default methods that pass null, and remove their implementations from JdbcDao, BufferedDao and PassthruDao. Do the same in com.mirth.connect.server.controllers.ChannelController for getStatisticsFromStorage(String) and getTotalStatisticsFromStorage(String), removing their overrides from DefaultChannelController, as the donkey ChannelController already does.

Follow-up (not for this PR): the rest of #457; see my comment there.

Claude checked (no action needed)
  • Traced every caller of the new overloads. Only getUndeployedDashboardStatuses and getUndeployedChannelStatistics pass a channel set, and undeployed channels are already filtered by channelIds before the storage read. Every other caller's behavior is unchanged.
  • JdbcDao still skips requested channels with no local tables.
  • A test merge into current main conflicts in DonkeyEngineController, JdbcDao and TimedDao.
  • CI on this PR: 737 tests passing, none added by this PR.

🤖 Drafted with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants