Skip to content

Commit 770c509

Browse files
authored
Replace GUARDED_BY with ABSL_GUARDED_BY in preparation for abseil upgrade (#2283)
Summary: Replace `GUARDED_BY` with `ABSL_GUARDED_BY` in preparation for abseil upgrade In order to upgrade to bazel 7, many of our dependencies (bazel repos) need to be upgraded. In a branch that builds the pixie repo with bazel 7, this was a supporting change I needed to get the build working. abseil/abseil-cpp@ba7a9e2 is where abseil removed the versions of the macro pixie used previously. Relevant Issues: #2282 Type of change: /kind cleanup Test Plan: Build should succeed --------- Signed-off-by: Dom Del Nano <[email protected]>
1 parent b77b322 commit 770c509

File tree

5 files changed

+18
-16
lines changed

5 files changed

+18
-16
lines changed

src/carnot/exec/grpc_router.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ class GRPCRouter final : public carnotpb::ResultSinkService::Service {
110110
*/
111111
struct SourceNodeTracker {
112112
SourceNodeTracker() = default;
113-
GRPCSourceNode* source_node GUARDED_BY(node_lock) = nullptr;
113+
GRPCSourceNode* source_node ABSL_GUARDED_BY(node_lock) = nullptr;
114114
// connection_initiated_by_sink and connection_closed_by_sink are true when the
115115
// grpc sink (aka the client) initiates the query result stream or closes a query result stream,
116116
// respectively.
117-
bool connection_initiated_by_sink GUARDED_BY(node_lock) = false;
118-
bool connection_closed_by_sink GUARDED_BY(node_lock) = false;
117+
bool connection_initiated_by_sink ABSL_GUARDED_BY(node_lock) = false;
118+
bool connection_closed_by_sink ABSL_GUARDED_BY(node_lock) = false;
119119
std::vector<std::unique_ptr<::px::carnotpb::TransferResultChunkRequest>> response_backlog
120-
GUARDED_BY(node_lock);
120+
ABSL_GUARDED_BY(node_lock);
121121
absl::base_internal::SpinLock node_lock;
122122
};
123123

@@ -126,17 +126,18 @@ class GRPCRouter final : public carnotpb::ResultSinkService::Service {
126126
*/
127127
struct QueryTracker {
128128
QueryTracker() : create_time(std::chrono::steady_clock::now()) {}
129-
absl::node_hash_map<int64_t, SourceNodeTracker> source_node_trackers GUARDED_BY(query_lock);
130-
const std::chrono::steady_clock::time_point create_time GUARDED_BY(query_lock);
131-
std::function<void()> restart_execution_func_ GUARDED_BY(query_lock);
129+
absl::node_hash_map<int64_t, SourceNodeTracker> source_node_trackers
130+
ABSL_GUARDED_BY(query_lock);
131+
const std::chrono::steady_clock::time_point create_time ABSL_GUARDED_BY(query_lock);
132+
std::function<void()> restart_execution_func_ ABSL_GUARDED_BY(query_lock);
132133
// The set of agents we've seen for the query.
133-
absl::flat_hash_set<sole::uuid> seen_agents GUARDED_BY(query_lock);
134-
absl::flat_hash_set<::grpc::ServerContext*> active_agent_contexts GUARDED_BY(query_lock);
134+
absl::flat_hash_set<sole::uuid> seen_agents ABSL_GUARDED_BY(query_lock);
135+
absl::flat_hash_set<::grpc::ServerContext*> active_agent_contexts ABSL_GUARDED_BY(query_lock);
135136
// The execution stats for agents that are clients to this service.
136-
std::vector<queryresultspb::AgentExecutionStats> agent_exec_stats GUARDED_BY(query_lock);
137+
std::vector<queryresultspb::AgentExecutionStats> agent_exec_stats ABSL_GUARDED_BY(query_lock);
137138

138139
// Errors that occur during execution from parent_agents.
139-
std::vector<statuspb::Status> upstream_exec_errors GUARDED_BY(query_lock);
140+
std::vector<statuspb::Status> upstream_exec_errors ABSL_GUARDED_BY(query_lock);
140141
absl::base_internal::SpinLock query_lock;
141142

142143
void ResetRestartExecutionFunc() ABSL_EXCLUSIVE_LOCKS_REQUIRED(query_lock) {
@@ -178,7 +179,7 @@ class GRPCRouter final : public carnotpb::ResultSinkService::Service {
178179
SourceNodeTracker* GetSourceNodeTracker(QueryTracker* query_tracker, int64_t source_id);
179180

180181
absl::node_hash_map<sole::uuid, std::shared_ptr<QueryTracker>> id_to_query_tracker_map_
181-
GUARDED_BY(id_to_query_tracker_map_lock_);
182+
ABSL_GUARDED_BY(id_to_query_tracker_map_lock_);
182183
mutable absl::base_internal::SpinLock id_to_query_tracker_map_lock_;
183184
};
184185

src/carnot/udf/borrow_pool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class BorrowPool {
6666
}
6767

6868
private:
69-
std::vector<StoredPtrType> pool_ GUARDED_BY(pool_lock_);
69+
std::vector<StoredPtrType> pool_ ABSL_GUARDED_BY(pool_lock_);
7070
absl::base_internal::SpinLock pool_lock_;
7171
};
7272

src/experimental/standalone_pem/sink_server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ class StandaloneResultSinkServer final : public carnotpb::ResultSinkService::Ser
180180
}
181181

182182
absl::flat_hash_map<sole::uuid, ::grpc::ServerWriter<::px::api::vizierpb::ExecuteScriptResponse>*>
183-
consumer_map_ GUARDED_BY(id_to_query_consumer_map_lock_);
183+
consumer_map_ ABSL_GUARDED_BY(id_to_query_consumer_map_lock_);
184184
mutable absl::base_internal::SpinLock id_to_query_consumer_map_lock_;
185185
};
186186

src/vizier/services/agent/shared/manager/chan_cache.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class ChanCache {
8383
};
8484

8585
// The cache of channels (grpc conns) made to other agents.
86-
absl::flat_hash_map<std::string, Channel> chan_cache_ GUARDED_BY(chan_cache_lock_);
86+
absl::flat_hash_map<std::string, Channel> chan_cache_ ABSL_GUARDED_BY(chan_cache_lock_);
8787
absl::base_internal::SpinLock chan_cache_lock_;
8888
// Connections that are alive for shorter than warm_up_period_ won't be cleared.
8989
std::chrono::nanoseconds warm_up_period_;

src/vizier/services/agent/shared/manager/relation_info_manager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ class RelationInfoManager {
6565
private:
6666
mutable std::atomic<bool> has_updates_ = false;
6767
mutable absl::base_internal::SpinLock relation_info_map_lock_;
68-
absl::btree_map<std::string, RelationInfo> relation_info_map_ GUARDED_BY(relation_info_map_lock_);
68+
absl::btree_map<std::string, RelationInfo> relation_info_map_
69+
ABSL_GUARDED_BY(relation_info_map_lock_);
6970
};
7071

7172
} // namespace agent

0 commit comments

Comments
 (0)