-
Notifications
You must be signed in to change notification settings - Fork 645
Views from host #3548
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
base: joshua/drop-views-on-disconnect
Are you sure you want to change the base?
Views from host #3548
Conversation
# Description of Changes Creates a multi-column index on the `sender` and `arg_id` columns of a view's backing table so that we can quickly retrieve a view's result set for each caller. <!-- Please describe your change, mention any related tickets, and so on here. --> # API and ABI breaking changes <!-- If this is an API or ABI breaking change, please apply the corresponding GitHub label. --> None This is an internal index. No module bindings are generated for it. Uniqueness of the index name follows from the uniqueness of the table name since views live in the table namespace. # Expected complexity level and risk <!-- How complicated do you think these changes are? Grade on a scale from 1 to 5, where 1 is a trivial change, and 5 is a deep-reaching and complex change. This complexity rating applies not only to the complexity apparent in the diff, but also to its interactions with existing and future code. If you answered more than a 2, explain what is complex about the PR, and what other components it interacts with in potentially concerning ways. --> 1 # Testing <!-- Describe any testing you've done, and any testing you'd like your reviewers to do, so that you're confident that all the changes work as expected! --> Performance change
0f58cb8 to
1abf255
Compare
1abf255 to
ce0d15a
Compare
# Description of Changes Addresses - #3487 (comment). Can be reviewed commit wise. 1. Provide `ModuleSubscriptions` a interface to invoke `ModuleHost::call_view`. 2. Handle `st_view_client table` insertion. 3. Make views available form sql.
4a475a2 to
c2f43a1
Compare
9ed65e4 to
fa156e1
Compare
fa156e1 to
131fdba
Compare
564a081 to
655ab83
Compare
| self.instance_env.start_view(ts, view); | ||
| } | ||
| } | ||
| self.instance_env.start_funcall(ts); |
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.
I think this call is redundant now.
| // Signal that this reducer call is finished. This gets us the timings | ||
| // associated to our reducer call, and clears all of the instance state | ||
| // associated to the call. |
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.
Copy errors
| // Signal that this reducer call is finished. This gets us the timings | |
| // associated to our reducer call, and clears all of the instance state | |
| // associated to the call. | |
| // Signal that this view call is finished. This gets us the timings | |
| // associated to our view call, and clears all of the instance state | |
| // associated to the call. |
| // Signal that this reducer call is finished. This gets us the timings | ||
| // associated to our reducer call, and clears all of the instance state | ||
| // associated to the call. |
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.
Same copy errors
| // Signal that this reducer call is finished. This gets us the timings | |
| // associated to our reducer call, and clears all of the instance state | |
| // associated to the call. | |
| // Signal that this view call is finished. This gets us the timings | |
| // associated to our view call, and clears all of the instance state | |
| // associated to the call. |
| F: FnOnce(&RelationalDB) -> T + Send + 'static, | ||
| F: FnOnce(Arc<RelationalDB>) -> Fut + Send + 'static, | ||
| Fut: std::future::Future<Output = T> + Send + 'static, |
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.
Why is this change required? It might be a good place to add a comment for future readers.
| // Merge read sets from the `MutTxId` into the `CommittedState`. | ||
| // It's important that this happens after applying the changes to `tx_data`, | ||
| // so that we can pass updated set of table ids. |
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.
I would also add here that tx_data already contains the inserts and deletes for the view tables
| fn merge_read_sets(&mut self, read_sets: ViewReadSets) { | ||
| for (view_id, read_set) in read_sets { | ||
| self.merge_read_set(view_id, read_set); | ||
| fn merge_read_sets(&mut self, read_sets: ViewReadSets, tables: impl IntoIterator<Item = TableId>) { |
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.
Can you rename the tables param to dropped_tables or something similar?
| Ok((tx, commit)) | ||
| } | ||
|
|
||
| /// Checks whether a memoized view exists for the given view name, arguments, and sender identity. |
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.
| /// Checks whether a memoized view exists for the given view name, arguments, and sender identity. | |
| /// Checks whether a materialized view exists for the given view name, arguments, and sender identity. |
| let mut metrics = ExecutionMetrics::default(); | ||
|
|
||
| for (view_name, args) in stmt.views() { | ||
| let (is_memoized, args) = tx |
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.
nit: is_materialized
| execution_duration: result.timings.total_duration, | ||
| }; | ||
|
|
||
| (res, trapped) |
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.
So we don't have to explicitly handle traps? They're handled a layer above?
Description of Changes
Host implementation to invoke
call_viewmethod.I also covers:
MutTxId::is_materializedto check if existing view exisits and updated.API and ABI breaking changes
NA
Testing