YugabyteDB (2.13.0.0-b42, bfc6a6643e7399ac8a0e81d06a3ee6d6571b33ab)

Coverage Report

Created: 2022-03-09 17:30

/Users/deen/code/yugabyte-db/src/yb/util/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
// The following only applies to changes made to this file as part of YugaByte development.
6
//
7
// Portions Copyright (c) YugaByte, Inc.
8
//
9
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
10
// in compliance with the License.  You may obtain a copy of the License at
11
//
12
// http://www.apache.org/licenses/LICENSE-2.0
13
//
14
// Unless required by applicable law or agreed to in writing, software distributed under the License
15
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
16
// or implied.  See the License for the specific language governing permissions and limitations
17
// under the License.
18
//
19
// A Status encapsulates the result of an operation.  It may indicate success,
20
// or it may indicate an error with an associated error message.
21
//
22
// Multiple threads can invoke const methods on a Status without
23
// external synchronization, but if any of the threads may call a
24
// non-const method, all threads accessing the same Status must use
25
// external synchronization.
26
27
#ifndef YB_UTIL_STATUS_H_
28
#define YB_UTIL_STATUS_H_
29
30
#include <string>
31
32
#include <boost/intrusive_ptr.hpp>
33
34
#include "yb/util/slice.h"
35
#include "yb/util/status_fwd.h"
36
#include "yb/util/strongly_typed_bool.h"
37
38
// Return the given status if it is not OK.
39
7.45G
#define YB_RETURN_NOT_OK(s) do { \
40
35.4M
    auto&& _s = (s); \
_ZZN2yb9TestTableIJNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE11cass_bool_tfdixS7_EE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clESH_
Line
Count
Source
40
1
    auto&& _s = (s); \
_ZZN2yb9TestTableIJNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEENS_13CassandraJsonEEE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clESH_
Line
Count
Source
40
4
    auto&& _s = (s); \
cassandra_cpp_driver-test.cc:_ZZN2yb12GetTableSizeEPNS_16CassandraSessionERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEENK3$_2clERKNS_12CassandraRowE
Line
Count
Source
40
31
    auto&& _s = (s); \
_ZZN2yb9TestTableIJ11cass_bool_tiNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEiS8_EE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clESH_
Line
Count
Source
40
4
    auto&& _s = (s); \
_ZZN2yb9TestTableIJNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEdEE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clESG_
Line
Count
Source
40
2
    auto&& _s = (s); \
_ZZN2yb9TestTableIJidEE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clES9_
Line
Count
Source
40
2
    auto&& _s = (s); \
_ZZN2yb9TestTableIJxdEE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clES9_
Line
Count
Source
40
1
    auto&& _s = (s); \
_ZZN2yb9TestTableIJ11cass_bool_tdEE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clESA_
Line
Count
Source
40
2
    auto&& _s = (s); \
_ZZN2yb9TestTableIJfdEE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clES9_
Line
Count
Source
40
2
    auto&& _s = (s); \
_ZZN2yb9TestTableIJddEE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clES9_
Line
Count
Source
40
1
    auto&& _s = (s); \
_ZZN2yb9TestTableIJNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEidEE20ExecuteAndReadOneRowEPNS_16CassandraSessionERKNS_18CassandraStatementEENKUlRKNS_12CassandraRowEE_clESG_
Line
Count
Source
40
1
    auto&& _s = (s); \
_ZZN2yb16CassandraSession10FetchValueINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEENS_6ResultIT_EERKS8_ENKUlRKNS_12CassandraRowEE_clESG_
Line
Count
Source
40
1
    auto&& _s = (s); \
Unexecuted instantiation: _ZZN2yb7tserver14CompactionTest12WriteAtLeastEmENKUlvE_clEv
Unexecuted instantiation: _ZZN2yb7tserver14CompactionTest22WriteAtLeastFilesPerDbEmENKUlvE_clEv
Unexecuted instantiation: _ZZN2yb7tserver14CompactionTest26WaitForNumCompactionsPerDbEmENKUlvE_clEv
master-test_ent.cc:_ZZN2yb6master10enterprise13MasterTestEnt15CreateCDCStreamERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEPS9_ENK3$_0clEv
Line
Count
Source
40
12
    auto&& _s = (s); \
Unexecuted instantiation: _ZZN2yb9pgwrapper19PgIndexBackfillSlow23WaitForBackfillSafeTimeERKNS_6client11YBTableNameERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEENKUlvE_clEv
Unexecuted instantiation: _ZZN2yb9pgwrapper19PgIndexBackfillSlow23WaitForBackfillSafeTimeERKNS_6client11YBTableNameERKNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEEENKUlvE0_clEv
Unexecuted instantiation: pg_libpq-test.cc:_ZZN2yb9pgwrapper12_GLOBAL__N_127GetColocatedTabletLocationsEPNS_6client8YBClientENSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEENS_9MonoDeltaEENK4$_46clEv
Unexecuted instantiation: pg_libpq-test.cc:_ZZN2yb9pgwrapper12_GLOBAL__N_128GetTablegroupTabletLocationsEPNS_6client8YBClientENSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEESB_NS_9MonoDeltaEENK4$_47clEv
Unexecuted instantiation: _ZZN2yb5tools27YbAdminSnapshotScheduleTest20WaitScheduleSnapshotENS_9MonoDeltaERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEjENKUlvE_clEv
Unexecuted instantiation: _ZZN2yb5tools27YbAdminSnapshotScheduleTest20WaitScheduleSnapshotENS_9MonoDeltaERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEjENKUlvE0_clEv
Unexecuted instantiation: _ZZN2yb16CassandraSession10FetchValueIiEENS_6ResultIT_EERKNSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEEENKUlRKNS_12CassandraRowEE_clESG_
Unexecuted instantiation: _ZZN2yb5tools12AdminCliTest19WaitForAllSnapshotsEPNS_6master17MasterBackupProxyEENKUlvE_clEv
Unexecuted instantiation: _ZZN2yb5tools12AdminCliTest18WaitForRestorationEvENKUlvE_clEv
external_mini_cluster.cc:_ZZN2yb19ExternalMiniCluster26WaitForMasterToMarkTSAliveEiNS_9MonoDeltaEENK3$_0clEv
Line
Count
Source
40
15
    auto&& _s = (s); \
external_mini_cluster.cc:_ZZN2yb19ExternalMiniCluster25WaitForMasterToMarkTSDeadEiNS_9MonoDeltaEENK3$_1clEv
Line
Count
Source
40
20
    auto&& _s = (s); \
Unexecuted instantiation: mini_cluster.cc:_ZZN2yb11MiniCluster21AddTServerToBlacklistERKNS_7tserver16MiniTabletServerEENK3$_7clEPNS_6master23SysClusterConfigEntryPBE
Unexecuted instantiation: mini_cluster.cc:_ZZN2yb11MiniCluster14ClearBlacklistEvENK3$_8clEPNS_6master23SysClusterConfigEntryPBE
Unexecuted instantiation: mini_cluster.cc:_ZZN2yb36WaitForTableActiveTabletLeadersPeersEPNS_11MiniClusterERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEmNS_9MonoDeltaEENK4$_11clEv
Unexecuted instantiation: mini_cluster.cc:_ZZN2yb37WaitAllReplicasSynchronizedWithLeaderEPNS_11MiniClusterENSt3__16chrono10time_pointINS_15CoarseMonoClockENS3_8durationIxNS2_5ratioILl1ELl1000000000EEEEEEEENK4$_17clEv
catalog_manager.cc:_ZZN2yb6master14CatalogManager18VerifyTablePgLayerE13scoped_refptrINS0_9TableInfoEEbENK3$_7clEv
Line
Count
Source
40
92
    auto&& _s = (s); \
catalog_manager.cc:_ZZN2yb6master14CatalogManager13EnableBgTasksEvENK4$_12clEv
Line
Count
Source
40
5.35k
    auto&& _s = (s); \
Unexecuted instantiation: _ZZN2yb6master25MasterSnapshotCoordinator4Impl4LoadEPNS_6tablet6TabletEENKUlRKNS_5SliceES8_E_clES8_S8_
sys_catalog.cc:_ZZN2yb6master15SysCatalogTable5VisitEPNS0_11VisitorBaseEENK3$_2clERKNS_5SliceES7_
Line
Count
Source
40
223k
    auto&& _s = (s); \
Unexecuted instantiation: snapshot_test_util.cc:_ZZN2yb6client16SnapshotTestUtil23WaitAllSnapshotsDeletedEvENK3$_2clEv
executor.cc:_ZZN2yb2ql8Executor23LoadPagingStateFromUserEPKNS0_12PTSelectStmtEPNS0_12TnodeContextEENK3$_0clES4_
Line
Count
Source
40
3.61M
    auto&& _s = (s); \
executor.cc:_ZZN2yb2ql8Executor23LoadPagingStateFromUserEPKNS0_12PTSelectStmtEPNS0_12TnodeContextEENK3$_1clES4_
Line
Count
Source
40
253
    auto&& _s = (s); \
