-
Notifications
You must be signed in to change notification settings - Fork 4.1k
sql: break gossip dep for table descriptors / table leases #47150
Description
Table descriptors versions are leased by nodes. We ensure that at most, the latest two versions of a table are leased. Schema changes which increment the version of a table descriptor wait until all leases to previous versions of the table are dropped. Gossip is the mechanism by which nodes are informed of their need to drop the table descriptor. In order to make this work, we ensure that all DDL statements in explicit transactions occur as the first writing statement so that we can synthetically anchor the transaction record to the system config span ((*kv.Txn).SetSystemConfigTrigger()).
This is an awkward restriction and should be lifted.
ERROR: unimplemented: schema change statement cannot follow a statement that has written in the same transaction
SQLSTATE: 0A000
HINT: You have attempted to use a feature that is not yet implemented.
See: https://github.com/cockroachdb/cockroach/issues/26508
Additionally, this dependency on gossip is an impediment to separating the SQL layer from the gossip network.