void GeoTransactionExecutor::SendBatchGeoMessage()

in platform/consensus/execution/geo_transaction_executor.cpp [75:107]


void GeoTransactionExecutor::SendBatchGeoMessage(
    const std::vector<std::unique_ptr<Request>>& batch_geo_request) {
  ResConfigData config_data = config_.GetConfigData();

  int self_send = replica_communicator_->SendBatchMessage(
      batch_geo_request, config_.GetSelfInfo());
  if (self_send < 0) {
    LOG(ERROR) << "send batch_geo_request to self FAIL!";
  }
  // Only for primary node: send out GEO_REQUEST to other regions.
  if (config_.GetSelfInfo().id() == system_info_->GetPrimaryId()) {
    for (const auto& region : config_data.region()) {
      if (region.region_id() == config_data.self_region_id()) {
        continue;
      }
      // maximum number of faulty replicas in this region
      int max_faulty = (region.replica_info_size() - 1) / 3;
      int num_request_sent = 0;
      for (const auto& replica : region.replica_info()) {
        // send to f + 1 replicas in the region
        if (num_request_sent > max_faulty) {
          break;
        }
        int ret =
            replica_communicator_->SendBatchMessage(batch_geo_request, replica);
        if (ret >= 0) {
          num_request_sent++;
        }
      }
    }
    // LOG(ERROR) << "local executor send out geo message";
  }
}