diff --git a/changelog/18.0/18.0.0/release_notes.md b/changelog/18.0/18.0.0/release_notes.md index c48ff018c85..88fa877bdc2 100644 --- a/changelog/18.0/18.0.0/release_notes.md +++ b/changelog/18.0/18.0.0/release_notes.md @@ -85,14 +85,14 @@ It is disabled by default. A new field `foreignKeyMode` has been added to the VSchema. This field can be provided for each keyspace. The VTGate flag `--foreign_key_mode` has been deprecated in favour of this field. There are 3 foreign key modes now supported in Vitess - -1. `FK_UNMANAGED` - +1. `unmanaged` - This mode represents the default behaviour in Vitess, where it does not manage foreign keys column references. Users are responsible for configuring foreign keys in MySQL in such a way that related rows, as determined by foreign keys, reside within the same shard. -2. `FK_MANAGED` [EXPERIMENTAL] - +2. `managed` [EXPERIMENTAL] - In this experimental mode, Vitess is fully aware of foreign key relationships and actively tracks foreign key constraints using the schema tracker. Vitess takes charge of handling DML operations with foreign keys cascading updates, deletes and verifying restrict. It will also validate parent row existence. This ensures that all the operations are logged in binary logs, unlike MySQL implementation of foreign keys. This enables seamless integration of VReplication with foreign keys. For more details on what operations Vitess takes please refer to the [design document for foreign keys](https://github.com/vitessio/vitess/issues/12967). -3. `FK_DISALLOW` - +3. `disallow` - In this mode Vitess explicitly disallows any DDL statements that try to create a foreign key constraint. This mode is equivalent to running VTGate with the flag `--foreign_key_mode=disallow`. #### Upgrade process diff --git a/changelog/18.0/18.0.0/summary.md b/changelog/18.0/18.0.0/summary.md index bd9e6e0c077..e9d7ad4e405 100644 --- a/changelog/18.0/18.0.0/summary.md +++ b/changelog/18.0/18.0.0/summary.md @@ -85,14 +85,14 @@ It is disabled by default. A new field `foreignKeyMode` has been added to the VSchema. This field can be provided for each keyspace. The VTGate flag `--foreign_key_mode` has been deprecated in favour of this field. There are 3 foreign key modes now supported in Vitess - -1. `FK_UNMANAGED` - +1. `unmanaged` - This mode represents the default behaviour in Vitess, where it does not manage foreign keys column references. Users are responsible for configuring foreign keys in MySQL in such a way that related rows, as determined by foreign keys, reside within the same shard. -2. `FK_MANAGED` [EXPERIMENTAL] - +2. `managed` [EXPERIMENTAL] - In this experimental mode, Vitess is fully aware of foreign key relationships and actively tracks foreign key constraints using the schema tracker. Vitess takes charge of handling DML operations with foreign keys cascading updates, deletes and verifying restrict. It will also validate parent row existence. This ensures that all the operations are logged in binary logs, unlike MySQL implementation of foreign keys. This enables seamless integration of VReplication with foreign keys. For more details on what operations Vitess takes please refer to the [design document for foreign keys](https://github.com/vitessio/vitess/issues/12967). -3. `FK_DISALLOW` - +3. `disallow` - In this mode Vitess explicitly disallows any DDL statements that try to create a foreign key constraint. This mode is equivalent to running VTGate with the flag `--foreign_key_mode=disallow`. #### Upgrade process diff --git a/go/test/endtoend/vtgate/foreignkey/sharded_vschema.json b/go/test/endtoend/vtgate/foreignkey/sharded_vschema.json index b40b10b88e0..688228f8772 100644 --- a/go/test/endtoend/vtgate/foreignkey/sharded_vschema.json +++ b/go/test/endtoend/vtgate/foreignkey/sharded_vschema.json @@ -1,6 +1,6 @@ { "sharded": true, - "foreignKeyMode": "FK_MANAGED", + "foreignKeyMode": "managed", "vindexes": { "xxhash": { "type": "xxhash" diff --git a/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go b/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go index c55ce9eef79..5c91fdbb929 100644 --- a/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go +++ b/go/test/endtoend/vtgate/foreignkey/stress/fk_stress_test.go @@ -323,7 +323,7 @@ func TestMain(m *testing.M) { Name: keyspaceName, VSchema: `{ "sharded": false, - "foreignKeyMode": "FK_MANAGED" + "foreignKeyMode": "managed" }`, } diff --git a/go/test/endtoend/vtgate/foreignkey/unsharded_vschema.json b/go/test/endtoend/vtgate/foreignkey/unsharded_vschema.json index fbdc3dd7c04..31f02ca41c4 100644 --- a/go/test/endtoend/vtgate/foreignkey/unsharded_vschema.json +++ b/go/test/endtoend/vtgate/foreignkey/unsharded_vschema.json @@ -1,6 +1,6 @@ { "sharded": false, - "foreignKeyMode": "FK_MANAGED", + "foreignKeyMode": "managed", "tables": { "u_t1": {}, "u_t2": {}, diff --git a/go/vt/vtgate/planbuilder/testdata/vschemas/schema.json b/go/vt/vtgate/planbuilder/testdata/vschemas/schema.json index 50a09c97a48..ac88fea498d 100644 --- a/go/vt/vtgate/planbuilder/testdata/vschemas/schema.json +++ b/go/vt/vtgate/planbuilder/testdata/vschemas/schema.json @@ -605,7 +605,7 @@ }, "sharded_fk_allow": { "sharded": true, - "foreignKeyMode": "FK_MANAGED", + "foreignKeyMode": "managed", "vindexes": { "hash_vin": { "type": "hash_test" @@ -746,7 +746,7 @@ } }, "unsharded_fk_allow": { - "foreignKeyMode": "FK_MANAGED", + "foreignKeyMode": "managed", "tables": { "u_tbl1": {}, "u_tbl2": {}, diff --git a/go/vt/vtgate/vindexes/vschema_test.go b/go/vt/vtgate/vindexes/vschema_test.go index c54935d8670..a59ec78139d 100644 --- a/go/vt/vtgate/vindexes/vschema_test.go +++ b/go/vt/vtgate/vindexes/vschema_test.go @@ -365,7 +365,7 @@ func TestVSchemaViews(t *testing.T) { got := string(out) want := ` { - "foreignKeyMode":"FK_UNMANAGED", + "foreignKeyMode":"unmanaged", "tables": { "t1": { "name": "t1", @@ -423,7 +423,7 @@ func TestVSchemaForeignKeys(t *testing.T) { require.NoError(t, err) want := ` { - "foreignKeyMode": "FK_UNMANAGED", + "foreignKeyMode": "unmanaged", "tables": { "t1": { "name": "t1", @@ -2725,7 +2725,7 @@ func TestVSchemaJSON(t *testing.T) { want := `{ "sharded": { "sharded": true, - "foreignKeyMode": "FK_DISALLOW", + "foreignKeyMode": "disallow", "tables": { "t3": { "name": "n3", @@ -2750,7 +2750,7 @@ func TestVSchemaJSON(t *testing.T) { } }, "unsharded": { - "foreignKeyMode": "FK_MANAGED", + "foreignKeyMode": "managed", "tables": { "t1": { "name": "n1", diff --git a/go/vt/vttablet/tabletserver/vstreamer/engine_test.go b/go/vt/vttablet/tabletserver/vstreamer/engine_test.go index 7f9a8cdff99..36bcc8f181a 100644 --- a/go/vt/vttablet/tabletserver/vstreamer/engine_test.go +++ b/go/vt/vttablet/tabletserver/vstreamer/engine_test.go @@ -110,7 +110,7 @@ func TestUpdateVSchema(t *testing.T) { "keyspaces": { "vttest": { "sharded": true, - "foreignKeyMode": "FK_UNMANAGED", + "foreignKeyMode": "unmanaged", "tables": { "t1": { "name": "t1",