github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/pkg/errors/engine_errors.go (about) 1 // Copyright 2022 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 "github.com/pingcap/errors" 18 ) 19 20 // all dataflow engine errors 21 var ( 22 // general errors 23 ErrUnknown = errors.Normalize( 24 "unknown error", 25 errors.RFCCodeText("DFLOW:ErrUnknown"), 26 ) 27 ErrInvalidArgument = errors.Normalize( 28 "invalid argument: %s", 29 errors.RFCCodeText("DFLOW:ErrInvalidArgument"), 30 ) 31 32 ErrClusterResourceNotEnough = errors.Normalize( 33 "cluster resource is not enough, please scale out the cluster", 34 errors.RFCCodeText("DFLOW:ErrClusterResourceNotEnough"), 35 ) 36 37 ErrDecodeEtcdKeyFail = errors.Normalize( 38 "failed to decode etcd key: %s", 39 errors.RFCCodeText("DFLOW:ErrDecodeEtcdKeyFail"), 40 ) 41 ErrEtcdAPIError = errors.Normalize( 42 "etcd api returns error", 43 errors.RFCCodeText("DFLOW:ErrEtcdAPIError"), 44 ) 45 46 // master related errors 47 ErrMasterNotReady = errors.Normalize( 48 "master is not ready", 49 errors.RFCCodeText("DFLOW:ErrMasterNotReady"), 50 ) 51 ErrMasterNoLeader = errors.Normalize( 52 "master has no leader", 53 errors.RFCCodeText("DFLOW:ErrMasterNoLeader"), 54 ) 55 ErrMasterDecodeConfigFile = errors.Normalize( 56 "decode config file failed", 57 errors.RFCCodeText("DFLOW:ErrMasterDecodeConfigFile"), 58 ) 59 ErrMasterConfigUnknownItem = errors.Normalize( 60 "master config contains unknown configuration options: %s", 61 errors.RFCCodeText("DFLOW:ErrMasterConfigUnknownItem"), 62 ) 63 ErrMasterNotFound = errors.Normalize( 64 "master is not found: master ID %s", 65 errors.RFCCodeText("DFLOW:ErrMasterNotFound"), 66 ) 67 ErrMasterClosed = errors.Normalize( 68 "master has been closed explicitly: master ID %s", 69 errors.RFCCodeText("DFLOW:ErrMasterClosed"), 70 ) 71 ErrMasterConcurrencyExceeded = errors.Normalize( 72 "master has reached concurrency quota", 73 errors.RFCCodeText("DFLOW:ErrMasterConcurrencyExceeded"), 74 ) 75 ErrMasterCreateWorkerBackoff = errors.Normalize( 76 "create worker is being backoff, retry later", 77 errors.RFCCodeText("DFLOW:ErrMasterCreateWorkerBackoff"), 78 ) 79 ErrMasterCreateWorkerTerminate = errors.Normalize( 80 "create worker is terminated, won't backoff any more", 81 errors.RFCCodeText("DFLOW:ErrMasterCreateWorkerTerminate"), 82 ) 83 ErrMasterInvalidMeta = errors.Normalize( 84 "invalid master meta data: %s", 85 errors.RFCCodeText("DFLOW:ErrMasterInvalidMeta"), 86 ) 87 ErrInvalidMasterMessage = errors.Normalize( 88 "invalid master message: %s", 89 errors.RFCCodeText("DFLOW:ErrInvalidMasterMessage"), 90 ) 91 ErrSendingMessageToTombstone = errors.Normalize( 92 "trying to send message to a tombstone worker handle: %s", 93 errors.RFCCodeText("DFLOW:ErrSendingMessageToTombstone"), 94 ) 95 ErrMasterInterfaceNotFound = errors.Normalize( 96 "basemaster interface not found", 97 errors.RFCCodeText("DFLOW:ErrMasterInterfaceNotFound"), 98 ) 99 ErrExecutorWatcherClosed = errors.Normalize( 100 "executor watcher is closed", 101 errors.RFCCodeText("DFLOW:ErrExecutorWatcherClosed"), 102 ) 103 104 ErrWorkerTypeNotFound = errors.Normalize( 105 "worker type is not found: type %d", 106 errors.RFCCodeText("DFLOW:ErrWorkerTypeNotFound"), 107 ) 108 ErrWorkerNotFound = errors.Normalize( 109 "worker is not found: worker ID %s", 110 errors.RFCCodeText("DFLOW:ErrWorkerNotFound"), 111 ) 112 ErrWorkerOffline = errors.Normalize( 113 "worker is offline: workerID: %s, error message: %s", 114 errors.RFCCodeText("DFLOW:ErrWorkerOffline"), 115 ) 116 ErrWorkerSuicide = errors.Normalize( 117 "worker has committed suicide due to master(%s) having timed out", 118 errors.RFCCodeText("DFLOW:ErrWorkerSuicide"), 119 ) 120 ErrWorkerUpdateStatusTryAgain = errors.Normalize( 121 "worker should try again in updating the status", 122 errors.RFCCodeText("DFLOW:ErrWorkerUpdateStatusTryAgain"), 123 ) 124 // TODO: unify the following three errors into one ErrWorkerTerminated 125 ErrWorkerFinish = errors.Normalize( 126 "worker finished and exited", 127 errors.RFCCodeText("DFLOW:ErrWorkerFinish"), 128 ) 129 ErrWorkerCancel = errors.Normalize( 130 "worker is canceled", 131 errors.RFCCodeText("DFLOW:ErrWorkerCancel"), 132 ) 133 ErrWorkerFailed = errors.Normalize( 134 "worker is failed permanently", 135 errors.RFCCodeText("DFLOW:ErrWorkerFailed"), 136 ) 137 ErrTooManyStatusUpdates = errors.Normalize( 138 "there are too many pending worker status updates: %d", 139 errors.RFCCodeText("DFLOW:ErrTooManyStatusUpdates"), 140 ) 141 ErrWorkerHalfExit = errors.Normalize( 142 "the worker is in half-exited state", 143 errors.RFCCodeText("DFLOW:ErrWorkerHalfExit"), 144 ) 145 // ErrCreateWorkerNonTerminate indicates the job can be re-created. 146 ErrCreateWorkerNonTerminate = errors.Normalize( 147 "create worker is not terminated", 148 errors.RFCCodeText("DFLOW:ErrCreateWorkerNonTerminate"), 149 ) 150 // ErrCreateWorkerTerminate indicates the job should be terminated permanently 151 // from the perspective of business logic. 152 ErrCreateWorkerTerminate = errors.Normalize( 153 "create worker is terminated", 154 errors.RFCCodeText("DFLOW:ErrCreateWorkerTerminate"), 155 ) 156 157 // job manager related errors 158 ErrJobManagerGetJobDetailFail = errors.Normalize( 159 "failed to get job detail from job master", 160 errors.RFCCodeText("DFLOW:ErrJobManagerGetJobDetailFail"), 161 ) 162 163 // master etcd related errors 164 ErrMasterEtcdEpochFail = errors.Normalize( 165 "server master generate epoch fail", 166 errors.RFCCodeText("DFLOW:ErrMasterEtcdEpochFail"), 167 ) 168 169 // executor related errors 170 ErrUnknownExecutor = errors.Normalize( 171 "unknown executor: %s", 172 errors.RFCCodeText("DFLOW:ErrUnknownExecutor"), 173 ) 174 ErrTombstoneExecutor = errors.Normalize( 175 "tombstone executor: %s", 176 errors.RFCCodeText("DFLOW:ErrTombstoneExecutor"), 177 ) 178 ErrExecutorNotFound = errors.Normalize( 179 "executor %s not found", 180 errors.RFCCodeText("DFLOW:ErrExecutorNotFound"), 181 ) 182 ErrExecutorAlreadyExists = errors.Normalize( 183 "executor %s already exists", 184 errors.RFCCodeText("DFLOW:ErrExecutorAlreadyExists"), 185 ) 186 ErrExecutorDecodeConfigFile = errors.Normalize( 187 "decode config file failed", 188 errors.RFCCodeText("DFLOW:ErrExecutorDecodeConfigFile"), 189 ) 190 ErrExecutorConfigUnknownItem = errors.Normalize( 191 "master config contains unknown configuration options: %s", 192 errors.RFCCodeText("DFLOW:ErrExecutorConfigUnknownItem"), 193 ) 194 ErrHeartbeat = errors.Normalize( 195 "heartbeat error type: %s", 196 errors.RFCCodeText("DFLOW:ErrHeartbeat"), 197 ) 198 ErrRuntimeIncomingQueueFull = errors.Normalize( 199 "runtime has too many pending CreateWorker requests", 200 errors.RFCCodeText("DFLOW:ErrRuntimeIncomingQueueFull"), 201 ) 202 ErrRuntimeIsClosed = errors.Normalize( 203 "runtime has been closed", 204 errors.RFCCodeText("DFLOW:ErrRuntimeIsClosed"), 205 ) 206 ErrRuntimeDuplicateTaskID = errors.Normalize( 207 "trying to add a task with the same ID as an existing one", 208 errors.RFCCodeText("DFLOW:ErrRuntimeDuplicateTaskID %s"), 209 ) 210 ErrRuntimeClosed = errors.Normalize( 211 "runtime has been closed", 212 errors.RFCCodeText("DFLOW:ErrRuntimeClosed"), 213 ) 214 ErrExecutorNotFoundForMessage = errors.Normalize( 215 "cannot find the executor for p2p messaging", 216 errors.RFCCodeText("DFLOW:ErrExecutorNotFoundForMessage"), 217 ) 218 ErrMasterTooManyPendingEvents = errors.Normalize( 219 "master has too many pending events", 220 errors.RFCCodeText("DFLOW:ErrMasterTooManyPendingEvents"), 221 ) 222 223 // meta related errors 224 ErrMetaNewClientFail = errors.Normalize( 225 "create meta client fail", 226 errors.RFCCodeText("DFLOW:ErrMetaNewClientFail"), 227 ) 228 ErrMetaOpFail = errors.Normalize( 229 "meta operation fail", 230 errors.RFCCodeText("DFLOW:ErrMetaOpFail"), 231 ) 232 ErrMetaOptionInvalid = errors.Normalize( 233 "meta option invalid", 234 errors.RFCCodeText("DFLOW:ErrMetaOptionInvalid"), 235 ) 236 ErrMetaOptionConflict = errors.Normalize( 237 "WithRange/WithPrefix/WithFromKey, more than one option are used", 238 errors.RFCCodeText("DFLOW:ErrMetaOptionConflict"), 239 ) 240 ErrMetaEmptyKey = errors.Normalize( 241 "meta empty key", 242 errors.RFCCodeText("DFLOW:ErrMetaEmptyKey"), 243 ) 244 ErrMetaNestedTxn = errors.Normalize( 245 "meta unsupported nested txn", 246 errors.RFCCodeText("DFLOW:ErrMetaNestedTxn"), 247 ) 248 ErrMetaCommittedTxn = errors.Normalize( 249 "meta already committed txn", 250 errors.RFCCodeText("DFLOW:ErrMetaCommittedTxn"), 251 ) 252 ErrMetaStoreIDDuplicate = errors.Normalize( 253 "metastore id duplicated", 254 errors.RFCCodeText("DFLOW:ErrMetaStoreIDDuplicate"), 255 ) 256 ErrMetaEntryNotFound = errors.Normalize( 257 "meta entry not found", 258 errors.RFCCodeText("DFLOW:ErrMetaEntryNotFound"), 259 ) 260 ErrMetaParamsInvalid = errors.Normalize( 261 "meta params invalid:%s", 262 errors.RFCCodeText("DFLOW:ErrMetaParamsInvalid"), 263 ) 264 ErrMetaClientTypeNotSupport = errors.Normalize( 265 "meta client type not support:%s", 266 errors.RFCCodeText("DFLOW:ErrMetaClientTypeNotSupport"), 267 ) 268 269 // Resource related errors 270 ErrDuplicateResourceID = errors.Normalize( 271 "duplicate resource ID: %s", 272 errors.RFCCodeText("DFLOW:ErrDuplicateResourceID"), 273 ) 274 ErrResourceAlreadyExists = errors.Normalize( 275 "resource %s already exists", 276 errors.RFCCodeText("DFLOW:ErrResourceAlreadyExists"), 277 ) 278 ErrIllegalResourcePath = errors.Normalize( 279 "resource path is illegal: %s", 280 errors.RFCCodeText("DFLOW:ErrIllegalResourcePath"), 281 ) 282 ErrResourceDoesNotExist = errors.Normalize( 283 "resource does not exists: %s", 284 errors.RFCCodeText("DFLOW:ErrResourceDoesNotExist"), 285 ) 286 ErrResourceConflict = errors.Normalize( 287 "resource % on executor %s conflicts with resource %s on executor %s", 288 errors.RFCCodeText("DFLOW:ErrResourceConflict"), 289 ) 290 ErrReadLocalFileDirectoryFailed = errors.Normalize( 291 "reading local file resource directory failed", 292 errors.RFCCodeText("DFLOW:ErrReadLocalFileDirectoryFailed"), 293 ) 294 ErrCreateLocalFileDirectoryFailed = errors.Normalize( 295 "creating local file resource directory failed", 296 errors.RFCCodeText("DFLOW:ErrCreateLocalFileDirectoryFailed"), 297 ) 298 ErrCleaningLocalTempFiles = errors.Normalize( 299 "errors is encountered when cleaning local temp files", 300 errors.RFCCodeText("DFLOW:ErrCleaningLocalTempFiles"), 301 ) 302 ErrRemovingLocalResource = errors.Normalize( 303 "removing a local resource file directory has failed", 304 errors.RFCCodeText("DFLOW:ErrRemovingLocalResource"), 305 ) 306 ErrFailToCreateExternalStorage = errors.Normalize( 307 "failed to create external storage", 308 errors.RFCCodeText("DFLOW:ErrFailToCreateExternalStorage"), 309 ) 310 ErrInvalidResourceHandle = errors.Normalize( 311 "using an invalid resource handle", 312 errors.RFCCodeText("DFLOW:ErrInvalidResourceHandle"), 313 ) 314 ErrLocalFileDirNotWritable = errors.Normalize( 315 "local resource directory not writable", 316 errors.RFCCodeText("DFLOW:ErrLocalFileDirNotWritable"), 317 ) 318 ErrNoQualifiedExecutor = errors.Normalize( 319 "no executor is available for scheduling", 320 errors.RFCCodeText("DFLOW:ErrNoQualifiedExecutor"), 321 ) 322 ErrFilterNoResult = errors.Normalize( 323 "filter % returns no result", 324 errors.RFCCodeText("DFLOW:ErrFilterNoResult"), 325 ) 326 ErrSelectorUnsatisfied = errors.Normalize( 327 "selector %v is not satisfied", 328 errors.RFCCodeText("DFLOW:ErrSelectorUnsatisfied"), 329 ) 330 ErrResourceFilesNotFound = errors.Normalize( 331 "resource files not found", 332 errors.RFCCodeText("DFLOW:ErrResourceFilesNotFound"), 333 ) 334 ErrResourceMetastoreError = errors.Normalize( 335 "resource metastore error", 336 errors.RFCCodeText("DFLOW:ErrResourceMetastoreError"), 337 ) 338 339 // Job related error 340 ErrJobNotFound = errors.Normalize( 341 "job %s is not found", 342 errors.RFCCodeText("DFLOW:ErrJobNotFound"), 343 ) 344 ErrJobAlreadyExists = errors.Normalize( 345 "job %s already exists", 346 errors.RFCCodeText("DFLOW:ErrJobAlreadyExists"), 347 ) 348 ErrJobAlreadyCanceled = errors.Normalize( 349 "job %s is already canceled", 350 errors.RFCCodeText("DFLOW:ErrJobAlreadyCanceled"), 351 ) 352 ErrJobNotTerminated = errors.Normalize( 353 "job %s is not terminated", 354 errors.RFCCodeText("DFLOW:ErrJobNotTerminated"), 355 ) 356 ErrJobNotRunning = errors.Normalize( 357 "job %s is not running", 358 errors.RFCCodeText("DFLOW:ErrJobNotRunning"), 359 ) 360 361 // metastore related errors 362 ErrMetaStoreNotExists = errors.Normalize( 363 "metastore %s does not exist", 364 errors.RFCCodeText("DFLOW:ErrMetaStoreNotExists"), 365 ) 366 367 // cli related errors 368 ErrInvalidCliParameter = errors.Normalize( 369 "invalid cli parameters", 370 errors.RFCCodeText("DFLOW:ErrInvalidCliParameter"), 371 ) 372 373 ErrIncompatibleSchedulerRequest = errors.Normalize( 374 "incompatible scheduler request: %s", 375 errors.RFCCodeText("DFLOW:ErrIncompatibleSchedulerRequest"), 376 ) 377 ErrDispatchTaskRequestIDNotFound = errors.Normalize( 378 "dispatch task request id %s not found", 379 errors.RFCCodeText("DFLOW:ErrDispatchTaskRequestIDNotFound"), 380 ) 381 ErrElectionRecordConflict = errors.Normalize( 382 "election record conflict", 383 errors.RFCCodeText("DFLOW:ErrElectionRecordConflict"), 384 ) 385 ErrDeserializeConfig = errors.Normalize( 386 "deserialize config failed", 387 errors.RFCCodeText("DFLOW:ErrDeserializeConfig"), 388 ) 389 )