-
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.
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.
I've fixed the replay parts, but we cannot integration test this until the add-column PR as simply dropping a table is not allowed. |
Co-authored-by: Shubham Mishra <[email protected]> Signed-off-by: Mazdak Farrokhzad <[email protected]>
08b70cf
to
813f34c
Compare
let (tx_table, tx_blob_store, delete_table) = self | ||
.tx_state | ||
.get_table_and_blob_store_or_create_from(table_id, commit_table); | ||
let mut rows_removed = tx_table.clear(tx_blob_store); |
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.
For tx_table
, shouldn’t it be enough to just remove it from the BTreeMap
of TxState::insert_tables
?
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.
If it wasn't for the blob store you could do that. We could as an optimization check whether the table layout is fixed, in which case there cannot be any blob store references, making the removal sound.
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, I don’t fully understand how we’re using blob_store
, but for TxState::blob_store
, won’t MutTxId::commit
eventually drop it anyway?
Do you think is it a problem to occupy extra bytes in blob_store
during the lifecycle of tx (until it commits or rollback)?
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
.