MCPcopy Create free account
hub / github.com/baidu/tera / ScanCallBack

Method ScanCallBack

src/sdk/table_impl.cc:502–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

500}
501
502void TableImpl::ScanCallBack(ScanTask* scan_task, ScanTabletRequest* request,
503 ScanTabletResponse* response, bool failed, int error_code) {
504 perf_counter_.rpc_s.Add(get_micros() - request->timestamp());
505 perf_counter_.rpc_s_cnt.Inc();
506 ResultStreamImpl* stream = scan_task->stream;
507
508 if (failed) {
509 if (error_code == sofa::pbrpc::RPC_ERROR_SERVER_SHUTDOWN ||
510 error_code == sofa::pbrpc::RPC_ERROR_SERVER_UNREACHABLE ||
511 error_code == sofa::pbrpc::RPC_ERROR_SERVER_UNAVAILABLE) {
512 response->set_status(kServerError);
513 } else if (error_code == sofa::pbrpc::RPC_ERROR_REQUEST_CANCELED ||
514 error_code == sofa::pbrpc::RPC_ERROR_SEND_BUFFER_FULL) {
515 response->set_status(kClientError);
516 } else if (error_code == sofa::pbrpc::RPC_ERROR_CONNECTION_CLOSED ||
517 error_code == sofa::pbrpc::RPC_ERROR_RESOLVE_ADDRESS) {
518 response->set_status(kConnectError);
519 } else if (error_code == sofa::pbrpc::RPC_ERROR_REQUEST_TIMEOUT) {
520 response->set_status(kRPCTimeout);
521 } else {
522 response->set_status(kRPCError);
523 }
524 }
525
526 StatusCode err = response->status();
527 if (err != kTabletNodeOk && err != kSnapshotNotExist) {
528 VLOG(10) << "fail to scan table: " << name_ << " errcode: " << StatusCodeToString(err);
529 }
530
531 scan_task->SetInternalError(err);
532 if (err == kKeyNotInRange || err == kConnectError) {
533 ScheduleUpdateMeta(stream->GetScanDesc()->GetStartRowKey(), scan_task->GetMetaTimeStamp());
534 }
535 if (err == kNotPermission) {
536 // Couldn't stop session_retry
537 // TODO: scan add Cancel() method for this scaning tablet
538 VLOG(10) << "fail to scan table: " << name_ << " errcode: " << StatusCodeToString(err);
539 }
540 stream->OnFinish(request, response);
541 stream->ReleaseRpcHandle(request, response);
542 task_pool_.PopTask(scan_task->GetId());
543 CHECK_EQ(scan_task->GetRef(), 2);
544 delete scan_task;
545}
546
547void TableImpl::SetReadTimeout(int64_t timeout_ms) {}
548

Callers 1

ScanCallBackWrapperMethod · 0.80

Calls 14

StatusCodeToStringFunction · 0.85
timestampMethod · 0.80
IncMethod · 0.80
SetInternalErrorMethod · 0.80
GetScanDescMethod · 0.80
GetMetaTimeStampMethod · 0.80
ReleaseRpcHandleMethod · 0.80
PopTaskMethod · 0.80
get_microsFunction · 0.50
AddMethod · 0.45
statusMethod · 0.45
OnFinishMethod · 0.45

Tested by

no test coverage detected