コード例 #1
0
ファイル: ExpHbaseInterface.cpp プロジェクト: hadr4ros/core
NABoolean isParentQueryCanceled()
{
  NABoolean isCanceled = FALSE;
  CliGlobals *cliGlobals = GetCliGlobals();
  StatsGlobals *statsGlobals = cliGlobals->getStatsGlobals();
  const char *parentQid = CmpCommon::context()->sqlSession()->getParentQid();
  if (statsGlobals && parentQid)
  {
    short savedPriority, savedStopMode;
    statsGlobals->getStatsSemaphore(cliGlobals->getSemId(),
      cliGlobals->myPin(), savedPriority, savedStopMode,
      FALSE /*shouldTimeout*/);
    StmtStats *ss = statsGlobals->getMasterStmtStats(parentQid, 
      strlen(parentQid), RtsQueryId::ANY_QUERY_);
    if (ss)
    {
      ExMasterStats *masterStats = ss->getMasterStats();
      if (masterStats && masterStats->getCanceledTime() != -1)
        isCanceled = TRUE;
    }
    statsGlobals->releaseStatsSemaphore(cliGlobals->getSemId(),
       cliGlobals->myPin(), savedPriority, savedStopMode);
  }
  return isCanceled;
}
コード例 #2
0
_callable void removeProcess()
{
  CliGlobals *cliGlobals = GetCliGlobals();
  StatsGlobals *statsGlobals = cliGlobals->getStatsGlobals();
  if (statsGlobals != NULL)
  {
    int error = statsGlobals->getStatsSemaphore(cliGlobals->getSemId(),
                cliGlobals->myPin());
    if (error == 0)
    {
      statsGlobals->removeProcess(cliGlobals->myPin());
      statsGlobals->releaseStatsSemaphore(cliGlobals->getSemId(), cliGlobals->myPin());
      statsGlobals->logProcessDeath(cliGlobals->myCpu(), cliGlobals->myPin(), "Normal process death");
    }
    else if (error == 4011)
    {
      // BINSEM_LOCK_ timed out. Halt the CPU
      PROCESSOR_HALT_ (SQL_FS_INTERNAL_ERROR);
    }
  }
}