Esempio n. 1
0
    virtual int scan(const int64_t timeout, const ObServer & server,
        const ObScanParam & scan_param, ObMergerRpcEvent & result) const
    {
      UNUSED(timeout);
      UNUSED(server);
      UNUSED(scan_param);
      result.set_result_code(OB_SUCCESS);
      ObScanner &scanner = result.get_result();
      
      ObScannerLoader loader;
      loader.load(filename, scanner_section_names[file_idx]);

      file_idx = (++file_idx % 6);
      loader.get_decoded_scanner(scanner);

      TBSYS_LOG(INFO, "+==============DUMP===============+");
      scanner.dump();
      TBSYS_LOG(INFO, "+=============END DUMP============+");

      if(!rpc_events_list_.push_back(&result))
      {
        TBSYS_LOG(ERROR, "fail to save rpc result");
      }
      else
      {
        TBSYS_LOG(INFO, "currently totally %ld results saved....", rpc_events_list_.get_array_index());
        TBSYS_LOG(INFO, "a RPC result save to rpc_event_list_");
      }
      return OB_SUCCESS;
    }
Esempio n. 2
0
int ObGetRequestEvent::check_request_finish(ObMergerRpcEvent & event, bool & finish)
{
  finish = false;
  bool retry = false;
  int ret = OB_SUCCESS;
  ObGetParam new_param;
  int32_t result_code = OB_SUCCESS;
  ObScanner & result = event.get_result(result_code);
  int64_t timeout = 0;
  const ObGetParam * org_param = dynamic_cast<const ObGetParam *>(get_request_param(timeout));
  if (NULL == org_param)
  {
    ret = OB_INPUT_PARAM_ERROR;
    TBSYS_LOG(WARN, "check result code error:result[%d], request[%lu], event[%lu], param[%p]",
        event.get_result_code(), get_request_id(), event.get_event_id(), org_param);
  }
  else if (result_code != OB_SUCCESS)
  {
    // TODO retry next server or delete the cache item and terminate if retry too many times
    retry = true;
    result.clear();
    // set fullfill to true item count = 0 for next get new param
    result.set_is_req_fullfilled(true, 0);
    TBSYS_LOG(INFO, "check result code failed:result[%d], request[%lu], event[%lu]",
        event.get_result_code(), get_request_id(), event.get_event_id());
  }
  else
  {
    // right now no duplicated rpc event and all is in-sequence return
    // add to result list for iterator
    ret = result_list_.push_back(&event);
    if (ret != OB_SUCCESS)
    {
      result.clear();
      result.set_is_req_fullfilled(true, 0);
      TBSYS_LOG(ERROR, "push the result failed:request[%lu], event[%lu], ret[%d]",
          get_request_id(), event.get_event_id(), ret);
    }
    else
    {
      FILL_TRACE_LOG("got one result from cs finished_sub_get_count[%d]", result_list_.size());
    }
  }
  
  // update the returned item count and construct the new param if not finish all
  ret = get_next_param(*org_param, result, returned_item_count_, finish, &new_param);
  if (ret != OB_SUCCESS)
  {
    TBSYS_LOG(ERROR, "get next param failed:request[%lu], event[%lu], ret[%d]", 
        get_request_id(), event.get_event_id(), ret);
  }
  
  if ((false == finish) && (OB_SUCCESS == ret))
  {
    ret = setup_new_request(retry, new_param);
    if (ret != OB_SUCCESS)
    {
      TBSYS_LOG(WARN, "setup new request failed:request[%lu], event[%lu], ret[%d]", 
          get_request_id(), event.get_event_id(), ret);
    }
  }
  return ret;
}