Exemplo n.º 1
0
   // PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__GETACCESSPRIVILEGE, "_rtnLocalLobStream::_getAccessPrivilege" )
   INT32 _rtnLocalLobStream::_getAccessPrivilege( const CHAR *fullName,
                                                     const bson::OID &oid,
                                                     INT32 mode )
   {
      INT32 rc = SDB_OK ;
      PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__GETACCESSPRIVILEGE ) ;

      for ( INT32 i = 0 ; i < RTN_LOB_ACCESS_PRIVILEGE_RETRY_TIMES ; i++ )
      {
         rc = sdbGetRTNCB()->getLobAccessManager()->getAccessPrivilege(
                  fullName, oid, mode, uniqueId(),
                  SDB_LOB_MODE_WRITE == mode ? &_accessInfo : NULL ) ;
         if ( SDB_OK == rc )
         {
            _hasLobPrivilege = TRUE ;
            break ;
         }
         else if ( SDB_LOB_IS_IN_USE == rc )
         {
            ossSleepmillis( RTN_LOB_ACCESS_PRIVILEGE_RETRY_INTERVAL ) ;
            continue ;
         }
         else
         {
            PD_LOG( PDERROR, "Failed to get lob privilege:%d", rc ) ;
            goto error ;
         }
      }

   done:
      PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__GETACCESSPRIVILEGE, rc ) ;
      return rc ;
   error:
      goto done ;
   }
Exemplo n.º 2
0
int pmdEDUMgr::_destroyAll ()
{
   _setDestroyed ( true ) ;
   setQuiesced ( true ) ;

   //stop all user edus
   unsigned int timeCounter = 0 ;
   unsigned int eduCount = _getEDUCount ( EDU_USER ) ;

   while ( eduCount != 0 )
   {
      if ( 0 == timeCounter % 50 )
      {
         _forceEDUs ( EDU_USER ) ;
      }
      ++timeCounter ;
      ossSleepmillis ( 100 ) ;
      eduCount = _getEDUCount ( EDU_USER ) ;
   }

   //stop all system edus
   timeCounter = 0 ;
   eduCount = _getEDUCount ( EDU_ALL ) ;
   while ( eduCount != 0 )
   {
      if ( 0 == timeCounter % 50 )
      {
         _forceEDUs ( EDU_ALL ) ;
      }

      ++timeCounter ;
      ossSleepmillis ( 100 ) ;
      eduCount = _getEDUCount ( EDU_ALL ) ;
   }

   return EDB_OK ;
}
Exemplo n.º 3
0
OSS_INLINE void ossSleepmicros(UINT64 s)
{
#if defined( SDB_ENGINE )
   boost::xtime xt ;
   boost::xtime_get ( &xt, boost::TIME_UTC_ ) ;
   xt.sec += (INT32)(s/1000000);
   xt.nsec += (int)((s%1000000)*1000);
   if(xt.nsec>=1000000000)
   {
      xt.nsec-=1000000000;
      xt.sec++;
   }
   boost::thread::sleep(xt);
#else
   ossSleepmillis( s / 1000 ) ;
#endif // SDB_ENGINE
}
Exemplo n.º 4
0
   INT32 _SDB_DMSCB::registerBackup( _pmdEDUCB *cb )
   {
      INT32 rc = SDB_OK ;

      _stateMtx.get();
      if ( DMS_STATE_NORMAL != _dmsCBState )
      {
         if ( DMS_STATE_BACKUP == _dmsCBState )
            rc = SDB_BACKUP_HAS_ALREADY_START ;
         else
            rc = SDB_DMS_STATE_NOT_COMPATIBLE ;
         _stateMtx.release () ;
         goto done;
      }
      _dmsCBState = DMS_STATE_BACKUP ;
      _stateMtx.release () ;

      while ( TRUE )
      {
         _stateMtx.get();
         if ( 0 == _writeCounter )
         {
            _backEvent.reset() ;
            _stateMtx.release();
            if ( cb )
            {
               cb->setDmsLockLevel( DMS_LOCK_WHOLE ) ;
            }
            goto done;
         }
         else
         {
            _stateMtx.release();
            ossSleepmillis( DMS_CHANGESTATE_WAIT_LOOP );
         }
      }

   done:
      return rc ;
   }