Skip to content
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

Fix defects with query channels #4786

Merged
merged 4 commits into from
Mar 7, 2024
Merged

Fix defects with query channels #4786

merged 4 commits into from
Mar 7, 2024

Conversation

eric-hughes-tiledb
Copy link
Contributor

@eric-hughes-tiledb eric-hughes-tiledb commented Mar 5, 2024

New class QueryChannel to replace the previous class that was not actually a channel. Added methods in class Query for it, and rewrote the channel C API handle class to use it. Correctly initialize the underlying channel object within the query field C API handle class, and return a channel handle with the right lifespan. (This fixes the defect reported.)

Reworked test fixture to use TemporaryLocalDirectory. Reworked tests for isolation with SECTION. Rewrote the two tests with aggegrates to use correct calling sequence.

Changed ensure_query_is_not_initialized to take a reference. Changed tiledb_query_get_default_channel to return an actual channel handle rather than a stub for one.

Reference:
https://app.shortcut.com/tiledb-inc/story/39123/tiledb-field-channel-returns-the-same-handle-and-is-prone-to-double-freeing

[sc-39123]


TYPE: BUG
DESC: Fix defects with query channels

… not actually a channel. Added methods in `class Query` for it, and rewrote the channel C API handle class to use it. Correctly initialize the underlying channel object within the query field C API handle class, and return a channel handle with the right lifespan. (This fixes the defect reported.)

Reworked test fixture to use `TemporaryLocalDirectory`. Reworked tests for isolation with SECTION. Rewrote the two tests with aggegrates to use correct calling sequence.

Changed `ensure_query_is_not_initialized` to take a reference. Changed `tiledb_query_get_default_channel` to return an actual channel handle rather than a stub for one.

Reference:
https://app.shortcut.com/tiledb-inc/story/39123/tiledb-field-channel-returns-the-same-handle-and-is-prone-to-double-freeing
Copy link

* Responsibility for choosing channel identifiers is the responsibility of
* `class Query`; this class merely carries the resulting identifier.
*/
class QueryChannelActual {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should rename this to QueryChannel and rename the one above to QueryChannelSerialization?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one: class QueryChannel
The previous one: class LegacyQueryAggregates

The existing class isn't really about channels so much as all the aggregates over the default channel. class LegacyQueryAggregatesOverDefault would be more accurate, but far wordier.

Copy link
Contributor

Choose a reason for hiding this comment

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

The wordier version might be fine. It's only used in a few places.

* without any grouping.
* - Channel 1: (optional) Simple aggregates, if any exist.
*/
inline size_t number_of_actual_channels() {
Copy link
Contributor

Choose a reason for hiding this comment

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

If we do the rename below we might be able to get rid of the word actual?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I did it that way to avoid conflating a bunch of renames with the rest of the PR.

@KiterLuc KiterLuc merged commit 8e5f815 into dev Mar 7, 2024
57 checks passed
@KiterLuc KiterLuc deleted the eh/query_channel branch March 7, 2024 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants