-
Notifications
You must be signed in to change notification settings - Fork 598
datastore: add clear_table
and fix drop_table
#3214
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: master
Are you sure you want to change the base?
Conversation
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.
Looks Good, thanks!
Considering there will be a follow-up PR to fix this for commitlog replay.
This PR will make commitlog replay logic to empty dropped tables but we still need a patch to actually drop them from memory.
Co-authored-by: Shubham Mishra <[email protected]> Signed-off-by: Mazdak Farrokhzad <[email protected]>
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.
Holding off on approving until we get the replay parts of this merged and tested, but I like this.
committed_state.get_table(table_id).and_then(|table| { | ||
table_stats.insert( | ||
table_id, | ||
TableStats { | ||
row_count: table.row_count, | ||
bytes_occupied_overestimate: table.bytes_occupied_overestimate(), | ||
num_indices: table.num_indices(), | ||
}, | ||
) | ||
}); |
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.
This reminds me: do we need to clean up any metrics when a table gets deleted? If there are any metrics that have a table ID in the with_label_values
, we'll want to call remove_label_values
on them at some point, probably within commit.
Description of Changes
Aternative to and closes #3210.
This version relies on
pending_schema_changes
.The first commit adds
clear_table
to the datastore that's efficient and can be exposed to the module ABI in a follow up.The second commit fixes
drop_table
.API and ABI breaking changes
None
Expected complexity level and risk
3?
Testing
test_drop_table_is_transactional
is amended to checkTxData
.