diff --git a/go/test/endtoend/vtgate/unsharded/main_test.go b/go/test/endtoend/vtgate/unsharded/main_test.go index 1df39b3f3ec..0887e2e4263 100644 --- a/go/test/endtoend/vtgate/unsharded/main_test.go +++ b/go/test/endtoend/vtgate/unsharded/main_test.go @@ -166,7 +166,7 @@ func TestMain(m *testing.M) { SchemaSQL: SchemaSQL, VSchema: VSchema, } - clusterInstance.VtTabletExtraArgs = []string{"-queryserver-config-transaction-timeout", "3"} + clusterInstance.VtTabletExtraArgs = []string{"-queryserver-config-transaction-timeout", "3", "-queryserver-config-max-result-size", "30"} if err := clusterInstance.StartUnshardedKeyspace(*Keyspace, 0, false); err != nil { log.Fatal(err.Error()) return 1 @@ -463,6 +463,22 @@ func TestFloatValueDefault(t *testing.T) { assertMatches(t, conn, "select table_name, column_name, column_default from information_schema.columns where table_name = 'test_float_default'", `[[VARCHAR("test_float_default") VARCHAR("pos_f") TEXT("2.1")] [VARCHAR("test_float_default") VARCHAR("neg_f") TEXT("-2.1")]]`) } +// TestRowCountExceeded tests the error message received when a query exceeds the row count specified +func TestRowCountExceeded(t *testing.T) { + vtParams := mysql.ConnParams{ + Host: "localhost", + Port: clusterInstance.VtgateMySQLPort, + } + conn, err := mysql.Connect(context.Background(), &vtParams) + require.NoError(t, err) + defer conn.Close() + + defer exec(t, conn, `delete from t1`) + execMulti(t, conn, `insert into t1(c1, c2, c3, c4) values (300,100,300,'abc'), (301,101,301,'abcd'), (1,1,1,'a'), (31,11,31,'ad');`) + + execAssertError(t, conn, "select * from t1, t1 t2, t1 t3", `Aborted desc = Row count exceeded 30 (errno 10001) (sqlstate HY000)`) +} + func exec(t *testing.T, conn *mysql.Conn, query string) *sqltypes.Result { t.Helper() qr, err := conn.ExecuteFetch(query, 1000, true) diff --git a/go/vt/vttablet/tabletserver/tabletserver.go b/go/vt/vttablet/tabletserver/tabletserver.go index 97457fd0550..66aae73d0e3 100644 --- a/go/vt/vttablet/tabletserver/tabletserver.go +++ b/go/vt/vttablet/tabletserver/tabletserver.go @@ -1548,7 +1548,7 @@ func convertErrorCode(err error) vtrpcpb.Code { case mysql.ERNotSupportedYet: errCode = vtrpcpb.Code_UNIMPLEMENTED case mysql.ERDiskFull, mysql.EROutOfMemory, mysql.EROutOfSortMemory, mysql.ERConCount, mysql.EROutOfResources, mysql.ERRecordFileFull, mysql.ERHostIsBlocked, - mysql.ERCantCreateThread, mysql.ERTooManyDelayedThreads, mysql.ERNetPacketTooLarge, mysql.ERTooManyUserConnections, mysql.ERLockTableFull, mysql.ERUserLimitReached, mysql.ERVitessMaxRowsExceeded: + mysql.ERCantCreateThread, mysql.ERTooManyDelayedThreads, mysql.ERNetPacketTooLarge, mysql.ERTooManyUserConnections, mysql.ERLockTableFull, mysql.ERUserLimitReached: errCode = vtrpcpb.Code_RESOURCE_EXHAUSTED case mysql.ERLockWaitTimeout: errCode = vtrpcpb.Code_DEADLINE_EXCEEDED @@ -1569,7 +1569,7 @@ func convertErrorCode(err error) vtrpcpb.Code { errCode = vtrpcpb.Code_CLUSTER_EVENT case mysql.ERTableExists, mysql.ERDupEntry, mysql.ERFileExists, mysql.ERUDFExists: errCode = vtrpcpb.Code_ALREADY_EXISTS - case mysql.ERGotSignal, mysql.ERForcingClose, mysql.ERAbortingConnection, mysql.ERLockDeadlock: + case mysql.ERGotSignal, mysql.ERForcingClose, mysql.ERAbortingConnection, mysql.ERLockDeadlock, mysql.ERVitessMaxRowsExceeded: // For ERLockDeadlock, a deadlock rolls back the transaction. errCode = vtrpcpb.Code_ABORTED case mysql.ERUnknownComError, mysql.ERBadNullError, mysql.ERBadDb, mysql.ERBadTable, mysql.ERNonUniq, mysql.ERWrongFieldWithGroup, mysql.ERWrongGroupField,