You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, we have no consistency guarantees around VSchema writes. If there is any concurrent read-modify-write cycles — we only offer an API for writing the entire object today — then you can lose intermediate writes. Given that the vschema plays a critical role in serving queries and data, this is not an ideal situation.
You can see the general problem reported in a specific context here: #15794
We have support for linearizing writes using the topo key version:
That is used for Keyspaces, Shards, and Tablets today using KeyspaceInfo, ShardInfo, and TabletInfo respectively, which wrap the Keyspace, Shard, and Tablet records and store the version of the key that was read from the topo server. If we look at KeyspaceShard as an example:
The version used on write to ensure we linearize the writes and are only allowed to update the latest/current version (do not lose intermediate changes):
We do not, however, use this same mechanism for VSchemas today. So you can have workflow related commands coming from systems and humans, humans using vtctldclient vschema related commands (GetVSchema and ApplyVSchema), systems using vschema related RPCs, vtgates doing the same via its VSchema SQL interface, with all of these read-modify-write cycles potentially happening concurrently and without any mechanism to ensure consistency via linearizing the writes (all writes happen in a sequential order w/o losing intermediate ones and going back in logical time) so that you can only update the current/latest vchema. This can potentially lead to undefined behavior and in turn can lead to major failures and downtime.
We should fix this in all topo server implementations (etcd, consul and zookeeper all support versions).
Add an interface for modifying discrete parts of the VSchema via concrete actions: AddTable, AddVindex, RemoveTable, etc.
Provide a replacement or alternative to transition away from the one shot ApplyVSchema command and if we keep it long term find a way to make it linearizable and ensure consistency as well
Ensure that SrvVSchema management is also linearizable (it contains copies of the keyspaces' VSchema protos)
Use Case(s)
Removing a sharp edge in Vitess cluster management.
The text was updated successfully, but these errors were encountered:
Feature Description
Today, we have no consistency guarantees around VSchema writes. If there is any concurrent read-modify-write cycles — we only offer an API for writing the entire object today — then you can lose intermediate writes. Given that the vschema plays a critical role in serving queries and data, this is not an ideal situation.
You can see the general problem reported in a specific context here: #15794
We have support for linearizing writes using the topo key version:
vitess/go/vt/topo/etcd2topo/file.go
Lines 48 to 74 in 998433c
That is used for Keyspaces, Shards, and Tablets today using KeyspaceInfo, ShardInfo, and TabletInfo respectively, which wrap the Keyspace, Shard, and Tablet records and store the version of the key that was read from the topo server. If we look at KeyspaceShard as an example:
vitess/go/vt/topo/keyspace.go
Lines 63 to 70 in 998433c
vitess/go/vt/topo/keyspace.go
Lines 117 to 143 in 998433c
vitess/go/vt/topo/keyspace.go
Lines 178 to 206 in 998433c
We do not, however, use this same mechanism for VSchemas today. So you can have workflow related commands coming from systems and humans, humans using
vtctldclient
vschema related commands (GetVSchema
andApplyVSchema
), systems using vschema related RPCs, vtgates doing the same via its VSchema SQL interface, with all of these read-modify-write cycles potentially happening concurrently and without any mechanism to ensure consistency via linearizing the writes (all writes happen in a sequential order w/o losing intermediate ones and going back in logical time) so that you can only update the current/latest vchema. This can potentially lead to undefined behavior and in turn can lead to major failures and downtime.We should fix this in all topo server implementations (etcd, consul and zookeeper all support versions).
This work will involve several pieces:
ApplyVSchema
command and if we keep it long term find a way to make it linearizable and ensure consistency as wellUse Case(s)
Removing a sharp edge in Vitess cluster management.
The text was updated successfully, but these errors were encountered: