Skip to content
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

Coprocessor will get invalid collation ID from TiDB #29697

Closed
Defined2014 opened this issue Nov 11, 2021 · 3 comments · Fixed by #30320
Closed

Coprocessor will get invalid collation ID from TiDB #29697

Defined2014 opened this issue Nov 11, 2021 · 3 comments · Fixed by #30320
Labels
component/charset sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.

Comments

@Defined2014
Copy link
Contributor

Defined2014 commented Nov 11, 2021

When add a warning log at GetCharsetInfoByID(link), it will be flooded by logs. From the log, we could get the collation ID is 0, seems it not be set in TiDB (not sure about it, just guess).

The error log is below,
[2021/11/11 16:19:47.624 +08:00] [ERROR] [cop_handler.go:453] ["Unable to get collation name from ID, use default collation instead."] [ID=0] [stack="github.com/pingcap/tidb/store/mockstore/unistore/cophandler.fieldTypeFromPBColumn\n\t/Users/jasonmo/tidb/store/mockstore/unistore/cophandler/cop_handler.go:456\ngithub.com/pingcap/tidb/store/mockstore/unistore/cophandler.(*evalContext).setColumnInfo\n\t/Users/jasonmo/tidb/store/mockstore/unistore/cophandler/cop_handler.go:205\ngithub.com/pingcap/tidb/store/mockstore/unistore/cophandler.newClosureExecutor\n\t/Users/jasonmo/tidb/store/mockstore/unistore/cophandler/closure_exec.go:248\ngithub.com/pingcap/tidb/store/mockstore/unistore/cophandler.buildClosureExecutor\n\t/Users/jasonmo/tidb/store/mockstore/unistore/cophandler/closure_exec.go:170\ngithub.com/pingcap/tidb/store/mockstore/unistore/cophandler.handleCopDAGRequest\n\t/Users/jasonmo/tidb/store/mockstore/unistore/cophandler/cop_handler.go:118\ngithub.com/pingcap/tidb/store/mockstore/unistore/cophandler.HandleCopRequestWithMPPCtx\n\t/Users/jasonmo/tidb/store/mockstore/unistore/cophandler/cop_handler.go:71\ngithub.com/pingcap/tidb/store/mockstore/unistore/cophandler.HandleCopRequest\n\t/Users/jasonmo/tidb/store/mockstore/unistore/cophandler/cop_handler.go:59\ngithub.com/pingcap/tidb/store/mockstore/unistore/tikv.(*Server).Coprocessor\n\t/Users/jasonmo/tidb/store/mockstore/unistore/tikv/server.go:565\ngithub.com/pingcap/tidb/store/mockstore/unistore.(*RPCClient).SendRequest\n\t/Users/jasonmo/tidb/store/mockstore/unistore/rpc.go:236\ngithub.com/pingcap/tidb/store/mockstore.(*clientRedirector).SendRequest\n\t/Users/jasonmo/tidb/store/mockstore/redirector.go:61\ngithub.com/tikv/client-go/v2/internal/client.reqCollapse.SendRequest\n\t/Users/jasonmo/go/pkg/mod/github.com/tikv/client-go/[email protected]/internal/client/client_collapse.go:74\ngithub.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).sendReqToRegion\n\t/Users/jasonmo/go/pkg/mod/github.com/tikv/client-go/[email protected]/internal/locate/region_request.go:1128\ngithub.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).SendReqCtx\n\t/Users/jasonmo/go/pkg/mod/github.com/tikv/client-go/[email protected]/internal/locate/region_request.go:980\ngithub.com/tikv/client-go/v2/txnkv/txnsnapshot.(*ClientHelper).SendReqCtx\n\t/Users/jasonmo/go/pkg/mod/github.com/tikv/client-go/[email protected]/txnkv/txnsnapshot/client_helper.go:108\ngithub.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTaskOnce\n\t/Users/jasonmo/tidb/store/copr/coprocessor.go:731\ngithub.com/pingcap/tidb/store/copr.(*copIteratorWorker).handleTask\n\t/Users/jasonmo/tidb/store/copr/coprocessor.go:645\ngithub.com/pingcap/tidb/store/copr.(*copIteratorWorker).run\n\t/Users/jasonmo/tidb/store/copr/coprocessor.go:382"]

@Defined2014 Defined2014 added the type/bug The issue is confirmed as a bug. label Nov 11, 2021
@ChenPeng2013 ChenPeng2013 added the sig/execution SIG execution label Nov 12, 2021
@XuHuaiyu XuHuaiyu added sig/sql-infra SIG: SQL Infra and removed sig/execution SIG execution labels Dec 1, 2021
@bb7133
Copy link
Member

bb7133 commented Dec 1, 2021

This is kind of expected: before introducing the new collation framework, collation id is meaningless for TiDB(there is only 1 collation for each charset). So for a lot of codes, the collation ID may be missing.

We probably need to fix it eventually with the code refactoring/testing enhancements.

@bb7133
Copy link
Member

bb7133 commented Dec 1, 2021

/cc @wjhuang2016

@bb7133 bb7133 added type/enhancement The issue or PR belongs to an enhancement. component/charset and removed type/bug The issue is confirmed as a bug. labels Dec 1, 2021
@wjhuang2016
Copy link
Member

// NewExtraHandleColInfo mocks a column info for extra handle column.
func NewExtraHandleColInfo() *ColumnInfo {
	colInfo := &ColumnInfo{
		ID:   ExtraHandleID,
		Name: ExtraHandleName,
	}
	colInfo.Flag = mysql.PriKeyFlag | mysql.NotNullFlag
	colInfo.Tp = mysql.TypeLonglong
	colInfo.Flen, colInfo.Decimal = mysql.GetDefaultFieldLengthAndDecimal(mysql.TypeLonglong)
	return colInfo
}

We doesn't set charset and collation for _tidb_rowid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/charset sig/sql-infra SIG: SQL Infra type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants