An error occurred while fetching folder content.
Vladimir Davydov
authored
Now, as we don't need to take the schema lock for checkpointing, it is only used to synchronize concurrent space modifications (drop, truncate, alter). Actually, a global lock is a way too heavy means to achieve this goal, because we only care about forbidding concurrent modifications of the same space while concurrent modifications of different spaces should work just fine. So this patch replaces the global schema lock with per space locking. A space lock is held while alter_space_do() is in progress so as to make sure that while AlterSpaceOp::prepare() is performing a potentially yielding operation, such as building a new index, the space struct doesn't get freed from under our feet. Note, the lock is released right after index build is complete, before the transaction is committed to WAL, so if the transaction is non-yielding it can modify the space again in the next statement (this is impossible now, but will be done in the scope of the transactional DDL feature). If alter_space_do() sees that the space is already locked it bails out and throws an error. This should be fine, because long-lasting operation involving schema change, such as building an index, are rare and only performed under the supervision of the user so throwing an error rather than waiting seems to be adequate. Removal of the schema lock allows us to remove latch_steal() helper and on_begin_stmt txn trigger altogether, as they were introduced solely to support locking. This is a prerequisite for transactional DDL, because it's unclear how to preserve the global schema lock while allowing to combine several DDL statements in the same transaction.
Name | Last commit | Last update |
---|