From fbd7ebf573105575fd476cd6799ba81bbc4efb40 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 10 Jan 2023 11:30:15 +0800 Subject: [PATCH] sink(ticdc): remove test --- cdc/sinkv2/eventsink/txn/mysql/mysql_test.go | 236 ------------------- 1 file changed, 236 deletions(-) diff --git a/cdc/sinkv2/eventsink/txn/mysql/mysql_test.go b/cdc/sinkv2/eventsink/txn/mysql/mysql_test.go index b16ea5b02f3..d8ab951c99a 100644 --- a/cdc/sinkv2/eventsink/txn/mysql/mysql_test.go +++ b/cdc/sinkv2/eventsink/txn/mysql/mysql_test.go @@ -1445,239 +1445,3 @@ func TestPrepareBatchDMLs(t *testing.T) { require.Equal(t, tc.expected, dmls) } } - -func TestGroupRowsByType(t *testing.T) { - ctx := context.Background() - ms := newMySQLBackendWithoutDB(ctx) - testCases := []struct { - name string - input []*model.RowChangedEvent - maxTxnRow int - }{ - { - name: "delete", - input: []*model.RowChangedEvent{ - { - StartTs: 418658114257813514, - CommitTs: 418658114257813515, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - PreColumns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.UniqueKeyFlag, - Value: 1, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.UniqueKeyFlag, - Value: 1, - }}, - IndexColumns: [][]int{{1, 2}}, - }, - { - StartTs: 418658114257813514, - CommitTs: 418658114257813515, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - PreColumns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.UniqueKeyFlag, - Value: 2, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.UniqueKeyFlag, - Value: 2, - }}, - IndexColumns: [][]int{{1, 2}}, - }, - { - StartTs: 418658114257813514, - CommitTs: 418658114257813515, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - PreColumns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.UniqueKeyFlag, - Value: 2, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.UniqueKeyFlag, - Value: 2, - }}, - IndexColumns: [][]int{{1, 2}}, - }, - { - StartTs: 418658114257813514, - CommitTs: 418658114257813515, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - PreColumns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.UniqueKeyFlag, - Value: 2, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.UniqueKeyFlag, - Value: 2, - }}, - IndexColumns: [][]int{{1, 2}}, - }, - }, - maxTxnRow: 2, - }, - { - name: "insert", - input: []*model.RowChangedEvent{ - { - StartTs: 418658114257813516, - CommitTs: 418658114257813517, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - Columns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | model.HandleKeyFlag, - Value: 1, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | model.HandleKeyFlag, - Value: 1, - }}, - IndexColumns: [][]int{{1, 1}}, - }, - { - StartTs: 418658114257813516, - CommitTs: 418658114257813517, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - Columns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }}, - IndexColumns: [][]int{{2, 2}}, - }, - { - StartTs: 418658114257813516, - CommitTs: 418658114257813517, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - Columns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }}, - IndexColumns: [][]int{{2, 2}}, - }, - { - StartTs: 418658114257813516, - CommitTs: 418658114257813517, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - Columns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }}, - IndexColumns: [][]int{{2, 2}}, - }, - - { - StartTs: 418658114257813516, - CommitTs: 418658114257813517, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - Columns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }}, - IndexColumns: [][]int{{2, 2}}, - }, - - { - StartTs: 418658114257813516, - CommitTs: 418658114257813517, - Table: &model.TableName{Schema: "common_1", Table: "uk_without_pk"}, - Columns: []*model.Column{nil, { - Name: "a1", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }, { - Name: "a3", - Type: mysql.TypeLong, - Flag: model.BinaryFlag | model.MultipleKeyFlag | - model.HandleKeyFlag | model.HandleKeyFlag, - Value: 2, - }}, - IndexColumns: [][]int{{2, 2}}, - }, - }, - maxTxnRow: 4, - }, - } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - event := &eventsink.TxnCallbackableEvent{ - Event: &model.SingleTableTxn{Rows: testCases[0].input}, - } - colums := tc.input[0].Columns - if len(colums) == 0 { - colums = tc.input[0].PreColumns - } - tableInfo := model.BuildTiDBTableInfo(colums, tc.input[0].IndexColumns) - ms.cfg.MaxTxnRow = tc.maxTxnRow - inserts, updates, deletes := ms.groupRowsByType(event, tableInfo, false) - for _, rows := range inserts { - require.LessOrEqual(t, len(rows), tc.maxTxnRow) - } - for _, rows := range updates { - require.LessOrEqual(t, len(rows), tc.maxTxnRow) - } - for _, rows := range deletes { - require.LessOrEqual(t, len(rows), tc.maxTxnRow) - } - }) - } -}