-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
descs: upgrade
WriteDescToBatch
to use CPut
Previously, `WriteDescToBatch`, which is called to update a descriptor in storage by a `desc.Collection`, uses `Put` primitive to directly modify the storage layer. We would like to tighten it to use a `CPut` to prevent (in)advertent clobbering of that table. This PR does that by book-keeping the raw bytes of the to-be-updated descriptor in the descriptor, acquired when we first read it into the `desc.Collection` from the storage layer. Then, the infrastructural work done in the previous commit allows us to carry over these raw bytes as we are preparing the `MutableDescriptor` that we pass into this `WriteDescToBatch` method. One additional difficulty is that what if we will need to call `WriteDescToBatch` more than once in one transaction. For example, in the new schema changer, statement phase and precommit phase will both be in one transaction, but we call `WriteDescToBatch` at the end of each stage. Hence, for some DDL stmts (e.g. `DROP COLUMN`), we will call `WriteDescToBatch` twice in one transaction. The first call will modify the descriptor in storage and also added this descriptor to `desc.Collection.uncommitted` set, so, the second call will get it from there. To make `CPut` work correctly for the second call, we will need to get the expected byte slice from the `uncommitted` descriptor set. This motivates the change to update a descriptor's byte slice field when it's added to the `uncommitted` descriptor sett.
- Loading branch information
Showing
6 changed files
with
36 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters