You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Need to implement two mechanisms to support unsafe ALTER TABLE in a non-blocking manner:
Rollback mechanism for removing a staged DataTableVersion (likely lives inside TransactionManager::Rollback
Predicate check mechanism. Current plan is two-stages in lifecycle: Installed (visible and evaluated by all transactions immediately before commit; sets a failed flag if appropriate but still commits) & Enforced (visible and evaluated by all transactions and forces an abort if failed).
Sequencing for unsafe ALTER TABLE:
Grab begin timestamp
Parse query
Check if query executes an unsafe ALTER TABLE
Grab all planned write locks in the CATALOG (ensures fast abort and ensures schema change does not change between now and 6, below)
Install predicate
Fetch new "begin" timestamp
Execute table scan to check visible tuples for safety compliance.
Check predicate validity, abort now if invalid
Grab commit latch
Double-check validity, release latch and abort if invalid
Set predicate to enforcing.
Release commit latch.
Sequence for other transaction
[Proceed as normal until immediately before grabbing commit latch]
Run all predicate checks storing whether they succeeded or failed.
Check whether any failed predicates are enforcing, if so abort.
Grab commit latch
For each failed predicate, recheck enforcing. If now enforcing, release latch and abort.
Grab commit timestamp.
For each failed predicate, set validity flag to false.
[Proceed as normal starting with logic immediately after grabbing commit timestamp]
Lifecycle management for predicates:
Immediately unlink on abort, GC with txn.
For committed: unlink predicate when timestamp older than oldest running transaction.
Delete predicate once unlink timestamp is older than oldest running transaction.
The text was updated successfully, but these errors were encountered:
After diving through the code, the hash map we are currently using is unsafe under our use case (implementation). This means we will either need an internal hash map implementation or a heavier wait process for executing rollbacks (i.e. copy over the hash map minus the removed element and CAS over to the new table). We can punt the issue further down the road by only installing the new version after we've confirmed commit (but this doesn't solve the problem for compaction in the future).
Need to implement two mechanisms to support unsafe ALTER TABLE in a non-blocking manner:
DataTableVersion
(likely lives insideTransactionManager::Rollback
Sequencing for unsafe ALTER TABLE:
Sequence for other transaction
Lifecycle management for predicates:
The text was updated successfully, but these errors were encountered: