コード例 #1
0
/**
 * 1. for every next segment of plan, one ExchangeSenderPipeline or
 * ExchangeSenderMaterialized will be add at top of it;
 * 2. serialize it and send it to every lower senders.
 */
bool ExchangeMerger::SerializeAndSendPlan() {
  IteratorExecutorMaster* IEM = IteratorExecutorMaster::getInstance();
  // GETCURRENTTIME(start);
  if (Config::pipelined_exchange) {
    for (unsigned i = 0; i < state_.lower_id_list_.size(); i++) {
      ExchangeSenderPipeline::State EIELstate(
          state_.schema_->duplicateSchema(), state_.child_,
          state_.upper_id_list_, state_.block_size_, state_.exchange_id_,
          state_.partition_schema_);

      /* set the partition offset*/
      EIELstate.partition_offset_ = i;
      PhysicalOperatorBase* EIEL = new ExchangeSenderPipeline(EIELstate);

      LOG(INFO) << "exchange_merger_id = " << state_.exchange_id_
                << "send the serialized segment of plan";
      if (IEM->ExecuteBlockStreamIteratorsOnSite(
              EIEL, state_.lower_id_list_[i]) == false) {
        LOG(INFO) << " failed!" << std::endl;
        return false;
      }
      LOG(INFO) << " successfully!" << std::endl;
      (reinterpret_cast<ExchangeSenderPipeline*>(EIEL))->state_.child_ = NULL;
      delete EIEL;
    }
  } else {
    for (unsigned i = 0; i < state_.lower_id_list_.size(); i++) {
      ExchangeSenderMaterialized::State EIELstate(
          state_.schema_->duplicateSchema(), state_.child_,
          state_.upper_id_list_, state_.block_size_, state_.exchange_id_,
          state_.partition_schema_);
      /* set the partition offset*/
      EIELstate.partition_offset_ = i;
      PhysicalOperatorBase* EIEL = new ExchangeSenderMaterialized(EIELstate);
      LOG(INFO) << "exchange_merger_id = " << state_.exchange_id_
                << "send the serialized segment of plan";
      if (IEM->ExecuteBlockStreamIteratorsOnSite(
              EIEL, state_.lower_id_list_[i]) == false) {
        LOG(INFO) << " failed!" << std::endl;
        return false;
      }
      LOG(INFO) << " successfully!" << std::endl;
      (reinterpret_cast<ExchangeSenderMaterialized*>(EIEL))->state_.child_ =
          NULL;
      delete EIEL;
    }
  }
  // GetElapsedTime(start));
  return true;
}
コード例 #2
0
bool ExpandableBlockStreamExchangeEpoll::SerializeAndSendToMulti(){
	IteratorExecutorMaster* IEM=IteratorExecutorMaster::getInstance();
//	GETCURRENTTIME(start);
	if(Config::pipelined_exchange){
		for(unsigned i=0;i<state.lower_id_list_.size();i++){
			ExpandableBlockStreamExchangeLowerEfficient::State EIELstate(
					state.schema_->duplicateSchema(),
					state.child_,
					state.upper_id_list_,
					state.block_size_,
					state.exchange_id_,
					state.partition_schema_);

			/* set the partition offset*/
			EIELstate.partition_offset_ = i;
			BlockStreamIteratorBase *EIEL = new ExpandableBlockStreamExchangeLowerEfficient(EIELstate);

			if(IEM->ExecuteBlockStreamIteratorsOnSite(EIEL,state.lower_id_list_[i])==false){
				logging_->elog("[%ld] Cannot send the serialized iterator tree to the remote node!\n",state.exchange_id_);
				return false;
			}
			((ExpandableBlockStreamExchangeLowerEfficient*)EIEL)->state_.child_=0;
			delete EIEL;
		}
	}
	else{
		for(unsigned i=0;i<state.lower_id_list_.size();i++){
			ExpandableBlockStreamExchangeLowerMaterialized::State EIELstate(state.schema_->duplicateSchema(),state.child_,state.upper_id_list_,state.block_size_,state.exchange_id_,state.partition_schema_);
			/* set the partition offset*/
			EIELstate.partition_offset = i;
			BlockStreamIteratorBase *EIEL = new ExpandableBlockStreamExchangeLowerMaterialized(EIELstate);

			if(IEM->ExecuteBlockStreamIteratorsOnSite(EIEL,state.lower_id_list_[i])==false){
				logging_->elog("[%ld] Cannot send the serialized iterator tree to the remote node!\n",state.exchange_id_);
				return false;
			}
			((ExpandableBlockStreamExchangeLowerMaterialized*)EIEL)->state_.child_=0;
			delete EIEL;
		}
	}
//	logging_->log("SerializeAndSendToMulti() call used %.3lf ms", GetElapsedTime(start));
	return true;
}
コード例 #3
0
bool ExpandableBlockStreamExchange::SerializeAndSendToMulti(){
	IteratorExecutorMaster* IEM=IteratorExecutorMaster::getInstance();
	ExpandableBlockStreamExchangeLower::State EIELstate(state.schema,state.child,state.upper_ip_list,state.block_size,state.exchange_id);
	BlockStreamIteratorBase *EIEL=new ExpandableBlockStreamExchangeLower(EIELstate);

	if(IEM->ExecuteBlockStreamIteratorsOnSites(EIEL,state.lower_ip_list)==false){
		printf("Cannot send the serialized iterator tree to the remote node!\n");
		return false;
	}
	return true;
}
コード例 #4
0
bool ExpandableBlockStreamExchangeMaterialized::SerializeAndSendToMulti(){
	IteratorExecutorMaster* IEM=IteratorExecutorMaster::getInstance();
	ExpandableBlockStreamExchangeLowerMaterialized::State EIELstate(state_.schema_,state_.child_,state_.upper_ip_list_,state_.block_size_,state_.exchange_id_);
	for(unsigned i=0;i<state_.lower_ip_list_.size();i++){
		/* set the partition offset*/
		EIELstate.partition_off_=i;
		BlockStreamIteratorBase *EIEL=new ExpandableBlockStreamExchangeLowerMaterialized(EIELstate);
		if(IEM->ExecuteBlockStreamIteratorsOnSite(EIEL,state_.lower_ip_list_[i])==false){
			printf("Cannot send the serialized iterator tree to the remote node!\n");
			return false;
		}
		EIEL->~BlockStreamIteratorBase();
	}

	BlockStreamIteratorBase *EIEL=new ExpandableBlockStreamExchangeLowerMaterialized(EIELstate);

	if(IEM->ExecuteBlockStreamIteratorsOnSites(EIEL,state_.lower_ip_list_)==false){
		printf("Cannot send the serialized iterator tree to the remote node!\n");
		return false;
	}
	return true;
}