src/storage/transaction/ChainAddEdgesProcessorLocal.cpp
bool ChainAddEdgesProcessorLocal::checkTerm(const cpp2::AddEdgesRequest& req) {
  auto space = req.get_space_id();
  auto partId = req.get_parts().begin()->first;

  auto part = env_->kvstore_->part(space, partId);
  if (!nebula::ok(part)) {
    pushResultCode(nebula::error(part), localPartId_);
    return false;
  }
  auto curTerm = (nebula::value(part))->termId();
  if (restrictTerm_ != curTerm) {
    VLOG(1) << folly::sformat(
        "check term failed, restrictTerm_={}, currTerm={}", restrictTerm_, curTerm);
    return false;
  }
  return true;
}
// we need to check term at both remote phase and local commit
we need to check term at both remote phase and local commit
we need to check term at both remote phase and local commit
bool ChainAddEdgesProcessorLocal::checkTerm(const cpp2::AddEdgesRequest& req) {
  auto space = req.get_space_id();
  auto partId = req.get_parts().begin()->first;
  auto part = env_->kvstore_->part(space, partId);
  if (!nebula::ok(part)) {
    pushResultCode(nebula::error(part), localPartId_);
    return false;
  }
  auto curTerm = (nebula::value(part))->termId();
  if (restrictTerm_ != curTerm) {
    VLOG(1) << folly::sformat(
        "check term failed, restrictTerm_={}, currTerm={}", restrictTerm_, curTerm);
    return false;
  }
  return true;
}
bool ChainAddEdgesProcessorLocal :: checkTerm ( const cpp2 :: AddEdgesRequest & req ) { auto space = req . get_space_id ( ) ; auto partId = req . get_parts ( ) . begin ( ) -> first ; auto part = env_ -> kvstore_ -> part ( space , partId ) ; if ( ! nebula :: ok ( part ) ) { pushResultCode ( nebula :: error ( part ) , localPartId_ ) ; return false ; } auto curTerm = ( nebula :: value ( part ) ) -> termId ( ) ; if ( restrictTerm_ != curTerm ) { VLOG ( 1 ) << folly :: sformat ( " " , restrictTerm_ , curTerm ) ; return false ; } return true ; }
we need to check term at both remote phase and local commit
we need to check term at both remote phase and local commit