-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding an interface for v schema #17686
base: main
Are you sure you want to change the base?
Changes from all commits
b8ad0fa
a78e8c1
6f2432e
5224ac1
3808f0e
c566c37
e087a42
d1bf653
d6cdbfc
43f7823
bd17b6c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No changes are needed in this file. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package vtctlclient | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestVSchemaAtomicOperations(t *testing.T) { | ||
// Test cases for: | ||
// - Concurrent modifications | ||
// - Version conflicts | ||
// - Successful atomic updates | ||
// - Invalid inputs | ||
// - Error conditions | ||
} |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. vtctlclient is deprecated so no changes needed there. I'm also not sure what this is supposed to be used for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can see how the And on the You can see a recent PR that added a couple of simple new commands here: #17442 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package vtctlclient | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/your-project/vschemapb" | ||
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Local example using etcd on Ubuntu
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Local example using zk2 on Ubuntu
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Local example using consul on Ubuntu
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / End-to-End Test (Race)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Region Sharding example using etcd on Ubuntu
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / End-to-End Test
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / VTop Example
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_queries)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_unsharded)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_gen4)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_copy_parallel)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (topo_connection_cache)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_godriver)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_multi_tenant)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_across_db_versions)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_concurrentdml)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_transaction)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (schemadiff_vrepl)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_topo)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtctlbackup_sharded_clustertest_heavy)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_etcd)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_foreignkey_stress)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_general_heavy)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (12)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtbackup)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_reservedconn)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_foreign_key_stress)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (13)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_cellalias)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_schema_tracker)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_revert)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (ers_prs_newfeatures_heavy)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (21)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vstream)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (mysql80)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_scheduler)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_partial_keyspace)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_mariadb_to_mysql)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (backup_pitr)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_partial_movetables_and_materialize)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Java Docker Test
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Java Docker Test
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_tablet_healthcheck_cache)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_plantests)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_readafterwrite)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (backup_pitr_mysqlshell)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtorc)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vttablet_prscomplex)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (backup_pitr_xtrabackup)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (15)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Docker Test Cluster
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Docker Test Cluster
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Docker Test Cluster
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (tabletmanager_throttler_topo)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (xb_recovery)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_vschema)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (mysql_server_vault)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (18)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_consul)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (xb_backup)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Unit Test (evalengine_mysql57)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_v2)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Unit Test (mysql57)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_schema)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (tabletmanager_tablegc)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Unit Test (evalengine_mysql84)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (tabletmanager_consul)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Vitess Tester (vtgate)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Unit Test (evalengine_mysql80)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Unit Test (mysql80)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Unit Test (mysql84)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vtgate_vindex_heavy)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_basic)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Upgrade Downgrade Test - Backups - E2E
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Queries)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_suite)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_migrate)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Schema)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress_suite)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Code Coverage
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Queries - 2)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Semi Sync Upgrade Downgrade Test
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run endtoend tests on Cluster (vreplication_vtctldclient_vdiff2_movetables_tz)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Unit Test (Race)
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Upgrade Downgrade Test - Backups - Manual
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Upgrade Downgrade Test - Online DDL flow
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Upgrade Downgrade Test - Reparent Old VTTablet
Check failure on line 6 in go/vt/vtctl/vtctlclient/grpc_client.go GitHub Actions / Run Upgrade Downgrade Test - Reparent Old Vtctl
|
||
) | ||
|
||
type gRPCVSchemaOperations struct { | ||
client *gRPCClient | ||
keyspace string | ||
} | ||
|
||
func (ops *gRPCVSchemaOperations) AddTable(ctx context.Context, keyspace, tableName string, tableSpec interface{}) error { | ||
// 1. Get current VSchema with version | ||
vschema, version, err := ops.client.GetVSchema(ctx, keyspace) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// 2. Validate table spec | ||
spec, err := validateTableSpec(tableSpec) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// 3. Modify VSchema | ||
// Add table to vschema.Tables map | ||
|
||
// 4. Save with version check | ||
return ops.client.SaveVSchema(ctx, keyspace, vschema, version) | ||
} | ||
|
||
// Implement other VSchemaOperations methods similarly |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,35 @@ type VtctlClient interface { | |
Close() | ||
} | ||
|
||
|
||
// VSchemaOperations defines the interface for atomic VSchema modifications | ||
type VSchemaOperations interface { | ||
// AddTable atomically adds a table to the VSchema | ||
AddTable(ctx context.Context, keyspace, tableName string, tableSpec interface{}) error | ||
|
||
// RemoveTable atomically removes a table from the VSchema | ||
RemoveTable(ctx context.Context, keyspace, tableName string) error | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
// AddVindex atomically adds a vindex to the VSchema | ||
AddVindex(ctx context.Context, keyspace, vindexName string, vindexSpec interface{}) error | ||
|
||
// RemoveVindex atomically removes a vindex from the VSchema | ||
RemoveVindex(ctx context.Context, keyspace, vindexName string) error | ||
} | ||
|
||
// VtctlClient defines the interface used to send remote vtctl commands | ||
type VtctlClient interface { | ||
// ExecuteVtctlCommand will execute the command remotely | ||
ExecuteVtctlCommand(ctx context.Context, args []string, actionTimeout time.Duration) (logutil.EventStream, error) | ||
|
||
// VSchema returns the VSchema operations interface | ||
VSchema() VSchemaOperations | ||
|
||
// Close will terminate the connection. This object won't be | ||
// used after this. | ||
Close() | ||
} | ||
|
||
// Factory functions are registered by client implementations | ||
type Factory func(ctx context.Context, addr string) (VtctlClient, error) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,205 @@ | ||
package vtctlclient | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"testing" | ||
"time" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"vitess.io/vitess/go/vt/topo" | ||
"vitess.io/vitess/go/vt/topo/memorytopo" | ||
vschemapb "vitess.io/vitess/go/vt/proto/vschema" | ||
) | ||
|
||
func TestVSchemaAtomicOperations(t *testing.T) { | ||
ctx := context.Background() | ||
ts := memorytopo.NewServer("") | ||
client := newTestClient(ts) | ||
|
||
tests := []struct { | ||
name string | ||
setup func(t *testing.T) | ||
operation func(t *testing.T) error | ||
concurrent func(t *testing.T) | ||
wantErr bool | ||
errContains string | ||
}{ | ||
{ | ||
name: "successful_add_table", | ||
setup: func(t *testing.T) { | ||
// Initialize empty vschema | ||
initEmptyVSchema(t, ts, "test_keyspace") | ||
}, | ||
operation: func(t *testing.T) error { | ||
return client.VSchema().AddTable(ctx, "test_keyspace", "test_table", &vschemapb.Table{}) | ||
}, | ||
wantErr: false, | ||
}, | ||
{ | ||
name: "concurrent_modification", | ||
setup: func(t *testing.T) { | ||
initEmptyVSchema(t, ts, "test_keyspace") | ||
}, | ||
operation: func(t *testing.T) error { | ||
return client.VSchema().AddTable(ctx, "test_keyspace", "test_table", &vschemapb.Table{}) | ||
}, | ||
concurrent: func(t *testing.T) { | ||
// Simulate concurrent modification | ||
client2 := newTestClient(ts) | ||
err := client2.VSchema().AddTable(ctx, "test_keyspace", "other_table", &vschemapb.Table{}) | ||
require.NoError(t, err) | ||
}, | ||
wantErr: true, | ||
errContains: "version mismatch", | ||
}, | ||
{ | ||
name: "retry_success", | ||
setup: func(t *testing.T) { | ||
initEmptyVSchema(t, ts, "test_keyspace") | ||
}, | ||
operation: func(t *testing.T) error { | ||
return client.VSchema().AddTable(ctx, "test_keyspace", "test_table", &vschemapb.Table{}) | ||
}, | ||
concurrent: func(t *testing.T) { | ||
// Simulate temporary interference | ||
time.Sleep(10 * time.Millisecond) | ||
client2 := newTestClient(ts) | ||
err := client2.VSchema().AddTable(ctx, "test_keyspace", "other_table", &vschemapb.Table{}) | ||
require.NoError(t, err) | ||
}, | ||
wantErr: false, // Should succeed after retry | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
tt.setup(t) | ||
|
||
if tt.concurrent != nil { | ||
go tt.concurrent(t) | ||
} | ||
|
||
err := tt.operation(t) | ||
|
||
if tt.wantErr { | ||
require.Error(t, err) | ||
assert.Contains(t, err.Error(), tt.errContains) | ||
} else { | ||
require.NoError(t, err) | ||
// Verify final state | ||
vschema, err := ts.GetVSchema(ctx, "test_keyspace") | ||
require.NoError(t, err) | ||
assert.NotNil(t, vschema) | ||
} | ||
}) | ||
} | ||
} | ||
|
||
func TestVSchemaVersionConflicts(t *testing.T) { | ||
ctx := context.Background() | ||
ts := memorytopo.NewServer("") | ||
client := newTestClient(ts) | ||
|
||
// Test multiple concurrent modifications | ||
t.Run("multiple_concurrent_modifications", func(t *testing.T) { | ||
initEmptyVSchema(t, ts, "test_keyspace") | ||
|
||
// Launch multiple goroutines attempting modifications | ||
const numGoroutines = 5 | ||
errChan := make(chan error, numGoroutines) | ||
|
||
for i := 0; i < numGoroutines; i++ { | ||
go func(idx int) { | ||
err := client.VSchema().AddTable(ctx, "test_keyspace", | ||
fmt.Sprintf("table_%d", idx), &vschemapb.Table{}) | ||
errChan <- err | ||
}(i) | ||
} | ||
|
||
// Collect results | ||
successCount := 0 | ||
for i := 0; i < numGoroutines; i++ { | ||
err := <-errChan | ||
if err == nil { | ||
successCount++ | ||
} | ||
} | ||
|
||
// At least one should succeed, others should fail with version conflict | ||
assert.True(t, successCount >= 1) | ||
assert.True(t, successCount < numGoroutines) | ||
}) | ||
} | ||
|
||
func TestVSchemaErrorConditions(t *testing.T) { | ||
ctx := context.Background() | ||
ts := memorytopo.NewServer("") | ||
client := newTestClient(ts) | ||
|
||
tests := []struct { | ||
name string | ||
operation func() error | ||
errContains string | ||
}{ | ||
{ | ||
name: "invalid_keyspace", | ||
operation: func() error { | ||
return client.VSchema().AddTable(ctx, "", "table", &vschemapb.Table{}) | ||
}, | ||
errContains: "invalid keyspace", | ||
}, | ||
{ | ||
name: "invalid_table_name", | ||
operation: func() error { | ||
return client.VSchema().AddTable(ctx, "keyspace", "", &vschemapb.Table{}) | ||
}, | ||
errContains: "invalid table name", | ||
}, | ||
{ | ||
name: "nil_table_spec", | ||
operation: func() error { | ||
return client.VSchema().AddTable(ctx, "keyspace", "table", nil) | ||
}, | ||
errContains: "nil table spec", | ||
}, | ||
{ | ||
name: "keyspace_not_found", | ||
operation: func() error { | ||
return client.VSchema().AddTable(ctx, "nonexistent", "table", &vschemapb.Table{}) | ||
}, | ||
errContains: "keyspace not found", | ||
}, | ||
} | ||
|
||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
err := tt.operation() | ||
require.Error(t, err) | ||
assert.Contains(t, err.Error(), tt.errContains) | ||
}) | ||
} | ||
} | ||
|
||
// Helper functions | ||
|
||
func initEmptyVSchema(t *testing.T, ts *memorytopo.Server, keyspace string) { | ||
ctx := context.Background() | ||
err := ts.CreateKeyspace(ctx, keyspace, &vschemapb.Keyspace{}) | ||
require.NoError(t, err) | ||
} | ||
|
||
func newTestClient(ts *memorytopo.Server) VtctlClient { | ||
// Create a test client implementation | ||
return &testVtctlClient{ | ||
ts: ts, | ||
} | ||
} | ||
|
||
type testVtctlClient struct { | ||
ts *memorytopo.Server | ||
} | ||
|
||
// Implement VtctlClient interface methods... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package vtctlserver | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/your-project/vtctlservicepb" | ||
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Local example using etcd on Ubuntu
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Local example using zk2 on Ubuntu
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Local example using consul on Ubuntu
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / End-to-End Test (Race)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Region Sharding example using etcd on Ubuntu
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / End-to-End Test
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / VTop Example
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_queries)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_unsharded)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_gen4)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_copy_parallel)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (topo_connection_cache)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_godriver)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_multi_tenant)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_across_db_versions)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_concurrentdml)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_transaction)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (schemadiff_vrepl)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_topo)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtctlbackup_sharded_clustertest_heavy)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_etcd)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_foreignkey_stress)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_general_heavy)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (12)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtbackup)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_reservedconn)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_foreign_key_stress)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (13)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_cellalias)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_schema_tracker)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_revert)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (ers_prs_newfeatures_heavy)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (21)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vstream)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (mysql80)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_scheduler)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_partial_keyspace)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_mariadb_to_mysql)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (backup_pitr)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_partial_movetables_and_materialize)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Java Docker Test
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Java Docker Test
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_tablet_healthcheck_cache)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_plantests)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_readafterwrite)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (backup_pitr_mysqlshell)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtorc)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vttablet_prscomplex)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (backup_pitr_xtrabackup)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (15)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Docker Test Cluster
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Docker Test Cluster
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Docker Test Cluster
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (tabletmanager_throttler_topo)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (xb_recovery)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_vschema)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (mysql_server_vault)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (18)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_topo_consul)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (xb_backup)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Unit Test (evalengine_mysql57)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_v2)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Unit Test (mysql57)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_schema)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (tabletmanager_tablegc)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Unit Test (evalengine_mysql84)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (tabletmanager_consul)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Vitess Tester (vtgate)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Unit Test (evalengine_mysql80)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Unit Test (mysql80)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Unit Test (mysql84)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vtgate_vindex_heavy)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_basic)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Upgrade Downgrade Test - Backups - E2E
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Queries)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_suite)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_migrate)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Schema)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl_stress_suite)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (onlineddl_vrepl)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Code Coverage
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Upgrade Downgrade Test - Query Serving (Queries - 2)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Semi Sync Upgrade Downgrade Test
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run endtoend tests on Cluster (vreplication_vtctldclient_vdiff2_movetables_tz)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Unit Test (Race)
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Upgrade Downgrade Test - Backups - Manual
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Upgrade Downgrade Test - Online DDL flow
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Upgrade Downgrade Test - Reparent Old VTTablet
Check failure on line 6 in go/vt/vtctl/vtctlserver/server.go GitHub Actions / Run Upgrade Downgrade Test - Reparent Old Vtctl
|
||
) | ||
|
||
type VtctlServer struct { | ||
// Add any necessary fields here | ||
} | ||
|
||
func (s *VtctlServer) AddVSchemaTable(ctx context.Context, req *vtctlservicepb.AddVSchemaTableRequest) (*vtctlservicepb.AddVSchemaTableResponse, error) { | ||
// Implement server-side handling of atomic VSchema modifications | ||
return nil, nil // Placeholder return, actual implementation needed | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gRPCVSchemaOperations
struct