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

Make getting a complete view of the schema optional #6211

Merged
merged 2 commits into from
Jan 20, 2023
Merged

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Jan 19, 2023

Rather than tying this to the Additive schema mode, make it an option which can be used with all applicable schema modes. It turns out that adding additional properties to the end of persisted_properties does cause problems, as it makes Object::create() expect values for those properties. However, we do (sometimes) want the additional tables to be added to the schema and not just in Additive mode, so that's a separate option.

This also fixes several bugs in the implementation which would result in it failing to actually have a complete view of the schema in some cases, and could result in frozen Realms having an incorrect schema.

This also incidentally improves the performance of freezing Realms as part of the fix for the schema management and fixes a few race conditions related to cached frozen Realms.

@tgoyne tgoyne self-assigned this Jan 19, 2023
@cla-bot cla-bot bot added the cla: yes label Jan 19, 2023
@tgoyne tgoyne force-pushed the tg/schema-view branch 2 times, most recently from 2e5668b to 9f23885 Compare January 19, 2023 02:51
@tgoyne tgoyne marked this pull request as ready for review January 19, 2023 05:38
Copy link
Member

@nicola-cab nicola-cab left a comment

Choose a reason for hiding this comment

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

LGTM.

});

if (!other_classes.empty()) {
insert(end(), other_classes.begin(), other_classes.end());
reserve(size() + other_classes.size());
Copy link
Member

Choose a reason for hiding this comment

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

I think this is equivalent to call directly insert.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's almost certainly not a useful optimization outside of very weird things, but this eliminates some moves by gathering pointers to the schema to copy and then constructing the copies in-place.

Rather than tying this to the Additive schema mode, make it an option which can
be used with all applicable schema modes. This also fixes several bugs in the
implementation which would result in it failing to actually have a complete
view of the schema in some cases, and could result in frozen Realms having an
incorrect schema.

This also incidentally improves the performance of freezing Realms as part of
the fix for the schema management and fixes a few race conditions related to
cached frozen Realms.
@tgoyne tgoyne merged commit 406586b into master Jan 20, 2023
@tgoyne tgoyne deleted the tg/schema-view branch January 20, 2023 05:16
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants