Skip to main content

mito2/
error.rs

1// Copyright 2023 Greptime Team
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// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use std::any::Any;
16use std::sync::Arc;
17
18use common_datasource::compression::CompressionType;
19use common_error::ext::{BoxedError, ErrorExt, RetryHint};
20use common_error::status_code::StatusCode;
21use common_macro::stack_trace_debug;
22use common_memory_manager;
23use common_runtime::JoinError;
24use common_time::Timestamp;
25use common_time::timestamp::TimeUnit;
26use datatypes::arrow::error::ArrowError;
27use datatypes::prelude::ConcreteDataType;
28use object_store::ErrorKind;
29use object_store::error::retry_hint_from_opendal_error;
30use partition::error::Error as PartitionError;
31use prost::DecodeError;
32use snafu::{Location, Snafu};
33use store_api::ManifestVersion;
34use store_api::logstore::provider::Provider;
35use store_api::storage::{FileId, RegionId};
36use tokio::time::error::Elapsed;
37
38use crate::cache::file_cache::FileType;
39use crate::region::RegionRoleState;
40use crate::schedule::remote_job_scheduler::JobId;
41use crate::worker::WorkerId;
42
43#[derive(Snafu)]
44#[snafu(visibility(pub))]
45#[stack_trace_debug]
46pub enum Error {
47    #[snafu(display("Unexpected data type"))]
48    DataTypeMismatch {
49        source: datatypes::error::Error,
50        #[snafu(implicit)]
51        location: Location,
52    },
53
54    #[snafu(display("External error, context: {}", context))]
55    External {
56        source: BoxedError,
57        context: String,
58        #[snafu(implicit)]
59        location: Location,
60    },
61
62    #[snafu(display("OpenDAL operator failed"))]
63    OpenDal {
64        #[snafu(implicit)]
65        location: Location,
66        #[snafu(source)]
67        error: object_store::Error,
68    },
69
70    #[snafu(display("Fail to compress object by {}, path: {}", compress_type, path))]
71    CompressObject {
72        compress_type: CompressionType,
73        path: String,
74        #[snafu(source)]
75        error: std::io::Error,
76    },
77
78    #[snafu(display("Fail to decompress object by {}, path: {}", compress_type, path))]
79    DecompressObject {
80        compress_type: CompressionType,
81        path: String,
82        #[snafu(source)]
83        error: std::io::Error,
84    },
85
86    #[snafu(display("Failed to ser/de json object"))]
87    SerdeJson {
88        #[snafu(implicit)]
89        location: Location,
90        #[snafu(source)]
91        error: serde_json::Error,
92    },
93
94    #[snafu(display("Failed to serialize column metadata"))]
95    SerializeColumnMetadata {
96        #[snafu(source)]
97        error: serde_json::Error,
98        #[snafu(implicit)]
99        location: Location,
100    },
101
102    #[snafu(display("Failed to serialize manifest, region_id: {}", region_id))]
103    SerializeManifest {
104        region_id: RegionId,
105        #[snafu(source)]
106        error: serde_json::Error,
107        #[snafu(implicit)]
108        location: Location,
109    },
110
111    #[snafu(display("Invalid scan index, start: {}, end: {}", start, end))]
112    InvalidScanIndex {
113        start: ManifestVersion,
114        end: ManifestVersion,
115        #[snafu(implicit)]
116        location: Location,
117    },
118
119    #[snafu(display("Invalid UTF-8 content"))]
120    Utf8 {
121        #[snafu(implicit)]
122        location: Location,
123        #[snafu(source)]
124        error: std::str::Utf8Error,
125    },
126
127    #[snafu(display("Cannot find RegionMetadata"))]
128    RegionMetadataNotFound {
129        #[snafu(implicit)]
130        location: Location,
131    },
132
133    #[snafu(display("Failed to join handle"))]
134    Join {
135        #[snafu(source)]
136        error: common_runtime::JoinError,
137        #[snafu(implicit)]
138        location: Location,
139    },
140
141    #[snafu(display("Worker {} is stopped", id))]
142    WorkerStopped {
143        id: WorkerId,
144        #[snafu(implicit)]
145        location: Location,
146    },
147
148    #[snafu(display("Failed to recv result"))]
149    Recv {
150        #[snafu(source)]
151        error: tokio::sync::oneshot::error::RecvError,
152        #[snafu(implicit)]
153        location: Location,
154    },
155
156    #[snafu(display("Invalid metadata, {}", reason))]
157    InvalidMeta {
158        reason: String,
159        #[snafu(implicit)]
160        location: Location,
161    },
162
163    #[snafu(display("Invalid region metadata"))]
164    InvalidMetadata {
165        source: store_api::metadata::MetadataError,
166        #[snafu(implicit)]
167        location: Location,
168    },
169
170    #[snafu(display("Failed to create RecordBatch from vectors"))]
171    NewRecordBatch {
172        #[snafu(implicit)]
173        location: Location,
174        #[snafu(source)]
175        error: ArrowError,
176    },
177
178    #[snafu(display("Failed to read parquet file, path: {}", path))]
179    ReadParquet {
180        path: String,
181        #[snafu(source)]
182        error: parquet::errors::ParquetError,
183        #[snafu(implicit)]
184        location: Location,
185    },
186
187    #[snafu(display("Failed to write parquet file"))]
188    WriteParquet {
189        #[snafu(source)]
190        error: parquet::errors::ParquetError,
191        #[snafu(implicit)]
192        location: Location,
193    },
194
195    #[snafu(display(
196        "Cannot assign a stable field id to native histogram sub-field '{}' of column id {} (unknown sub-field name or derived id overflows i32)",
197        field_name,
198        column_id
199    ))]
200    InvalidNativeHistogramSubfield {
201        column_id: i32,
202        field_name: String,
203        #[snafu(implicit)]
204        location: Location,
205    },
206
207    #[snafu(display(
208        "Native histogram column '{}' has no usable PARQUET:field_id to namespace its sub-field ids (missing, malformed, or exceeds i32::MAX)",
209        field_name
210    ))]
211    InvalidNativeHistogramFieldId {
212        field_name: String,
213        #[snafu(implicit)]
214        location: Location,
215    },
216
217    #[snafu(display("Region {} not found", region_id))]
218    RegionNotFound {
219        region_id: RegionId,
220        #[snafu(implicit)]
221        location: Location,
222    },
223
224    #[snafu(display("Object store not found: {}", object_store))]
225    ObjectStoreNotFound {
226        object_store: String,
227        #[snafu(implicit)]
228        location: Location,
229    },
230
231    #[snafu(display("Region {} is corrupted, reason: {}", region_id, reason))]
232    RegionCorrupted {
233        region_id: RegionId,
234        reason: String,
235        #[snafu(implicit)]
236        location: Location,
237    },
238
239    #[snafu(display("Invalid request to region {}, reason: {}", region_id, reason))]
240    InvalidRequest {
241        region_id: RegionId,
242        reason: String,
243        #[snafu(implicit)]
244        location: Location,
245    },
246
247    #[snafu(display(
248        "STALE_CURSOR: incremental query stale, region: {}, given_seq: {}, min_readable_seq: {}, retry_hint: FALLBACK_FULL_RECOMPUTE",
249        region_id,
250        given_seq,
251        min_readable_seq
252    ))]
253    IncrementalQueryStale {
254        region_id: RegionId,
255        given_seq: u64,
256        min_readable_seq: u64,
257        #[snafu(implicit)]
258        location: Location,
259    },
260
261    #[snafu(display(
262        "STALE_SNAPSHOT_FENCE: snapshot upper bound stale, region: {}, given_seq: {}, min_enforceable_seq: {}, retry_hint: REBIND_SNAPSHOT_FENCE",
263        region_id,
264        given_seq,
265        min_enforceable_seq
266    ))]
267    SnapshotFenceStale {
268        region_id: RegionId,
269        given_seq: u64,
270        min_enforceable_seq: u64,
271        #[snafu(implicit)]
272        location: Location,
273    },
274
275    #[snafu(display("Old manifest missing for region {}", region_id))]
276    MissingOldManifest {
277        region_id: RegionId,
278        #[snafu(implicit)]
279        location: Location,
280    },
281
282    #[snafu(display("New manifest missing for region {}", region_id))]
283    MissingNewManifest {
284        region_id: RegionId,
285        #[snafu(implicit)]
286        location: Location,
287    },
288
289    #[snafu(display("Manifest missing for region {}", region_id))]
290    MissingManifest {
291        region_id: RegionId,
292        #[snafu(implicit)]
293        location: Location,
294    },
295
296    #[snafu(display("File consistency check failed for file {}: {}", file_id, reason))]
297    InconsistentFile {
298        file_id: FileId,
299        reason: String,
300        #[snafu(implicit)]
301        location: Location,
302    },
303
304    #[snafu(display("Files lost during remapping: old={}, new={}", old_count, new_count))]
305    FilesLost {
306        old_count: usize,
307        new_count: usize,
308        #[snafu(implicit)]
309        location: Location,
310    },
311
312    #[snafu(display("No old manifests provided (need at least one for template)"))]
313    NoOldManifests {
314        #[snafu(implicit)]
315        location: Location,
316    },
317
318    #[snafu(display("Failed to fetch manifests"))]
319    FetchManifests {
320        #[snafu(implicit)]
321        location: Location,
322        source: BoxedError,
323    },
324
325    #[snafu(display("Partition expression missing for region {}", region_id))]
326    MissingPartitionExpr {
327        region_id: RegionId,
328        #[snafu(implicit)]
329        location: Location,
330    },
331
332    #[snafu(display("Failed to serialize partition expression: {}", source))]
333    SerializePartitionExpr {
334        #[snafu(source)]
335        source: PartitionError,
336        #[snafu(implicit)]
337        location: Location,
338    },
339
340    #[snafu(display(
341        "Failed to convert ConcreteDataType to ColumnDataType, reason: {}",
342        reason
343    ))]
344    ConvertColumnDataType {
345        reason: String,
346        source: api::error::Error,
347        #[snafu(implicit)]
348        location: Location,
349    },
350
351    /// An error type to indicate that schema is changed and we need
352    /// to fill default values again.
353    #[snafu(display("Need to fill default value for region {}", region_id))]
354    FillDefault {
355        region_id: RegionId,
356        // The error is for internal use so we don't need a location.
357    },
358
359    #[snafu(display(
360        "Failed to create default value for column {} of region {}",
361        column,
362        region_id
363    ))]
364    CreateDefault {
365        region_id: RegionId,
366        column: String,
367        source: datatypes::Error,
368        #[snafu(implicit)]
369        location: Location,
370    },
371
372    #[snafu(display("Failed to build entry, region_id: {}", region_id))]
373    BuildEntry {
374        region_id: RegionId,
375        #[snafu(implicit)]
376        location: Location,
377        source: BoxedError,
378    },
379
380    #[snafu(display("Failed to write WAL"))]
381    WriteWal {
382        #[snafu(implicit)]
383        location: Location,
384        source: BoxedError,
385    },
386
387    #[snafu(display("Failed to read WAL, provider: {}", provider))]
388    ReadWal {
389        provider: Provider,
390        #[snafu(implicit)]
391        location: Location,
392        source: BoxedError,
393    },
394
395    #[snafu(display("Failed to decode WAL entry, region_id: {}", region_id))]
396    DecodeWal {
397        region_id: RegionId,
398        #[snafu(implicit)]
399        location: Location,
400        #[snafu(source)]
401        error: DecodeError,
402    },
403
404    #[snafu(display("Failed to delete WAL, region_id: {}", region_id))]
405    DeleteWal {
406        region_id: RegionId,
407        #[snafu(implicit)]
408        location: Location,
409        source: BoxedError,
410    },
411
412    // Shared error for each writer in the write group.
413    #[snafu(display("Failed to write region"))]
414    WriteGroup { source: Arc<Error> },
415
416    #[snafu(display("Invalid parquet SST file {}, reason: {}", file, reason))]
417    InvalidParquet {
418        file: String,
419        reason: String,
420        #[snafu(implicit)]
421        location: Location,
422    },
423
424    #[snafu(display("Invalid batch, {}", reason))]
425    InvalidBatch {
426        reason: String,
427        #[snafu(implicit)]
428        location: Location,
429    },
430
431    #[snafu(display("Invalid arrow record batch, {}", reason))]
432    InvalidRecordBatch {
433        reason: String,
434        #[snafu(implicit)]
435        location: Location,
436    },
437
438    #[snafu(display("Invalid wal read request, {}", reason))]
439    InvalidWalReadRequest {
440        reason: String,
441        #[snafu(implicit)]
442        location: Location,
443    },
444
445    #[snafu(display("Failed to convert array to vector"))]
446    ConvertVector {
447        #[snafu(implicit)]
448        location: Location,
449        source: datatypes::error::Error,
450    },
451
452    #[snafu(display("Failed to compute arrow arrays"))]
453    ComputeArrow {
454        #[snafu(implicit)]
455        location: Location,
456        #[snafu(source)]
457        error: datatypes::arrow::error::ArrowError,
458    },
459
460    #[snafu(display("Failed to evaluate partition filter"))]
461    EvalPartitionFilter {
462        #[snafu(implicit)]
463        location: Location,
464        #[snafu(source)]
465        error: datafusion::error::DataFusionError,
466    },
467
468    #[snafu(display("Failed to merge candidate series"))]
469    MergeCandidateSeries {
470        #[snafu(implicit)]
471        location: Location,
472        #[snafu(source)]
473        error: datafusion::error::DataFusionError,
474    },
475
476    #[snafu(display("Failed to compute vector"))]
477    ComputeVector {
478        #[snafu(implicit)]
479        location: Location,
480        source: datatypes::error::Error,
481    },
482
483    #[snafu(display("Primary key length mismatch, expect: {}, actual: {}", expect, actual))]
484    PrimaryKeyLengthMismatch {
485        expect: usize,
486        actual: usize,
487        #[snafu(implicit)]
488        location: Location,
489    },
490
491    #[snafu(display("Invalid sender",))]
492    InvalidSender {
493        #[snafu(implicit)]
494        location: Location,
495    },
496
497    #[snafu(display("Invalid scheduler state"))]
498    InvalidSchedulerState {
499        #[snafu(implicit)]
500        location: Location,
501    },
502
503    #[snafu(display("Failed to stop scheduler"))]
504    StopScheduler {
505        #[snafu(source)]
506        error: JoinError,
507        #[snafu(implicit)]
508        location: Location,
509    },
510
511    #[snafu(display(
512        "Failed to batch delete SST files, region id: {}, file ids: {:?}",
513        region_id,
514        file_ids
515    ))]
516    DeleteSsts {
517        region_id: RegionId,
518        file_ids: Vec<FileId>,
519        #[snafu(source)]
520        error: object_store::Error,
521        #[snafu(implicit)]
522        location: Location,
523    },
524
525    #[snafu(display("Failed to delete index file, file id: {}", file_id))]
526    DeleteIndex {
527        file_id: FileId,
528        #[snafu(source)]
529        error: object_store::Error,
530        #[snafu(implicit)]
531        location: Location,
532    },
533
534    #[snafu(display("Failed to batch delete index files, file ids: {:?}", file_ids))]
535    DeleteIndexes {
536        file_ids: Vec<FileId>,
537        #[snafu(source)]
538        error: object_store::Error,
539        #[snafu(implicit)]
540        location: Location,
541    },
542
543    #[snafu(display("Failed to flush region {}", region_id))]
544    FlushRegion {
545        region_id: RegionId,
546        source: Arc<Error>,
547        #[snafu(implicit)]
548        location: Location,
549    },
550
551    #[snafu(display("Region {} is dropped", region_id))]
552    RegionDropped {
553        region_id: RegionId,
554        #[snafu(implicit)]
555        location: Location,
556    },
557
558    #[snafu(display("Region {} is closed", region_id))]
559    RegionClosed {
560        region_id: RegionId,
561        #[snafu(implicit)]
562        location: Location,
563    },
564
565    #[snafu(display(
566        "Stale compaction execution for region {}, the region may have been reopened, truncated or the compaction was superseded",
567        region_id
568    ))]
569    StaleCompactionExecution {
570        region_id: RegionId,
571        #[snafu(implicit)]
572        location: Location,
573    },
574
575    #[snafu(display("Region {} is truncated", region_id))]
576    RegionTruncated {
577        region_id: RegionId,
578        #[snafu(implicit)]
579        location: Location,
580    },
581
582    #[snafu(display(
583        "Engine write buffer is full, rejecting write requests of region {}",
584        region_id,
585    ))]
586    RejectWrite {
587        region_id: RegionId,
588        #[snafu(implicit)]
589        location: Location,
590    },
591
592    #[snafu(display("Failed to compact region {}", region_id))]
593    CompactRegion {
594        region_id: RegionId,
595        source: Arc<Error>,
596        #[snafu(implicit)]
597        location: Location,
598    },
599
600    #[snafu(display("Failed to edit region {}", region_id))]
601    EditRegion {
602        region_id: RegionId,
603        source: Arc<Error>,
604        #[snafu(implicit)]
605        location: Location,
606    },
607
608    #[snafu(display(
609        "Failed to compat readers for region {}, reason: {}",
610        region_id,
611        reason,
612    ))]
613    CompatReader {
614        region_id: RegionId,
615        reason: String,
616        #[snafu(implicit)]
617        location: Location,
618    },
619
620    #[snafu(display("Invalue region req"))]
621    InvalidRegionRequest {
622        source: store_api::metadata::MetadataError,
623        #[snafu(implicit)]
624        location: Location,
625    },
626
627    #[snafu(display(
628        "Region {} is in {:?} state, which does not permit manifest updates.",
629        region_id,
630        state
631    ))]
632    UpdateManifest {
633        region_id: RegionId,
634        state: RegionRoleState,
635        #[snafu(implicit)]
636        location: Location,
637    },
638
639    #[snafu(display("Region {} is in {:?} state, expect: {:?}", region_id, state, expect))]
640    RegionState {
641        region_id: RegionId,
642        state: RegionRoleState,
643        expect: RegionRoleState,
644        #[snafu(implicit)]
645        location: Location,
646    },
647
648    #[snafu(display(
649        "Partition expr version mismatch for region {}: request {}, expected {}",
650        region_id,
651        request_version,
652        expected_version
653    ))]
654    PartitionExprVersionMismatch {
655        region_id: RegionId,
656        request_version: u64,
657        expected_version: u64,
658        #[snafu(implicit)]
659        location: Location,
660    },
661
662    #[snafu(display("Invalid options"))]
663    JsonOptions {
664        #[snafu(source)]
665        error: serde_json::Error,
666        #[snafu(implicit)]
667        location: Location,
668    },
669
670    #[snafu(display(
671        "Empty region directory, region_id: {}, region_dir: {}",
672        region_id,
673        region_dir,
674    ))]
675    EmptyRegionDir {
676        region_id: RegionId,
677        region_dir: String,
678        #[snafu(implicit)]
679        location: Location,
680    },
681
682    #[snafu(display("Empty manifest directory, manifest_dir: {}", manifest_dir,))]
683    EmptyManifestDir {
684        manifest_dir: String,
685        #[snafu(implicit)]
686        location: Location,
687    },
688
689    #[snafu(display("Column not found, column: {column}"))]
690    ColumnNotFound {
691        column: String,
692        #[snafu(implicit)]
693        location: Location,
694    },
695
696    #[snafu(display("Failed to build index applier"))]
697    BuildIndexApplier {
698        source: index::inverted_index::error::Error,
699        #[snafu(implicit)]
700        location: Location,
701    },
702
703    #[snafu(display("Failed to build index asynchronously in region {}", region_id))]
704    BuildIndexAsync {
705        region_id: RegionId,
706        source: Arc<Error>,
707        #[snafu(implicit)]
708        location: Location,
709    },
710
711    #[snafu(display("Failed to convert value"))]
712    ConvertValue {
713        source: datatypes::error::Error,
714        #[snafu(implicit)]
715        location: Location,
716    },
717
718    #[snafu(display("Failed to apply inverted index"))]
719    ApplyInvertedIndex {
720        source: index::inverted_index::error::Error,
721        #[snafu(implicit)]
722        location: Location,
723    },
724
725    #[snafu(display("Failed to apply bloom filter index"))]
726    ApplyBloomFilterIndex {
727        source: index::bloom_filter::error::Error,
728        #[snafu(implicit)]
729        location: Location,
730    },
731
732    #[cfg(feature = "vector_index")]
733    #[snafu(display("Failed to apply vector index: {}", reason))]
734    ApplyVectorIndex {
735        reason: String,
736        #[snafu(implicit)]
737        location: Location,
738    },
739
740    #[snafu(display("Failed to push index value"))]
741    PushIndexValue {
742        source: index::inverted_index::error::Error,
743        #[snafu(implicit)]
744        location: Location,
745    },
746
747    #[snafu(display("Failed to write index completely"))]
748    IndexFinish {
749        source: index::inverted_index::error::Error,
750        #[snafu(implicit)]
751        location: Location,
752    },
753
754    #[snafu(display("Operate on aborted index"))]
755    OperateAbortedIndex {
756        #[snafu(implicit)]
757        location: Location,
758    },
759
760    #[snafu(display("Failed to read puffin blob"))]
761    PuffinReadBlob {
762        source: puffin::error::Error,
763        #[snafu(implicit)]
764        location: Location,
765    },
766
767    #[snafu(display("Failed to add blob to puffin file"))]
768    PuffinAddBlob {
769        source: puffin::error::Error,
770        #[snafu(implicit)]
771        location: Location,
772    },
773
774    #[snafu(display("Failed to clean dir {dir}"))]
775    CleanDir {
776        dir: String,
777        #[snafu(source)]
778        error: std::io::Error,
779        #[snafu(implicit)]
780        location: Location,
781    },
782
783    #[snafu(display("Invalid config, {reason}"))]
784    InvalidConfig {
785        reason: String,
786        #[snafu(implicit)]
787        location: Location,
788    },
789
790    #[snafu(display(
791        "Stale log entry found during replay, region: {}, flushed: {}, replayed: {}",
792        region_id,
793        flushed_entry_id,
794        unexpected_entry_id
795    ))]
796    StaleLogEntry {
797        region_id: RegionId,
798        flushed_entry_id: u64,
799        unexpected_entry_id: u64,
800    },
801
802    #[snafu(display(
803        "Failed to download file, region_id: {}, file_id: {}, file_type: {:?}",
804        region_id,
805        file_id,
806        file_type,
807    ))]
808    Download {
809        region_id: RegionId,
810        file_id: FileId,
811        file_type: FileType,
812        #[snafu(source)]
813        error: std::io::Error,
814        #[snafu(implicit)]
815        location: Location,
816    },
817
818    #[snafu(display(
819        "Failed to upload file, region_id: {}, file_id: {}, file_type: {:?}",
820        region_id,
821        file_id,
822        file_type,
823    ))]
824    Upload {
825        region_id: RegionId,
826        file_id: FileId,
827        file_type: FileType,
828        #[snafu(source)]
829        error: std::io::Error,
830        #[snafu(implicit)]
831        location: Location,
832    },
833
834    #[snafu(display("Failed to create directory {}", dir))]
835    CreateDir {
836        dir: String,
837        #[snafu(source)]
838        error: std::io::Error,
839    },
840
841    #[snafu(display("Record batch error"))]
842    RecordBatch {
843        source: common_recordbatch::error::Error,
844        #[snafu(implicit)]
845        location: Location,
846    },
847
848    #[snafu(display("BiErrors, first: {first}, second: {second}"))]
849    BiErrors {
850        first: Box<Error>,
851        second: Box<Error>,
852        #[snafu(implicit)]
853        location: Location,
854    },
855
856    #[snafu(display("Encode null value"))]
857    IndexEncodeNull {
858        #[snafu(implicit)]
859        location: Location,
860    },
861
862    #[snafu(display("Failed to encode memtable to Parquet bytes"))]
863    EncodeMemtable {
864        #[snafu(source)]
865        error: parquet::errors::ParquetError,
866        #[snafu(implicit)]
867        location: Location,
868    },
869
870    #[snafu(display("Partition {} out of range, {} in total", given, all))]
871    PartitionOutOfRange {
872        given: usize,
873        all: usize,
874        #[snafu(implicit)]
875        location: Location,
876    },
877
878    #[snafu(display("Failed to iter data part"))]
879    ReadDataPart {
880        #[snafu(implicit)]
881        location: Location,
882        #[snafu(source)]
883        error: parquet::errors::ParquetError,
884    },
885
886    #[snafu(display("Failed to read row group in memtable"))]
887    DecodeArrowRowGroup {
888        #[snafu(source)]
889        error: ArrowError,
890        #[snafu(implicit)]
891        location: Location,
892    },
893
894    #[snafu(display("Invalid region options, {}", reason))]
895    InvalidRegionOptions {
896        reason: String,
897        #[snafu(implicit)]
898        location: Location,
899    },
900
901    #[snafu(display("checksum mismatch (actual: {}, expected: {})", actual, expected))]
902    ChecksumMismatch { actual: u32, expected: u32 },
903
904    #[snafu(display(
905        "No checkpoint found, region: {}, last_version: {}",
906        region_id,
907        last_version
908    ))]
909    NoCheckpoint {
910        region_id: RegionId,
911        last_version: ManifestVersion,
912        #[snafu(implicit)]
913        location: Location,
914    },
915
916    #[snafu(display(
917        "No manifests found in range: [{}..{}), region: {}, last_version: {}",
918        start_version,
919        end_version,
920        region_id,
921        last_version
922    ))]
923    NoManifests {
924        region_id: RegionId,
925        start_version: ManifestVersion,
926        end_version: ManifestVersion,
927        last_version: ManifestVersion,
928        #[snafu(implicit)]
929        location: Location,
930    },
931
932    #[snafu(display(
933        "Failed to install manifest to {}, region: {}, available manifest version: {}, last version: {}",
934        target_version,
935        region_id,
936        available_version,
937        last_version
938    ))]
939    InstallManifestTo {
940        region_id: RegionId,
941        target_version: ManifestVersion,
942        available_version: ManifestVersion,
943        #[snafu(implicit)]
944        location: Location,
945        last_version: ManifestVersion,
946    },
947
948    #[snafu(display("Region {} is stopped", region_id))]
949    RegionStopped {
950        region_id: RegionId,
951        #[snafu(implicit)]
952        location: Location,
953    },
954
955    #[snafu(display(
956        "Time range predicate overflows, timestamp: {:?}, target unit: {}",
957        timestamp,
958        unit
959    ))]
960    TimeRangePredicateOverflow {
961        timestamp: Timestamp,
962        unit: TimeUnit,
963        #[snafu(implicit)]
964        location: Location,
965    },
966
967    #[snafu(display("Failed to open region"))]
968    OpenRegion {
969        #[snafu(implicit)]
970        location: Location,
971        source: Arc<Error>,
972    },
973
974    #[snafu(display(
975        "Region {} does not satisfy requirement '{}': {}",
976        region_id,
977        requirement,
978        reason
979    ))]
980    RegionRequirement {
981        region_id: RegionId,
982        requirement: &'static str,
983        reason: &'static str,
984        #[snafu(implicit)]
985        location: Location,
986    },
987
988    #[snafu(display("Failed to parse job id"))]
989    ParseJobId {
990        #[snafu(implicit)]
991        location: Location,
992        #[snafu(source)]
993        error: uuid::Error,
994    },
995
996    #[snafu(display("Operation is not supported: {}", err_msg))]
997    UnsupportedOperation {
998        err_msg: String,
999        #[snafu(implicit)]
1000        location: Location,
1001    },
1002
1003    #[snafu(display(
1004        "Failed to remotely compact region {} by job {:?} due to {}",
1005        region_id,
1006        job_id,
1007        reason
1008    ))]
1009    RemoteCompaction {
1010        region_id: RegionId,
1011        job_id: Option<JobId>,
1012        reason: String,
1013        #[snafu(implicit)]
1014        location: Location,
1015    },
1016
1017    #[snafu(display("Failed to initialize puffin stager"))]
1018    PuffinInitStager {
1019        source: puffin::error::Error,
1020        #[snafu(implicit)]
1021        location: Location,
1022    },
1023
1024    #[snafu(display("Failed to purge puffin stager"))]
1025    PuffinPurgeStager {
1026        source: puffin::error::Error,
1027        #[snafu(implicit)]
1028        location: Location,
1029    },
1030
1031    #[snafu(display("Failed to build puffin reader"))]
1032    PuffinBuildReader {
1033        source: puffin::error::Error,
1034        #[snafu(implicit)]
1035        location: Location,
1036    },
1037
1038    #[snafu(display("Failed to retrieve index options from column metadata"))]
1039    IndexOptions {
1040        #[snafu(implicit)]
1041        location: Location,
1042        source: datatypes::error::Error,
1043        column_name: String,
1044    },
1045
1046    #[snafu(display("Failed to create fulltext index creator"))]
1047    CreateFulltextCreator {
1048        source: index::fulltext_index::error::Error,
1049        #[snafu(implicit)]
1050        location: Location,
1051    },
1052
1053    #[snafu(display("Failed to cast vector of {from} to {to}"))]
1054    CastVector {
1055        #[snafu(implicit)]
1056        location: Location,
1057        from: ConcreteDataType,
1058        to: ConcreteDataType,
1059        source: datatypes::error::Error,
1060    },
1061
1062    #[snafu(display("Failed to push text to fulltext index"))]
1063    FulltextPushText {
1064        source: index::fulltext_index::error::Error,
1065        #[snafu(implicit)]
1066        location: Location,
1067    },
1068
1069    #[snafu(display("Failed to finalize fulltext index creator"))]
1070    FulltextFinish {
1071        source: index::fulltext_index::error::Error,
1072        #[snafu(implicit)]
1073        location: Location,
1074    },
1075
1076    #[snafu(display("Failed to apply fulltext index"))]
1077    ApplyFulltextIndex {
1078        source: index::fulltext_index::error::Error,
1079        #[snafu(implicit)]
1080        location: Location,
1081    },
1082
1083    #[snafu(display("SST file {} does not contain valid stats info", file_path))]
1084    StatsNotPresent {
1085        file_path: String,
1086        #[snafu(implicit)]
1087        location: Location,
1088    },
1089
1090    #[snafu(display("Failed to decode stats of file {}", file_path))]
1091    DecodeStats {
1092        file_path: String,
1093        #[snafu(implicit)]
1094        location: Location,
1095    },
1096
1097    #[snafu(display("Region {} is busy", region_id))]
1098    RegionBusy {
1099        region_id: RegionId,
1100        #[snafu(implicit)]
1101        location: Location,
1102    },
1103
1104    #[snafu(display("Failed to get schema metadata"))]
1105    GetSchemaMetadata {
1106        source: common_meta::error::Error,
1107        #[snafu(implicit)]
1108        location: Location,
1109    },
1110
1111    #[snafu(display("Timeout"))]
1112    Timeout {
1113        #[snafu(source)]
1114        error: Elapsed,
1115        #[snafu(implicit)]
1116        location: Location,
1117    },
1118
1119    #[snafu(display("Failed to read file metadata"))]
1120    Metadata {
1121        #[snafu(source)]
1122        error: std::io::Error,
1123        #[snafu(implicit)]
1124        location: Location,
1125    },
1126
1127    #[snafu(display("Failed to push value to bloom filter"))]
1128    PushBloomFilterValue {
1129        source: index::bloom_filter::error::Error,
1130        #[snafu(implicit)]
1131        location: Location,
1132    },
1133
1134    #[snafu(display("Failed to finish bloom filter"))]
1135    BloomFilterFinish {
1136        source: index::bloom_filter::error::Error,
1137        #[snafu(implicit)]
1138        location: Location,
1139    },
1140
1141    #[cfg(feature = "vector_index")]
1142    #[snafu(display("Failed to build vector index: {}", reason))]
1143    VectorIndexBuild {
1144        reason: String,
1145        #[snafu(implicit)]
1146        location: Location,
1147    },
1148
1149    #[cfg(feature = "vector_index")]
1150    #[snafu(display("Failed to finish vector index: {}", reason))]
1151    VectorIndexFinish {
1152        reason: String,
1153        #[snafu(implicit)]
1154        location: Location,
1155    },
1156
1157    #[snafu(display("Manual compaction is override by following operations."))]
1158    ManualCompactionOverride {},
1159
1160    #[snafu(display("Compaction is cancelled."))]
1161    CompactionCancelled {},
1162
1163    #[snafu(display("Compaction memory exhausted for region {region_id} (policy: {policy})",))]
1164    CompactionMemoryExhausted {
1165        region_id: RegionId,
1166        policy: String,
1167        #[snafu(source)]
1168        source: common_memory_manager::Error,
1169        #[snafu(implicit)]
1170        location: Location,
1171    },
1172
1173    #[snafu(display(
1174        "Incompatible WAL provider change. This is typically caused by changing WAL provider in database config file without completely cleaning existing files. Global provider: {}, region provider: {}",
1175        global,
1176        region
1177    ))]
1178    IncompatibleWalProviderChange { global: String, region: String },
1179
1180    #[snafu(display("Expected mito manifest info"))]
1181    MitoManifestInfo {
1182        #[snafu(implicit)]
1183        location: Location,
1184    },
1185
1186    #[snafu(display("Failed to scan series"))]
1187    ScanSeries {
1188        #[snafu(implicit)]
1189        location: Location,
1190        source: Arc<Error>,
1191    },
1192
1193    #[snafu(display("Partition {} scan multiple times", partition))]
1194    ScanMultiTimes {
1195        partition: usize,
1196        #[snafu(implicit)]
1197        location: Location,
1198    },
1199
1200    #[snafu(display("Invalid partition expression: {}", expr))]
1201    InvalidPartitionExpr {
1202        expr: String,
1203        #[snafu(implicit)]
1204        location: Location,
1205        source: partition::error::Error,
1206    },
1207
1208    #[snafu(display("Failed to decode bulk wal entry"))]
1209    ConvertBulkWalEntry {
1210        #[snafu(implicit)]
1211        location: Location,
1212        source: common_grpc::Error,
1213    },
1214
1215    #[snafu(display("Failed to encode"))]
1216    Encode {
1217        #[snafu(implicit)]
1218        location: Location,
1219        source: mito_codec::error::Error,
1220    },
1221
1222    #[snafu(display("Failed to decode"))]
1223    Decode {
1224        #[snafu(implicit)]
1225        location: Location,
1226        source: mito_codec::error::Error,
1227    },
1228
1229    #[snafu(display("Unexpected: {reason}"))]
1230    Unexpected {
1231        reason: String,
1232        #[snafu(implicit)]
1233        location: Location,
1234    },
1235
1236    #[cfg(feature = "enterprise")]
1237    #[snafu(display("Failed to scan external range"))]
1238    ScanExternalRange {
1239        source: BoxedError,
1240        #[snafu(implicit)]
1241        location: Location,
1242    },
1243
1244    #[snafu(display(
1245        "Inconsistent timestamp column length, expect: {}, actual: {}",
1246        expected,
1247        actual
1248    ))]
1249    InconsistentTimestampLength {
1250        expected: usize,
1251        actual: usize,
1252        #[snafu(implicit)]
1253        location: Location,
1254    },
1255
1256    #[snafu(display(
1257        "Too many files to read concurrently: {}, max allowed: {}",
1258        actual,
1259        max
1260    ))]
1261    TooManyFilesToRead {
1262        actual: usize,
1263        max: usize,
1264        #[snafu(implicit)]
1265        location: Location,
1266    },
1267
1268    #[snafu(display("Duration out of range: {input:?}"))]
1269    DurationOutOfRange {
1270        input: std::time::Duration,
1271        #[snafu(source)]
1272        error: chrono::OutOfRangeError,
1273        #[snafu(implicit)]
1274        location: Location,
1275    },
1276
1277    #[snafu(display("GC job permit exhausted"))]
1278    TooManyGcJobs {
1279        #[snafu(implicit)]
1280        location: Location,
1281    },
1282
1283    #[snafu(display(
1284        "Staging partition expr mismatch, manifest: {:?}, request: {}",
1285        manifest_expr,
1286        request_expr
1287    ))]
1288    StagingPartitionExprMismatch {
1289        manifest_expr: Option<String>,
1290        request_expr: String,
1291        #[snafu(implicit)]
1292        location: Location,
1293    },
1294
1295    #[snafu(display(
1296        "Invalid source and target region, source: {}, target: {}",
1297        source_region_id,
1298        target_region_id
1299    ))]
1300    InvalidSourceAndTargetRegion {
1301        source_region_id: RegionId,
1302        target_region_id: RegionId,
1303        #[snafu(implicit)]
1304        location: Location,
1305    },
1306
1307    #[snafu(display("Failed to prune file"))]
1308    PruneFile {
1309        source: Arc<Error>,
1310        #[snafu(implicit)]
1311        location: Location,
1312    },
1313
1314    #[snafu(display("Failed to cast column"))]
1315    CastColumn {
1316        #[snafu(source)]
1317        error: datafusion::error::DataFusionError,
1318        #[snafu(implicit)]
1319        location: Location,
1320    },
1321
1322    #[snafu(display("Failed to generate Arrow schema from Parquet file: {}", file))]
1323    ParquetToArrowSchema {
1324        file: String,
1325        #[snafu(source)]
1326        error: parquet::errors::ParquetError,
1327        #[snafu(implicit)]
1328        location: Location,
1329    },
1330
1331    #[snafu(display(
1332        "Region {} is in {:?} state, expect: Writable, Staging or Downgrading",
1333        region_id,
1334        state
1335    ))]
1336    FlushableRegionState {
1337        region_id: RegionId,
1338        state: RegionRoleState,
1339        #[snafu(implicit)]
1340        location: Location,
1341    },
1342}
1343
1344pub type Result<T, E = Error> = std::result::Result<T, E>;
1345
1346impl Error {
1347    /// Returns true if we need to fill default value for a region.
1348    pub(crate) fn is_fill_default(&self) -> bool {
1349        matches!(self, Error::FillDefault { .. })
1350    }
1351
1352    /// Returns true if the file is not found on the object store.
1353    pub(crate) fn is_object_not_found(&self) -> bool {
1354        match self {
1355            Error::OpenDal { error, .. } => error.kind() == ErrorKind::NotFound,
1356            _ => false,
1357        }
1358    }
1359}
1360
1361impl ErrorExt for Error {
1362    fn status_code(&self) -> StatusCode {
1363        use Error::*;
1364
1365        match self {
1366            DataTypeMismatch { source, .. } => source.status_code(),
1367            OpenDal { .. } | ReadParquet { .. } => StatusCode::StorageUnavailable,
1368            WriteWal { source, .. } | ReadWal { source, .. } | DeleteWal { source, .. } => {
1369                source.status_code()
1370            }
1371            CompressObject { .. }
1372            | DecompressObject { .. }
1373            | SerdeJson { .. }
1374            | Utf8 { .. }
1375            | NewRecordBatch { .. }
1376            | RegionCorrupted { .. }
1377            | InconsistentFile { .. }
1378            | CreateDefault { .. }
1379            | InvalidParquet { .. }
1380            | OperateAbortedIndex { .. }
1381            | IndexEncodeNull { .. }
1382            | NoCheckpoint { .. }
1383            | NoManifests { .. }
1384            | FilesLost { .. }
1385            | InstallManifestTo { .. }
1386            | Unexpected { .. }
1387            | SerializeColumnMetadata { .. }
1388            | SerializeManifest { .. }
1389            | StagingPartitionExprMismatch { .. } => StatusCode::Unexpected,
1390
1391            RegionNotFound { .. } => StatusCode::RegionNotFound,
1392            ObjectStoreNotFound { .. }
1393            | InvalidScanIndex { .. }
1394            | InvalidMeta { .. }
1395            | InvalidRequest { .. }
1396            | PartitionExprVersionMismatch { .. }
1397            | FillDefault { .. }
1398            | ConvertColumnDataType { .. }
1399            | ColumnNotFound { .. }
1400            | InvalidMetadata { .. }
1401            | InvalidRegionOptions { .. }
1402            | InvalidWalReadRequest { .. }
1403            | PartitionOutOfRange { .. }
1404            | ParseJobId { .. }
1405            | DurationOutOfRange { .. }
1406            | MissingOldManifest { .. }
1407            | MissingNewManifest { .. }
1408            | MissingManifest { .. }
1409            | NoOldManifests { .. }
1410            | MissingPartitionExpr { .. }
1411            | SerializePartitionExpr { .. }
1412            | InvalidSourceAndTargetRegion { .. } => StatusCode::InvalidArguments,
1413
1414            IncrementalQueryStale { .. } | SnapshotFenceStale { .. } => StatusCode::RequestOutdated,
1415
1416            RegionMetadataNotFound { .. }
1417            | Join { .. }
1418            | WorkerStopped { .. }
1419            | Recv { .. }
1420            | DecodeWal { .. }
1421            | ComputeArrow { .. }
1422            | EvalPartitionFilter { .. }
1423            | MergeCandidateSeries { .. }
1424            | BiErrors { .. }
1425            | StopScheduler { .. }
1426            | ComputeVector { .. }
1427            | EncodeMemtable { .. }
1428            | CreateDir { .. }
1429            | ReadDataPart { .. }
1430            | BuildEntry { .. }
1431            | Metadata { .. }
1432            | CastColumn { .. }
1433            | MitoManifestInfo { .. }
1434            | ParquetToArrowSchema { .. } => StatusCode::Internal,
1435
1436            FetchManifests { source, .. } => source.status_code(),
1437
1438            OpenRegion { source, .. } => source.status_code(),
1439
1440            WriteParquet { .. } => StatusCode::StorageUnavailable,
1441            WriteGroup { source, .. } => source.status_code(),
1442            InvalidBatch { .. } => StatusCode::InvalidArguments,
1443            InvalidRecordBatch { .. } => StatusCode::InvalidArguments,
1444            ConvertVector { source, .. } => source.status_code(),
1445
1446            PrimaryKeyLengthMismatch { .. } => StatusCode::InvalidArguments,
1447            InvalidSender { .. } => StatusCode::InvalidArguments,
1448            InvalidSchedulerState { .. } => StatusCode::InvalidArguments,
1449            RegionRequirement { .. } => StatusCode::InvalidArguments,
1450            DeleteSsts { .. } | DeleteIndex { .. } | DeleteIndexes { .. } => {
1451                StatusCode::StorageUnavailable
1452            }
1453            FlushRegion { source, .. } | BuildIndexAsync { source, .. } => source.status_code(),
1454            RegionDropped { .. } => StatusCode::Cancelled,
1455            RegionClosed { .. } => StatusCode::Cancelled,
1456            StaleCompactionExecution { .. } => StatusCode::Cancelled,
1457            RegionTruncated { .. } => StatusCode::Cancelled,
1458            RejectWrite { .. } => StatusCode::StorageUnavailable,
1459            CompactRegion { source, .. } => source.status_code(),
1460            EditRegion { source, .. } => source.status_code(),
1461            CompatReader { .. } => StatusCode::Unexpected,
1462            InvalidRegionRequest { source, .. } => source.status_code(),
1463            RegionState { .. } | UpdateManifest { .. } => StatusCode::RegionNotReady,
1464            JsonOptions { .. } => StatusCode::InvalidArguments,
1465            EmptyRegionDir { .. } | EmptyManifestDir { .. } => StatusCode::RegionNotFound,
1466            ConvertValue { source, .. } => source.status_code(),
1467            ApplyBloomFilterIndex { source, .. } => source.status_code(),
1468            InvalidPartitionExpr { source, .. } => source.status_code(),
1469            BuildIndexApplier { source, .. }
1470            | PushIndexValue { source, .. }
1471            | ApplyInvertedIndex { source, .. }
1472            | IndexFinish { source, .. } => source.status_code(),
1473            #[cfg(feature = "vector_index")]
1474            ApplyVectorIndex { .. } => StatusCode::Internal,
1475            PuffinReadBlob { source, .. }
1476            | PuffinAddBlob { source, .. }
1477            | PuffinInitStager { source, .. }
1478            | PuffinBuildReader { source, .. }
1479            | PuffinPurgeStager { source, .. } => source.status_code(),
1480            CleanDir { .. } => StatusCode::Unexpected,
1481            InvalidConfig { .. } => StatusCode::InvalidArguments,
1482            StaleLogEntry { .. }
1483            | InvalidNativeHistogramSubfield { .. }
1484            | InvalidNativeHistogramFieldId { .. } => StatusCode::Unexpected,
1485
1486            External { source, .. } => source.status_code(),
1487
1488            RecordBatch { source, .. } => source.status_code(),
1489
1490            Download { .. } | Upload { .. } => StatusCode::StorageUnavailable,
1491            ChecksumMismatch { .. } => StatusCode::Unexpected,
1492            RegionStopped { .. } => StatusCode::RegionNotReady,
1493            TimeRangePredicateOverflow { .. } => StatusCode::InvalidArguments,
1494            UnsupportedOperation { .. } => StatusCode::Unsupported,
1495            RemoteCompaction { .. } => StatusCode::Unexpected,
1496
1497            IndexOptions { source, .. } => source.status_code(),
1498            CreateFulltextCreator { source, .. } => source.status_code(),
1499            CastVector { source, .. } => source.status_code(),
1500            FulltextPushText { source, .. }
1501            | FulltextFinish { source, .. }
1502            | ApplyFulltextIndex { source, .. } => source.status_code(),
1503            DecodeStats { .. } | StatsNotPresent { .. } => StatusCode::Internal,
1504            RegionBusy { .. } => StatusCode::RegionBusy,
1505            GetSchemaMetadata { source, .. } => source.status_code(),
1506            Timeout { .. } => StatusCode::Cancelled,
1507
1508            DecodeArrowRowGroup { .. } => StatusCode::Internal,
1509
1510            PushBloomFilterValue { source, .. } | BloomFilterFinish { source, .. } => {
1511                source.status_code()
1512            }
1513
1514            #[cfg(feature = "vector_index")]
1515            VectorIndexBuild { .. } | VectorIndexFinish { .. } => StatusCode::Internal,
1516
1517            ManualCompactionOverride {} | CompactionCancelled {} => StatusCode::Cancelled,
1518
1519            CompactionMemoryExhausted { source, .. } => source.status_code(),
1520
1521            IncompatibleWalProviderChange { .. } => StatusCode::InvalidArguments,
1522
1523            ScanSeries { source, .. } => source.status_code(),
1524
1525            ScanMultiTimes { .. } => StatusCode::InvalidArguments,
1526            ConvertBulkWalEntry { source, .. } => source.status_code(),
1527
1528            Encode { source, .. } | Decode { source, .. } => source.status_code(),
1529
1530            #[cfg(feature = "enterprise")]
1531            ScanExternalRange { source, .. } => source.status_code(),
1532
1533            InconsistentTimestampLength { .. } => StatusCode::InvalidArguments,
1534
1535            TooManyFilesToRead { .. } | TooManyGcJobs { .. } => StatusCode::RateLimited,
1536
1537            PruneFile { source, .. } => source.status_code(),
1538
1539            FlushableRegionState { .. } => StatusCode::RegionNotReady,
1540        }
1541    }
1542
1543    fn as_any(&self) -> &dyn Any {
1544        self
1545    }
1546
1547    fn retry_hint(&self) -> RetryHint {
1548        use Error::*;
1549
1550        match self {
1551            ReadParquet { .. }
1552            | WriteParquet { .. }
1553            | RejectWrite { .. }
1554            | Download { .. }
1555            | Upload { .. }
1556            | RegionState { .. }
1557            | UpdateManifest { .. }
1558            | RegionStopped { .. }
1559            | RegionBusy { .. }
1560            | FlushableRegionState { .. } => RetryHint::Retryable,
1561
1562            OpenDal { error, .. }
1563            | DeleteSsts { error, .. }
1564            | DeleteIndex { error, .. }
1565            | DeleteIndexes { error, .. } => retry_hint_from_opendal_error(error),
1566
1567            WriteWal { source, .. }
1568            | ReadWal { source, .. }
1569            | DeleteWal { source, .. }
1570            | FetchManifests { source, .. }
1571            | External { source, .. } => source.retry_hint(),
1572
1573            OpenRegion { source, .. }
1574            | WriteGroup { source, .. }
1575            | FlushRegion { source, .. }
1576            | BuildIndexAsync { source, .. }
1577            | CompactRegion { source, .. }
1578            | EditRegion { source, .. }
1579            | ScanSeries { source, .. }
1580            | PruneFile { source, .. } => source.retry_hint(),
1581
1582            DataTypeMismatch { source, .. }
1583            | ConvertVector { source, .. }
1584            | ConvertValue { source, .. }
1585            | IndexOptions { source, .. }
1586            | CastVector { source, .. } => source.retry_hint(),
1587
1588            BuildIndexApplier { source, .. }
1589            | PushIndexValue { source, .. }
1590            | ApplyInvertedIndex { source, .. }
1591            | IndexFinish { source, .. } => source.retry_hint(),
1592
1593            ApplyBloomFilterIndex { source, .. }
1594            | PushBloomFilterValue { source, .. }
1595            | BloomFilterFinish { source, .. } => source.retry_hint(),
1596
1597            PuffinReadBlob { source, .. }
1598            | PuffinAddBlob { source, .. }
1599            | PuffinInitStager { source, .. }
1600            | PuffinBuildReader { source, .. }
1601            | PuffinPurgeStager { source, .. } => source.retry_hint(),
1602
1603            CreateFulltextCreator { source, .. }
1604            | FulltextPushText { source, .. }
1605            | FulltextFinish { source, .. }
1606            | ApplyFulltextIndex { source, .. } => source.retry_hint(),
1607
1608            InvalidRegionRequest { source, .. } => source.retry_hint(),
1609            InvalidPartitionExpr { source, .. } => source.retry_hint(),
1610            RecordBatch { source, .. } => source.retry_hint(),
1611            GetSchemaMetadata { source, .. } => source.retry_hint(),
1612            CompactionMemoryExhausted { source, .. } => source.retry_hint(),
1613            ConvertBulkWalEntry { source, .. } => source.retry_hint(),
1614            Encode { source, .. } | Decode { source, .. } => source.retry_hint(),
1615
1616            #[cfg(feature = "enterprise")]
1617            ScanExternalRange { source, .. } => source.retry_hint(),
1618
1619            _ => RetryHint::NonRetryable,
1620        }
1621    }
1622}