fdbserver/ClusterController.actor.cpp
// Check if txn system is recruited successfully in each region
Check if txn system is recruited successfully in each region
Check if txn system is recruited successfully in each region
void checkRegions(const std::vector<RegionInfo>& regions) {
		if (desiredDcIds.get().present() && desiredDcIds.get().get().size() == 2 &&
		    desiredDcIds.get().get()[0].get() == regions[0].dcId &&
		    desiredDcIds.get().get()[1].get() == regions[1].dcId) {
			return;
		}
		try {
			std::map<Optional<Standalone<StringRef>>, int> id_used;
			getWorkerForRoleInDatacenter(regions[0].dcId,
			                             ProcessClass::ClusterController,
			                             ProcessClass::ExcludeFit,
			                             db.config,
			                             id_used,
			                             {},
			                             true);
			getWorkerForRoleInDatacenter(
			    regions[0].dcId, ProcessClass::Master, ProcessClass::ExcludeFit, db.config, id_used, {}, true);
			std::set<Optional<Key>> primaryDC;
			primaryDC.insert(regions[0].dcId);
			getWorkersForTlogs(db.config,
			                   db.config.tLogReplicationFactor,
			                   db.config.getDesiredLogs(),
			                   db.config.tLogPolicy,
			                   id_used,
			                   true,
			                   primaryDC);
			if (regions[0].satelliteTLogReplicationFactor > 0 && db.config.usableRegions > 1) {
				bool satelliteFallback = false;
				getWorkersForSatelliteLogs(db.config, regions[0], regions[1], id_used, satelliteFallback, true);
			}
			getWorkerForRoleInDatacenter(
			    regions[0].dcId, ProcessClass::Resolver, ProcessClass::ExcludeFit, db.config, id_used, {}, true);
			getWorkerForRoleInDatacenter(
			    regions[0].dcId, ProcessClass::CommitProxy, ProcessClass::ExcludeFit, db.config, id_used, {}, true);
			getWorkerForRoleInDatacenter(
			    regions[0].dcId, ProcessClass::GrvProxy, ProcessClass::ExcludeFit, db.config, id_used, {}, true);
			std::vector<Optional<Key>> dcPriority;
			dcPriority.push_back(regions[0].dcId);
			dcPriority.push_back(regions[1].dcId);
			desiredDcIds.set(dcPriority);
		} catch (Error& e) {
			if (e.code() != error_code_no_more_servers) {
				throw;
			}
		}
	}
void checkRegions ( const std :: vector < RegionInfo > & regions ) { if ( desiredDcIds . get ( ) . present ( ) && desiredDcIds . get ( ) . get ( ) . size ( ) == 2 && desiredDcIds . get ( ) . get ( ) [ 0 ] . get ( ) == regions [ 0 ] . dcId && desiredDcIds . get ( ) . get ( ) [ 1 ] . get ( ) == regions [ 1 ] . dcId ) { return ; } try { std :: map < Optional < Standalone < StringRef > > , int > id_used ; getWorkerForRoleInDatacenter ( regions [ 0 ] . dcId , ProcessClass :: ClusterController , ProcessClass :: ExcludeFit , db . config , id_used , { } , true ) ; getWorkerForRoleInDatacenter ( regions [ 0 ] . dcId , ProcessClass :: Master , ProcessClass :: ExcludeFit , db . config , id_used , { } , true ) ; std :: set < Optional < Key > > primaryDC ; primaryDC . insert ( regions [ 0 ] . dcId ) ; getWorkersForTlogs ( db . config , db . config . tLogReplicationFactor , db . config . getDesiredLogs ( ) , db . config . tLogPolicy , id_used , true , primaryDC ) ; if ( regions [ 0 ] . satelliteTLogReplicationFactor > 0 && db . config . usableRegions > 1 ) { bool satelliteFallback = false ; getWorkersForSatelliteLogs ( db . config , regions [ 0 ] , regions [ 1 ] , id_used , satelliteFallback , true ) ; } getWorkerForRoleInDatacenter ( regions [ 0 ] . dcId , ProcessClass :: Resolver , ProcessClass :: ExcludeFit , db . config , id_used , { } , true ) ; getWorkerForRoleInDatacenter ( regions [ 0 ] . dcId , ProcessClass :: CommitProxy , ProcessClass :: ExcludeFit , db . config , id_used , { } , true ) ; getWorkerForRoleInDatacenter ( regions [ 0 ] . dcId , ProcessClass :: GrvProxy , ProcessClass :: ExcludeFit , db . config , id_used , { } , true ) ; std :: vector < Optional < Key > > dcPriority ; dcPriority . push_back ( regions [ 0 ] . dcId ) ; dcPriority . push_back ( regions [ 1 ] . dcId ) ; desiredDcIds . set ( dcPriority ) ; } catch ( Error & e ) { if ( e . code ( ) != error_code_no_more_servers ) { throw ; } } }
Check if txn system is recruited successfully in each region
Check if txn system is recruited successfully in each region