Coverage Report

Created: 2025-04-11 12:29

/root/doris/be/src/common/status.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file. See the AUTHORS file for names of contributors.
4
5
#pragma once
6
7
#include <fmt/format.h>
8
#include <gen_cpp/Status_types.h> // for TStatus
9
#include <gen_cpp/types.pb.h>
10
#include <glog/logging.h>
11
12
#include <cstdint>
13
#include <iostream>
14
#include <memory>
15
#include <string>
16
#include <string_view>
17
#include <utility>
18
19
#include "common/compiler_util.h" // IWYU pragma: keep
20
#include "common/config.h"
21
#include "common/expected.h"
22
#include "util/stack_util.h"
23
24
namespace doris {
25
26
namespace io {
27
struct ObjectStorageStatus;
28
}
29
30
class Status;
31
32
extern io::ObjectStorageStatus convert_to_obj_response(Status st);
33
34
class PStatus;
35
36
namespace ErrorCode {
37
38
// E thrift_error_name, print_stacktrace
39
#define APPLY_FOR_THRIFT_ERROR_CODES(TStatusError)        \
40
    TStatusError(PUBLISH_TIMEOUT, false);                 \
41
    TStatusError(MEM_ALLOC_FAILED, true);                 \
42
    TStatusError(BUFFER_ALLOCATION_FAILED, true);         \
43
    TStatusError(INVALID_ARGUMENT, false);                \
44
    TStatusError(INVALID_JSON_PATH, false);               \
45
    TStatusError(MINIMUM_RESERVATION_UNAVAILABLE, true);  \
46
    TStatusError(CORRUPTION, true);                       \
47
    TStatusError(IO_ERROR, true);                         \
48
    TStatusError(NOT_FOUND, true);                        \
49
    TStatusError(ALREADY_EXIST, true);                    \
50
    TStatusError(NOT_IMPLEMENTED_ERROR, false);           \
51
    TStatusError(END_OF_FILE, false);                     \
52
    TStatusError(INTERNAL_ERROR, true);                   \
53
    TStatusError(RUNTIME_ERROR, true);                    \
54
    TStatusError(CANCELLED, false);                       \
55
    TStatusError(ANALYSIS_ERROR, false);                  \
56
    TStatusError(MEM_LIMIT_EXCEEDED, false);              \
57
    TStatusError(THRIFT_RPC_ERROR, true);                 \
58
    TStatusError(TIMEOUT, true);                          \
59
    TStatusError(LIMIT_REACH, false);                     \
60
    TStatusError(TOO_MANY_TASKS, true);                   \
61
    TStatusError(UNINITIALIZED, false);                   \
62
    TStatusError(INCOMPLETE, false);                      \
63
    TStatusError(OLAP_ERR_VERSION_ALREADY_MERGED, false); \
64
    TStatusError(ABORTED, false);                         \
65
    TStatusError(DATA_QUALITY_ERROR, false);              \
66
    TStatusError(LABEL_ALREADY_EXISTS, true);             \
67
    TStatusError(NOT_AUTHORIZED, true);                   \
68
    TStatusError(BINLOG_DISABLE, false);                  \
69
    TStatusError(BINLOG_TOO_OLD_COMMIT_SEQ, false);       \
70
    TStatusError(BINLOG_TOO_NEW_COMMIT_SEQ, false);       \
71
    TStatusError(BINLOG_NOT_FOUND_DB, false);             \
72
    TStatusError(BINLOG_NOT_FOUND_TABLE, false);          \
73
    TStatusError(NETWORK_ERROR, false);                   \
74
    TStatusError(ILLEGAL_STATE, false);                   \
75
    TStatusError(SNAPSHOT_NOT_EXIST, true);               \
76
    TStatusError(HTTP_ERROR, true);                       \
77
    TStatusError(TABLET_MISSING, true);                   \
78
    TStatusError(NOT_MASTER, true);                       \
79
    TStatusError(OBTAIN_LOCK_FAILED, false);              \
80
    TStatusError(SNAPSHOT_EXPIRED, false);                \
81
    TStatusError(DELETE_BITMAP_LOCK_ERROR, false);
82
// E error_name, error_code, print_stacktrace
83
#define APPLY_FOR_OLAP_ERROR_CODES(E)                        \
84
    E(OK, 0, false);                                         \
85
    E(CALL_SEQUENCE_ERROR, -202, true);                      \
86
    E(BUFFER_OVERFLOW, -204, true);                          \
87
    E(CONFIG_ERROR, -205, true);                             \
88
    E(INIT_FAILED, -206, true);                              \
89
    E(INVALID_SCHEMA, -207, true);                           \
90
    E(CHECKSUM_ERROR, -208, true);                           \
91
    E(SIGNATURE_ERROR, -209, true);                          \
92
    E(CATCH_EXCEPTION, -210, true);                          \
93
    E(PARSE_PROTOBUF_ERROR, -211, true);                     \
94
    E(SERIALIZE_PROTOBUF_ERROR, -212, true);                 \
95
    E(WRITE_PROTOBUF_ERROR, -213, true);                     \
96
    E(VERSION_NOT_EXIST, -214, false);                       \
97
    E(TABLE_NOT_FOUND, -215, true);                          \
98
    E(TRY_LOCK_FAILED, -216, false);                         \
99
    E(EXCEEDED_LIMIT, -217, false);                          \
100
    E(OUT_OF_BOUND, -218, false);                            \
101
    E(INVALID_ROOT_PATH, -222, true);                        \
102
    E(NO_AVAILABLE_ROOT_PATH, -223, true);                   \
103
    E(CHECK_LINES_ERROR, -224, true);                        \
104
    E(INVALID_CLUSTER_INFO, -225, true);                     \
105
    E(TRANSACTION_NOT_EXIST, -226, false);                   \
106
    E(DISK_FAILURE, -227, true);                             \
107
    E(TRANSACTION_ALREADY_COMMITTED, -228, false);           \
108
    E(TRANSACTION_ALREADY_VISIBLE, -229, false);             \
109
    E(VERSION_ALREADY_MERGED, -230, true);                   \
110
    E(LZO_DISABLED, -231, true);                             \
111
    E(DISK_REACH_CAPACITY_LIMIT, -232, true);                \
112
    E(TOO_MANY_TRANSACTIONS, -233, false);                   \
113
    E(INVALID_SNAPSHOT_VERSION, -234, true);                 \
114
    E(TOO_MANY_VERSION, -235, false);                        \
115
    E(NOT_INITIALIZED, -236, true);                          \
116
    E(ALREADY_CANCELLED, -237, false);                       \
117
    E(TOO_MANY_SEGMENTS, -238, false);                       \
118
    E(ALREADY_CLOSED, -239, false);                          \
119
    E(SERVICE_UNAVAILABLE, -240, true);                      \
120
    E(NEED_SEND_AGAIN, -241, false);                         \
121
    E(OS_ERROR, -242, true);                                 \
122
    E(DIR_NOT_EXIST, -243, true);                            \
123
    E(CREATE_FILE_ERROR, -245, true);                        \
124
    E(STL_ERROR, -246, true);                                \
125
    E(MUTEX_ERROR, -247, true);                              \
126
    E(PTHREAD_ERROR, -248, true);                            \
127
    E(UB_FUNC_ERROR, -250, true);                            \
128
    E(COMPRESS_ERROR, -251, true);                           \
129
    E(DECOMPRESS_ERROR, -252, true);                         \
130
    E(FILE_ALREADY_EXIST, -253, true);                       \
131
    E(BAD_CAST, -254, true);                                 \
132
    E(ARITHMETIC_OVERFLOW_ERRROR, -255, false);              \
133
    E(PERMISSION_DENIED, -256, false);                       \
134
    E(QUERY_MEMORY_EXCEEDED, -257, false);                   \
135
    E(WORKLOAD_GROUP_MEMORY_EXCEEDED, -258, false);          \
136
    E(PROCESS_MEMORY_EXCEEDED, -259, false);                 \
137
    E(CE_CMD_PARAMS_ERROR, -300, true);                      \
138
    E(CE_BUFFER_TOO_SMALL, -301, true);                      \
139
    E(CE_CMD_NOT_VALID, -302, true);                         \
140
    E(CE_LOAD_TABLE_ERROR, -303, true);                      \
141
    E(CE_NOT_FINISHED, -304, true);                          \
142
    E(CE_TABLET_ID_EXIST, -305, true);                       \
143
    E(TABLE_VERSION_DUPLICATE_ERROR, -400, true);            \
144
    E(TABLE_VERSION_INDEX_MISMATCH_ERROR, -401, true);       \
145
    E(TABLE_INDEX_VALIDATE_ERROR, -402, true);               \
146
    E(TABLE_INDEX_FIND_ERROR, -403, true);                   \
147
    E(TABLE_CREATE_FROM_HEADER_ERROR, -404, true);           \
148
    E(TABLE_CREATE_META_ERROR, -405, true);                  \
149
    E(TABLE_ALREADY_DELETED_ERROR, -406, false);             \
150
    E(ENGINE_INSERT_EXISTS_TABLE, -500, true);               \
151
    E(ENGINE_DROP_NOEXISTS_TABLE, -501, true);               \
152
    E(ENGINE_LOAD_INDEX_TABLE_ERROR, -502, true);            \
153
    E(TABLE_INSERT_DUPLICATION_ERROR, -503, true);           \
154
    E(DELETE_VERSION_ERROR, -504, true);                     \
155
    E(GC_SCAN_PATH_ERROR, -505, true);                       \
156
    E(ENGINE_INSERT_OLD_TABLET, -506, true);                 \
157
    E(FETCH_OTHER_ERROR, -600, true);                        \
158
    E(FETCH_TABLE_NOT_EXIST, -601, true);                    \
159
    E(FETCH_VERSION_ERROR, -602, true);                      \
160
    E(FETCH_SCHEMA_ERROR, -603, true);                       \
161
    E(FETCH_COMPRESSION_ERROR, -604, true);                  \
162
    E(FETCH_CONTEXT_NOT_EXIST, -605, true);                  \
163
    E(FETCH_GET_READER_PARAMS_ERR, -606, true);              \
164
    E(FETCH_SAVE_SESSION_ERR, -607, true);                   \
165
    E(FETCH_MEMORY_EXCEEDED, -608, true);                    \
166
    E(READER_IS_UNINITIALIZED, -700, true);                  \
167
    E(READER_GET_ITERATOR_ERROR, -701, true);                \
168
    E(CAPTURE_ROWSET_READER_ERROR, -702, true);              \
169
    E(READER_READING_ERROR, -703, true);                     \
170
    E(READER_INITIALIZE_ERROR, -704, true);                  \
171
    E(BE_VERSION_NOT_MATCH, -800, true);                     \
172
    E(BE_REPLACE_VERSIONS_ERROR, -801, true);                \
173
    E(BE_MERGE_ERROR, -802, true);                           \
174
    E(CAPTURE_ROWSET_ERROR, -804, true);                     \
175
    E(BE_SAVE_HEADER_ERROR, -805, true);                     \
176
    E(BE_INIT_OLAP_DATA, -806, true);                        \
177
    E(BE_TRY_OBTAIN_VERSION_LOCKS, -807, true);              \
178
    E(BE_NO_SUITABLE_VERSION, -808, false);                  \
179
    E(BE_INVALID_NEED_MERGED_VERSIONS, -810, true);          \
180
    E(BE_ERROR_DELETE_ACTION, -811, true);                   \
181
    E(BE_SEGMENTS_OVERLAPPING, -812, true);                  \
182
    E(PUSH_INIT_ERROR, -900, true);                          \
183
    E(PUSH_VERSION_INCORRECT, -902, true);                   \
184
    E(PUSH_SCHEMA_MISMATCH, -903, true);                     \
185
    E(PUSH_CHECKSUM_ERROR, -904, true);                      \
186
    E(PUSH_ACQUIRE_DATASOURCE_ERROR, -905, true);            \
187
    E(PUSH_CREAT_CUMULATIVE_ERROR, -906, true);              \
188
    E(PUSH_BUILD_DELTA_ERROR, -907, true);                   \
189
    E(PUSH_VERSION_ALREADY_EXIST, -908, false);              \
190
    E(PUSH_TABLE_NOT_EXIST, -909, true);                     \
191
    E(PUSH_INPUT_DATA_ERROR, -910, true);                    \
192
    E(PUSH_TRANSACTION_ALREADY_EXIST, -911, false);          \
193
    E(PUSH_BATCH_PROCESS_REMOVED, -912, true);               \
194
    E(PUSH_COMMIT_ROWSET, -913, true);                       \
195
    E(PUSH_ROWSET_NOT_FOUND, -914, true);                    \
196
    E(INDEX_LOAD_ERROR, -1000, true);                        \
197
    E(INDEX_CHECKSUM_ERROR, -1002, true);                    \
198
    E(INDEX_DELTA_PRUNING, -1003, true);                     \
199
    E(DATA_ROW_BLOCK_ERROR, -1100, true);                    \
200
    E(DATA_FILE_TYPE_ERROR, -1101, true);                    \
201
    E(WRITER_INDEX_WRITE_ERROR, -1200, true);                \
202
    E(WRITER_DATA_WRITE_ERROR, -1201, true);                 \
203
    E(WRITER_ROW_BLOCK_ERROR, -1202, true);                  \
204
    E(WRITER_SEGMENT_NOT_FINALIZED, -1203, true);            \
205
    E(ROWBLOCK_DECOMPRESS_ERROR, -1300, true);               \
206
    E(ROWBLOCK_FIND_ROW_EXCEPTION, -1301, true);             \
207
    E(HEADER_ADD_VERSION, -1400, true);                      \
208
    E(HEADER_DELETE_VERSION, -1401, true);                   \
209
    E(HEADER_ADD_PENDING_DELTA, -1402, true);                \
210
    E(HEADER_ADD_INCREMENTAL_VERSION, -1403, true);          \
211
    E(HEADER_INVALID_FLAG, -1404, true);                     \
212
    E(HEADER_LOAD_INVALID_KEY, -1408, true);                 \
213
    E(HEADER_LOAD_JSON_HEADER, -1410, true);                 \
214
    E(HEADER_INIT_FAILED, -1411, true);                      \
215
    E(HEADER_PB_PARSE_FAILED, -1412, true);                  \
216
    E(HEADER_HAS_PENDING_DATA, -1413, true);                 \
217
    E(SCHEMA_SCHEMA_INVALID, -1500, true);                   \
218
    E(SCHEMA_SCHEMA_FIELD_INVALID, -1501, true);             \
219
    E(ALTER_MULTI_TABLE_ERR, -1600, true);                   \
220
    E(ALTER_DELTA_DOES_NOT_EXISTS, -1601, true);             \
221
    E(ALTER_STATUS_ERR, -1602, true);                        \
222
    E(PREVIOUS_SCHEMA_CHANGE_NOT_FINISHED, -1603, true);     \
223
    E(SCHEMA_CHANGE_INFO_INVALID, -1604, true);              \
224
    E(QUERY_SPLIT_KEY_ERR, -1605, true);                     \
225
    E(DATA_QUALITY_ERR, -1606, false);                       \
226
    E(COLUMN_DATA_LOAD_BLOCK, -1700, true);                  \
227
    E(COLUMN_DATA_RECORD_INDEX, -1701, true);                \
228
    E(COLUMN_DATA_MAKE_FILE_HEADER, -1702, true);            \
229
    E(COLUMN_DATA_READ_VAR_INT, -1703, true);                \
230
    E(COLUMN_DATA_PATCH_LIST_NUM, -1704, true);              \
231
    E(COLUMN_READ_STREAM, -1706, true);                      \
232
    E(COLUMN_STREAM_NOT_EXIST, -1716, true);                 \
233
    E(COLUMN_VALUE_NULL, -1717, true);                       \
234
    E(COLUMN_SEEK_ERROR, -1719, true);                       \
235
    E(COLUMN_NO_MATCH_OFFSETS_SIZE, -1720, true);            \
236
    E(COLUMN_NO_MATCH_FILTER_SIZE, -1721, true);             \
237
    E(DELETE_INVALID_CONDITION, -1900, true);                \
238
    E(DELETE_UPDATE_HEADER_FAILED, -1901, true);             \
239
    E(DELETE_SAVE_HEADER_FAILED, -1902, true);               \
240
    E(DELETE_INVALID_PARAMETERS, -1903, true);               \
241
    E(DELETE_INVALID_VERSION, -1904, true);                  \
242
    E(CUMULATIVE_NO_SUITABLE_VERSION, -2000, false);         \
243
    E(CUMULATIVE_REPEAT_INIT, -2001, true);                  \
244
    E(CUMULATIVE_INVALID_PARAMETERS, -2002, true);           \
245
    E(CUMULATIVE_FAILED_ACQUIRE_DATA_SOURCE, -2003, true);   \
246
    E(CUMULATIVE_INVALID_NEED_MERGED_VERSIONS, -2004, true); \
247
    E(CUMULATIVE_ERROR_DELETE_ACTION, -2005, true);          \
248
    E(CUMULATIVE_MISS_VERSION, -2006, true);                 \
249
    E(FULL_NO_SUITABLE_VERSION, -2008, false);               \
250
    E(FULL_MISS_VERSION, -2009, true);                       \
251
    E(META_INVALID_ARGUMENT, -3000, true);                   \
252
    E(META_OPEN_DB_ERROR, -3001, true);                      \
253
    E(META_KEY_NOT_FOUND, -3002, false);                     \
254
    E(META_GET_ERROR, -3003, true);                          \
255
    E(META_PUT_ERROR, -3004, true);                          \
256
    E(META_ITERATOR_ERROR, -3005, true);                     \
257
    E(META_DELETE_ERROR, -3006, true);                       \
258
    E(META_ALREADY_EXIST, -3007, true);                      \
259
    E(ROWSET_WRITER_INIT, -3100, true);                      \
260
    E(ROWSET_SAVE_FAILED, -3101, true);                      \
261
    E(ROWSET_GENERATE_ID_FAILED, -3102, true);               \
262
    E(ROWSET_DELETE_FILE_FAILED, -3103, true);               \
263
    E(ROWSET_BUILDER_INIT, -3104, true);                     \
264
    E(ROWSET_TYPE_NOT_FOUND, -3105, true);                   \
265
    E(ROWSET_ALREADY_EXIST, -3106, true);                    \
266
    E(ROWSET_CREATE_READER, -3107, true);                    \
267
    E(ROWSET_INVALID, -3108, true);                          \
268
    E(ROWSET_READER_INIT, -3110, true);                      \
269
    E(ROWSET_INVALID_STATE_TRANSITION, -3112, true);         \
270
    E(STRING_OVERFLOW_IN_VEC_ENGINE, -3113, true);           \
271
    E(ROWSET_ADD_MIGRATION_V2, -3114, true);                 \
272
    E(PUBLISH_VERSION_NOT_CONTINUOUS, -3115, false);         \
273
    E(ROWSET_RENAME_FILE_FAILED, -3116, false);              \
274
    E(SEGCOMPACTION_INIT_READER, -3117, false);              \
275
    E(SEGCOMPACTION_INIT_WRITER, -3118, false);              \
276
    E(SEGCOMPACTION_FAILED, -3119, false);                   \
277
    E(ROWSET_ADD_TO_BINLOG_FAILED, -3122, true);             \
278
    E(ROWSET_BINLOG_NOT_ONLY_ONE_VERSION, -3123, true);      \
279
    E(INVERTED_INDEX_INVALID_PARAMETERS, -6000, false);      \
280
    E(INVERTED_INDEX_NOT_SUPPORTED, -6001, false);           \
281
    E(INVERTED_INDEX_CLUCENE_ERROR, -6002, false);           \
282
    E(INVERTED_INDEX_FILE_NOT_FOUND, -6003, false);          \
283
    E(INVERTED_INDEX_BYPASS, -6004, false);                  \
284
    E(INVERTED_INDEX_NO_TERMS, -6005, false);                \
285
    E(INVERTED_INDEX_RENAME_FILE_FAILED, -6006, true);       \
286
    E(INVERTED_INDEX_EVALUATE_SKIPPED, -6007, false);        \
287
    E(INVERTED_INDEX_BUILD_WAITTING, -6008, false);          \
288
    E(INVERTED_INDEX_NOT_IMPLEMENTED, -6009, false);         \
289
    E(INVERTED_INDEX_COMPACTION_ERROR, -6010, false);        \
290
    E(INVERTED_INDEX_ANALYZER_ERROR, -6011, false);          \
291
    E(INVERTED_INDEX_FILE_CORRUPTED, -6012, false);          \
292
    E(KEY_NOT_FOUND, -7000, false);                          \
293
    E(KEY_ALREADY_EXISTS, -7001, false);                     \
294
    E(ENTRY_NOT_FOUND, -7002, false);                        \
295
    E(INVALID_TABLET_STATE, -7211, false);                   \
296
    E(ROWSETS_EXPIRED, -7311, false);                        \
297
    E(CGROUP_ERROR, -7411, false);                           \
298
    E(FATAL_ERROR, -7412, false);
299
300
// Define constexpr int error_code_name = error_code_value
301
#define M(NAME, ERRORCODE, ENABLESTACKTRACE) constexpr int NAME = ERRORCODE;
302
APPLY_FOR_OLAP_ERROR_CODES(M)
303
#undef M
304
305
#define MM(name, ENABLESTACKTRACE) constexpr int name = TStatusCode::name;
306
APPLY_FOR_THRIFT_ERROR_CODES(MM)
307
#undef MM
308
309
constexpr int MAX_ERROR_CODE_DEFINE_NUM = 65536;
310
struct ErrorCodeState {
311
    int16_t error_code = 0;
312
    bool stacktrace = true;
313
    std::string description;
314
    size_t count = 0; // Used for count the number of error happens
315
    std::mutex mutex; // lock guard for count state
316
};
317
extern ErrorCodeState error_states[MAX_ERROR_CODE_DEFINE_NUM];
318
319
class ErrorCodeInitializer {
320
public:
321
0
    ErrorCodeInitializer(int temp) : signal_value(temp) {
322
0
        for (auto& error_state : error_states) {
323
0
            error_state.error_code = 0;
324
0
        }
325
0
#define M(NAME, ENABLESTACKTRACE)                                  \
326
0
    error_states[TStatusCode::NAME].stacktrace = ENABLESTACKTRACE; \
327
0
    error_states[TStatusCode::NAME].description = #NAME;           \
328
0
    error_states[TStatusCode::NAME].error_code = TStatusCode::NAME;
329
0
        APPLY_FOR_THRIFT_ERROR_CODES(M)
330
0
#undef M
331
0
// In status.h, if error code > 0, then it means it will be used in TStatusCode and will
332
0
// also be used in FE.
333
0
// Other error codes that with error code < 0, will only be used in BE.
334
0
// We use abs(error code) as the index in error_states, so that these two kinds of error
335
0
// codes MUST not have overlap.
336
0
// Add an assert here to make sure the code in TStatusCode and other error code are not
337
0
// overlapped.
338
0
#define M(NAME, ERRORCODE, ENABLESTACKTRACE)                    \
339
0
    assert(error_states[abs(ERRORCODE)].error_code == 0);       \
340
0
    error_states[abs(ERRORCODE)].stacktrace = ENABLESTACKTRACE; \
341
0
    error_states[abs(ERRORCODE)].error_code = ERRORCODE;
342
0
        APPLY_FOR_OLAP_ERROR_CODES(M)
343
0
#undef M
344
0
    }
345
346
1
    void check_init() const {
347
        //the signal value is 0, it means the global error states not inited, it's logical error
348
        // DO NOT use dcheck here, because dcheck depend on glog, and glog maybe not inited at this time.
349
1
        if (signal_value == 0) {
350
0
            exit(-1);
351
0
        }
352
1
    }
353
354
private:
355
    int signal_value = 0;
356
};
357
358
extern ErrorCodeInitializer error_code_init;
359
} // namespace ErrorCode
360
361
class [[nodiscard]] Status {
362
public:
363
337M
    Status() : _code(ErrorCode::OK), _err_msg(nullptr) {}
364
365
    // used to convert Exception to Status
366
    Status(int code, std::string msg, std::string stack = "") : _code(code) {
367
        _err_msg = std::make_unique<ErrMsg>();
368
        _err_msg->_msg = std::move(msg);
369
        if (config::enable_stacktrace) {
370
            _err_msg->_stack = std::move(stack);
371
        }
372
    }
373
374
    // copy c'tor makes copy of error detail so Status can be returned by value
375
230k
    Status(const Status& rhs) { *this = rhs; }
376
377
    // move c'tor
378
31.7k
    Status(Status&& rhs) noexcept = default;
379
380
    // same as copy c'tor
381
230k
    Status& operator=(const Status& rhs) {
382
230k
        _code = rhs._code;
383
230k
        if (rhs._err_msg) {
384
608
            _err_msg = std::make_unique<ErrMsg>(*rhs._err_msg);
385
230k
        } else {
386
            // If rhs error msg is empty, then should also clear current error msg
387
            // For example, if rhs is OK and current status is error, then copy to current
388
            // status, should clear current error message.
389
230k
            _err_msg.reset();
390
230k
        }
391
230k
        return *this;
392
230k
    }
393
394
    // move assign
395
3.66M
    Status& operator=(Status&& rhs) noexcept {
396
3.66M
        _code = rhs._code;
397
3.66M
        if (rhs._err_msg) {
398
57.7k
            _err_msg = std::move(rhs._err_msg);
399
3.60M
        } else {
400
3.60M
            _err_msg.reset();
401
3.60M
        }
402
3.66M
        return *this;
403
3.66M
    }
404
405
    template <bool stacktrace = true>
406
    Status static create(const TStatus& status) {
407
        return Error<stacktrace>(
408
                status.status_code,
409
                "TStatus: " + (status.error_msgs.empty() ? "" : status.error_msgs[0]));
410
    }
411
412
    template <bool stacktrace = true>
413
    Status static create(const PStatus& pstatus) {
414
        return Error<stacktrace>(
415
                pstatus.status_code(),
416
                "PStatus: " + (pstatus.error_msgs_size() == 0 ? "" : pstatus.error_msgs(0)));
417
    }
418
419
    template <int code, bool stacktrace = true, typename... Args>
420
6.69k
    Status static Error(std::string_view msg, Args&&... args) {
421
6.69k
        Status status;
422
6.69k
        status._code = code;
423
6.69k
        status._err_msg = std::make_unique<ErrMsg>();
424
6.69k
        if constexpr (sizeof...(args) == 0) {
425
48
            status._err_msg->_msg = msg;
426
48
        } else {
427
48
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
48
        }
429
6.69k
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
6.69k
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
6.69k
        return status;
436
6.69k
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRSt17basic_string_viewIcSt11char_traitsIcEEEEES0_S5_DpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRlEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJRKmRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS7_EDpOT1_
_ZN5doris6Status5ErrorILi33ELb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
83
    Status static Error(std::string_view msg, Args&&... args) {
421
83
        Status status;
422
83
        status._code = code;
423
83
        status._err_msg = std::make_unique<ErrMsg>();
424
83
        if constexpr (sizeof...(args) == 0) {
425
83
            status._err_msg->_msg = msg;
426
83
        } else {
427
83
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
83
        }
429
83
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
83
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
83
        return status;
436
83
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi4ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi5ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRlRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EEES0_St17basic_string_viewIcS6_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin257ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin258ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin259ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT1_
_ZN5doris6Status5ErrorILi32ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
2
    Status static Error(std::string_view msg, Args&&... args) {
421
2
        Status status;
422
2
        status._code = code;
423
2
        status._err_msg = std::make_unique<ErrMsg>();
424
2
        if constexpr (sizeof...(args) == 0) {
425
2
            status._err_msg->_msg = msg;
426
2
        } else {
427
2
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
2
        }
429
2
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
2
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
2
        return status;
436
2
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRmEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJPKcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJPKcS3_EEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_EEES0_St17basic_string_viewIcS5_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_S7_EEES0_St17basic_string_viewIcS5_EDpOT1_
_ZN5doris6Status5ErrorILi6ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
73
    Status static Error(std::string_view msg, Args&&... args) {
421
73
        Status status;
422
73
        status._code = code;
423
73
        status._err_msg = std::make_unique<ErrMsg>();
424
73
        if constexpr (sizeof...(args) == 0) {
425
73
            status._err_msg->_msg = msg;
426
73
        } else {
427
73
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
73
        }
429
73
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
73
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
73
        return status;
436
73
    }
_ZN5doris6Status5ErrorILi33ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
30
    Status static Error(std::string_view msg, Args&&... args) {
421
30
        Status status;
422
30
        status._code = code;
423
30
        status._err_msg = std::make_unique<ErrMsg>();
424
30
        if constexpr (sizeof...(args) == 0) {
425
30
            status._err_msg->_msg = msg;
426
30
        } else {
427
30
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
30
        }
429
30
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
30
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
30
        return status;
436
30
    }
_ZN5doris6Status5ErrorILi3ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
6
    Status static Error(std::string_view msg, Args&&... args) {
421
6
        Status status;
422
6
        status._code = code;
423
6
        status._err_msg = std::make_unique<ErrMsg>();
424
6
        if constexpr (sizeof...(args) == 0) {
425
6
            status._err_msg->_msg = msg;
426
6
        } else {
427
6
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
6
        }
429
6
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
6
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
6
        return status;
436
6
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi33ELb1EJRmRKtEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi33ELb1EJRmRiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
_ZN5doris6Status5ErrorILi33ELb0EJRNS_10segment_v214HashStrategyPBEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
1
    Status static Error(std::string_view msg, Args&&... args) {
421
1
        Status status;
422
1
        status._code = code;
423
1
        status._err_msg = std::make_unique<ErrMsg>();
424
1
        if constexpr (sizeof...(args) == 0) {
425
1
            status._err_msg->_msg = msg;
426
1
        } else {
427
1
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
1
        }
429
1
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
1
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
1
        return status;
436
1
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi3ELb1EJRKNS_13PrimitiveTypeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin6009ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJimEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJSt17basic_string_viewIcSt11char_traitsIcEEEEES0_S5_DpOT1_
_ZN5doris6Status5ErrorILi6ELb1EJRiS2_EEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
1
    Status static Error(std::string_view msg, Args&&... args) {
421
1
        Status status;
422
1
        status._code = code;
423
1
        status._err_msg = std::make_unique<ErrMsg>();
424
1
        if constexpr (sizeof...(args) == 0) {
425
1
            status._err_msg->_msg = msg;
426
1
        } else {
427
1
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
1
        }
429
1
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
1
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
1
        return status;
436
1
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJR8CURLcodeEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
_ZN5doris6Status5ErrorILi34ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
15
    Status static Error(std::string_view msg, Args&&... args) {
421
15
        Status status;
422
15
        status._code = code;
423
15
        status._err_msg = std::make_unique<ErrMsg>();
424
15
        if constexpr (sizeof...(args) == 0) {
425
15
            status._err_msg->_msg = msg;
426
15
        } else {
427
15
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
15
        }
429
15
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
15
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
15
        return status;
436
15
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRNS_19TStorageBackendType4typeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
_ZN5doris6Status5ErrorILi34ELb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_S7_EEES0_St17basic_string_viewIcS5_EDpOT1_
Line
Count
Source
420
2
    Status static Error(std::string_view msg, Args&&... args) {
421
2
        Status status;
422
2
        status._code = code;
423
2
        status._err_msg = std::make_unique<ErrMsg>();
424
2
        if constexpr (sizeof...(args) == 0) {
425
2
            status._err_msg->_msg = msg;
426
2
        } else {
427
2
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
2
        }
429
2
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
2
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
2
        return status;
436
2
    }
_ZN5doris6Status5ErrorILi34ELb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
3
    Status static Error(std::string_view msg, Args&&... args) {
421
3
        Status status;
422
3
        status._code = code;
423
3
        status._err_msg = std::make_unique<ErrMsg>();
424
3
        if constexpr (sizeof...(args) == 0) {
425
3
            status._err_msg->_msg = msg;
426
3
        } else {
427
3
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
3
        }
429
3
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
3
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
3
        return status;
436
3
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi33ELb0EJNS_13PredicateTypeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
_ZN5doris6Status5ErrorILi6ELb1EJiRA15_KcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
2
    Status static Error(std::string_view msg, Args&&... args) {
421
2
        Status status;
422
2
        status._code = code;
423
2
        status._err_msg = std::make_unique<ErrMsg>();
424
2
        if constexpr (sizeof...(args) == 0) {
425
2
            status._err_msg->_msg = msg;
426
2
        } else {
427
2
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
2
        }
429
2
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
2
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
2
        return status;
436
2
    }
_ZN5doris6Status5ErrorILin206ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
2
    Status static Error(std::string_view msg, Args&&... args) {
421
2
        Status status;
422
2
        status._code = code;
423
2
        status._err_msg = std::make_unique<ErrMsg>();
424
2
        if constexpr (sizeof...(args) == 0) {
425
2
            status._err_msg->_msg = msg;
426
2
        } else {
427
2
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
2
        }
429
2
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
2
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
2
        return status;
436
2
    }
_ZN5doris6Status5ErrorILin3002ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
38
    Status static Error(std::string_view msg, Args&&... args) {
421
38
        Status status;
422
38
        status._code = code;
423
38
        status._err_msg = std::make_unique<ErrMsg>();
424
38
        if constexpr (sizeof...(args) == 0) {
425
38
            status._err_msg->_msg = msg;
426
38
        } else {
427
38
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
38
        }
429
38
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
38
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
38
        return status;
436
38
    }
_ZN5doris6Status5ErrorILi33ELb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT1_
Line
Count
Source
420
2
    Status static Error(std::string_view msg, Args&&... args) {
421
2
        Status status;
422
2
        status._code = code;
423
2
        status._err_msg = std::make_unique<ErrMsg>();
424
2
        if constexpr (sizeof...(args) == 0) {
425
2
            status._err_msg->_msg = msg;
426
2
        } else {
427
2
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
2
        }
429
2
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
2
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
2
        return status;
436
2
    }
_ZN5doris6Status5ErrorILi30ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
254
    Status static Error(std::string_view msg, Args&&... args) {
421
254
        Status status;
422
254
        status._code = code;
423
254
        status._err_msg = std::make_unique<ErrMsg>();
424
254
        if constexpr (sizeof...(args) == 0) {
425
254
            status._err_msg->_msg = msg;
426
254
        } else {
427
254
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
254
        }
429
254
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
254
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
254
        return status;
436
254
    }
_ZN5doris6Status5ErrorILin6002ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
11
    Status static Error(std::string_view msg, Args&&... args) {
421
11
        Status status;
422
11
        status._code = code;
423
11
        status._err_msg = std::make_unique<ErrMsg>();
424
11
        if constexpr (sizeof...(args) == 0) {
425
11
            status._err_msg->_msg = msg;
426
11
        } else {
427
11
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
11
        }
429
11
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
11
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
11
        return status;
436
11
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJiiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EEES0_St17basic_string_viewIcS5_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJiiiiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJRNS_10segment_v212idx_query_v29QueryTypeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
_ZN5doris6Status5ErrorILi6ELb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT1_
Line
Count
Source
420
8
    Status static Error(std::string_view msg, Args&&... args) {
421
8
        Status status;
422
8
        status._code = code;
423
8
        status._err_msg = std::make_unique<ErrMsg>();
424
8
        if constexpr (sizeof...(args) == 0) {
425
8
            status._err_msg->_msg = msg;
426
8
        } else {
427
8
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
8
        }
429
8
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
8
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
8
        return status;
436
8
    }
_ZN5doris6Status5ErrorILi36ELb0EJPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS9_lEEES0_St17basic_string_viewIcS7_EDpOT1_
Line
Count
Source
420
2
    Status static Error(std::string_view msg, Args&&... args) {
421
2
        Status status;
422
2
        status._code = code;
423
2
        status._err_msg = std::make_unique<ErrMsg>();
424
2
        if constexpr (sizeof...(args) == 0) {
425
2
            status._err_msg->_msg = msg;
426
2
        } else {
427
2
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
2
        }
429
2
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
2
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
2
        return status;
436
2
    }
_ZN5doris6Status5ErrorILi30ELb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
6.11k
    Status static Error(std::string_view msg, Args&&... args) {
421
6.11k
        Status status;
422
6.11k
        status._code = code;
423
6.11k
        status._err_msg = std::make_unique<ErrMsg>();
424
6.11k
        if constexpr (sizeof...(args) == 0) {
425
6.11k
            status._err_msg->_msg = msg;
426
6.11k
        } else {
427
6.11k
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
6.11k
        }
429
6.11k
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
6.11k
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
6.11k
        return status;
436
6.11k
    }
_ZN5doris6Status5ErrorILi6ELb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT1_
Line
Count
Source
420
3
    Status static Error(std::string_view msg, Args&&... args) {
421
3
        Status status;
422
3
        status._code = code;
423
3
        status._err_msg = std::make_unique<ErrMsg>();
424
3
        if constexpr (sizeof...(args) == 0) {
425
3
            status._err_msg->_msg = msg;
426
3
        } else {
427
3
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
3
        }
429
3
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
3
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
3
        return status;
436
3
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJmNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_jS7_S7_EEES0_St17basic_string_viewIcS5_EDpOT1_
_ZN5doris6Status5ErrorILi1ELb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
19
    Status static Error(std::string_view msg, Args&&... args) {
421
19
        Status status;
422
19
        status._code = code;
423
19
        status._err_msg = std::make_unique<ErrMsg>();
424
19
        if constexpr (sizeof...(args) == 0) {
425
19
            status._err_msg->_msg = msg;
426
19
        } else {
427
19
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
19
        }
429
19
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
19
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
19
        return status;
436
19
    }
_ZN5doris6Status5ErrorILi36ELb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
1
    Status static Error(std::string_view msg, Args&&... args) {
421
1
        Status status;
422
1
        status._code = code;
423
1
        status._err_msg = std::make_unique<ErrMsg>();
424
1
        if constexpr (sizeof...(args) == 0) {
425
1
            status._err_msg->_msg = msg;
426
1
        } else {
427
1
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
1
        }
429
1
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
1
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
1
        return status;
436
1
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi4ELb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT1_
_ZN5doris6Status5ErrorILi6ELb1EJPKcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
12
    Status static Error(std::string_view msg, Args&&... args) {
421
12
        Status status;
422
12
        status._code = code;
423
12
        status._err_msg = std::make_unique<ErrMsg>();
424
12
        if constexpr (sizeof...(args) == 0) {
425
12
            status._err_msg->_msg = msg;
426
12
        } else {
427
12
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
12
        }
429
12
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
12
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
12
        return status;
436
12
    }
_ZN5doris6Status5ErrorILi6ELb1EJmEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
2
    Status static Error(std::string_view msg, Args&&... args) {
421
2
        Status status;
422
2
        status._code = code;
423
2
        status._err_msg = std::make_unique<ErrMsg>();
424
2
        if constexpr (sizeof...(args) == 0) {
425
2
            status._err_msg->_msg = msg;
426
2
        } else {
427
2
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
2
        }
429
2
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
2
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
2
        return status;
436
2
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJRKNS_13TSerdeDialect4typeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJRiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmEEES0_St17basic_string_viewIcS6_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi34ELb1EJmRiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi32ELb1EJRmS2_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EEES0_St17basic_string_viewIcS6_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi32ELb1EJRjRmEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb0EJPKcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
_ZN5doris6Status5ErrorILi31ELb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Line
Count
Source
420
2
    Status static Error(std::string_view msg, Args&&... args) {
421
2
        Status status;
422
2
        status._code = code;
423
2
        status._err_msg = std::make_unique<ErrMsg>();
424
2
        if constexpr (sizeof...(args) == 0) {
425
2
            status._err_msg->_msg = msg;
426
2
        } else {
427
2
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
2
        }
429
2
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
2
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
2
        return status;
436
2
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_EEES0_St17basic_string_viewIcS5_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_RmSA_EEES0_St17basic_string_viewIcS5_EDpOT1_
_ZN5doris6Status5ErrorILi6ELb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT1_
Line
Count
Source
420
12
    Status static Error(std::string_view msg, Args&&... args) {
421
12
        Status status;
422
12
        status._code = code;
423
12
        status._err_msg = std::make_unique<ErrMsg>();
424
12
        if constexpr (sizeof...(args) == 0) {
425
12
            status._err_msg->_msg = msg;
426
12
        } else {
427
12
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
12
        }
429
12
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
12
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
12
        return status;
436
12
    }
_ZN5doris6Status5ErrorILi6ELb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_EEES0_St17basic_string_viewIcS5_EDpOT1_
Line
Count
Source
420
1
    Status static Error(std::string_view msg, Args&&... args) {
421
1
        Status status;
422
1
        status._code = code;
423
1
        status._err_msg = std::make_unique<ErrMsg>();
424
1
        if constexpr (sizeof...(args) == 0) {
425
1
            status._err_msg->_msg = msg;
426
1
        } else {
427
1
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
428
1
        }
429
1
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
430
1
            config::enable_stacktrace) {
431
            // Delete the first one frame pointers, which are inside the status.h
432
0
            status._err_msg->_stack = get_stack_trace(1);
433
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
434
0
        }
435
1
        return status;
436
1
    }
Unexecuted instantiation: _ZN5doris6Status5ErrorILi6ELb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN3orc8TypeKindEEEES0_St17basic_string_viewIcS5_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi33ELb0EJRKPKcRiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi33ELb0EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKPKcEEES0_St17basic_string_viewIcS5_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILi4ELb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKPKcEEES0_St17basic_string_viewIcS5_EDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
Unexecuted instantiation: _ZN5doris6Status5ErrorILin7412ELb1EJRlS2_EEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT1_
437
438
    template <bool stacktrace = true, typename... Args>
439
28.3k
    Status static Error(int code, std::string_view msg, Args&&... args) {
440
28.3k
        Status status;
441
28.3k
        status._code = code;
442
28.3k
        status._err_msg = std::make_unique<ErrMsg>();
443
28.3k
        if constexpr (sizeof...(args) == 0) {
444
28.3k
            status._err_msg->_msg = msg;
445
28.3k
        } else {
446
28.3k
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
447
28.3k
        }
448
28.3k
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
449
28.3k
            config::enable_stacktrace) {
450
0
            status._err_msg->_stack = get_stack_trace(1);
451
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
452
0
        }
453
28.3k
        return status;
454
28.3k
    }
_ZN5doris6Status5ErrorILb0EJEEES0_iSt17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
439
28.3k
    Status static Error(int code, std::string_view msg, Args&&... args) {
440
28.3k
        Status status;
441
28.3k
        status._code = code;
442
28.3k
        status._err_msg = std::make_unique<ErrMsg>();
443
28.3k
        if constexpr (sizeof...(args) == 0) {
444
28.3k
            status._err_msg->_msg = msg;
445
28.3k
        } else {
446
28.3k
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
447
28.3k
        }
448
28.3k
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
449
28.3k
            config::enable_stacktrace) {
450
0
            status._err_msg->_stack = get_stack_trace(1);
451
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
452
0
        }
453
28.3k
        return status;
454
28.3k
    }
_ZN5doris6Status5ErrorILb1EJEEES0_iSt17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
439
68
    Status static Error(int code, std::string_view msg, Args&&... args) {
440
68
        Status status;
441
68
        status._code = code;
442
68
        status._err_msg = std::make_unique<ErrMsg>();
443
68
        if constexpr (sizeof...(args) == 0) {
444
68
            status._err_msg->_msg = msg;
445
68
        } else {
446
68
            status._err_msg->_msg = fmt::format(msg, std::forward<Args>(args)...);
447
68
        }
448
68
        if (stacktrace && ErrorCode::error_states[abs(code)].stacktrace &&
449
68
            config::enable_stacktrace) {
450
0
            status._err_msg->_stack = get_stack_trace(1);
451
0
            LOG(WARNING) << "meet error status: " << status; // may print too many stacks.
452
0
        }
453
68
        return status;
454
68
    }
455
456
335M
    static Status OK() { return {}; }
457
458
    template <bool stacktrace = true, typename... Args>
459
0
    static Status FatalError(std::string_view msg, Args&&... args) {
460
0
#ifndef NDEBUG
461
0
        LOG(FATAL) << fmt::format(msg, std::forward<Args>(args)...);
462
0
#endif
463
0
        return Error<ErrorCode::FATAL_ERROR, stacktrace>(msg, std::forward<Args>(args)...);
464
0
    }
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRSt17basic_string_viewIcSt11char_traitsIcEEEEES0_S5_DpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRlEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRlRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EEES0_St17basic_string_viewIcS6_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRmEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJPKcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJPKcS3_EEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_EEES0_St17basic_string_viewIcS5_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_S7_EEES0_St17basic_string_viewIcS5_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJimEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJSt17basic_string_viewIcSt11char_traitsIcEEEEES0_S5_DpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10FatalErrorILb1EJRlS2_EEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
465
466
// default have stacktrace. could disable manually.
467
#define ERROR_CTOR(name, code)                                                       \
468
    template <bool stacktrace = true, typename... Args>                              \
469
135
    static Status name(std::string_view msg, Args&&... args) {                       \
470
135
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
135
    }
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJRKmRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS7_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status12RuntimeErrorILb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status19MemoryLimitExceededILb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
_ZN5doris6Status10CorruptionILb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
2
    static Status name(std::string_view msg, Args&&... args) {                       \
470
2
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
2
    }
_ZN5doris6Status13InternalErrorILb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
72
    static Status name(std::string_view msg, Args&&... args) {                       \
470
72
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
72
    }
Unexecuted instantiation: _ZN5doris6Status12NotSupportedILb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status12NotSupportedILb1EJRKNS_13PrimitiveTypeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
_ZN5doris6Status13InternalErrorILb1EJRiS2_EEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
1
    static Status name(std::string_view msg, Args&&... args) {                       \
470
1
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
1
    }
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJR8CURLcodeEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
_ZN5doris6Status7IOErrorILb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
15
    static Status name(std::string_view msg, Args&&... args) {                       \
470
15
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
15
    }
_ZN5doris6Status7IOErrorILb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS7_S7_EEES0_St17basic_string_viewIcS5_EDpOT0_
Line
Count
Source
469
2
    static Status name(std::string_view msg, Args&&... args) {                       \
470
2
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
2
    }
_ZN5doris6Status7IOErrorILb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
1
    static Status name(std::string_view msg, Args&&... args) {                       \
470
1
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
1
    }
_ZN5doris6Status13InternalErrorILb1EJiRA15_KcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
2
    static Status name(std::string_view msg, Args&&... args) {                       \
470
2
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
2
    }
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJiiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EEES0_St17basic_string_viewIcS5_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJiiiiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJRNS_10segment_v212idx_query_v29QueryTypeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
_ZN5doris6Status13InternalErrorILb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT0_
Line
Count
Source
469
8
    static Status name(std::string_view msg, Args&&... args) {                       \
470
8
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
8
    }
_ZN5doris6Status13InternalErrorILb1EJRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT0_
Line
Count
Source
469
3
    static Status name(std::string_view msg, Args&&... args) {                       \
470
3
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
3
    }
Unexecuted instantiation: _ZN5doris6Status12RuntimeErrorILb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT0_
_ZN5doris6Status13InternalErrorILb1EJPKcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
12
    static Status name(std::string_view msg, Args&&... args) {                       \
470
12
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
12
    }
_ZN5doris6Status13InternalErrorILb1EJmEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
2
    static Status name(std::string_view msg, Args&&... args) {                       \
470
2
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
2
    }
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJRKNS_13TSerdeDialect4typeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJRiNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEmEEES0_St17basic_string_viewIcS6_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status7IOErrorILb1EJmRiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status10CorruptionILb1EJRmS2_RKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_EEES0_St17basic_string_viewIcS6_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status10CorruptionILb1EJRjRmEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb0EJPKcEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
_ZN5doris6Status8NotFoundILb1EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
469
2
    static Status name(std::string_view msg, Args&&... args) {                       \
470
2
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
2
    }
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_EEES0_St17basic_string_viewIcS5_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES9_RmSA_EEES0_St17basic_string_viewIcS5_EDpOT0_
_ZN5doris6Status13InternalErrorILb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEES0_St17basic_string_viewIcS5_EDpOT0_
Line
Count
Source
469
12
    static Status name(std::string_view msg, Args&&... args) {                       \
470
12
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
12
    }
_ZN5doris6Status13InternalErrorILb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_EEES0_St17basic_string_viewIcS5_EDpOT0_
Line
Count
Source
469
1
    static Status name(std::string_view msg, Args&&... args) {                       \
470
1
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
471
1
    }
Unexecuted instantiation: _ZN5doris6Status13InternalErrorILb1EJRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEN3orc8TypeKindEEEES0_St17basic_string_viewIcS5_EDpOT0_
Unexecuted instantiation: _ZN5doris6Status12RuntimeErrorILb1EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKPKcEEES0_St17basic_string_viewIcS5_EDpOT0_
472
473
// default have no stacktrace. could enable manually.
474
#define ERROR_CTOR_NOSTACK(name, code)                                               \
475
    template <bool stacktrace = false, typename... Args>                             \
476
6.21k
    static Status name(std::string_view msg, Args&&... args) {                       \
477
6.21k
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
478
6.21k
    }
_ZN5doris6Status15InvalidArgumentILb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
476
83
    static Status name(std::string_view msg, Args&&... args) {                       \
477
83
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
478
83
    }
_ZN5doris6Status15InvalidArgumentILb0EJRNS_10segment_v214HashStrategyPBEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
476
1
    static Status name(std::string_view msg, Args&&... args) {                       \
477
1
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
478
1
    }
Unexecuted instantiation: _ZN5doris6Status15InvalidArgumentILb0EJNS_13PredicateTypeEEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
_ZN5doris6Status12NetworkErrorILb0EJPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKS9_lEEES0_St17basic_string_viewIcS7_EDpOT0_
Line
Count
Source
476
2
    static Status name(std::string_view msg, Args&&... args) {                       \
477
2
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
478
2
    }
_ZN5doris6Status9EndOfFileILb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
476
6.11k
    static Status name(std::string_view msg, Args&&... args) {                       \
477
6.11k
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
478
6.11k
    }
_ZN5doris6Status9CancelledILb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
476
19
    static Status name(std::string_view msg, Args&&... args) {                       \
477
19
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
478
19
    }
_ZN5doris6Status12NetworkErrorILb0EJEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Line
Count
Source
476
1
    static Status name(std::string_view msg, Args&&... args) {                       \
477
1
        return Error<ErrorCode::code, stacktrace>(msg, std::forward<Args>(args)...); \
478
1
    }
Unexecuted instantiation: _ZN5doris6Status15InvalidArgumentILb0EJRKPKcRiEEES0_St17basic_string_viewIcSt11char_traitsIcEEDpOT0_
Unexecuted instantiation: _ZN5doris6Status15InvalidArgumentILb0EJNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKPKcEEES0_St17basic_string_viewIcS5_EDpOT0_
479
480
    ERROR_CTOR(PublishTimeout, PUBLISH_TIMEOUT)
481
    ERROR_CTOR(MemoryAllocFailed, MEM_ALLOC_FAILED)
482
    ERROR_CTOR(BufferAllocFailed, BUFFER_ALLOCATION_FAILED)
483
    ERROR_CTOR_NOSTACK(InvalidArgument, INVALID_ARGUMENT)
484
    ERROR_CTOR_NOSTACK(InvalidJsonPath, INVALID_JSON_PATH)
485
    ERROR_CTOR(MinimumReservationUnavailable, MINIMUM_RESERVATION_UNAVAILABLE)
486
    ERROR_CTOR(Corruption, CORRUPTION)
487
    ERROR_CTOR(IOError, IO_ERROR)
488
    ERROR_CTOR(NotFound, NOT_FOUND)
489
    ERROR_CTOR_NOSTACK(AlreadyExist, ALREADY_EXIST)
490
    ERROR_CTOR(NotSupported, NOT_IMPLEMENTED_ERROR)
491
    ERROR_CTOR_NOSTACK(EndOfFile, END_OF_FILE)
492
    ERROR_CTOR(InternalError, INTERNAL_ERROR)
493
    ERROR_CTOR(RuntimeError, RUNTIME_ERROR)
494
    ERROR_CTOR_NOSTACK(Cancelled, CANCELLED)
495
    ERROR_CTOR(MemoryLimitExceeded, MEM_LIMIT_EXCEEDED)
496
    ERROR_CTOR(RpcError, THRIFT_RPC_ERROR)
497
    ERROR_CTOR_NOSTACK(TimedOut, TIMEOUT)
498
    ERROR_CTOR_NOSTACK(TooManyTasks, TOO_MANY_TASKS)
499
    ERROR_CTOR(Uninitialized, UNINITIALIZED)
500
    ERROR_CTOR(Aborted, ABORTED)
501
    ERROR_CTOR_NOSTACK(DataQualityError, DATA_QUALITY_ERROR)
502
    ERROR_CTOR_NOSTACK(NotAuthorized, NOT_AUTHORIZED)
503
    ERROR_CTOR(HttpError, HTTP_ERROR)
504
    ERROR_CTOR_NOSTACK(NeedSendAgain, NEED_SEND_AGAIN)
505
    ERROR_CTOR_NOSTACK(CgroupError, CGROUP_ERROR)
506
    ERROR_CTOR_NOSTACK(ObtainLockFailed, OBTAIN_LOCK_FAILED)
507
    ERROR_CTOR_NOSTACK(NetworkError, NETWORK_ERROR)
508
#undef ERROR_CTOR
509
510
    template <int code>
511
788k
    bool is() const {
512
788k
        return code == _code;
513
788k
    }
_ZNK5doris6Status2isILin7002EEEbv
Line
Count
Source
511
6.02k
    bool is() const {
512
6.02k
        return code == _code;
513
6.02k
    }
_ZNK5doris6Status2isILi6EEEbv
Line
Count
Source
511
4
    bool is() const {
512
4
        return code == _code;
513
4
    }
_ZNK5doris6Status2isILin206EEEbv
Line
Count
Source
511
1
    bool is() const {
512
1
        return code == _code;
513
1
    }
_ZNK5doris6Status2isILi30EEEbv
Line
Count
Source
511
778k
    bool is() const {
512
778k
        return code == _code;
513
778k
    }
_ZNK5doris6Status2isILi33EEEbv
Line
Count
Source
511
1
    bool is() const {
512
1
        return code == _code;
513
1
    }
_ZNK5doris6Status2isILi39EEEbv
Line
Count
Source
511
1
    bool is() const {
512
1
        return code == _code;
513
1
    }
_ZNK5doris6Status2isILin240EEEbv
Line
Count
Source
511
3.78k
    bool is() const {
512
3.78k
        return code == _code;
513
3.78k
    }
514
515
0
    void set_code(int code) { _code = code; }
516
517
334M
    bool ok() const { return _code == ErrorCode::OK; }
518
519
    // Convert into TStatus.
520
    void to_thrift(TStatus* status) const;
521
    TStatus to_thrift() const;
522
    void to_protobuf(PStatus* status) const;
523
524
    std::string to_string() const;
525
    std::string to_string_no_stack() const;
526
527
    /// @return A json representation of this status.
528
    std::string to_json() const;
529
530
34.7k
    int code() const { return _code; }
531
532
    /// Clone this status and add the specified prefix to the message.
533
    ///
534
    /// If this status is OK, then an OK status will be returned.
535
    ///
536
    /// @param [in] msg
537
    ///   The message to prepend.
538
    /// @return A ref to Status object
539
    Status& prepend(std::string_view msg);
540
541
    /// Add the specified suffix to the message.
542
    ///
543
    /// If this status is OK, then an OK status will be returned.
544
    ///
545
    /// @param [in] msg
546
    ///   The message to append.
547
    /// @return A ref to Status object
548
    Status& append(std::string_view msg);
549
550
    // if(!status) or if (status) will use this operator
551
71.5M
    operator bool() const { return this->ok(); }
552
553
    // Used like if ASSERT_EQ(res, Status::OK())
554
    // if the state is ok, then both code and precise code is not initialized properly, so that should check ok state
555
    // ignore error messages during comparison
556
19.5k
    bool operator==(const Status& st) const { return _code == st._code; }
557
558
    // Used like if ASSERT_NE(res, Status::OK())
559
1.21M
    bool operator!=(const Status& st) const { return _code != st._code; }
560
561
    friend std::ostream& operator<<(std::ostream& ostr, const Status& status);
562
563
30.6k
    std::string_view msg() const { return _err_msg ? _err_msg->_msg : std::string_view(""); }
564
565
0
    std::pair<int, std::string> retrieve_error_msg() { return {_code, std::move(_err_msg->_msg)}; }
566
567
    friend io::ObjectStorageStatus convert_to_obj_response(Status st);
568
569
private:
570
    int _code;
571
    struct ErrMsg {
572
        std::string _msg;
573
        std::string _stack;
574
    };
575
    std::unique_ptr<ErrMsg> _err_msg;
576
577
2.20k
    std::string code_as_string() const {
578
2.20k
        return (int)_code >= 0 ? doris::to_string(static_cast<TStatusCode::type>(_code))
579
2.20k
                               : fmt::format("E{}", (int16_t)_code);
580
2.20k
    }
581
};
582
583
// There are many thread using status to indicate the cancel state, one thread may update it and
584
// the other thread will read it. Status is not thread safe, for example, if one thread is update it
585
// and another thread is call to_string method, it may core, because the _err_msg is an unique ptr and
586
// it is deconstructed during copy method.
587
// And also we could not use lock, because we need get status frequently to check if it is cancelled.
588
// The default value is ok.
589
class AtomicStatus {
590
public:
591
18.8k
    AtomicStatus() : error_st_(Status::OK()) {}
592
593
3.62M
    bool ok() const { return error_code_.load(std::memory_order_acquire) == 0; }
594
595
53
    bool update(const Status& new_status) {
596
        // If new status is normal, or the old status is abnormal, then not need update
597
53
        if (new_status.ok() || error_code_.load(std::memory_order_acquire) != 0) {
598
42
            return false;
599
42
        }
600
11
        std::lock_guard l(mutex_);
601
11
        if (error_code_.load(std::memory_order_acquire) != 0) {
602
0
            return false;
603
0
        }
604
11
        error_st_ = new_status;
605
11
        error_code_.store(new_status.code(), std::memory_order_release);
606
11
        return true;
607
11
    }
608
609
    // will copy a new status object to avoid concurrency
610
    // This stauts could only be called when ok==false
611
80
    Status status() const {
612
80
        std::lock_guard l(mutex_);
613
80
        return error_st_;
614
80
    }
615
616
    AtomicStatus(const AtomicStatus&) = delete;
617
    void operator=(const AtomicStatus&) = delete;
618
619
private:
620
    std::atomic_int16_t error_code_ = 0;
621
    Status error_st_;
622
    // mutex's lock is not a const method, but we will use this mutex in
623
    // some const method, so that it should be mutable.
624
    mutable std::mutex mutex_;
625
};
626
627
2.05k
inline std::ostream& operator<<(std::ostream& ostr, const Status& status) {
628
2.05k
    ostr << '[' << status.code_as_string() << ']';
629
2.05k
    ostr << status.msg();
630
2.05k
    if (status._err_msg && !status._err_msg->_stack.empty() && config::enable_stacktrace) {
631
0
        ostr << '\n' << status._err_msg->_stack;
632
0
    }
633
2.05k
    return ostr;
634
2.05k
}
635
636
1.95k
inline std::string Status::to_string() const {
637
1.95k
    std::stringstream ss;
638
1.95k
    ss << *this;
639
1.95k
    return ss.str();
640
1.95k
}
641
642
inline std::string Status::to_string_no_stack() const {
643
    return fmt::format("[{}]{}", code_as_string(), msg());
644
}
645
646
// some generally useful macros
647
#define RETURN_IF_ERROR(stmt)           \
648
3.48k
    do {                                \
649
3.48k
        Status _status_ = (stmt);       \
650
3.48k
        if (UNLIKELY(!_status_.ok())) { \
651
13
            return _status_;            \
652
13
        }                               \
653
3.48k
    } while (false)
654
655
#define PROPAGATE_FALSE(stmt)                     \
656
    do {                                          \
657
        if (UNLIKELY(!static_cast<bool>(stmt))) { \
658
            return false;                         \
659
        }                                         \
660
    } while (false)
661
662
#define THROW_IF_ERROR(stmt)            \
663
    do {                                \
664
        Status _status_ = (stmt);       \
665
        if (UNLIKELY(!_status_.ok())) { \
666
            throw Exception(_status_);  \
667
        }                               \
668
    } while (false)
669
670
#define RETURN_IF_STATUS_ERROR(status, stmt) \
671
    do {                                     \
672
        status = (stmt);                     \
673
        if (UNLIKELY(!status.ok())) {        \
674
            return;                          \
675
        }                                    \
676
    } while (false)
677
678
#define EXIT_IF_ERROR(stmt)             \
679
    do {                                \
680
        Status _status_ = (stmt);       \
681
        if (UNLIKELY(!_status_.ok())) { \
682
            LOG(ERROR) << _status_;     \
683
            exit(1);                    \
684
        }                               \
685
    } while (false)
686
687
#define RETURN_FALSE_IF_ERROR(stmt)   \
688
    do {                              \
689
        Status status = (stmt);       \
690
        if (UNLIKELY(!status.ok())) { \
691
            return false;             \
692
        }                             \
693
    } while (false)
694
695
/// @brief Emit a warning if @c to_call returns a bad status.
696
#define WARN_IF_ERROR(to_call, warning_prefix)              \
697
34
    do {                                                    \
698
34
        Status _s = (to_call);                              \
699
34
        if (UNLIKELY(!_s.ok())) {                           \
700
0
            LOG(WARNING) << (warning_prefix) << ": " << _s; \
701
0
        }                                                   \
702
34
    } while (false);
703
704
#define RETURN_NOT_OK_STATUS_WITH_WARN(stmt, warning_prefix)       \
705
    do {                                                           \
706
        Status _s = (stmt);                                        \
707
        if (UNLIKELY(!_s.ok())) {                                  \
708
            LOG(WARNING) << (warning_prefix) << ", error: " << _s; \
709
            return _s;                                             \
710
        }                                                          \
711
    } while (false);
712
713
template <typename T>
714
using Result = expected<T, Status>;
715
716
using ResultError = unexpected<Status>;
717
718
#define RETURN_IF_ERROR_RESULT(stmt)                \
719
    do {                                            \
720
        Status _status_ = (stmt);                   \
721
        if (UNLIKELY(!_status_.ok())) {             \
722
            return unexpected(std::move(_status_)); \
723
        }                                           \
724
    } while (false)
725
726
#define DORIS_TRY(stmt)                          \
727
18
    ({                                           \
728
18
        auto&& res = (stmt);                     \
729
18
        using T = std::decay_t<decltype(res)>;   \
730
18
        if (!res.has_value()) [[unlikely]] {     \
731
0
            return std::forward<T>(res).error(); \
732
0
        }                                        \
733
18
        std::forward<T>(res).value();            \
734
18
    });
735
736
} // namespace doris
737
738
// specify formatter for Status
739
template <>
740
struct fmt::formatter<doris::Status> {
741
    template <typename ParseContext>
742
13
    constexpr auto parse(ParseContext& ctx) {
743
13
        return ctx.begin();
744
13
    }
745
746
    template <typename FormatContext>
747
13
    auto format(doris::Status const& status, FormatContext& ctx) {
748
13
        return fmt::format_to(ctx.out(), "{}", status.to_string());
749
13
    }
750
};