MCPcopy Create free account
hub / github.com/apache/impala / QueueInboundCall

Method QueueInboundCall

be/src/kudu/rpc/service_pool.cc:151–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151Status ServicePool::QueueInboundCall(unique_ptr<InboundCall> call) {
152 InboundCall* c = call.release();
153
154 vector<uint32_t> unsupported_features;
155 for (uint32_t feature : c->GetRequiredFeatures()) {
156 if (!service_->SupportsFeature(feature)) {
157 unsupported_features.push_back(feature);
158 }
159 }
160
161 if (!unsupported_features.empty()) {
162 c->RespondUnsupportedFeature(unsupported_features);
163 return Status::NotSupported("call requires unsupported application feature flags",
164 JoinMapped(unsupported_features,
165 [] (uint32_t flag) { return std::to_string(flag); },
166 ", "));
167 }
168
169 TRACE_TO(c->trace(), "Inserting onto call queue");
170
171 // Queue message on service queue
172 std::optional<InboundCall*> evicted;
173 auto queue_status = service_queue_.Put(c, &evicted);
174 if (queue_status == QUEUE_FULL) {
175 RejectTooBusy(c);
176 return Status::OK();
177 }
178
179 if (PREDICT_TRUE(evicted)) {
180 RejectTooBusy(*evicted);
181 }
182
183 if (PREDICT_TRUE(queue_status == QUEUE_SUCCESS)) {
184 // NB: do not do anything with 'c' after it is successfully queued --
185 // a service thread may have already dequeued it, processed it, and
186 // responded by this point, in which case the pointer would be invalid.
187 return Status::OK();
188 }
189
190 Status status = Status::OK();
191 if (queue_status == QUEUE_SHUTDOWN) {
192 status = Status::ServiceUnavailable("Service is shutting down");
193 c->RespondFailure(ErrorStatusPB::FATAL_SERVER_SHUTTING_DOWN, status);
194 } else {
195 status = Status::RuntimeError(Substitute("Unknown error from BlockingQueue: $0", queue_status));
196 c->RespondFailure(ErrorStatusPB::FATAL_UNKNOWN, status);
197 }
198 return status;
199}
200
201void ServicePool::RunThread() {
202 while (true) {

Callers

nothing calls this directly

Calls 15

NotSupportedFunction · 0.85
JoinMappedFunction · 0.85
OKFunction · 0.85
ServiceUnavailableFunction · 0.85
RuntimeErrorFunction · 0.85
SubstituteFunction · 0.85
GetRequiredFeaturesMethod · 0.80
push_backMethod · 0.80
releaseMethod · 0.45
SupportsFeatureMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected