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 schema timestamps used when loading enumerations from REST. #5291

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

shaunrd0
Copy link
Contributor

@shaunrd0 shaunrd0 commented Sep 6, 2024

This fixes a bug loading enumerations after a REST request was made using array directory timestamp ranges. The response from the request gives the enumerations on the latest schema in that range, which can result in attempting to store enumerations on a schema where they no longer exist after being dropped in a previous array schema evolution.

Thanks @johnkerl for reporting, in the end I found the exact error from your issue was thrown because the enumeration happened to have the same name as a previously dropped enumeration. I was able to reproduce your error in the test case I added here by evolving the schema a third time to add back an enumeration with an identical name of one that was previously dropped.


TYPE: NO_HISTORY
DESC: Fix schema timestamps used when loading enumerations from REST.

+ Fix error by using current schema's timestamps when loading
  enumerations from REST.
/** Handle `struct` for API ArraySchema objects. */
struct tiledb_array_schema_handle_t
: public tiledb::api::CAPIHandle<tiledb_array_schema_handle_t> {
/** Type name */
static constexpr std::string_view object_type_name{"array_schema"};

private:
using array_schema_type = shared_ptr<ArraySchema>;
using array_schema_type = shared_ptr<tiledb::sm::ArraySchema>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you explain why we now need to fully qualify tiledb::sm classes now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, meant to add a comment for this on my PR. It was namespace pollution with using tiledb::sm at the top of this file. When I included this header it makes tiledb::Array and tiledb::sm::Array ambiguous for example.

Copy link
Member

@ypatia ypatia left a comment

Choose a reason for hiding this comment

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

LGTM once Luc's comment is addressed. Thanks for the quick fix!

@KiterLuc KiterLuc merged commit edb48b1 into dev Sep 9, 2024
62 checks passed
@KiterLuc KiterLuc deleted the smr/sc-54604/rest-bug-load-enums-all-schemas branch September 9, 2024 12:59
@KiterLuc
Copy link
Contributor

KiterLuc commented Sep 9, 2024

/backport to release-2.26

Copy link
Contributor

github-actions bot commented Sep 9, 2024

Started backporting to release-2.26: https://github.com/TileDB-Inc/TileDB/actions/runs/10773738557

Copy link
Contributor

github-actions bot commented Sep 9, 2024

@KiterLuc backporting to release-2.26 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: Add REST test.
Using index info to reconstruct a base tree...
A	tiledb/api/c_api/array_schema/array_schema_api.cc
A	tiledb/api/c_api/array_schema/array_schema_api_internal.h
M	tiledb/sm/array/array.cc
Falling back to patching base and 3-way merge...
Auto-merging tiledb/sm/array/array.cc
CONFLICT (modify/delete): tiledb/api/c_api/array_schema/array_schema_api_internal.h deleted in HEAD and modified in Add REST test.. Version Add REST test. of tiledb/api/c_api/array_schema/array_schema_api_internal.h left in tree.
CONFLICT (modify/delete): tiledb/api/c_api/array_schema/array_schema_api.cc deleted in HEAD and modified in Add REST test.. Version Add REST test. of tiledb/api/c_api/array_schema/array_schema_api.cc left in tree.
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Add REST test.
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

github-actions bot commented Sep 9, 2024

@KiterLuc an error occurred while backporting to release-2.26, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

KiterLuc pushed a commit that referenced this pull request Sep 9, 2024
…rations from REST. (#5291) (#5293)

Backport of #5291 to
release-2.26.

---
TYPE: NO_HISTORY
DESC: Fix schema timestamps used when loading enumerations from REST.

---------

Co-authored-by: Ypatia Tsavliri <[email protected]>
KiterLuc added a commit that referenced this pull request Sep 10, 2024
…ng enumerations from REST. (#5291) (#5293)"

This reverts commit 9683584.
shaunrd0 added a commit that referenced this pull request Oct 17, 2024
This fixes a performance regression added in
#5291 while loading
enumerations for all array schemas. The regression impacts arrays with
multiple evolved schemas. Previously #5291 introduced a loop over REST
requests for-each schema, this PR loads all enumerations for all schemas
in a single request.

---
TYPE: C_API
DESC: Introduce tiledb_array_load_enumerations_all_schemas

TYPE: CPP_API
DESC: Introduce ArrayExperimental::load_enumerations_all_schemas

---------

Co-authored-by: Ypatia Tsavliri <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants