Skip to content
Snippets Groups Projects
Commit 626c5fd0 authored by Vladimir Davydov's avatar Vladimir Davydov
Browse files

ddl: don't use space_index from AlterSpaceOp::commit,rollback

If there are multiple DDL operations in the same transactions, which is
impossible now, but will be implemented soon, AlterSpaceOp::commit and
rollback methods must not access space index map. To understand that,
consider the following example:

  - on_replace: AlterSpaceOp1 creates index I1 for space S1
  - on_replace: AlterSpaceOp2 moves index I1 from space S1 to space S2
  - on_commit:  AlterSpaceOp1 commits creation of index I1

AlterSpaceOp1 can't lookup I1 in S1 by id, because the index was moved
from S1 to S2 by AlterSpaceOp2. If AlterSpaceOp1 attempts to look it up,
it will access a wrong index.

Fix that by caching pointers to old and new indexes in AlterSpaceOp on
construct/prepare instead of using space_index() on commit/rollback to
access them.
parent 0ae5a2d7
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment