Commit ae60a18
committed
docs(meta/errors): explain relationship between various error types in meta-store
- Refacotr: move meta-related error into `errors` mod.
Defines meta-store errors and meta-store application errors.
Error relations
The overall relations between errors defined in meta-store components are:
```text
KVAppError
|
+- AppError ------> TableNotFound
| DbExists
| ...
`- MetaError
|
+- MetaStorageError
|
+- MetaClientError
| |
| +- MetaNetworkError
| +- HandshakeError
|
+- MetaNetworkError
|
`- MetaApiError
|
+- ForwardToLeader -.
+- CanNotForward |
| |
+- MetaNetworkError |
| |
+- MetaDataError ---|-----------.
| | |
`- RemoteError ---|-----------+
| |
| |
| | MetaOperationError
| .---------|----------' |
| | | .----------'
v v v v
ForwardToLeader MetaDataError
| |
.---------------' '---------.
v v
MetaDataReadError Raft*Error
| |
+- MetaStorageError +- MetaStorageError
```
Bottom level errors:
Bottom level errors are derived from non-meta-store layers.
- `MetaStorageError`
- `MetaNetworkError`
- `MetaBytesError`
```text
MetaNetworkError
|
+- Connection errors
+- DNS errors
`- Payload codec error
MetaStorageError
|
+- Sled errors
+- Txn conflict
`- Codec error:--.
|
v
MetaBytesError
```
Application level errors
Application level errors(`KVAppError`) are defined for meta-store application, e.g.,
`SchemaApi`, `ShareApi` etc. An application error has two main sub error: meta-store related or
application related:
- `KVAppError::MetaError` is error raised from inside meta-store and an application can do
nothing about it. It includes all errors that meta-store might return.
- `KVAppError::AppError` are application specific errors, such as `TableNotFound`, `DbExists`.
These errors should be dealt with by an application correctly.
`MetaError`
`MetaError` defines every error could occur inside a meta-store implementation(an embedded meta-store
or a client-server meta-store service).
The sub errors are about both a local implementation and a remote meta-store implementation:
For a remote meta-store service:
- `MetaClientError`: is only returned with remote meta-store service: when creating a client to
meta-store service. Since a client will send a handshake request, `MetaClientError` also
includes a network sub error: `MetaNetworkError`.
- `MetaNetworkError` is only returned with remote meta-store service: when sending a request to
a remote meta-store service.
- `MetaApiError` is only returned with remote meta-store service: it is all of the errors that
could occur when a meta-store service handling a request.
For a local meta-store:
- `MetaStorageError`: meta-store is implemented directly upon storage layer.
`MetaApiError`
`MetaApiError` is defined for meta-store service RPC API handler:
It includes Raft related errors and errors that occurs when forwarding a request between
meta-store servers:
- Errors informing request forwarding state:: `ForwardToLeader` or `CanNotForward`.
- Errors occurs when forwarding a request: `MetaNetworkError`.
- Errors occurs when reading/writing: `MetaDataError`. Because a request may be dealt with
locally or dealt with remotely, via request forwarding, there are two variants for
`MetaDataError`:
- `MetaApiError::MetaDataError(MetaDataError)` is returned when a request is dealt with locally.
- `MetaApiError::RemoteError(MetaDataError)` is returned when a request is dealt with on a
remote noMetaDataError.
`MetaDataError`
It is the error that could occur when dealing with read/write request.
In meta-store, data is written through Raft protocol, thus part of its sub errors are Raft
related: `RaftWriteError` or `RaftChangeMembershipError`.
In meta-store reading data does not depend on Raft protocol, thus read errors is defined as
`MetaDataReadError` and is derived directly from MetaStorageError.
Other errors:
- `MetaOperationError` is a intermediate error and a subset error of `MetaApiError` and is
defined for a local request handler without forwarding. It is finally converted to `MetaApiError`.
- `ForwardRPCError` is another intermediate error to wrap a result of a forwarded request.
- Fix: #76891 parent ce58d74 commit ae60a18
File tree
22 files changed
+275
-139
lines changed- src
- meta
- api/src
- types/src
- errors
- query/management/src/stage
22 files changed
+275
-139
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
0 commit comments