executor.cc:_ZZN2yb2ql8Executor19ProcessTnodeResultsEPNS0_12TnodeContextEENK3$_5clES3_
Line
Count
Source
40
309
    auto&& _s = (s); \
Unexecuted instantiation: tablet-split-itest-base.cc:_ZZN2yb16TabletSplitITest32CheckPostSplitTabletReplicasDataEmmmENK3$_3clEv
tablet-split-itest-base.cc:_ZZN2yb35TabletSplitExternalMiniClusterITest22SplitTabletCrashMasterEbPNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_6clEv
Line
Count
Source
40
183
    auto&& _s = (s); \
Unexecuted instantiation: ts_tablet_manager.cc:_ZZN2yb7tserver15TSTabletManager24TriggerCompactionAndWaitERKNSt3__16vectorINS2_10shared_ptrINS_6tablet6TabletEEENS2_9allocatorIS7_EEEEENK3$_7clEv
Unexecuted instantiation: mini_tablet_server.cc:_ZZN2yb7tserver16MiniTabletServer9ReconnectEvENK3$_1clERKN5boost4asio2ip7addressE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient13ListSnapshotsERKNS_10EnumBitSetINS1_17ListSnapshotsFlagEEEENK3$_0clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient13ListSnapshotsERKNS_10EnumBitSetINS1_17ListSnapshotsFlagEEEENK3$_1clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient14CreateSnapshotERKNSt3__16vectorINS_6client11YBTableNameENS3_9allocatorIS6_EEEEbiENK3$_2clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient23CreateNamespaceSnapshotERKNS0_18TypedNamespaceNameEENK3$_3clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient24ListSnapshotRestorationsERKNS_17StronglyTypedUuidINS_28TxnSnapshotRestorationId_TagEEEENK3$_4clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient22CreateSnapshotScheduleERKNS_6client11YBTableNameENS_9MonoDeltaES7_ENK3$_5clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient21ListSnapshotSchedulesERKNS_17StronglyTypedUuidINS_22SnapshotScheduleId_TagEEEENK3$_6clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient22DeleteSnapshotScheduleERKNS_17StronglyTypedUuidINS_22SnapshotScheduleId_TagEEEENK3$_7clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient15RestoreSnapshotERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS_10HybridTimeEENK3$_8clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient14DeleteSnapshotERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEENK3$_9clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient22CreateSnapshotMetaFileERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEESB_ENK4$_10clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient22ImportSnapshotMetaFileERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKNS0_18TypedNamespaceNameERKNS3_6vectorINS_6client11YBTableNameENS7_ISH_EEEEENK4$_11clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient22ImportSnapshotMetaFileERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEERKNS0_18TypedNamespaceNameERKNS3_6vectorINS_6client11YBTableNameENS7_ISH_EEEEENK4$_13clEPNS_3rpc13RpcControllerE
Unexecuted instantiation: yb-admin_client_ent.cc:_ZZN2yb5tools10enterprise18ClusterAdminClient21ListReplicaTypeCountsERKNS_6client11YBTableNameEENK4$_14clEPNS_3rpc13RpcControllerE
client-internal.cc:_ZZN2yb6client8YBClient4Data32WaitUntilIndexPermissionsAtLeastEPS1_RKNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEESC_RKNS_16IndexPermissionsENS4_6chrono10time_pointINS_15CoarseMonoClockENSG_8durationIxNS4_5ratioILl1ELl1000000000EEEEEEESM_ENK3$_0clESN_Pb
Line
Count
Source
40
1.29k
    auto&& _s = (s); \
client-internal.cc:_ZZN2yb6client8YBClient4Data32WaitUntilIndexPermissionsAtLeastEPS1_RKNS0_11YBTableNameES6_RKNS_16IndexPermissionsENSt3__16chrono10time_pointINS_15CoarseMonoClockENSB_8durationIxNSA_5ratioILl1ELl1000000000EEEEEEESH_ENK3$_1clESI_Pb
Line
Count
Source
40
408
    auto&& _s = (s); \
client-internal.cc:_ZZN2yb6client8YBClient4Data32WaitUntilIndexPermissionsAtLeastEPS1_RKNS0_11YBTableNameES6_RKNS_16IndexPermissionsENSt3__16chrono10time_pointINS_15CoarseMonoClockENSB_8durationIxNSA_5ratioILl1ELl1000000000EEEEEEESH_ENK3$_2clESI_Pb
Line
Count
Source
40
2.58k
    auto&& _s = (s); \
conflict_resolution.cc:_ZZN2yb5docdb12_GLOBAL__N_134TransactionConflictResolverContext13ReadConflictsEPNS1_16ConflictResolverEENKUlT_NS_17StronglyTypedBoolINS0_14FullDocKey_TagEEET0_T1_T2_E_clINS0_14IntentStrengthENS_5SliceEPNS0_8KeyBytesENS6_INS0_11LastKey_TagEEEEEDaS5_S8_S9_SA_SB_
Line
Count
Source
40
16.1M
    auto&& _s = (s); \
conflict_resolution.cc:_ZZN2yb5docdb12_GLOBAL__N_134TransactionConflictResolverContext13ReadConflictsEPNS1_16ConflictResolverEENKUlT_NS_17StronglyTypedBoolINS0_14FullDocKey_TagEEET0_T1_T2_E0_clINS0_14IntentStrengthENS_5SliceEPNS0_8KeyBytesENS6_INS0_11LastKey_TagEEEEEDaS5_S8_S9_SA_SB_
Line
Count
Source
40
2.99M
    auto&& _s = (s); \
docdb.cc:_ZZN2yb5docdb12_GLOBAL__N_119DetermineKeysToLockERKNSt3__16vectorINS2_10unique_ptrINS0_12DocOperationENS2_14default_deleteIS5_EEEENS2_9allocatorIS8_EEEERKN6google8protobuf16RepeatedPtrFieldINS0_14KeyValuePairPBEEENS_14IsolationLevelENS0_13OperationKindENS_11RowMarkTypeEbNS_17StronglyTypedBoolINS0_26PartialRangeKeyIntents_TagEEEENK3$_0clENS0_14IntentStrengthENSO_INS0_14FullDocKey_TagEEENS_5SliceEPNS0_8KeyBytesENSO_INS0_11LastKey_TagEEE
Line
Count
Source
40
5.82M
    auto&& _s = (s); \
Unexecuted instantiation: _ZZN2yb5docdb14RocksDBPatcher4Impl15UpdateFileSizesEvENKUliRKN7rocksdb12FileMetaDataEE_clEiS6_
pg_session.cc:_ZZN2yb6pggate9PgSession9RunHelper5ApplyERKNS_6SchemaERKNSt3__110shared_ptrINS0_7PgsqlOpEEEPybENK3$_2clINS0_20BufferableOperationsENS_17StronglyTypedBoolINS0_26IsTransactionalSession_TagEEEEENS_6StatusET_T0_
Line
Count
Source
40
93.7k
    auto&& _s = (s); \
net_util.cc:_ZZNK2yb8HostPort16ResolveAddressesEPNSt3__16vectorIN5boost4asio2ip14basic_endpointINS5_3tcpEEENS1_9allocatorIS8_EEEEENK3$_0clERKNS5_7addressE
Line
Count
Source
40
380k
    auto&& _s = (s); \
41
7.27G
    if (PREDICT_FALSE(!_s.ok())) return MoveStatus(std::move(_s)); \
42
7.27G
  } while (false)
43
44
// Return the given status if it is not OK, but first clone it and prepend the given message.
45
3.03G
#define YB_RETURN_NOT_OK_PREPEND(s, msg) do { \
46
54
    auto&& _s = (s); \
_ZZN7rocksdb33DBTestUniversalCompactionDeletion20WaitFilePathsDeletedINSt3__16vectorINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS7_IS9_EEEEEEN2yb6StatusET_RKS9_ENKUlvE_clEv
Line
Count
Source
46
36
    auto&& _s = (s); \
_ZZN7rocksdb33DBTestUniversalCompactionDeletion20WaitFilePathsDeletedINSt3__113unordered_setINS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEENS2_4hashIS9_EENS2_8equal_toIS9_EENS7_IS9_EEEEEEN2yb6StatusET_RKS9_ENKUlvE_clEv
Line
Count
Source
46
18
    auto&& _s = (s); \
