diff options
author | Steve Totten <tottens@users.noreply.github.com> | 2003-10-31 17:51:26 +0000 |
---|---|---|
committer | Steve Totten <tottens@users.noreply.github.com> | 2003-10-31 17:51:26 +0000 |
commit | d38ba6c4bab36f65b6ed82748453ae42dca415d4 (patch) | |
tree | 8521f9c7975e3e8583b6a53754a2891c45fc0ab0 | |
parent | f05ae06563766914b7fb6f3c5a487fbfb2099780 (diff) | |
download | ATCD-d38ba6c4bab36f65b6ed82748453ae42dca415d4.tar.gz |
ChangeLogTag: Fri Oct 31 11:38:07 2003 Steve Totten <totten_s@ociweb.com>
-rw-r--r-- | TAO/ChangeLog | 12 | ||||
-rw-r--r-- | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp | 10 | ||||
-rw-r--r-- | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h | 10 | ||||
-rwxr-xr-x | TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp | 170 |
4 files changed, 196 insertions, 6 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index ec5b71c3060..38a8049f8f5 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,15 @@ +Fri Oct 31 11:38:07 2003 Steve Totten <totten_s@ociweb.com> + + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h: + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp: + Added type_id() to get the type id of an object group. + Delegates to PortableGroup's PG_ObjectGroupManager. + + * orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp: + Use FT_ReplicationManager's type_id() method to get the type + id of a failed object group so we can unregister factories by + location and type. + Fri Oct 31 10:14:22 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu> * orbsvcs/orbsvcs/FaultTolerance/FT_ServerRequest_Interceptor.cpp: diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp index 9f3f5735315..dcb3a32016f 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp @@ -484,6 +484,16 @@ void TAO::FT_ReplicationManager::shutdown_i ( // this->orb_->shutdown (0 ACE_ENV_SINGLE_ARG_PARAMETER); } +// Get the type_id associated with an object group. +char * TAO::FT_ReplicationManager::type_id ( + PortableGroup::ObjectGroup_ptr object_group + ACE_ENV_ARG_DECL) +{ + // Delegate to our ObjectGroupManager. + return this->object_group_manager_.type_id ( + object_group ACE_ENV_ARG_PARAMETER); +} + ////////////////////////////////////////////////////// // PortableGroup::PropertyManager methods diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h index f8424ed7e89..a3a22be2325 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h @@ -73,7 +73,7 @@ namespace TAO /** * Initialize this object. - * @param orbManager our ORB -- we keep var to it. + * @param orb Our CORBA::ORB -- we keep var to it. * @return zero for success; nonzero is process return code for failure. */ int init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); @@ -99,6 +99,14 @@ namespace TAO */ const char * identity () const; + /** + * Get the type_id associated with an object group. + * @param object_group The ObjectGroup. + * @return String identifying the type id associated with the ObjectGroup. + */ + char * type_id (PortableGroup::ObjectGroup_ptr object_group + ACE_ENV_ARG_DECL); + ///////////////////////// // Implementation methods private: diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp index 9667836fa9c..eb11bc3ccdf 100755 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp @@ -132,6 +132,18 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::analyze_fault_event ( { result = this->single_replica_failure (fault_event_desc); } + + // All objects at location failed. + if ((result == 0) && (fault_event_desc.all_at_location_failed == 1)) + { + result = this->location_failure (fault_event_desc); + } + + // All objects of type at location failed. + if ((result == 0) && (fault_event_desc.all_of_type_at_location_failed == 1)) + { + result = this->type_failure (fault_event_desc); + } #endif /* (INTEGRATED_WITH_REPLICATION_MANAGER == 1) */ // Debugging support. @@ -871,7 +883,6 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::add_members ( // @@ DLW SAYS: we need to find out the role played by this object // group so we can use the correct set of factories. // Get the list of factories for the type of the failed replica. -// PortableGroup::FactoryInfos_var factories_by_type = CORBA::String_var type_id; PortableGroup::FactoryInfos_var factories_by_type = factory_registry->list_factories_by_role ( @@ -905,8 +916,9 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::add_members ( // the value of the MinimumNumberReplicas property. FT::Location_var good_location; for (FT_Location_Set::iterator iter (valid_locations); - iter.next (good_location.out()); - iter.advance()) + iter.next (good_location.out()) && + fault_event_desc.minimum_number_replicas > num_members; + iter.advance(), ++num_members) { // Create a new member of the object group at this location. new_iogr = this->replication_manager_->create_member ( @@ -919,8 +931,8 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::add_members ( // Stop adding members when we reach the value of the // MinimumNumberReplicas property. - if (num_members++ >= fault_event_desc.minimum_number_replicas) - break; + // if (num_members++ >= fault_event_desc.minimum_number_replicas) + // break; } } @@ -937,6 +949,153 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::add_members ( return result; } +// Handle a location failure. +int TAO::FT_ReplicationManagerFaultAnalyzer::location_failure ( + TAO::FT_FaultEventDescriptor & fault_event_desc) +{ + int result = 0; + + // To handle a location failure, we should: + // - Unregister all the factories at that location. + // (We do this first so that we don't try to create a new replica + // at that location for any of the affected object groups.) + // - Determine all the object groups that had members at that + // location. + // - Handle each one of them as a single replica failure. + + ACE_TRY_NEW_ENV + { + // Get the factory registry from the Replication Manager. + PortableGroup::Criteria fake_criteria; + PortableGroup::FactoryRegistry_var factory_registry = + this->replication_manager_->get_factory_registry ( + fake_criteria ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Unregister all factories at the failed location. + factory_registry->unregister_factory_by_location ( + fault_event_desc.location.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Determine all the object groups that had members at that + // location. + PortableGroup::ObjectGroups_var object_groups_at_location = + this->replication_manager_->groups_at_location ( + fault_event_desc.location.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Handle each one of them as a single replica failure. + for (CORBA::ULong i=0; + result==0 && i<object_groups_at_location->length(); + ++i) + { + // Get the object group id. + fault_event_desc.object_group_id = + this->replication_manager_->get_object_group_id ( + object_groups_at_location[i] ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Get type id of this object group. + fault_event_desc.type_id = + this->replication_manager_->type_id ( + object_groups_at_location[i] ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Handle it as a single replica failure. + result = this->single_replica_failure (fault_event_desc); + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION ( + ACE_ANY_EXCEPTION, + "TAO::FT_ReplicationManagerFaultAnalyzer::location_failure: "); + result = -1; + } + ACE_ENDTRY; + + return result; +} + +// Handle a type failure. +int TAO::FT_ReplicationManagerFaultAnalyzer::type_failure ( + TAO::FT_FaultEventDescriptor & fault_event_desc) +{ + int result = 0; + + // To handle a type failure, we should: + // - Unregister the factory at the location of the failure + // that is associated with the failed type. + // (We do this first so that we don't try to create a new replica + // with that factory for any of the affected object groups.) + // - Determine all the object groups that had members at that + // location of that type. + // - Handle each one of them as a single replica failure. + + ACE_TRY_NEW_ENV + { + // Get the factory registry from the Replication Manager. + PortableGroup::Criteria fake_criteria; + PortableGroup::FactoryRegistry_var factory_registry = + this->replication_manager_->get_factory_registry ( + fake_criteria ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Unregister the factory at the failed location associated with + // the role. + //@@ Using type_id as the role for now. + factory_registry->unregister_factory ( + fault_event_desc.type_id.in(), + fault_event_desc.location.in() + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Get all the object groups that had members at that + // location. + PortableGroup::ObjectGroups_var object_groups_at_location = + this->replication_manager_->groups_at_location ( + fault_event_desc.location.in() ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // For each one, if it was of the same type as the failed type, + // handle it as a single replica failure. + for (CORBA::ULong i=0; + result==0 && i<object_groups_at_location->length(); + ++i) + { + // Get the object group id. + fault_event_desc.object_group_id = + this->replication_manager_->get_object_group_id ( + object_groups_at_location[i] ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // Get type id of this object group. + FT::TypeId_var type_id = + this->replication_manager_->type_id ( + object_groups_at_location[i] ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + + // If the type id is the same as the failed type id... + if (ACE_OS::strcmp (type_id.in(), fault_event_desc.type_id.in()) == 0) + { + // Handle it as a single replica failure. + fault_event_desc.type_id = CORBA::string_dup (type_id.in()); + result = this->single_replica_failure (fault_event_desc); + } + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION ( + ACE_ANY_EXCEPTION, + "TAO::FT_ReplicationManagerFaultAnalyzer::type_failure: "); + result = -1; + } + ACE_ENDTRY; + + return result; +} + // Template instantiations. #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) @@ -949,3 +1108,4 @@ template class ACE_Unbounded_Set_Iterator<FT::Location>; #pragma instantiate ACE_Unbounded_Set_Iterator<FT::Location> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + |