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

Method ScanMem

be/src/rpc/rpc-mgr-test.h:256–278  ·  view source on GitHub ↗

The request comes with an int 'pattern' and a payload of int array sent with sidecar. Scan the array to make sure every element matches 'pattern'.

Source from the content-addressed store, hash-verified

254 // The request comes with an int 'pattern' and a payload of int array sent with
255 // sidecar. Scan the array to make sure every element matches 'pattern'.
256 virtual void ScanMem(const ScanMemRequestPB* request, ScanMemResponsePB* response,
257 RpcContext* context) override {
258 int32_t pattern = request->pattern();
259 Slice payload;
260 ASSERT_OK(
261 FromKuduStatus(context->GetInboundSidecar(request->sidecar_idx(), &payload)));
262 ASSERT_EQ(payload.size() % sizeof(int32_t), 0);
263
264 const int32_t* v = reinterpret_cast<const int32_t*>(payload.data());
265 for (int i = 0; i < payload.size() / sizeof(int32_t); ++i) {
266 int32_t val = v[i];
267 if (val != pattern) {
268 // Incoming requests will already be tracked and we need to release the memory.
269 mem_tracker_.Release(context->GetTransferSize());
270 context->RespondFailure(kudu::Status::Corruption(
271 Substitute("Expecting $1; Found $2", pattern, val)));
272 return;
273 }
274 }
275 // Incoming requests will already be tracked and we need to release the memory.
276 mem_tracker_.Release(context->GetTransferSize());
277 context->RespondSuccess();
278 }
279
280 MemTracker* mem_tracker() { return &mem_tracker_; }
281

Callers 2

TEST_PFunction · 0.80

Calls 10

FromKuduStatusFunction · 0.85
CorruptionFunction · 0.85
SubstituteFunction · 0.85
GetInboundSidecarMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
ReleaseMethod · 0.45
GetTransferSizeMethod · 0.45
RespondFailureMethod · 0.45
RespondSuccessMethod · 0.45

Tested by

no test coverage detected