Unexecuted instantiation: restore_sys_catalog_state.cc:_ZZN2yb6master22RestoreSysCatalogState7ProcessEvENK3$_0clINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_19SysNamespaceEntryPBEEEDaRKT_PT0_
Unexecuted instantiation: restore_sys_catalog_state.cc:_ZZN2yb6master22RestoreSysCatalogState7ProcessEvENK3$_0clINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_16SysTablesEntryPBEEEDaRKT_PT0_
Unexecuted instantiation: restore_sys_catalog_state.cc:_ZZN2yb6master22RestoreSysCatalogState7ProcessEvENK3$_0clINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_17SysTabletsEntryPBEEEDaRKT_PT0_
Unexecuted instantiation: restore_sys_catalog_state.cc:_ZZN2yb6master22RestoreSysCatalogState7ProcessEvENK3$_1clINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_19SysNamespaceEntryPBEEEDaRKT_PT0_
Unexecuted instantiation: restore_sys_catalog_state.cc:_ZZN2yb6master22RestoreSysCatalogState7ProcessEvENK3$_1clINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_16SysTablesEntryPBEEEDaRKT_PT0_
Unexecuted instantiation: restore_sys_catalog_state.cc:_ZZN2yb6master22RestoreSysCatalogState7ProcessEvENK3$_1clINSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEENS0_17SysTabletsEntryPBEEEDaRKT_PT0_
47
2.41G
    if (PREDICT_FALSE(!_s.ok())) return MoveStatus(_s).CloneAndPrepend(msg); \
48
2.41G
  } while (0);
49
50
// Return 'to_return' if 'to_call' returns a bad status.  The substitution for 'to_return' may
51
// reference the variable 's' for the bad status.
52
0
#define YB_RETURN_NOT_OK_RET(to_call, to_return) do { \
53
0
    ::yb::Status s = (to_call); \
54
0
    if (PREDICT_FALSE(!s.ok())) return (to_return);  \
55
0
  } while (0);
56
57
// Return the given status by adding the error code if it is not OK.
58
7.77k
#define YB_RETURN_NOT_OK_SET_CODE(s, code) do { \
59
7.77k
    auto&& _s = (s); \
60
7.77k
    if (PREDICT_FALSE(!_s.ok())) return MoveStatus(_s).CloneAndAddErrorCode(code); \
61
7.77k
  } while (false)
