// PD_TRACE_DECLARE_FUNCTION ( SDB_RTNLOCALLOBSTREAM__PREPARE, "_rtnLocalLobStream::_prepare" ) INT32 _rtnLocalLobStream::_prepare( const CHAR *fullName, const bson::OID &oid, INT32 mode, _pmdEDUCB *cb ) { INT32 rc = SDB_OK ; PD_TRACE_ENTRY( SDB_RTNLOCALLOBSTREAM__PREPARE ) ; dmsStorageUnitID suID = DMS_INVALID_CS ; const CHAR *clName = NULL ; _dmsCB = sdbGetDMSCB() ; if ( SDB_LOB_MODE_READ != mode ) { rc = _dmsCB->writable( cb ) ; if ( rc ) { PD_LOG( PDERROR, "Database is not writable, rc = %d", rc ) ; goto error ; } _writeDMS = TRUE ; } rc = rtnResolveCollectionNameAndLock( fullName, _dmsCB, &_su, &clName, suID ) ; if ( SDB_OK != rc ) { PD_LOG( PDERROR, "Failed to resolve collection name:%s", fullName ) ; goto error ; } rc = _su->data()->getMBContext( &_mbContext, clName, -1 ) ; if ( SDB_OK != rc ) { PD_LOG( PDERROR, "Failed to resolve collection name:%s", clName ) ; goto error ; } rc = _getAccessPrivilege( fullName, oid, mode ) ; if ( SDB_OK != rc ) { PD_LOG( PDERROR, "Failed to get lob privilege:%d", rc ) ; goto error ; } done: PD_TRACE_EXITRC( SDB_RTNLOCALLOBSTREAM__PREPARE, rc ) ; return rc ; error: _closeInner( cb ) ; goto done ; }
void _pmdController::registerCB( SDB_ROLE dbrole ) { // For data node we need DPS ( log ), Transaction, Cluster and Bufferpool if ( SDB_ROLE_DATA == dbrole ) { PMD_REGISTER_CB( sdbGetDPSCB() ) ; // DPS PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetClsCB() ) ; // CLS PMD_REGISTER_CB( sdbGetBPSCB() ) ; // BPS } // For coord node we need Transaction, Coordinator and FMP else if ( SDB_ROLE_COORD == dbrole ) { PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetCoordCB() ) ; // COORD PMD_REGISTER_CB( sdbGetFMPCB () ) ; // FMP } // For catalog node we need DPS ( log ), Transaction, Cluster, Catalog // Bufferpool and Authentication else if ( SDB_ROLE_CATALOG == dbrole ) { PMD_REGISTER_CB( sdbGetDPSCB() ) ; // DPS PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetClsCB() ) ; // CLS PMD_REGISTER_CB( sdbGetCatalogueCB() ) ; // CATALOGUE PMD_REGISTER_CB( sdbGetBPSCB() ) ; // BPS PMD_REGISTER_CB( sdbGetAuthCB() ) ; // AUTH } // For standalone mode we need DPS ( log ), Transaction and Bufferpool else if ( SDB_ROLE_STANDALONE == dbrole ) { PMD_REGISTER_CB( sdbGetDPSCB() ) ; // DPS PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetBPSCB() ) ; // BPS } // For OM we need DPS ( log ), transaction, bufferpool, Authentication // and OMService else if ( SDB_ROLE_OM == dbrole ) { PMD_REGISTER_CB( sdbGetDPSCB() ) ; // DPS PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetBPSCB() ) ; // BPS PMD_REGISTER_CB( sdbGetAuthCB() ) ; // AUTH PMD_REGISTER_CB( sdbGetOMManager() ) ; // OMSVC } // Everyone need DMS ( data management ), Runtime, SQL, Aggregator // and Controller PMD_REGISTER_CB( sdbGetDMSCB() ) ; // DMS PMD_REGISTER_CB( sdbGetRTNCB() ) ; // RTN PMD_REGISTER_CB( sdbGetSQLCB() ) ; // SQL PMD_REGISTER_CB( sdbGetAggrCB() ) ; // AGGR PMD_REGISTER_CB( sdbGetPMDController() ) ; // CONTROLLER }
INT32 _rtnDataSet::initByQuery( const rtnQueryOptions &options, _pmdEDUCB *cb ) { clear() ; _cb = cb ; INT32 rc = rtnQuery( options._fullName, options._query, options._selector, options._orderBy, options._hint, options._flag, _cb, options._skip, options._limit, sdbGetDMSCB(), _rtnCB, _contextID, NULL, FALSE ) ; _lastErr = rc ; return rc ; }
_rtnDataSet::_rtnDataSet( const rtnQueryOptions &options, _pmdEDUCB *cb ) :_contextID( -1 ), _cb( cb ), _lastErr( SDB_OK ), _fetchFromContext( TRUE ), _rtnCB( NULL ) { _rtnCB = sdbGetRTNCB() ; _lastErr = rtnQuery( options._fullName, options._query, options._selector, options._orderBy, options._hint, options._flag, _cb, options._skip, options._limit, sdbGetDMSCB(), _rtnCB, _contextID, NULL, FALSE ) ; }
void _pmdController::registerCB( SDB_ROLE dbrole ) { if ( SDB_ROLE_DATA == dbrole ) { PMD_REGISTER_CB( sdbGetDPSCB() ) ; // DPS PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetClsCB() ) ; // CLS PMD_REGISTER_CB( sdbGetBPSCB() ) ; // BPS } else if ( SDB_ROLE_COORD == dbrole ) { PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetCoordCB() ) ; // COORD PMD_REGISTER_CB( sdbGetFMPCB () ) ; // FMP } else if ( SDB_ROLE_CATALOG == dbrole ) { PMD_REGISTER_CB( sdbGetDPSCB() ) ; // DPS PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetClsCB() ) ; // CLS PMD_REGISTER_CB( sdbGetCatalogueCB() ) ; // CATALOGUE PMD_REGISTER_CB( sdbGetBPSCB() ) ; // BPS PMD_REGISTER_CB( sdbGetAuthCB() ) ; // AUTH } else if ( SDB_ROLE_STANDALONE == dbrole ) { PMD_REGISTER_CB( sdbGetDPSCB() ) ; // DPS PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetBPSCB() ) ; // BPS } else if ( SDB_ROLE_OM == dbrole ) { PMD_REGISTER_CB( sdbGetDPSCB() ) ; // DPS PMD_REGISTER_CB( sdbGetTransCB() ) ; // TRANS PMD_REGISTER_CB( sdbGetBPSCB() ) ; // BPS PMD_REGISTER_CB( sdbGetAuthCB() ) ; // AUTH PMD_REGISTER_CB( sdbGetOMManager() ) ; // OMSVC } PMD_REGISTER_CB( sdbGetDMSCB() ) ; // DMS PMD_REGISTER_CB( sdbGetRTNCB() ) ; // RTN PMD_REGISTER_CB( sdbGetSQLCB() ) ; // SQL PMD_REGISTER_CB( sdbGetAggrCB() ) ; // AGGR PMD_REGISTER_CB( sdbGetPMDController() ) ; // CONTROLLER }
INT32 _clsLocalValidation::run() { INT32 rc = SDB_OK ; const UINT32 pLen = 512 ; SDB_RTNCB *rtnCB = sdbGetRTNCB() ; SDB_DMSCB *dmsCB = sdbGetDMSCB() ; CHAR *p = (CHAR *)SDB_OSS_MALLOC( pLen ) ; if ( NULL == p ) { PD_LOG( PDERROR, "failed to allocate mem." ) ; rc = SDB_OOM ; goto error ; } *p = '\0' ; *( p + pLen - 1 ) = '\0' ; /*try { boost::thread t( func ) ; t.join() ; } catch( std::exception &e ) { PD_LOG( PDERROR, "failed to create new thread:%s", e.what() ) ; rc = SDB_SYS ; goto error ; }*/ pmdUpdateValidationTick() ; done: SAFE_OSS_FREE( p ) ; return rc ; error: goto done ; }
void _rtnLocalLobStream::_closeInner( _pmdEDUCB *cb ) { if ( _hasLobPrivilege ) { sdbGetRTNCB()->getLobAccessManager()->releaseAccessPrivilege( getFullName(), getOID(), _getMode(), uniqueId() ) ; _hasLobPrivilege = FALSE ; } if ( _mbContext && _su ) { _su->data()->releaseMBContext( _mbContext ) ; _mbContext = NULL ; } if ( _su && _dmsCB ) { sdbGetDMSCB()->suUnlock ( _su->CSID() ) ; _su = NULL ; } if ( _writeDMS ) { _dmsCB->writeDown( cb ) ; _writeDMS = FALSE ; } }