-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(query-orchestrator): initialize missing data source queue in isPa… #11617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,6 +280,38 @@ describe('PreAggregations', () => { | |
| }); | ||
| }); | ||
|
|
||
| describe('isPartitionExist', () => { | ||
| test('initializes a missing data source queue before checking the job result', async () => { | ||
| const preAggregations = new PreAggregations( | ||
| 'TEST', | ||
| mockDriverFactory as any, | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-function | ||
| () => {}, | ||
| queryCache!, | ||
| { | ||
| cacheAndQueueDriver: 'memory', | ||
| queueOptions: async () => ({ | ||
| executionTimeout: 1, | ||
| concurrency: 2, | ||
| }), | ||
| }, | ||
| ); | ||
| mockDriver!.tables.push('stb_pre_aggregations.orders_main'); | ||
|
|
||
| await expect( | ||
| preAggregations.isPartitionExist( | ||
| 'request-id', | ||
| false, | ||
| 'named_data_source', | ||
| 'stb_pre_aggregations', | ||
| 'stb_pre_aggregations.orders_main', | ||
| ['job-key'], | ||
| 'job-token', | ||
| ) | ||
| ).resolves.toEqual([true, 'done']); | ||
| }); | ||
|
Comment on lines
+311
to
+312
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test covers the crash path (before the fix this threw
Also, nothing shuts the created queue down at the end of the test. With |
||
| }); | ||
|
|
||
| describe('loadAllPreAggregationsIfNeeded', () => { | ||
| let preAggregations: PreAggregations | null = null; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since these lines are being rewritten anyway, worth closing the pre-existing connection leak: if
conn.getResult(key)rejects (Cube Store hiccup, timeout),release(conn)never runs and the queue-driver connection is leaked. For the CubeStore queue driver that's a pooled connection held for the process lifetime, and this is a polling endpoint, so leaks accumulate per failed poll.