github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/pkg/errors/cdc_errors.go (about) 1 // Copyright 2020 PingCAP, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package errors 15 16 import ( 17 "fmt" 18 19 "github.com/pingcap/errors" 20 ) 21 22 // errors 23 var ( 24 // kv related errors 25 ErrChangeFeedNotExists = errors.Normalize( 26 "changefeed not exists, %s", 27 errors.RFCCodeText("CDC:ErrChangeFeedNotExists"), 28 ) 29 ErrChangeFeedAlreadyExists = errors.Normalize( 30 "changefeed already exists, %s", 31 errors.RFCCodeText("CDC:ErrChangeFeedAlreadyExists"), 32 ) 33 ErrChangeFeedDeletionUnfinished = errors.Normalize( 34 "changefeed exists after deletion, %s", 35 errors.RFCCodeText("CDC:ErrChangeFeedDeletionUnfinished"), 36 ) 37 ErrCaptureNotExist = errors.Normalize( 38 "capture not exists, %s", 39 errors.RFCCodeText("CDC:ErrCaptureNotExist"), 40 ) 41 ErrSchedulerRequestFailed = errors.Normalize( 42 "scheduler request failed, %s", 43 errors.RFCCodeText("CDC:ErrSchedulerRequestFailed"), 44 ) 45 ErrGetAllStoresFailed = errors.Normalize( 46 "get stores from pd failed", 47 errors.RFCCodeText("CDC:ErrGetAllStoresFailed"), 48 ) 49 ErrMetaListDatabases = errors.Normalize( 50 "meta store list databases", 51 errors.RFCCodeText("CDC:ErrMetaListDatabases"), 52 ) 53 ErrDDLSchemaNotFound = errors.Normalize( 54 "cannot find mysql.tidb_ddl_job schema", 55 errors.RFCCodeText("CDC:ErrDDLSchemaNotFound"), 56 ) 57 ErrGRPCDialFailed = errors.Normalize( 58 "grpc dial failed", 59 errors.RFCCodeText("CDC:ErrGRPCDialFailed"), 60 ) 61 ErrTiKVEventFeed = errors.Normalize( 62 "tikv event feed failed", 63 errors.RFCCodeText("CDC:ErrTiKVEventFeed"), 64 ) 65 ErrPDBatchLoadRegions = errors.Normalize( 66 "pd batch load regions failed", 67 errors.RFCCodeText("CDC:ErrPDBatchLoadRegions"), 68 ) 69 ErrMetaNotInRegion = errors.Normalize( 70 "meta not exists in region", 71 errors.RFCCodeText("CDC:ErrMetaNotInRegion"), 72 ) 73 ErrRegionsNotCoverSpan = errors.Normalize( 74 "regions not completely left cover span, span %v regions: %v", 75 errors.RFCCodeText("CDC:ErrRegionsNotCoverSpan"), 76 ) 77 ErrGetTiKVRPCContext = errors.Normalize( 78 "get tikv grpc context failed", 79 errors.RFCCodeText("CDC:ErrGetTiKVRPCContext"), 80 ) 81 ErrPendingRegionCancel = errors.Normalize( 82 "pending region cancelled due to stream disconnecting", 83 errors.RFCCodeText("CDC:ErrPendingRegionCancel"), 84 ) 85 ErrEventFeedAborted = errors.Normalize( 86 "single event feed aborted", 87 errors.RFCCodeText("CDC:ErrEventFeedAborted"), 88 ) 89 ErrUnknownKVEventType = errors.Normalize( 90 "unknown kv optype: %s, entry: %v", 91 errors.RFCCodeText("CDC:ErrUnknownKVEventType"), 92 ) 93 ErrPrewriteNotMatch = errors.Normalize( 94 "prewrite not match, key: %s, start-ts: %d, commit-ts: %d, type: %s, optype: %s", 95 errors.RFCCodeText("CDC:ErrPrewriteNotMatch"), 96 ) 97 ErrEventFeedEventError = errors.Normalize( 98 "eventfeed returns event error", 99 errors.RFCCodeText("CDC:ErrEventFeedEventError"), 100 ) 101 ErrPDEtcdAPIError = errors.Normalize( 102 "etcd api call error", 103 errors.RFCCodeText("CDC:ErrPDEtcdAPIError"), 104 ) 105 ErrNewStore = errors.Normalize( 106 "new store failed", 107 errors.RFCCodeText("CDC:ErrNewStore"), 108 ) 109 ErrRegionWorkerExit = errors.Normalize( 110 "region worker exited", 111 errors.RFCCodeText("CDC:ErrRegionWorkerExit"), 112 ) 113 114 // codec related errors 115 ErrEncodeFailed = errors.Normalize( 116 "encode failed", 117 errors.RFCCodeText("CDC:ErrEncodeFailed"), 118 ) 119 ErrDecodeFailed = errors.Normalize( 120 "decode failed: %s", 121 errors.RFCCodeText("CDC:ErrDecodeFailed"), 122 ) 123 ErrFilterRuleInvalid = errors.Normalize( 124 "filter rule is invalid %v", 125 errors.RFCCodeText("CDC:ErrFilterRuleInvalid"), 126 ) 127 128 ErrDispatcherFailed = errors.Normalize( 129 "dispatcher failed", 130 errors.RFCCodeText("CDC:ErrDispatcherFailed"), 131 ) 132 133 ErrColumnSelectorFailed = errors.Normalize( 134 "column selector failed", 135 errors.RFCCodeText("CDC:ErrColumnSelectorFailed"), 136 ) 137 138 // internal errors 139 ErrAdminStopProcessor = errors.Normalize( 140 "stop processor by admin command", 141 errors.RFCCodeText("CDC:ErrAdminStopProcessor"), 142 ) 143 // ErrVersionIncompatible is an error for running CDC on an incompatible Cluster. 144 ErrVersionIncompatible = errors.Normalize( 145 "version is incompatible: %s", 146 errors.RFCCodeText("CDC:ErrVersionIncompatible"), 147 ) 148 ErrClusterIDMismatch = errors.Normalize( 149 "cluster ID mismatch, tikv cluster ID is %d and request cluster ID is %d", 150 errors.RFCCodeText("CDC:ErrClusterIDMismatch"), 151 ) 152 ErrMultipleCDCClustersExist = errors.Normalize( 153 "multiple TiCDC clusters exist while using --pd", 154 errors.RFCCodeText("CDC:ErrMultipleCDCClustersExist"), 155 ) 156 157 // sink related errors 158 ErrExecDDLFailed = errors.Normalize( 159 "exec DDL failed", 160 errors.RFCCodeText("CDC:ErrExecDDLFailed"), 161 ) 162 ErrKafkaSendMessage = errors.Normalize( 163 "kafka send message failed", 164 errors.RFCCodeText("CDC:ErrKafkaSendMessage"), 165 ) 166 ErrKafkaProducerClosed = errors.Normalize( 167 "kafka producer closed", 168 errors.RFCCodeText("CDC:ErrKafkaProducerClosed"), 169 ) 170 ErrKafkaAsyncSendMessage = errors.Normalize( 171 "kafka async send message failed", 172 errors.RFCCodeText("CDC:ErrKafkaAsyncSendMessage"), 173 ) 174 ErrKafkaInvalidPartitionNum = errors.Normalize( 175 "invalid partition num %d", 176 errors.RFCCodeText("CDC:ErrKafkaInvalidPartitionNum"), 177 ) 178 ErrKafkaInvalidRequiredAcks = errors.Normalize( 179 "invalid required acks %d, "+ 180 "only support these values: 0(NoResponse),1(WaitForLocal) and -1(WaitForAll)", 181 errors.RFCCodeText("CDC:ErrKafkaInvalidRequiredAcks"), 182 ) 183 ErrKafkaNewProducer = errors.Normalize( 184 "new kafka producer", 185 errors.RFCCodeText("CDC:ErrKafkaNewProducer"), 186 ) 187 ErrKafkaInvalidClientID = errors.Normalize( 188 "invalid kafka client ID '%s'", 189 errors.RFCCodeText("CDC:ErrKafkaInvalidClientID"), 190 ) 191 ErrKafkaInvalidVersion = errors.Normalize( 192 "invalid kafka version", 193 errors.RFCCodeText("CDC:ErrKafkaInvalidVersion"), 194 ) 195 ErrKafkaInvalidConfig = errors.Normalize( 196 "kafka config invalid", 197 errors.RFCCodeText("CDC:ErrKafkaInvalidConfig"), 198 ) 199 ErrKafkaCreateTopic = errors.Normalize( 200 "kafka create topic failed", 201 errors.RFCCodeText("CDC:ErrKafkaCreateTopic"), 202 ) 203 ErrKafkaInvalidTopicExpression = errors.Normalize( 204 "invalid topic expression", 205 errors.RFCCodeText("CDC:ErrKafkaTopicExprInvalid"), 206 ) 207 ErrKafkaConfigNotFound = errors.Normalize( 208 "kafka config item not found", 209 errors.RFCCodeText("CDC:ErrKafkaConfigNotFound"), 210 ) 211 // for pulsar 212 ErrPulsarSendMessage = errors.Normalize( 213 "pulsar send message failed", 214 errors.RFCCodeText("CDC:ErrPulsarSendMessage"), 215 ) 216 ErrPulsarProducerClosed = errors.Normalize( 217 "pulsar producer closed", 218 errors.RFCCodeText("CDC:ErrPulsarProducerClosed"), 219 ) 220 ErrPulsarAsyncSendMessage = errors.Normalize( 221 "pulsar async send message failed", 222 errors.RFCCodeText("CDC:ErrPulsarAsyncSendMessage"), 223 ) 224 ErrPulsarFlushUnfinished = errors.Normalize( 225 "flush not finished before producer close", 226 errors.RFCCodeText("CDC:ErrPulsarFlushUnfinished"), 227 ) 228 ErrPulsarInvalidPartitionNum = errors.Normalize( 229 "invalid partition num %d", 230 errors.RFCCodeText("CDC:ErrPulsarInvalidPartitionNum"), 231 ) 232 ErrPulsarNewClient = errors.Normalize( 233 "new pulsar client", 234 errors.RFCCodeText("CDC:ErrPulsarNewClient"), 235 ) 236 ErrPulsarNewProducer = errors.Normalize( 237 "new pulsar producer", 238 errors.RFCCodeText("CDC:ErrPulsarNewProducer"), 239 ) 240 ErrPulsarInvalidClientID = errors.Normalize( 241 "invalid pulsar client ID '%s'", 242 errors.RFCCodeText("CDC:ErrPulsarInvalidClientID"), 243 ) 244 ErrPulsarInvalidVersion = errors.Normalize( 245 "invalid pulsar version", 246 errors.RFCCodeText("CDC:ErrPulsarInvalidVersion"), 247 ) 248 ErrPulsarInvalidConfig = errors.Normalize( 249 "pulsar config invalid %s", 250 errors.RFCCodeText("CDC:ErrPulsarInvalidConfig"), 251 ) 252 ErrPulsarCreateTopic = errors.Normalize( 253 "pulsar create topic failed", 254 errors.RFCCodeText("CDC:ErrPulsarCreateTopic"), 255 ) 256 ErrPulsarInvalidTopicExpression = errors.Normalize( 257 "invalid topic expression", 258 errors.RFCCodeText("CDC:ErrPulsarTopicExprInvalid"), 259 ) 260 ErrPulsarBrokerConfigNotFound = errors.Normalize( 261 "pulsar broker config item not found", 262 errors.RFCCodeText("CDC:ErrPulsarBrokerConfigNotFound"), 263 ) 264 ErrPulsarTopicNotExists = errors.Normalize("pulsar topic not exists after creation", 265 errors.RFCCodeText("CDC:ErrPulsarTopicNotExists"), 266 ) 267 268 ErrRedoConfigInvalid = errors.Normalize( 269 "redo log config invalid", 270 errors.RFCCodeText("CDC:ErrRedoConfigInvalid"), 271 ) 272 ErrRedoDownloadFailed = errors.Normalize( 273 "redo log down load to local failed", 274 errors.RFCCodeText("CDC:ErrRedoDownloadFailed"), 275 ) 276 ErrRedoWriterStopped = errors.Normalize( 277 "redo log writer stopped", 278 errors.RFCCodeText("CDC:ErrRedoWriterStopped"), 279 ) 280 ErrRedoFileOp = errors.Normalize( 281 "redo file operation", 282 errors.RFCCodeText("CDC:ErrRedoFileOp"), 283 ) 284 ErrRedoMetaFileNotFound = errors.Normalize( 285 "no redo meta file found in dir: %s", 286 errors.RFCCodeText("CDC:ErrRedoMetaFileNotFound"), 287 ) 288 ErrRedoMetaInitialize = errors.Normalize( 289 "initialize meta for redo log", 290 errors.RFCCodeText("CDC:ErrRedoMetaInitialize"), 291 ) 292 ErrFileSizeExceed = errors.Normalize( 293 "rawData size %d exceeds maximum file size %d", 294 errors.RFCCodeText("CDC:ErrFileSizeExceed"), 295 ) 296 ErrExternalStorageAPI = errors.Normalize( 297 "external storage api", 298 errors.RFCCodeText("CDC:ErrS3StorageAPI"), 299 ) 300 ErrStorageInitialize = errors.Normalize( 301 "fail to open storage for redo log", 302 errors.RFCCodeText("CDC:ErrStorageInitialize"), 303 ) 304 ErrCodecInvalidConfig = errors.Normalize( 305 "Codec invalid config", 306 errors.RFCCodeText("CDC:ErrCodecInvalidConfig"), 307 ) 308 309 ErrCompressionFailed = errors.Normalize( 310 "Compression failed", 311 errors.RFCCodeText("CDC:ErrCompressionFailed"), 312 ) 313 314 ErrSinkURIInvalid = errors.Normalize( 315 "sink uri invalid '%s'", 316 errors.RFCCodeText("CDC:ErrSinkURIInvalid"), 317 ) 318 ErrIncompatibleSinkConfig = errors.Normalize( 319 "incompatible configuration in sink uri(%s) and config file(%s), "+ 320 "please try to update the configuration only through sink uri", 321 errors.RFCCodeText("CDC:ErrIncompatibleSinkConfig"), 322 ) 323 ErrSinkUnknownProtocol = errors.Normalize( 324 "unknown '%s' message protocol for sink", 325 errors.RFCCodeText("CDC:ErrSinkUnknownProtocol"), 326 ) 327 ErrMySQLTxnError = errors.Normalize( 328 "MySQL txn error", 329 errors.RFCCodeText("CDC:ErrMySQLTxnError"), 330 ) 331 ErrMySQLDuplicateEntry = errors.Normalize( 332 "MySQL duplicate entry error", 333 errors.RFCCodeText("CDC:ErrMySQLDuplicateEntry"), 334 ) 335 ErrMySQLQueryError = errors.Normalize( 336 "MySQL query error", 337 errors.RFCCodeText("CDC:ErrMySQLQueryError"), 338 ) 339 ErrMySQLConnectionError = errors.Normalize( 340 "MySQL connection error", 341 errors.RFCCodeText("CDC:ErrMySQLConnectionError"), 342 ) 343 ErrMySQLInvalidConfig = errors.Normalize( 344 "MySQL config invalid", 345 errors.RFCCodeText("CDC:ErrMySQLInvalidConfig"), 346 ) 347 ErrMySQLWorkerPanic = errors.Normalize( 348 "MySQL worker panic", 349 errors.RFCCodeText("CDC:ErrMySQLWorkerPanic"), 350 ) 351 ErrAvroToEnvelopeError = errors.Normalize( 352 "to envelope failed", 353 errors.RFCCodeText("CDC:ErrAvroToEnvelopeError"), 354 ) 355 ErrAvroMarshalFailed = errors.Normalize( 356 "json marshal failed", 357 errors.RFCCodeText("CDC:ErrAvroMarshalFailed"), 358 ) 359 ErrAvroEncodeFailed = errors.Normalize( 360 "encode to avro native data", 361 errors.RFCCodeText("CDC:ErrAvroEncodeFailed"), 362 ) 363 ErrAvroEncodeToBinary = errors.Normalize( 364 "encode to binray from native", 365 errors.RFCCodeText("CDC:ErrAvroEncodeToBinary"), 366 ) 367 ErrAvroSchemaAPIError = errors.Normalize( 368 "schema manager API error, %s", 369 errors.RFCCodeText("CDC:ErrAvroSchemaAPIError"), 370 ) 371 ErrAvroInvalidMessage = errors.Normalize( 372 "avro invalid message format, %s", 373 errors.RFCCodeText("CDC:ErrAvroInvalidMessage"), 374 ) 375 ErrMaxwellEncodeFailed = errors.Normalize( 376 "maxwell encode failed", 377 errors.RFCCodeText("CDC:ErrMaxwellEncodeFailed"), 378 ) 379 ErrMaxwellInvalidData = errors.Normalize( 380 "maxwell invalid data", 381 errors.RFCCodeText("CDC:ErrMaxwellInvalidData"), 382 ) 383 ErrOpenProtocolCodecInvalidData = errors.Normalize( 384 "open-protocol codec invalid data", 385 errors.RFCCodeText("CDC:ErrOpenProtocolCodecInvalidData"), 386 ) 387 ErrCanalDecodeFailed = errors.Normalize( 388 "canal decode failed", 389 errors.RFCCodeText("CDC:ErrCanalDecodeFailed"), 390 ) 391 ErrCanalEncodeFailed = errors.Normalize( 392 "canal encode failed", 393 errors.RFCCodeText("CDC:ErrCanalEncodeFailed"), 394 ) 395 ErrOldValueNotEnabled = errors.Normalize( 396 "old value is not enabled", 397 errors.RFCCodeText("CDC:ErrOldValueNotEnabled"), 398 ) 399 ErrSinkInvalidConfig = errors.Normalize( 400 "sink config invalid", 401 errors.RFCCodeText("CDC:ErrSinkInvalidConfig"), 402 ) 403 ErrCraftCodecInvalidData = errors.Normalize( 404 "craft codec invalid data", 405 errors.RFCCodeText("CDC:ErrCraftCodecInvalidData"), 406 ) 407 ErrMessageTooLarge = errors.Normalize( 408 "message is too large", 409 errors.RFCCodeText("CDC:ErrMessageTooLarge"), 410 ) 411 ErrStorageSinkInvalidDateSeparator = errors.Normalize( 412 "date separator in storage sink is invalid", 413 errors.RFCCodeText("CDC:ErrStorageSinkInvalidDateSeparator"), 414 ) 415 ErrCSVEncodeFailed = errors.Normalize( 416 "csv encode failed", 417 errors.RFCCodeText("CDC:ErrCSVEncodeFailed"), 418 ) 419 ErrCSVDecodeFailed = errors.Normalize( 420 "csv decode failed", 421 errors.RFCCodeText("CDC:ErrCSVDecodeFailed"), 422 ) 423 ErrDebeziumEncodeFailed = errors.Normalize( 424 "debezium encode failed", 425 errors.RFCCodeText("CDC:ErrDebeziumEncodeFailed"), 426 ) 427 ErrStorageSinkInvalidConfig = errors.Normalize( 428 "storage sink config invalid", 429 errors.RFCCodeText("CDC:ErrStorageSinkInvalidConfig"), 430 ) 431 ErrStorageSinkInvalidFileName = errors.Normalize( 432 "filename in storage sink is invalid", 433 errors.RFCCodeText("CDC:ErrStorageSinkInvalidFileName"), 434 ) 435 436 // utilities related errors 437 ErrToTLSConfigFailed = errors.Normalize( 438 "generate tls config failed", 439 errors.RFCCodeText("CDC:ErrToTLSConfigFailed"), 440 ) 441 ErrCheckClusterVersionFromPD = errors.Normalize( 442 "failed to request PD %s, please try again later", 443 errors.RFCCodeText("CDC:ErrCheckClusterVersionFromPD"), 444 ) 445 ErrNewSemVersion = errors.Normalize( 446 "create sem version", 447 errors.RFCCodeText("CDC:ErrNewSemVersion"), 448 ) 449 ErrCheckDirWritable = errors.Normalize( 450 "check dir writable failed", 451 errors.RFCCodeText("CDC:ErrCheckDirWritable"), 452 ) 453 ErrCheckDirValid = errors.Normalize( 454 "check dir valid failed", 455 errors.RFCCodeText("CDC:ErrCheckDirValid"), 456 ) 457 ErrGetDiskInfo = errors.Normalize( 458 "get dir disk info failed", 459 errors.RFCCodeText("CDC:ErrGetDiskInfo"), 460 ) 461 ErrLoadTimezone = errors.Normalize( 462 "load timezone", 463 errors.RFCCodeText("CDC:ErrLoadTimezone"), 464 ) 465 ErrURLFormatInvalid = errors.Normalize( 466 "url format is invalid", 467 errors.RFCCodeText("CDC:ErrURLFormatInvalid"), 468 ) 469 ErrIntersectNoOverlap = errors.Normalize( 470 "span doesn't overlap: %+v vs %+v", 471 errors.RFCCodeText("CDC:ErrIntersectNoOverlap"), 472 ) 473 ErrOperateOnClosedNotifier = errors.Normalize( 474 "operate on a closed notifier", 475 errors.RFCCodeText("CDC:ErrOperateOnClosedNotifier"), 476 ) 477 ErrDiskFull = errors.Normalize( 478 "failed to preallocate file because disk is full", 479 errors.RFCCodeText("CDC:ErrDiskFull")) 480 ErrWaitFreeMemoryTimeout = errors.Normalize( 481 "wait free memory timeout", 482 errors.RFCCodeText("CDC:ErrWaitFreeMemoryTimeout"), 483 ) 484 485 // encode/decode, data format and data integrity errors 486 ErrInvalidRecordKey = errors.Normalize( 487 "invalid record key - %q", 488 errors.RFCCodeText("CDC:ErrInvalidRecordKey"), 489 ) 490 ErrCodecDecode = errors.Normalize( 491 "codec decode error", 492 errors.RFCCodeText("CDC:ErrCodecDecode"), 493 ) 494 ErrUnknownMetaType = errors.Normalize( 495 "unknown meta type %v", 496 errors.RFCCodeText("CDC:ErrUnknownMetaType"), 497 ) 498 ErrDatumUnflatten = errors.Normalize( 499 "unflatten datume data", 500 errors.RFCCodeText("CDC:ErrDatumUnflatten"), 501 ) 502 ErrDecodeRowToDatum = errors.Normalize( 503 "decode row data to datum failed", 504 errors.RFCCodeText("CDC:ErrDecodeRowToDatum"), 505 ) 506 ErrMarshalFailed = errors.Normalize( 507 "marshal failed", 508 errors.RFCCodeText("CDC:ErrMarshalFailed"), 509 ) 510 ErrUnmarshalFailed = errors.Normalize( 511 "unmarshal failed", 512 errors.RFCCodeText("CDC:ErrUnmarshalFailed"), 513 ) 514 ErrInvalidChangefeedID = errors.Normalize( 515 fmt.Sprintf("%s, %s, %s, %s,", 516 "bad changefeed id", 517 `please match the pattern "^[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*$"`, 518 "the length should no more than %d", 519 `eg, "simple-changefeed-task"`), 520 errors.RFCCodeText("CDC:ErrInvalidChangefeedID"), 521 ) 522 ErrInvalidNamespace = errors.Normalize( 523 fmt.Sprintf("%s, %s, %s, %s,", 524 "bad namespace", 525 `please match the pattern "^[a-zA-Z0-9]+(\-[a-zA-Z0-9]+)*$"`, 526 "the length should no more than %d", 527 `eg, "simple-namespace-test"`), 528 errors.RFCCodeText("CDC:ErrInvalidNamespace"), 529 ) 530 ErrInvalidEtcdKey = errors.Normalize( 531 "invalid key: %s", 532 errors.RFCCodeText("CDC:ErrInvalidEtcdKey"), 533 ) 534 535 // schema storage errors 536 ErrSchemaStorageUnresolved = errors.Normalize( 537 "can not found schema snapshot, the specified ts(%d) is more than resolvedTs(%d)", 538 errors.RFCCodeText("CDC:ErrSchemaStorageUnresolved"), 539 ) 540 ErrSchemaStorageGCed = errors.Normalize( 541 "can not found schema snapshot, the specified ts(%d) is less than gcTS(%d)", 542 errors.RFCCodeText("CDC:ErrSchemaStorageGCed"), 543 ) 544 ErrSchemaSnapshotNotFound = errors.Normalize( 545 "can not found schema snapshot, ts: %d", 546 errors.RFCCodeText("CDC:ErrSchemaSnapshotNotFound"), 547 ) 548 ErrSchemaStorageTableMiss = errors.Normalize( 549 "table %d not found", 550 errors.RFCCodeText("CDC:ErrSchemaStorageTableMiss"), 551 ) 552 ErrSnapshotSchemaNotFound = errors.Normalize( 553 "schema %d not found in schema snapshot", 554 errors.RFCCodeText("CDC:ErrSnapshotSchemaNotFound"), 555 ) 556 ErrSnapshotTableNotFound = errors.Normalize( 557 "table %d not found in schema snapshot", 558 errors.RFCCodeText("CDC:ErrSnapshotTableNotFound"), 559 ) 560 ErrSnapshotSchemaExists = errors.Normalize( 561 "schema %s(%d) already exists", 562 errors.RFCCodeText("CDC:ErrSnapshotSchemaExists"), 563 ) 564 ErrSnapshotTableExists = errors.Normalize( 565 "table %s.%s already exists", 566 errors.RFCCodeText("CDC:ErrSnapshotTableExists"), 567 ) 568 ErrInvalidDDLJob = errors.Normalize( 569 "invalid ddl job(%d)", 570 errors.RFCCodeText("CDC:ErrInvalidDDLJob"), 571 ) 572 ErrExchangePartition = errors.Normalize( 573 "exchange partition failed, %s", 574 errors.RFCCodeText("CDC:ErrExchangePartition"), 575 ) 576 577 ErrCorruptedDataMutation = errors.Normalize( 578 "Changefeed %s.%s stopped due to corrupted data mutation received", 579 errors.RFCCodeText("CDC:ErrCorruptedDataMutation")) 580 581 // server related errors 582 ErrCaptureSuicide = errors.Normalize( 583 "capture suicide", 584 errors.RFCCodeText("CDC:ErrCaptureSuicide"), 585 ) 586 ErrCaptureRegister = errors.Normalize( 587 "capture register to etcd failed", 588 errors.RFCCodeText("CDC:ErrCaptureRegister"), 589 ) 590 ErrCaptureNotInitialized = errors.Normalize( 591 "capture has not been initialized yet", 592 errors.RFCCodeText("CDC:ErrCaptureNotInitialized"), 593 ) 594 ErrProcessorUnknown = errors.Normalize( 595 "processor running unknown error", 596 errors.RFCCodeText("CDC:ErrProcessorUnknown"), 597 ) 598 ErrOwnerUnknown = errors.Normalize( 599 "owner running unknown error", 600 errors.RFCCodeText("CDC:ErrOwnerUnknown"), 601 ) 602 ErrProcessorTableNotFound = errors.Normalize( 603 "table not found in processor cache", 604 errors.RFCCodeText("CDC:ErrProcessorTableNotFound"), 605 ) 606 ErrInvalidServerOption = errors.Normalize( 607 "invalid server option", 608 errors.RFCCodeText("CDC:ErrInvalidServerOption"), 609 ) 610 ErrServeHTTP = errors.Normalize( 611 "serve http error", 612 errors.RFCCodeText("CDC:ErrServeHTTP"), 613 ) 614 ErrCaptureCampaignOwner = errors.Normalize( 615 "campaign owner failed", 616 errors.RFCCodeText("CDC:ErrCaptureCampaignOwner"), 617 ) 618 ErrCaptureResignOwner = errors.Normalize( 619 "resign owner failed", 620 errors.RFCCodeText("CDC:ErrCaptureResignOwner"), 621 ) 622 ErrClusterIsUnhealthy = errors.Normalize( 623 "TiCDC cluster is unhealthy", 624 errors.RFCCodeText("CDC:ErrClusterIsUnhealthy"), 625 ) 626 ErrAPIInvalidParam = errors.Normalize( 627 "invalid api parameter", 628 errors.RFCCodeText("CDC:ErrAPIInvalidParam"), 629 ) 630 ErrAPIGetPDClientFailed = errors.Normalize( 631 "failed to get PDClient to connect PD, please recheck", 632 errors.RFCCodeText("CDC:ErrAPIGetPDClientFailed"), 633 ) 634 ErrRequestForwardErr = errors.Normalize( 635 "request forward error, an request can only forward to owner one time", 636 errors.RFCCodeText("ErrRequestForwardErr"), 637 ) 638 ErrInternalServerError = errors.Normalize( 639 "internal server error", 640 errors.RFCCodeText("CDC:ErrInternalServerError"), 641 ) 642 ErrChangefeedUpdateRefused = errors.Normalize( 643 "changefeed update error: %s", 644 errors.RFCCodeText("CDC:ErrChangefeedUpdateRefused"), 645 ) 646 ErrChangefeedUpdateFailedTransaction = errors.Normalize( 647 "changefeed update failed due to unexpected etcd transaction failure: %s", 648 errors.RFCCodeText("CDC:ErrChangefeedUpdateFailed"), 649 ) 650 ErrUpdateServiceSafepointFailed = errors.Normalize( 651 "updating service safepoint failed", 652 errors.RFCCodeText("CDC:ErrUpdateServiceSafepointFailed"), 653 ) 654 ErrStartTsBeforeGC = errors.Normalize( 655 "fail to create or maintain changefeed because start-ts %d "+ 656 "is earlier than or equal to GC safepoint at %d", 657 errors.RFCCodeText("CDC:ErrStartTsBeforeGC"), 658 ) 659 ErrTargetTsBeforeStartTs = errors.Normalize( 660 "fail to create changefeed because target-ts %d is earlier than start-ts %d", 661 errors.RFCCodeText("CDC:ErrTargetTsBeforeStartTs"), 662 ) 663 ErrSnapshotLostByGC = errors.Normalize( 664 "fail to create or maintain changefeed due to snapshot loss"+ 665 " caused by GC. checkpoint-ts %d is earlier than or equal to GC safepoint at %d", 666 errors.RFCCodeText("CDC:ErrSnapshotLostByGC"), 667 ) 668 ErrGCTTLExceeded = errors.Normalize( 669 "the checkpoint-ts(%d) lag of the changefeed(%s) has exceeded "+ 670 "the GC TTL and the changefeed is blocking global GC progression", 671 errors.RFCCodeText("CDC:ErrGCTTLExceeded"), 672 ) 673 ErrNotOwner = errors.Normalize( 674 "this capture is not a owner", 675 errors.RFCCodeText("CDC:ErrNotOwner"), 676 ) 677 ErrOwnerNotFound = errors.Normalize( 678 "owner not found", 679 errors.RFCCodeText("CDC:ErrOwnerNotFound"), 680 ) 681 ErrTableIneligible = errors.Normalize( 682 "some tables are not eligible to replicate(%v), "+ 683 "if you want to ignore these tables, please set ignore_ineligible_table to true", 684 errors.RFCCodeText("CDC:ErrTableIneligible"), 685 ) 686 ErrInvalidCheckpointTs = errors.Normalize( 687 "checkpointTs(%v) should not larger than resolvedTs(%v)", 688 errors.RFCCodeText("CDC:ErrInvalidCheckpointTs"), 689 ) 690 691 // EtcdWorker related errors. Internal use only. 692 // ErrEtcdTryAgain is used by a PatchFunc to force a transaction abort. 693 ErrEtcdTryAgain = errors.Normalize( 694 "the etcd txn should be aborted and retried immediately", 695 errors.RFCCodeText("CDC:ErrEtcdTryAgain"), 696 ) 697 // ErrEtcdIgnore is used by a PatchFunc to signal that the reactor no longer wishes to update Etcd. 698 ErrEtcdIgnore = errors.Normalize( 699 "this patch should be excluded from the current etcd txn", 700 errors.RFCCodeText("CDC:ErrEtcdIgnore"), 701 ) 702 // ErrEtcdSessionDone is used by etcd worker to signal a session done 703 ErrEtcdSessionDone = errors.Normalize( 704 "the etcd session is done", 705 errors.RFCCodeText("CDC:ErrEtcdSessionDone"), 706 ) 707 // ErrReactorFinished is used by reactor to signal a **normal** exit. 708 ErrReactorFinished = errors.Normalize( 709 "the reactor has done its job and should no longer be executed", 710 errors.RFCCodeText("CDC:ErrReactorFinished"), 711 ) 712 ErrLeaseExpired = errors.Normalize( 713 "owner lease expired ", 714 errors.RFCCodeText("CDC:ErrLeaseExpired"), 715 ) 716 ErrEtcdTxnSizeExceed = errors.Normalize( 717 "patch size:%d of a single changefeed exceed etcd txn max size:%d", 718 errors.RFCCodeText("CDC:ErrEtcdTxnSizeExceed"), 719 ) 720 ErrEtcdTxnOpsExceed = errors.Normalize( 721 "patch ops:%d of a single changefeed exceed etcd txn max ops:%d", 722 errors.RFCCodeText("CDC:ErrEtcdTxnOpsExceed"), 723 ) 724 ErrEtcdMigrateFailed = errors.Normalize( 725 "etcd meta data migrate failed:%s", 726 errors.RFCCodeText("CDC:ErrEtcdMigrateFailed"), 727 ) 728 ErrChangefeedUnretryable = errors.Normalize( 729 "changefeed is in unretryable state, please check the error message"+ 730 ", and you should manually handle it", 731 errors.RFCCodeText("CDC:ErrChangefeedUnretryable"), 732 ) 733 734 // workerpool errors 735 ErrWorkerPoolHandleCancelled = errors.Normalize( 736 "workerpool handle is cancelled", 737 errors.RFCCodeText("CDC:ErrWorkerPoolHandleCancelled"), 738 ) 739 ErrAsyncPoolExited = errors.Normalize( 740 "asyncPool has exited. Report a bug if seen externally.", 741 errors.RFCCodeText("CDC:ErrAsyncPoolExited"), 742 ) 743 ErrWorkerPoolGracefulUnregisterTimedOut = errors.Normalize( 744 "workerpool handle graceful unregister timed out", 745 errors.RFCCodeText("CDC:ErrWorkerPoolGracefulUnregisterTimedOut"), 746 ) 747 748 // redo log related errors 749 ErrConsistentStorage = errors.Normalize( 750 "consistent storage (%s) not support", 751 errors.RFCCodeText("CDC:ErrConsistentStorage"), 752 ) 753 // sorter errors 754 ErrIllegalSorterParameter = errors.Normalize( 755 "illegal parameter for sorter: %s", 756 errors.RFCCodeText("CDC:ErrIllegalSorterParameter"), 757 ) 758 ErrConflictingFileLocks = errors.Normalize( 759 "file lock conflict: %s", 760 errors.RFCCodeText("ErrConflictingFileLocks"), 761 ) 762 763 // retry error 764 ErrReachMaxTry = errors.Normalize("reach maximum try: %s, error: %s", 765 errors.RFCCodeText("CDC:ErrReachMaxTry"), 766 ) 767 768 // tcp server error 769 ErrTCPServerClosed = errors.Normalize("The TCP server has been closed", 770 errors.RFCCodeText("CDC:ErrTCPServerClosed"), 771 ) 772 773 // p2p error 774 ErrPeerMessageIllegalMeta = errors.Normalize( 775 "peer-to-peer message server received an RPC call with illegal metadata", 776 errors.RFCCodeText("CDC:ErrPeerMessageIllegalMeta"), 777 ) 778 ErrPeerMessageClientPermanentFail = errors.Normalize( 779 "peer-to-peer message client has failed permanently, no need to reconnect: %s", 780 errors.RFCCodeText("CDC:ErrPeerMessageClientPermanentFail"), 781 ) 782 ErrPeerMessageClientClosed = errors.Normalize( 783 "peer-to-peer message client has been closed", 784 errors.RFCCodeText("CDC:ErrPeerMessageClientClosed"), 785 ) 786 ErrPeerMessageSendTryAgain = errors.Normalize( 787 "peer-to-peer message client has too many pending messages to send,"+ 788 " try again later", 789 errors.RFCCodeText("CDC:ErrPeerMessageSendTryAgain"), 790 ) 791 ErrPeerMessageEncodeError = errors.Normalize( 792 "failed to encode peer-to-peer message", 793 errors.RFCCodeText("CDC:ErrPeerMessageEncodeError"), 794 ) 795 ErrPeerMessageInternalSenderClosed = errors.Normalize( 796 "peer-to-peer message server tries to send to a closed stream. Internal only.", 797 errors.RFCCodeText("CDC:ErrPeerMessageInternalSenderClosed"), 798 ) 799 ErrPeerMessageStaleConnection = errors.Normalize( 800 "peer-to-peer message stale connection: old-epoch %d, new-epoch %d", 801 errors.RFCCodeText("CDC:ErrPeerMessageStaleConnection"), 802 ) 803 ErrPeerMessageDuplicateConnection = errors.Normalize( 804 "peer-to-peer message duplicate connection: epoch %d", 805 errors.RFCCodeText("CDC:ErrPeerMessageDuplicateConnection"), 806 ) 807 ErrPeerMessageServerClosed = errors.Normalize( 808 "peer-to-peer message server has closed connection: %s.", 809 errors.RFCCodeText("CDC:ErrPeerMessageServerClosed"), 810 ) 811 ErrPeerMessageDataLost = errors.Normalize( 812 "peer-to-peer message data lost, topic: %s, seq: %d", 813 errors.RFCCodeText("CDC:ErrPeerMessageDataLost"), 814 ) 815 ErrPeerMessageToManyPeers = errors.Normalize( 816 "peer-to-peer message server got too many peers: %d peers", 817 errors.RFCCodeText("CDC:ErrPeerMessageToManyPeers"), 818 ) 819 ErrPeerMessageDecodeError = errors.Normalize( 820 "failed to decode peer-to-peer message", 821 errors.RFCCodeText("CDC:ErrPeerMessageDecodeError"), 822 ) 823 ErrPeerMessageTaskQueueCongested = errors.Normalize( 824 "peer-to-peer message server has too many pending tasks", 825 errors.RFCCodeText("CDC:ErrPeerMessageTaskQueueCongested"), 826 ) 827 ErrPeerMessageReceiverMismatch = errors.Normalize( 828 "peer-to-peer message receiver is a mismatch: expected %s, got %s", 829 errors.RFCCodeText("CDC:ErrPeerMessageReceiverMismatch"), 830 ) 831 ErrPeerMessageTopicCongested = errors.Normalize( 832 "peer-to-peer message topic has congested, aborting all connections", 833 errors.RFCCodeText("CDC:ErrPeerMessageTopicCongested"), 834 ) 835 ErrPeerMessageInjectedServerRestart = errors.Normalize( 836 "peer-to-peer message server injected error", 837 errors.RFCCodeText("CDC:ErrPeerMessageInjectedServerRestart"), 838 ) 839 840 // RESTful client error 841 ErrRewindRequestBodyError = errors.Normalize( 842 "failed to seek to the beginning of request body", 843 errors.RFCCodeText("CDC:ErrRewindRequestBodyError"), 844 ) 845 ErrZeroLengthResponseBody = errors.Normalize( 846 "0-length response with status code: %d", 847 errors.RFCCodeText("CDC:ErrZeroLengthResponseBody"), 848 ) 849 ErrInvalidHost = errors.Normalize( 850 "host must be a URL or a host:port pair: %q", 851 errors.RFCCodeText("CDC:ErrInvalidHost"), 852 ) 853 854 // Upstream error 855 ErrUpstreamNotFound = errors.Normalize( 856 "upstream not found, cluster-id: %d", 857 errors.RFCCodeText("CDC:ErrUpstreamNotFound"), 858 ) 859 ErrUpstreamManagerNotReady = errors.Normalize( 860 "upstream manager not ready", 861 errors.RFCCodeText("CDC:ErrUpstreamManagerNotReady"), 862 ) 863 ErrUpstreamClosed = errors.Normalize( 864 "upstream has been closed", 865 errors.RFCCodeText("CDC:ErrUpstreamClosed"), 866 ) 867 ErrUpstreamHasRunningImport = errors.Normalize( 868 "upstream has running import tasks, upstream-id: %d", 869 errors.RFCCodeText("CDC:ErrUpstreamHasRunningImport"), 870 ) 871 872 // ReplicationSet error 873 ErrReplicationSetInconsistent = errors.Normalize( 874 "replication set inconsistent: %s", 875 errors.RFCCodeText("CDC:ErrReplicationSetInconsistent"), 876 ) 877 ErrReplicationSetMultiplePrimaryError = errors.Normalize( 878 "replication set multiple primary: %s", 879 errors.RFCCodeText("CDC:ErrReplicationSetMultiplePrimaryError"), 880 ) 881 882 ErrUpstreamMissMatch = errors.Normalize( 883 "upstream missmatch,old: %d, new %d", 884 errors.RFCCodeText("CDC:ErrUpstreamMissMatch"), 885 ) 886 887 ErrServerIsNotReady = errors.Normalize( 888 "cdc server is not ready", 889 errors.RFCCodeText("CDC:ErrServerIsNotReady"), 890 ) 891 892 // cli error 893 ErrCliInvalidCheckpointTs = errors.Normalize( 894 "invalid overwrite-checkpoint-ts %s, "+ 895 "overwrite-checkpoint-ts only accept 'now' or a valid timestamp in integer", 896 errors.RFCCodeText("CDC:ErrCliInvalidCheckpointTs"), 897 ) 898 ErrCliCheckpointTsIsInFuture = errors.Normalize( 899 "the overwrite-checkpoint-ts %d must be smaller than current TSO", 900 errors.RFCCodeText("CDC:ErrCliCheckpointTsIsInFuture"), 901 ) 902 ErrCliAborted = errors.Normalize( 903 "command '%s' is aborted by user", 904 errors.RFCCodeText("CDC:ErrCliAborted"), 905 ) 906 // Filter error 907 ErrFailedToFilterDML = errors.Normalize( 908 "failed to filter dml event: %v, please report a bug", 909 errors.RFCCodeText("CDC:ErrFailedToFilterDML"), 910 ) 911 ErrExpressionParseFailed = errors.Normalize( 912 "invalid filter expressions. There is a syntax error in: '%s'", 913 errors.RFCCodeText("CDC:ErrInvalidFilterExpression"), 914 ) 915 ErrExpressionColumnNotFound = errors.Normalize( 916 "invalid filter expression(s). Cannot find column '%s' from table '%s' in: %s", 917 errors.RFCCodeText("CDC:ErrExpressionColumnNotFound"), 918 ) 919 ErrInvalidIgnoreEventType = errors.Normalize( 920 "invalid ignore event type: '%s'", 921 errors.RFCCodeText("CDC:ErrInvalidIgnoreEventType"), 922 ) 923 ErrConvertDDLToEventTypeFailed = errors.Normalize( 924 "failed to convert ddl '%s' to filter event type", 925 errors.RFCCodeText("CDC:ErrConvertDDLToEventTypeFailed"), 926 ) 927 ErrSyncRenameTableFailed = errors.Normalize( 928 "table's old name is not in filter rule, and its new name in filter rule "+ 929 "table id '%d', ddl query: [%s], it's an unexpected behavior, "+ 930 "if you want to replicate this table, please add its old name to filter rule.", 931 errors.RFCCodeText("CDC:ErrSyncRenameTableFailed"), 932 ) 933 934 // changefeed config error 935 ErrInvalidReplicaConfig = errors.Normalize( 936 "invalid replica config, %s", 937 errors.RFCCodeText("CDC:ErrInvalidReplicaConfig"), 938 ) 939 ErrInternalCheckFailed = errors.Normalize( 940 "internal check failed, %s", 941 errors.RFCCodeText("CDC:ErrInternalCheckFailed"), 942 ) 943 944 ErrHandleDDLFailed = errors.Normalize( 945 "handle ddl failed, query: %s, startTs: %d. "+ 946 "If you want to skip this DDL and continue with replication, "+ 947 "you can manually execute this DDL downstream. Afterwards, "+ 948 "add `ignore-txn-start-ts=[%d]` to the changefeed in the filter configuration.", 949 errors.RFCCodeText("CDC:ErrHandleDDLFailed"), 950 ) 951 952 ErrInvalidGlueSchemaRegistryConfig = errors.Normalize( 953 "invalid glue schema registry config, %s", 954 errors.RFCCodeText("CDC:ErrInvalidGlueSchemaRegistryConfig"), 955 ) 956 957 // cdc v2 958 // TODO(CharlesCheung): refactor this errors 959 ErrElectorNotLeader = errors.Normalize( 960 "%s is not leader", 961 errors.RFCCodeText("CDC:ErrNotLeader"), 962 ) 963 ErrNotController = errors.Normalize( 964 "not controller", 965 errors.RFCCodeText("CDC:ErrNotController"), 966 ) 967 ErrMetaRowsAffectedNotMatch = errors.Normalize( 968 "rows affected by the operation %s is unexpected: expected %d, got %d", 969 errors.RFCCodeText("CDC:ErrMetaOpIgnored"), 970 ) 971 ErrMetaOpFailed = errors.Normalize( 972 "unexpected meta operation failure: %s", 973 errors.RFCCodeText("DFLOW:ErrMetaOpFailed"), 974 ) 975 ErrMetaInvalidState = errors.Normalize( 976 "meta state is invalid: %s", 977 errors.RFCCodeText("DFLOW:ErrMetaInvalidState"), 978 ) 979 ErrInconsistentMetaCache = errors.Normalize( 980 "meta cache is inconsistent: %s", 981 errors.RFCCodeText("DFLOW:ErrInconsistentMetaCache"), 982 ) 983 984 ErrUnexpected = errors.Normalize( 985 "cdc met unexpected error: %s", 986 errors.RFCCodeText("CDC:ErrUnexpected"), 987 ) 988 989 // credential related errors 990 ErrCredentialNotFound = errors.Normalize( 991 "credential not found: %s", 992 errors.RFCCodeText("CDC:ErrCredentialNotFound"), 993 ) 994 ErrUnauthorized = errors.Normalize( 995 "user %s unauthorized, error: %s", 996 errors.RFCCodeText("CDC:ErrUnauthorized"), 997 ) 998 )