62
63
7.27G
#define RETURN_NOT_OK           YB_RETURN_NOT_OK
64
2.41G
#define RETURN_NOT_OK_PREPEND   YB_RETURN_NOT_OK_PREPEND
65
0
#define RETURN_NOT_OK_RET       YB_RETURN_NOT_OK_RET
66
7.77k
#define RETURN_NOT_OK_SET_CODE  YB_RETURN_NOT_OK_SET_CODE
67
68
extern "C" {
69
70
struct YBCStatusStruct;
71
72
}
73
74
namespace yb {
75
76
class Slice;
77
78
YB_STRONGLY_TYPED_BOOL(DupFileName);
79
YB_STRONGLY_TYPED_BOOL(AddRef);
80
81
class StatusErrorCode;
82
struct StatusCategoryDescription;
83
84
class NODISCARD_CLASS Status {
85
 public:
86
  // Wrapper class for OK status to forbid creation of Result from Status::OK in compile time
87
  class OK {
88
   public:
89
13.9G
    operator Status() const {
90
13.9G
      return Status();
91
13.9G
    }
92
  };
93
  // Create a success status.
94
14.5G
  Status() {}
95
96
  // Returns true if the status indicates success.
97
17.4G
  MUST_USE_RESULT bool ok() const { return state_ == nullptr; }
98
99
  // Declares set of Is* functions
100
101
  #define YB_STATUS_CODE(name, pb_name, value, message) \
102
234M
      bool BOOST_PP_CAT(Is, name)() const { \
103
234M
        return code() == BOOST_PP_CAT(k, name); \
104
234M
      }
Unexecuted instantiation: _ZNK2yb6Status20IsConfigurationErrorEv
Unexecuted instantiation: _ZNK2yb6Status10IsCombinedEv
Unexecuted instantiation: _ZNK2yb6Status16IsSnapshotTooOldEv
_ZNK2yb6Status10IsNotFoundEv
Line
Count
Source
102
28.1M
      bool BOOST_PP_CAT(Is, name)() const { \
103
28.1M
        return code() == BOOST_PP_CAT(k, name); \
104
28.1M
      }
_ZNK2yb6Status6IsBusyEv
Line
Count
Source
102
828k
      bool BOOST_PP_CAT(Is, name)() const { \
103
828k
        return code() == BOOST_PP_CAT(k, name); \
104
828k
      }
_ZNK2yb6Status10IsTimedOutEv
Line
Count
Source
102
8.95M
      bool BOOST_PP_CAT(Is, name)() const { \
103
8.95M
        return code() == BOOST_PP_CAT(k, name); \
104
8.95M
      }
_ZNK2yb6Status10IsTryAgainEv
Line
Count
Source
102
49.9M
      bool BOOST_PP_CAT(Is, name)() const { \
103
49.9M
        return code() == BOOST_PP_CAT(k, name); \
104
49.9M
      }
_ZNK2yb6Status9IsExpiredEv
Line
Count
Source
102
5.66M
      bool BOOST_PP_CAT(Is, name)() const { \
103
5.66M
        return code() == BOOST_PP_CAT(k, name); \
104
5.66M
      }
_ZNK2yb6Status16IsAlreadyPresentEv
Line
Count
Source
102
3.17M
      bool BOOST_PP_CAT(Is, name)() const { \
103
3.17M
        return code() == BOOST_PP_CAT(k, name); \
104
3.17M
      }
_ZNK2yb6Status17IsInvalidArgumentEv
Line
Count
Source
102
127k
      bool BOOST_PP_CAT(Is, name)() const { \
103
127k
        return code() == BOOST_PP_CAT(k, name); \
104
127k
      }
_ZNK2yb6Status20IsServiceUnavailableEv
Line
Count
Source
102
7.43M
      bool BOOST_PP_CAT(Is, name)() const { \
103
7.43M
        return code() == BOOST_PP_CAT(k, name); \
104
7.43M
      }
_ZNK2yb6Status9IsIOErrorEv
Line
Count
Source
102
4.88M
      bool BOOST_PP_CAT(Is, name)() const { \
103
4.88M
        return code() == BOOST_PP_CAT(k, name); \
104
4.88M
      }
_ZNK2yb6Status14IsIllegalStateEv
Line
Count
Source
102
17.0M
      bool BOOST_PP_CAT(Is, name)() const { \
103
17.0M
        return code() == BOOST_PP_CAT(k, name); \
104
17.0M
      }
_ZNK2yb6Status9IsQLErrorEv
Line
Count
Source
102
7.50M
      bool BOOST_PP_CAT(Is, name)() const { \
103
7.50M
        return code() == BOOST_PP_CAT(k, name); \
104
7.50M
      }
_ZNK2yb6Status12IsIncompleteEv
Line
Count
Source
102
19.8M
      bool BOOST_PP_CAT(Is, name)() const { \
103
19.8M
        return code() == BOOST_PP_CAT(k, name); \
104
19.8M
      }
_ZNK2yb6Status9IsAbortedEv
Line
Count
Source
102
14.6M
      bool BOOST_PP_CAT(Is, name)() const { \
103
14.6M
        return code() == BOOST_PP_CAT(k, name); \
104
14.6M
      }
_ZNK2yb6Status12IsCorruptionEv
Line
Count
Source
102
1.15k
      bool BOOST_PP_CAT(Is, name)() const { \
103
1.15k
        return code() == BOOST_PP_CAT(k, name); \
104
1.15k
      }
_ZNK2yb6Status18IsLeaderHasNoLeaseEv
Line
Count
Source
102
7.27M
      bool BOOST_PP_CAT(Is, name)() const { \
103
7.27M
        return code() == BOOST_PP_CAT(k, name); \
104
7.27M
      }
_ZNK2yb6Status23IsLeaderNotReadyToServeEv
Line
Count
Source
102
7.31M
      bool BOOST_PP_CAT(Is, name)() const { \
103
7.31M
        return code() == BOOST_PP_CAT(k, name); \
104
7.31M
      }
_ZNK2yb6Status14IsNotSupportedEv
Line
Count
Source
102
6.04M
      bool BOOST_PP_CAT(Is, name)() const { \
103
6.04M
        return code() == BOOST_PP_CAT(k, name); \
104
6.04M
      }
_ZNK2yb6Status4IsOkEv
Line
Count
Source
102
3.95k
      bool BOOST_PP_CAT(Is, name)() const { \
103
3.95k
        return code() == BOOST_PP_CAT(k, name); \
104
3.95k
      }
_ZNK2yb6Status14IsNetworkErrorEv
Line
Count
Source
102
8.63M
      bool BOOST_PP_CAT(Is, name)() const { \
103
8.63M
        return code() == BOOST_PP_CAT(k, name); \
104
8.63M
      }
_ZNK2yb6Status20IsShutdownInProgressEv
Line
Count
Source
102
94.5k
      bool BOOST_PP_CAT(Is, name)() const { \
103
94.5k
        return code() == BOOST_PP_CAT(k, name); \
104
94.5k
      }
_ZNK2yb6Status17IsMergeInProgressEv
Line
Count
Source
102
16.3M
      bool BOOST_PP_CAT(Is, name)() const { \
103
16.3M
        return code() == BOOST_PP_CAT(k, name); \
104
16.3M
      }
_ZNK2yb6Status13IsRemoteErrorEv
Line
Count
Source
102
20.1M
      bool BOOST_PP_CAT(Is, name)() const { \
103
20.1M
        return code() == BOOST_PP_CAT(k, name); \
104
20.1M
      }
_ZNK2yb6Status14IsRuntimeErrorEv
Line
Count
Source
102
25
      bool BOOST_PP_CAT(Is, name)() const { \
103
25
        return code() == BOOST_PP_CAT(k, name); \
104
25
      }
_ZNK2yb6Status11IsEndOfFileEv
Line
Count
Source
102
342k
      bool BOOST_PP_CAT(Is, name)() const { \
103
342k
        return code() == BOOST_PP_CAT(k, name); \
104
342k
      }
_ZNK2yb6Status15IsInternalErrorEv
Line
Count
Source
102
1
      bool BOOST_PP_CAT(Is, name)() const { \
103
1
        return code() == BOOST_PP_CAT(k, name); \
104
1
      }
_ZNK2yb6Status15IsUninitializedEv
Line
Count
Source
102
147k
      bool BOOST_PP_CAT(Is, name)() const { \
103
147k
        return code() == BOOST_PP_CAT(k, name); \
104
147k
      }
_ZNK2yb6Status15IsNotAuthorizedEv
Line
Count
Source
102
469
      bool BOOST_PP_CAT(Is, name)() const { \
103
469
        return code() == BOOST_PP_CAT(k, name); \
104
469
      }
_ZNK2yb6Status16IsInvalidCommandEv
Line
Count
Source
102
124k
      bool BOOST_PP_CAT(Is, name)() const { \
103
124k
        return code() == BOOST_PP_CAT(k, name); \
104
124k
      }
105
  #include "yb/util/status_codes.h"
106
  #undef YB_STATUS_CODE
107
108
  // Returns a text message of this status to be reported to users.
109
  // Returns empty string for success.
110
5.50k
  std::string ToUserMessage(bool include_code = false) const {
111
5.50k
    return ToString(false /* include_file_and_line */, include_code);
112
5.50k
  }
113
114
  // Return a string representation of this status suitable for printing.
115
  // Returns the string "OK" for success.
116
  std::string ToString(bool include_file_and_line = true, bool include_code = true) const;
117
118
  // Return a string representation of the status code, without the message
119
  // text or posix code information.
120
  std::string CodeAsString() const;
121
122
  // Returned string has unlimited lifetime, and should NOT be released by the caller.
123
  const char* CodeAsCString() const;
124
125
  // Return the message portion of the Status. This is similar to ToString,
126
  // except that it does not include the stringified error code or posix code.
127
  //
128
  // For OK statuses, this returns an empty string.
129
  //
130
  // The returned Slice is only valid as long as this Status object remains
131
  // live and unchanged.
132
  Slice message() const;
133
134
  const uint8_t* ErrorData(uint8_t category) const;
135
  Slice ErrorCodesSlice() const;
136
137
  const char* file_name() const;
138
  int line_number() const;
139
140
  // Return a new Status object with the same state plus an additional leading message.
141
  Status CloneAndPrepend(const Slice& msg) const;
142
143
  // Same as CloneAndPrepend, but appends to the message instead.
144
  Status CloneAndAppend(const Slice& msg) const;
145
146
  // Same as CloneAndPrepend, but adds new error code to status.
147
  // If error code of the same category already present, it will be replaced with new one.
148
  Status CloneAndAddErrorCode(const StatusErrorCode& error_code) const;
149
150
  // Returns the memory usage of this object without the object itself. Should
151
  // be used when embedded inside another object.
152
  size_t memory_footprint_excluding_this() const;
153
154
  // Returns the memory usage of this object including the object itself.
155
  // Should be used when allocated on the heap.
156
  size_t memory_footprint_including_this() const;
157
158
  enum Code : int32_t {
159
  #define YB_STATUS_CODE(name, pb_name, value, message) \
160
      BOOST_PP_CAT(k, name) = value,
161
  #include "yb/util/status_codes.h" // NOLINT
162
  #undef YB_STATUS_CODE
163
  };
164
165
  // Return a new Status object with the same state except status code.
166
  Status CloneAndReplaceCode(Code code) const;
167
168
  Status(Code code,
169
         const char* file_name,
170
         int line_number,
171
         const Slice& msg,
172
         // Error message details. If present - would be combined as "msg: msg2".
173
         const Slice& msg2 = Slice(),
174
         const StatusErrorCode* error = nullptr,
175
         DupFileName dup_file_name = DupFileName::kFalse);
176
177
  Status(Code code,
178
         const char* file_name,
179
         int line_number,
180
         const Slice& msg,
181
         // Error message details. If present - would be combined as "msg: msg2".
182
         const Slice& msg2,
183
         const StatusErrorCode& error,
184
         DupFileName dup_file_name = DupFileName::kFalse)
185
3.28M
      : Status(code, file_name, line_number, msg, msg2, &error, dup_file_name) {
186
3.28M
  }
Unexecuted instantiation: _ZN2yb6StatusC2ENS0_4CodeEPKciRKNS_5SliceES6_RKNS_15StatusErrorCodeENS_17StronglyTypedBoolINS_15DupFileName_TagEEE
_ZN2yb6StatusC1ENS0_4CodeEPKciRKNS_5SliceES6_RKNS_15StatusErrorCodeENS_17StronglyTypedBoolINS_15DupFileName_TagEEE
Line
Count
Source
185
3.28M
      : Status(code, file_name, line_number, msg, msg2, &error, dup_file_name) {
186
3.28M
  }
187
188
  Status(Code code,
189
         const char* file_name,
190
         int line_number,
191
         const StatusErrorCode& error,
192
         DupFileName dup_file_name = DupFileName::kFalse);
193
194
  Status(Code code,
195
         const char* file_name,
196
         int line_number,
197
         const Slice& msg,
198
         const StatusErrorCode& error,
199
         DupFileName dup_file_name = DupFileName::kFalse);
200
201
  Status(Code code,
202
         const char* file_name,
203
         int line_number,
204
         const Slice& msg,
205
         const Slice& errors,
206
         DupFileName dup_file_name);
207
208
  Code code() const;
209
210
  static void RegisterCategory(const StatusCategoryDescription& description);
211
212
  static const std::string& CategoryName(uint8_t category);
213
214
  // Adopt status that was previously exported to C interface.
215
  explicit Status(YBCStatusStruct* state, AddRef add_ref);
216
217
  // Increments state ref count and returns pointer that could be used in C interface.
218
  YBCStatusStruct* RetainStruct() const;
219
220
  // Reset state w/o touching ref count. Return detached pointer that could be used in C interface.
221
  YBCStatusStruct* DetachStruct();
222
223
 private:
224
  struct State;
225
226
  bool file_name_duplicated() const;
227
228
  typedef boost::intrusive_ptr<State> StatePtr;
229
230
  explicit Status(StatePtr state);
231
232
  friend void intrusive_ptr_release(State* state);
233
  friend void intrusive_ptr_add_ref(State* state);
234
235
  StatePtr state_;
236
237
  static_assert(sizeof(Code) == 4, "Code enum size is part of ABI");
238
};
239
240
678k
inline Status&& MoveStatus(Status&& status) {
241
678k
  return std::move(status);
242
678k
}
243
244
64.7k
inline const Status& MoveStatus(const Status& status) {
245
64.7k
  return status;
246
64.7k
}
247
248
176
inline std::string StatusToString(const Status& status) {
249
176
  return status.ToString();
250
176
}
251
252
304k
inline std::ostream& operator<<(std::ostream& out, const Status& status) {
253
304k
  return out << status.ToString();
254
304k
}
255
256
}  // namespace yb
257
258
#define STATUS(status_type, ...) \
259
66.5M
    (Status(Status::BOOST_PP_CAT(k, status_type), __FILE__, __LINE__, __VA_ARGS__))
260
261
// Utility macros to perform the appropriate check. If the check fails, returns the specified
262
// (error) Status, with the given message.
263
52.8M
#define SCHECK(expr, status_type, msg) do { \
264
51.8M
      if (PREDICT_FALSE(!(expr))) return STATUS(status_type, (msg)); \
265
51.8M
    } while (0)
266
267
5.90k
#define SCHECK_NOTNULL(expr) do { \
268
5.90k
      if ((expr) == nullptr) { \
269
0
        return STATUS(IllegalState, BOOST_PP_STRINGIZE(expr) " must not be null"); \
270
0
      } \
271
5.90k
    } while (0)
272
273
#include "yb/util/status_format.h"
274
#include "yb/util/status_log.h"
275
276
#endif  // YB_UTIL_STATUS_H_