bpm: a process-instance listing resolves every activity in three queries - #7266
Open
delchev wants to merge 1 commit into
Open
bpm: a process-instance listing resolves every activity in three queries#7266delchev wants to merge 1 commit into
delchev wants to merge 1 commit into
Conversation
#7212 made the listing resolve each instance's activity id instead of reading the always-null one off the instance, at three queries apiece - an execution query and the two job queries. The Monitoring shell's Overview polls the listing with no key and no limit every 30 s, so a tenant with a few hundred running instances paid 3N statements a poll for a column the listing renders as one badge. The resolution is now done for the whole listing at once: one execution query over all the listed ids, and the two job queries over the current tenant - Flowable's job queries take a single process-instance id, so the tenant is the narrowest batch filter there is - grouped by process instance in memory. The evidence and the answer are unchanged, down to a step parked between retry attempts that only its own timer job still names; the query count no longer grows with the listing, which the new engine test pins by reading H2's own query statistics. The single-instance path keeps its targeted queries. Also: the two in-memory engine tests meant DB_CLOSE_DELAY=-1, not 1000. Fixes #7250 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
BpmService.getProcessInstancesresolved each instance's activity id one instance at a time -getActiveActivityIds, aJobQueryand aTimerJobQuery, three statements apiece (#7212).GET /services/bpm/bpm-processes/instancesis unbounded, and the Monitoring shell's Overview polls it with no key every 30 s, so a tenant with a few hundred running instances paid 3N statements per poll.The resolution now happens for the whole listing at once, in
BpmProviderFlowable.getProcessInstanceActivityIds(List<ProcessInstance>):ExecutionQueryover all the listed ids (processInstanceIds+onlyChildExecutions, tenant-scoped), filtered to the active executions - the flag is not a query criterion, so it is read off the returned rows, which keeps a scope execution (a subprocess or multi-instance parent) from being reported as a second activity;The evidence and the answer are unchanged, including a step parked between retry attempts that only its own timer job names (#7193). The single-instance path (
/instance/{id}, the diagram) keeps its targeted queries.Tests
BpmProviderFlowableActiveActivitiesTest, against a real in-memory engine:INFORMATION_SCHEMA.QUERY_STATISTICS. That is the regression this fix is about.mvn -pl components/engine/engine-bpm-flowable test- 35/35 green.Note
The nit from the issue is fixed too: both in-memory engine tests meant
DB_CLOSE_DELAY=-1, not1000.While here: the
limit: 100the AngularJS Processes view sends is not a parameter the endpoint declares, so it is dropped on the floor - capping the call would not have helped, which is why this batches instead.Fixes #7250
🤖 Generated with Claude Code