What Happens During an On-Line Alter?

Ryan Lecha -

During an alter in ClustrixDB the following occurs:

  • Begin/Copy Phase: A copy of the Original Table begins. This copy applies the alter as it is created. A queue is created. This records all writes to the original table while the copy occurs.

  • Replay Phase: The copy has finished so the queue starts to replay all writes that occurred while the copy was occurring. During this time all new writes are still applied to the old table and to the queue.

  • Flip Phase: The replay has finished and the alter is complete. Transactions that started before or during the alter will write to the old table and the queue (which is replayed to the new table immediately) and writes from new transactions will be written to both the new and old table.

  • Cleanup Phase: When there are no Transactions older than the time the alter finished, the old table and it's queues will be cleaned up, their utilized space regained.

A queue is created for each replica on the new table. So if the table being altered has 12 slices, 24 queues will be created. Each of these queues can only grow as large as the disk they are located on. If the disk gets full from this operation it will cause the alter to fail and rollback.

More information about ALTERs in ClustrixDB can be found in our documentation: Online Schema Changes

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk