错误码

MatrixOne 向 SQL 客户端返回数字错误编号和五字符 SQLSTATE,同时使用内部错误标识对故障分类。这些值用途不同,不能混为一谈。

实际使用中,应结合客户端可见的错误编号、SQLSTATE、错误消息和失败语句判断问题。MatrixOne 的错误编号不保证与 MySQL 一致,也不保证不同版本的同一语句总是返回相同编号。

备注

SQL 标准定义了 SQLSTATE 类别;同一条语句的 MatrixOne 数字错误编号可能与 MySQL 不同。

MySQL 客户端错误编号对照

下表来自 MatrixOne issue #30470 对 MatrixOne v4.2.5 和 MySQL 8.0.46 的 25 个场景实测。表中是 MySQL 客户端显示为 ERROR NNNN 的数字,不是本页下方的 MatrixOne 内部错误标识。将编号用于重试、幂等或告警逻辑前,请在目标构建和查询路径上复核。

场景

MatrixOne

MySQL

唯一键冲突

1062

1062

主键冲突

1062

1062

列数据超长

1406

1406

表已存在

1050

1050

索引名重复

1061

1061

数据库不存在

1049

1049

SQL 语法错误

1064

1064

INSERT 中表不存在

1146

1146

SELECT 中表不存在

1064

1146

SELECT 列表中列不存在

20301

1054

WHERE 中列不存在

20301

1054

列名重复

3819

1060

向 NOT NULL 列插入 NULL

3819

1048

函数不存在

20105

1305

非法整数字符串

20203

1366

非法日期值

20203

1292

函数参数个数错误

20203

1582

整数越界

1690

1264

外键:插入孤儿行

20101

1452

外键:删除被引用的父行

20101

1451

系统变量不存在

20101

1193

表别名冲突

20301

1066

ORDER BY 引用了不存在的列

20301

1054

DROP TABLE 中表不存在

1146

1051

创建外键时引用的表不存在

1146

1824

有些 MatrixOne 编号对应多个 MySQL 错误。下表的文案片段仅供诊断,不是稳定或完整的匹配接口。不同版本或查询路径的文案可能变化,同一片段也可能出现在多个场景;还需结合失败语句、对象及约束元数据判断:

MatrixOne 编号

可查看的文案片段示例

还需核对的语句上下文

1064

syntax 提示语法错误;table 与 does not exist 同时出现提示表不存在。

判断失败语句是否为 SELECT,并核对所引用的表。

1146

table 与 does not exist 表示对象不存在,但不能区分下列场景。

根据操作及引用对象区分 INSERT、DROP TABLE 和创建外键的 CREATE TABLE。

20301

column 与 does not exist 提示列无法解析;表别名或 ORDER BY 错误可能使用其他文案。

判断无效名称是列引用、重复表别名还是 ORDER BY 引用。

20101

foreign key constraint 提示约束失败;the system variable does not exist 提示系统变量不存在。

外键错误还要区分子表 INSERT 与父表 DELETE,并检查约束。

应用应在目标版本复现实语句,并结合操作类型、约束元数据和错误编号判断。上表中编号不一致的场景不保证与 MySQL 错误编号兼容;不能仅凭文案片段决定重试、幂等或告警策略。

MatrixOne 内部错误标识

下方表格分类的是 MatrixOne 内部错误标识;即使数字与客户端 ERROR NNNN 相同,也不一定表示同一种错误。

错误编码开头

类型

201

内部错误

202

数字与函数错误

203

无效操作

204

未知错误或 IO 错误

205

RPC 超时

206

事务错误或存储引擎错误

207

锁错误

详细错误码对应的错误信息及错误详情请参见下表:

错误码

错误信息

错误详情

错误分类

20100

ErrStart

internal error code start

内部错误

20101

ErrInternal

Internal error

内部错误

20103

ErrNYI

not yet implemented

内部错误

20104

ErrOOM

out of memory

内部错误

20105

ErrQueryInterrupted

query interrupted

内部错误

20106

ErrNotSupported

not supported

内部错误

20200

ErrDivByZero

division by zero

数字与函数

20201

ErrOutOfRange

data out of range

数字与函数

20202

ErrDataTruncated

data truncated

数字与函数

20203

ErrInvalidArg

invalid argument

数字与函数

20204

ErrTruncatedWrongValueForField

truncated wrong value for column

数字与函数

20300

ErrBadConfig

invalid configuration

无效操作

20301

ErrInvalidInput

invalid input

无效操作

20302

ErrSyntaxError

SQL syntax error

无效操作

20303

ErrParseError

SQL parser error

无效操作

20304

ErrConstraintViolation

constraint violation

无效操作

20305

ErrDuplicate

tae data duplicated

无效操作

20306

ErrRoleGrantedToSelf

cannot grant role

无效操作

20307

ErrDuplicateEntry

duplicate entry for key

无效操作

20400

ErrInvalidState

invalid state

未知状态或 I/O 错误

20401

ErrLogServiceNotReady

log service not ready

未知状态或 I/O 错误

20402

ErrBadDB

invalid database

未知状态或 I/O 错误

20403

ErrNoSuchTable

no such table

未知状态或 I/O 错误

20404

ErrEmptyVector

empty vector

未知状态或 I/O 错误

20405

ErrFileNotFound

file is not found

未知状态或 I/O 错误

20406

ErrFileAlreadyExists

file alread exists

未知状态或 I/O 错误

20407

ErrUnexpectedEOF

unexpteded end of file

未知状态或 I/O 错误

20408

ErrEmptyRange

empty range of file

未知状态或 I/O 错误

20409

ErrSizeNotMatch

file size does not match

未知状态或 I/O 错误

20410

ErrNoProgress

file has no io progress

未知状态或 I/O 错误

20411

ErrInvalidPath

invalid file path

未知状态或 I/O 错误

20412

ErrShortWrite

file io short write

未知状态或 I/O 错误

20413

ErrInvalidWrite

file io invalid write

未知状态或 I/O 错误

20414

ErrShortBuffer

file io short buffer

未知状态或 I/O 错误

20415

ErrNoDB

not connect to a database

未知状态或 I/O 错误

20416

ErrNoWorkingStore

no working store

未知状态或 I/O 错误

20417

ErrNoHAKeeper

cannot locate ha keeper

未知状态或 I/O 错误

20418

ErrInvalidTruncateLsn

invalid truncate lsn, shard already truncated

未知状态或 I/O 错误

20419

ErrNotLeaseHolder

not lease holder, current lease holder ID xxx

未知状态或 I/O 错误

20420

ErrDBAlreadyExists

database already exists

未知状态或 I/O 错误

20421

ErrTableAlreadyExists

table already exists

未知状态或 I/O 错误

20422

ErrNoService

service not found

未知状态或 I/O 错误

20423

ErrDupServiceName

duplicate service name

未知状态或 I/O 错误

20424

ErrWrongService

wrong service, expecting A, got B

未知状态或 I/O 错误

20425

ErrBadS3Config

bad s3 config

未知状态或 I/O 错误

20426

ErrBadView

invalid view

未知状态或 I/O 错误

20427

ErrInvalidTask

invalid task

未知状态或 I/O 错误

20428

ErrInvalidServiceIndex

invalid service idx

未知状态或 I/O 错误

20429

ErrDragonboatTimeout

Dragonboat timeout

未知状态或 I/O 错误

20430

ErrDragonboatTimeoutTooSmall

Dragonboat timeout too small

未知状态或 I/O 错误

20431

ErrDragonboatInvalidDeadline

Dragonboat invalid deadline

未知状态或 I/O 错误

20432

ErrDragonboatRejected

Dragonboat rejected

未知状态或 I/O 错误

20433

ErrDragonboatInvalidPayloadSize

invalid payload size

未知状态或 I/O 错误

20434

ErrDragonboatShardNotReady

shard not ready

未知状态或 I/O 错误

20435

ErrDragonboatSystemClosed

Dragonboat system closed

未知状态或 I/O 错误

20436

ErrDragonboatInvalidRange

Dragonboat invalid range

未知状态或 I/O 错误

20437

ErrDragonboatShardNotFound

shard not found

未知状态或 I/O 错误

20438

ErrDragonboatOtherSystemError

other system error

未知状态或 I/O 错误

20439

ErrDropNonExistsDB

Can’t drop database ; database doesn’t exist

未知状态或 I/O 错误

20500

ErrRPCTimeout

rpc timeout

RPC 超时

20501

ErrClientClosed

client closed

RPC 超时

20502

ErrBackendClosed

backend closed

RPC 超时

20503

ErrStreamClosed

stream closed

RPC 超时

20504

ErrNoAvailableBackend

no available backend

RPC 超时

20600

ErrTxnClosed

the transaction has been committed or aborted

事务

20601

ErrTxnWriteConflict

transaction write conflict

事务

20602

ErrMissingTxn

missing transaction

事务

20603

ErrUnresolvedConflict

unresolved conflict

事务

20604

ErrTxnError

transaction error

事务

20605

ErrDNShardNotFound

TN shard not found

事务

20606

ErrShardNotReported

TN shard not reported

事务

20607

ErrTAEError

tae error

TAE 错误

20608

ErrTAERead

tae read error

TAE 错误

20609

ErrRpcError

rpc error

TAE 错误

20610

ErrWaitTxn

transaction wait error

TAE 错误

20611

ErrTxnNotFound

transaction not found

TAE 错误

20612

ErrTxnNotActive

transaction not active

TAE 错误

20613

ErrTAEWrite

tae write error

TAE 错误

20614

ErrTAECommit

tae commit error

TAE 错误

20615

ErrTAERollback

tae rollback error

TAE 错误

20616

ErrTAEPrepare

tae prepare error

TAE 错误

20617

ErrTAEPossibleDuplicate

tae possible duplicate

TAE 错误

20618

ErrTxnRWConflict

r-w conflict

TAE 错误

20619

ErrTxnWWConflict

w-w conflict

TAE 错误

20620

ErrNotFound

transaction not found

TAE 错误

20621

ErrTxnInternal

transaction internal error

TAE 错误

20622

ErrTxnReadConflict

transaction read conflict

TAE 错误

20623

ErrPrimaryKeyDuplicated

duplicated primary key

TAE 错误

20624

ErrAppendableSegmentNotFound

appendable segment not found

TAE 错误

20625

ErrAppendableBlockNotFound

appendable block not found

TAE 错误

20626

ErrTAEDebug

TAE debug

TAE 错误

20709

ErrRemoteLockWaitTimeout

remote lock wait timeout

锁错误