diff options
14 files changed, 381 insertions, 88 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 356977ec52e..77a079f82c2 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,37 @@ +Thu Dec 4 16:46:15 2003 Dale Wilson <wilson_d@ociweb.com> + + * orbsvcs/FT_ReplicationManager/FT_DefaultFaultAnalyzer.cpp: + * orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.h: + * orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp: + Nursemaid the notification thru the system until it triggers a + recovery. Remove questionable assumptions that were causing the + analysis to fail. + + * orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp: + * orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h: + * orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp: + Initialize default property values -- including adding + new methods to make it possible. + + + * orbsvcs/orbsvcs/PortableGroup/PG_conf.h: + Set defaults. Add comments to complain about unnecessary limits + (I'm afraid to remove the limits -- who knows what code depends + on them). + + * orbsvcs/tests/FT_App/TAO_Object_Group_Creator.h: + * orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp: + Add preliminary support for infrastructure-managed groups (needs work!). + + * orbsvcs/tests/FT_App/FT_App.mpc: + Always build the server first so the IDL gets compiled. + + * orbsvcs/tests/FT_App/run_test_rmnotifier.pl: + doc change. + + Thu Dec 4 10:20:34 2003 Dale Wilson <wilson_d@ociweb.com> * orbsvcs/FTRT_Event_Service/Factory_Service/EventChannelFactory_i.cpp: diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_DefaultFaultAnalyzer.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_DefaultFaultAnalyzer.cpp index 81f65f0c316..c569626b386 100755 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_DefaultFaultAnalyzer.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_DefaultFaultAnalyzer.cpp @@ -50,6 +50,7 @@ int TAO::FT_DefaultFaultAnalyzer::validate_event_type ( // So, the event header's event_type.domain_name must be "FT_CORBA" // and the event header's event_type.type_name must be "ObjectCrashFault". + // @@ why make string dups just to do a strcmp? CORBA::String_var domain_name = CORBA::string_dup ( event.header.fixed_header.event_type.domain_name); CORBA::String_var type_name = CORBA::string_dup ( diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp index 78c2562f218..320ab55f4a8 100644 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManager.cpp @@ -300,6 +300,50 @@ int TAO::FT_ReplicationManager::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) } } + //////////////////////////////// + // Initialize default properties + PortableGroup::Value value; + value <<= TAO_PG_MEMBERSHIP_STYLE; + this->properties_support_.set_default_property (PortableGroup::PG_MEMBERSHIP_STYLE, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN(-1); + + value <<= TAO_PG_INITIAL_NUMBER_MEMBERS; + this->properties_support_.set_default_property (PortableGroup::PG_INITIAL_NUMBER_MEMBERS, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN(-1); + + value <<= TAO_PG_MINIMUM_NUMBER_MEMBERS; + this->properties_support_.set_default_property (PortableGroup::PG_MINIMUM_NUMBER_MEMBERS, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN(-1); + + value <<= FT::SEMI_ACTIVE; + this->properties_support_.set_default_property (FT::FT_REPLICATION_STYLE, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN(-1); + + value <<= FT::CONS_APP_CTRL; + this->properties_support_.set_default_property ( FT::FT_CONSISTENCY_STYLE, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN(-1); + + value <<= FT::PULL; + this->properties_support_.set_default_property (FT::FT_FAULT_MONITORING_STYLE, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN(-1); + + value <<= FT::MEMB; + this->properties_support_.set_default_property (FT::FT_FAULT_MONITORING_GRANULARITY, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN(-1); + +#if 0 + FaultMonitoringIntervalAndTimeoutValue times; + value <<= times; + this->properties_support_.set_default_property (FT::FT_FAULT_MONITORING_INTERVAL_AND_TIMEOUT, value ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN(-1); +#endif + +#if 0 + value << interval; + this->properties_support_.set_default_property (FT::FT_CHECKPOINT_INTERVAL, value); +#endif + + return result; } diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp index 760ab04740c..40ef13ae035 100755 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.cpp @@ -11,7 +11,7 @@ */ //============================================================================= -#include "orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.h" +#include "FT_ReplicationManagerFaultAnalyzer.h" #include "orbsvcs/CosNotifyCommC.h" #include "orbsvcs/FT_NotifierC.h" #include "orbsvcs/FT_ReplicationManager/FT_ReplicationManager.h" @@ -527,7 +527,7 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure ( result = -1; } ACE_ENDTRY; - ACE_CHECK_RETURN (-1); + ACE_CHECK_RETURN (-1); //@@ is this necessary? if (result == 0) { @@ -536,6 +536,7 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure ( result = this->get_membership_style (properties.in(), membership_style); if (result != 0) { + //@@ it seems a shame to fail here. We should at least remove the failed replica from the group. ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ( "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " @@ -563,6 +564,7 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure ( result = this->get_replication_style (properties.in(), replication_style); if (result != 0) { + //@@ it seems a shame to fail here. We should at least remove the failed replica from the group. ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ( "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " @@ -591,13 +593,17 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure ( properties.in(), minimum_number_members); if (result != 0) { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ( - "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " - "Could not extract MinimumNumberMembers from properties on " - "ObjectGroup with id <%Q>.\n"), - fault_event_desc.object_group_id), - -1); + // This is not a fatal error. It may be App Controlled. + result = 0; + if (TAO_debug_level > 3) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ( + "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " + "Could not extract MinimumNumberMembers from properties on " + "ObjectGroup with id <%Q>.\n"), + fault_event_desc.object_group_id)); + } } else { @@ -619,13 +625,17 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure ( properties.in(), initial_number_members); if (result != 0) { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ( - "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " - "Could not extract InitialNumberMembers from properties on " - "ObjectGroup with id <%Q>.\n"), - fault_event_desc.object_group_id), - -1); + // This is not a fatal error. It may be App Controlled. + result = 0; + if (TAO_debug_level > 3) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ( + "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " + "Could not extract InitialNumberMembers from properties on " + "ObjectGroup with id <%Q>.\n"), + fault_event_desc.object_group_id)); + } } else { @@ -647,13 +657,17 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure ( fault_event_desc.factories.out()); if (result != 0) { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ( - "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " - "Could not extract Factories from properties on " - "ObjectGroup with id <%Q>.\n"), - fault_event_desc.object_group_id), - -1); + // This is not a fatal error. It may be App Controlled. + result = 0; + if (TAO_debug_level > 3) + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT ( + "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " + "Could not extract Factories from properties on " + "ObjectGroup with id <%Q>.\n"), + fault_event_desc.object_group_id)); + } } else { @@ -698,31 +712,44 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure ( // If the MembershipStyle is FT::MEMB_INF_CTRL (infrastructure // controlled) and the primary has faulted, establish a new primary. // We get back a new object group. - PortableGroup::ObjectGroup_var new_object_group; if ((result == 0) && - (fault_event_desc.membership_style == FT::MEMB_INF_CTRL) && - (fault_event_desc.object_is_primary == 1)) + (fault_event_desc.membership_style == FT::MEMB_INF_CTRL)) { - if (TAO_debug_level > 6) - { - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ( - "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " - "Setting new primary for " - "ObjectGroup with id <%Q>.\n"), - fault_event_desc.object_group_id - )); - } - result = this->set_new_primary ( - the_object_group.in(), - fault_event_desc, - new_object_group.out()); + + PortableGroup::ObjectGroup_var new_object_group; + result = this->remove_failed_member ( + the_object_group.in(), + fault_event_desc, + new_object_group.out()); if (result == 0) { the_object_group = new_object_group; } + + if (fault_event_desc.object_is_primary == 1) + { + if (TAO_debug_level > 6) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ( + "TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure: " + "Setting new primary for " + "ObjectGroup with id <%Q>.\n"), + fault_event_desc.object_group_id + )); + } + result = this->set_new_primary ( + the_object_group.in(), + fault_event_desc, + new_object_group.out()); + if (result == 0) + { + the_object_group = new_object_group; + } + } } +#if 0 // According to the FT CORBA specification, this will be handled by the ObjectGroupManager::remove_member method // If the MembershipStyle is FT::MEMB_INF_CTRL (infrastructure // controlled) and the number of remaining members is less than // the MinimumNumberMembers property, add new members. @@ -746,14 +773,11 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::single_replica_failure ( new_object_group.out()); the_object_group = new_object_group; } - +#endif return result; } -// Choose a new primary member for the ObjectGroup. -// Sets <new_iogr> and returns 0 on success. -// Returns -1 on failure. -int TAO::FT_ReplicationManagerFaultAnalyzer::set_new_primary ( +int TAO::FT_ReplicationManagerFaultAnalyzer::remove_failed_member ( PortableGroup::ObjectGroup_ptr iogr, TAO::FT_FaultEventDescriptor & fault_event_desc, PortableGroup::ObjectGroup_out new_iogr) @@ -770,11 +794,37 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::set_new_primary ( fault_event_desc.location.in() ACE_ENV_ARG_DECL); ACE_TRY_CHECK; + new_iogr = temp_iogr._retn (); + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION ( + ACE_ANY_EXCEPTION, + "TAO::FT_ReplicationManagerFaultAnalyzer::remove_failed_member: "); + result = -1; + } + ACE_ENDTRY; + return result; +} + + +// Choose a new primary member for the ObjectGroup. +// Sets <new_iogr> and returns 0 on success. +// Returns -1 on failure. +int TAO::FT_ReplicationManagerFaultAnalyzer::set_new_primary ( + PortableGroup::ObjectGroup_ptr iogr, + TAO::FT_FaultEventDescriptor & fault_event_desc, + PortableGroup::ObjectGroup_out new_iogr) +{ + int result = 0; + new_iogr = PortableGroup::ObjectGroup::_nil (); + ACE_TRY_NEW_ENV + { // Get the locations of the remaining members of the object group. PortableGroup::Locations_var locations = this->replication_manager_->locations_of_members ( - temp_iogr.in() + iogr ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -782,7 +832,7 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::set_new_primary ( if (locations->length() >= 1) { new_iogr = this->replication_manager_->set_primary_member ( - temp_iogr.in(), + iogr, (*locations)[0] ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; @@ -809,6 +859,7 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::set_new_primary ( return result; } +#if 0 // this is handled by the remove_member method // While the number of members in the object group is less than // the MinimumNumberMembers property, add new members. // Sets <new_iogr> and returns 0 on success. @@ -915,6 +966,7 @@ int TAO::FT_ReplicationManagerFaultAnalyzer::add_members ( return result; } +#endif // 0 // Handle a location failure. int TAO::FT_ReplicationManagerFaultAnalyzer::location_failure ( diff --git a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.h b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.h index 90e5e5434a2..f15238af5bf 100755 --- a/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.h +++ b/TAO/orbsvcs/FT_ReplicationManager/FT_ReplicationManagerFaultAnalyzer.h @@ -153,6 +153,13 @@ namespace TAO const PortableGroup::Location & location, int & object_is_primary); + /// remove a failed member from a group + int remove_failed_member ( + PortableGroup::ObjectGroup_ptr iogr, + TAO::FT_FaultEventDescriptor & fault_event_desc, + PortableGroup::ObjectGroup_out new_iogr); + + // Choose a new primary member for the ObjectGroup. // Sets <new_iogr> and returns 0 on success. // Returns -1 on failure. @@ -161,6 +168,7 @@ namespace TAO TAO::FT_FaultEventDescriptor & fault_event_desc, PortableGroup::ObjectGroup_out new_iogr); +#if 0 // this is handled by the remove_member method // While the number of members in the object group is less than // the MinimumNumberMembers property, add new members. // Sets <new_iogr> and returns 0 on success. @@ -169,7 +177,7 @@ namespace TAO PortableGroup::ObjectGroup_ptr iogr, TAO::FT_FaultEventDescriptor & fault_event_desc, PortableGroup::ObjectGroup_out new_iogr); - +#endif /////////////// // Data Members diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp index 0cb75948b68..1569b65789a 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.cpp @@ -13,7 +13,6 @@ #include "PG_Properties_Support.h" - TAO::PG_Properties_Support::PG_Properties_Support () { } @@ -23,9 +22,17 @@ TAO::PG_Properties_Support::~PG_Properties_Support () } +void TAO::PG_Properties_Support::set_default_property (const char * name, + const PortableGroup::Value & value + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + this->default_properties_.set_property(name, value ACE_ENV_ARG_PARAMETER); +} + void TAO::PG_Properties_Support::set_default_properties (const PortableGroup::Properties & props) { - this->default_properties_.decode(props); + this->default_properties_.decode (props); } PortableGroup::Properties * diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h index d2a27bf7ff7..8cbc0c1e7b6 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Properties_Support.h @@ -62,6 +62,19 @@ namespace TAO ~PG_Properties_Support (); /** + * Set a single default property. + * Overwriting any value previously set for that property. + * Leaving all other properties untouched. + * @param name the name of the property to set + * @value an Any containing the value. + */ + void set_default_property (const char * name, + const PortableGroup::Value & value + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + ; + + /** * Update the default property set. * * Properties that appear in props are replaced in or added to the default diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp index 7b49a90784d..51fe4ed25c4 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.cpp @@ -71,10 +71,17 @@ void TAO::PG_Property_Set::decode (const PortableGroup::Properties & property_se // note assumption one level name with no kind // @@ TODO: fix this const CosNaming::NameComponent & nc = nsName[0]; + + this->set_property (ACE_static_cast (const char *, nc.id), property.val ACE_ENV_ARG_PARAMETER) + ACE_CHECK; + +#if 0 ACE_CString name = ACE_static_cast (const char *, nc.id); const PortableGroup::Value * value_copy; ACE_NEW_THROW_EX (value_copy, PortableGroup::Value (property.val), CORBA::NO_MEMORY ()); + ACE_CHECK; + const PortableGroup::Value * replaced_value = 0; if (0 == this->values_.rebind (name, value_copy, replaced_value)) { @@ -94,6 +101,7 @@ void TAO::PG_Property_Set::decode (const PortableGroup::Properties & property_se // @@ should throw something here ACE_THROW (CORBA::NO_MEMORY ()); } +#endif } } @@ -143,6 +151,39 @@ void TAO::PG_Property_Set::remove (const PortableGroup::Properties & property_se } } +void TAO::PG_Property_Set::set_property ( + const char * name, + const PortableGroup::Value & value + ACE_ENV_ARG_DECL) +{ + ACE_CString key (name); + PortableGroup::Value * value_copy; + ACE_NEW_THROW_EX ( + value_copy, PortableGroup::Value (value), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + const PortableGroup::Value * replaced_value = 0; + if (0 == this->values_.rebind (name, value_copy, replaced_value)) + { + if (0 != replaced_value) + { + delete replaced_value; + } + } + else + { + if (TAO_debug_level > 3) + { + ACE_ERROR ( (LM_ERROR, + "%n\n%T: Property_set: rebind failed.\n" + )); + } + // @@ should throw something here + ACE_THROW (CORBA::NO_MEMORY ()); + } +} + void TAO::PG_Property_Set::export_properties(PortableGroup::Properties & property_set) const @@ -153,10 +194,8 @@ void TAO::PG_Property_Set::export_properties(PortableGroup::Properties & propert property_set.length (merged_values.current_size ()); size_t pos = 0; - // note AFICT ACE_Hash_Map does not support const iterators, hence the const cast. - ValueMap & mutable_values = ACE_const_cast (ValueMap &, this->values_); - for (ValueMapIterator it = mutable_values.begin (); - it != mutable_values.end (); + for (ValueMapIterator it = merged_values.begin (); + it != merged_values.end (); ++it) { const ACE_CString & name = (*it).ext_id_; diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h index b2220ba9f89..68264080acd 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_Property_Set.h @@ -116,6 +116,15 @@ namespace TAO ACE_THROW_SPEC ((CORBA::SystemException)); /** + * set or replace a single property + */ + void set_property ( + const char * name, + const PortableGroup::Value & value + ACE_ENV_ARG_DECL); + + + /** * Export the properties to a PortableGroup::Properties * * This method is intended to be used to implement the PropertyManager::get_*_properties @@ -158,6 +167,7 @@ namespace TAO PG_Property_Set * defaults_; }; + #ifdef PG_PS_UNIT_TEST /** diff --git a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_conf.h b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_conf.h index 65aff18f6a2..dcb0e3d5a5e 100644 --- a/TAO/orbsvcs/orbsvcs/PortableGroup/PG_conf.h +++ b/TAO/orbsvcs/orbsvcs/PortableGroup/PG_conf.h @@ -24,14 +24,14 @@ #include "orbsvcs/PortableGroupC.h" -#ifndef TAO_PG_MAX_OBJECT_GROUPS +#ifndef TAO_PG_MAX_OBJECT_GROUPS // @@ why create arbitrary limits? /// The maximum number of object groups to be managed by the /// ObjectGroupManager. This number is also equal to the number of /// factory sets managed by the GenericFactory. const size_t TAO_PG_MAX_OBJECT_GROUPS = 1024; #endif /* TAO_PG_MAX_NUMBER_OF_OBJECT_GROUPS */ -#ifndef TAO_PG_MAX_LOCATIONS +#ifndef TAO_PG_MAX_LOCATIONS // @@ why create arbitrary limits? /// The maximum number of locations to be managed by the /// ObjectGroupManager. const size_t TAO_PG_MAX_LOCATIONS = 1024; @@ -46,7 +46,7 @@ const PortableGroup::MembershipStyleValue TAO_PG_MEMBERSHIP_STYLE = #ifndef TAO_PG_INITIAL_NUMBER_MEMBERS /// The default initial number of object group members. const PortableGroup::InitialNumberMembersValue TAO_PG_INITIAL_NUMBER_MEMBERS = - 0; + 2; #endif /* TAO_PG_INITIAL_NUMBER_MEMBERS */ #ifndef TAO_PG_MINIMUM_NUMBER_MEMBERS diff --git a/TAO/orbsvcs/tests/FT_App/FT_App.mpc b/TAO/orbsvcs/tests/FT_App/FT_App.mpc index 99c2250e308..0b91e76f89f 100644 --- a/TAO/orbsvcs/tests/FT_App/FT_App.mpc +++ b/TAO/orbsvcs/tests/FT_App/FT_App.mpc @@ -5,21 +5,41 @@ project(*Server): taoserver, fault_tolerance, orbsvcsexe{ FT_TestReplica_i.cpp FT_ReplicaFactory_i.cpp } +// Custom folder: test scripts +// too bad this doesn't work! +// If you omit the generic_outputext, it creates an empty folder +// if you include the generic_outputext, it tries to "build" the .pl +// file which runs the test even when you don't want to. +// Define_Custom(Script) { +// inputext = .pl, .py, .rb +// generic_outputext = .txt +// } +// Script_Files { +// run_test_detector.pl +// } + Documentation_Files { README FT_App.mpc + run_test_basic.pl // can the client talk to the server + run_test_detector.pl // does a detector notice a server fault + run_test_notifier.pl // does the notification get to an analyzer + run_test_fault_consumer.pl // Is the notification analyzed correctly + run_test_registry.pl // does the stand-along factory registry work + run_test_rmregistry.pl // does the factory registry in the RM work + run_test_replication_mgr.pl // + run_test_demo.pl // test it all together } } project(*Client): taoclient, fault_tolerance, orbsvcsexe { exename = ft_client includes += $(TAO_ROOT) + after += *Server Source_Files { FT_Client.cpp } Documentation_Files { - // pretend the pl file is documentation for now - run_test_basic.pl } } @@ -30,25 +50,10 @@ project(*Notifier): taoserver, fault_tolerance, orbsvcsexe { StubFaultNotifier.cpp } - // Custom folder: script to run this test -// too bad this doesn't work! -// If you omit the generic_outputext, it creates an empty folder -// if you include the generic_outputext, it tries to "build" the .pl -// file which runs the test even when you don't want to. -// Define_Custom(Script) { -// inputext = .pl, .py, .rb -// generic_outputext = .txt -// } -// Script_Files { -// run_test_detector.pl -// } - // explicitly omit IDL and doc files IDL_Files { } Documentation_Files { - // pretend the pl file is documentation for now - run_test_detector.pl } } @@ -66,8 +71,6 @@ project(*Analyzer): taoclient, fault_tolerance, orbsvcsexe { IDL_Files { } Documentation_Files { - // pretend the pl file is documentation for now - run_test_notifier.pl } } @@ -83,8 +86,6 @@ project(*FaultConsumer): taoserver, fault_tolerance, orbsvcsexe { IDL_Files { } Documentation_Files { - // pretend the pl file is documentation for now - run_test_fault_consumer.pl } } @@ -118,9 +119,6 @@ project(*Creator): taoclient, fault_tolerance, orbsvcsexe { } Documentation_Files { - // pretend the pl file is documentation for now - run_test_registry.pl - run_test_rmregistry.pl } } @@ -133,7 +131,5 @@ project(*RMController): taoclient, fault_tolerance, orbsvcsexe { IDL_Files { } Documentation_Files { - // pretend the pl file is documentation for now - run_test_replication_mgr.pl } } diff --git a/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp b/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp index 985541869c5..5da8173f8fa 100644 --- a/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp +++ b/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.cpp @@ -190,6 +190,66 @@ int TAO::Object_Group_Creator::create_detector_for_replica ( return result; } + +CORBA::Object_ptr TAO::Object_Group_Creator::create_infrastructure_managed_group ( + const char * type_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ( (CORBA::SystemException )) +{ + CORBA::Object_var group = CORBA::Object::_nil (); + + PortableGroup::ObjectGroupId group_id = 0; + + if (this->have_replication_manager_) + { + // set typeid properties + PortableGroup::Properties properties (1); + properties.length (3); + + properties[0].nam.length (1); + properties[0].nam[0].id = PortableGroup::PG_MEMBERSHIP_STYLE; + properties[0].val <<= PortableGroup::MEMB_INF_CTRL; + + PortableGroup::InitialNumberMembersValue inm(2); + properties[1].nam.length (1); + properties[1].nam[0].id = PortableGroup::PG_INITIAL_NUMBER_MEMBERS; + properties[1].val <<= inm; + + PortableGroup::MinimumNumberMembersValue mnm(1); + properties[2].nam.length (1); + properties[2].nam[0].id = PortableGroup::PG_MINIMUM_NUMBER_MEMBERS; + properties[2].val <<= mnm; + + this->replication_manager_->set_type_properties ( + type_id, + properties + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (group._retn ()); + + ::PortableGroup::GenericFactory::FactoryCreationId_var creation_id; + PortableGroup::Criteria criteria (1); + criteria.length (1); + criteria[0].nam.length (1); + criteria[0].nam[0].id = PortableGroup::PG_MEMBERSHIP_STYLE; + criteria[0].val <<= PortableGroup::MEMB_APP_CTRL; + + group = this->replication_manager_->create_object ( + type_id, + criteria, + creation_id + ACE_ENV_ARG_PARAMETER + ); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_TEXT("%T %n (%P|%t): Object_Group_Creator: infrastructure managed group requires Replication Manager\n") + )); + } + return group._retn (); +} + CORBA::Object_ptr TAO::Object_Group_Creator::create_group ( const char * role, int write_iors @@ -206,7 +266,7 @@ CORBA::Object_ptr TAO::Object_Group_Creator::create_group ( CORBA::ULong count = infos->length (); ACE_ERROR ( (LM_INFO, - "%T %n (%P|%t): Object_Group_Creator: found %u factories for %s : %s\n", + ACE_TEXT("%T %n (%P|%t): Object_Group_Creator: found %u factories for %s : %s\n"), ACE_static_cast (unsigned, count), role, ACE_static_cast (const char *, type_id) @@ -219,11 +279,32 @@ CORBA::Object_ptr TAO::Object_Group_Creator::create_group ( ::PortableGroup::GenericFactory::FactoryCreationId_var creation_id; if (this->have_replication_manager_) { - PortableGroup::Criteria criteria (1); - criteria.length (1); + + ////////////////////////////////////////////////////// + // note infrastructure controlled because we want the + // ReplicationManager to manage the object after it's created. + // Initial number members = 0 because we do not want the Replication + // Manager to populate the group. + // Minimum number of members = 0 because we do not want the + // Replication Manager to replace failed members. + // Semi-active, because that's what we do. + PortableGroup::Criteria criteria (3); + criteria.length (4); criteria[0].nam.length (1); criteria[0].nam[0].id = PortableGroup::PG_MEMBERSHIP_STYLE; - criteria[0].val <<= PortableGroup::MEMB_APP_CTRL; + criteria[0].val <<= PortableGroup::MEMB_INF_CTRL; + + criteria[1].nam.length (1); + criteria[1].nam[0].id = PortableGroup::PG_INITIAL_NUMBER_MEMBERS; + criteria[1].val <<= PortableGroup::InitialNumberMembersValue (0); + + criteria[2].nam.length (1); + criteria[2].nam[0].id = PortableGroup::PG_MINIMUM_NUMBER_MEMBERS; + criteria[2].val <<= PortableGroup::MinimumNumberMembersValue (0); + + criteria[3].nam.length (1); + criteria[3].nam[0].id = FT::FT_REPLICATION_STYLE; + criteria[3].val <<= FT::SEMI_ACTIVE; group = this->replication_manager_->create_object ( type_id.in (), diff --git a/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.h b/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.h index 3dcfb698c76..5bf6c6aae58 100644 --- a/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.h +++ b/TAO/orbsvcs/tests/FT_App/TAO_Object_Group_Creator.h @@ -53,6 +53,13 @@ namespace TAO ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)); + ///////////////// + // functionality + CORBA::Object_ptr create_infrastructure_managed_group( + const char * type_id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)); + int unregister_role(const char * role ACE_ENV_ARG_DECL); //////////// diff --git a/TAO/orbsvcs/tests/FT_App/run_test_rmnotifier.pl b/TAO/orbsvcs/tests/FT_App/run_test_rmnotifier.pl index cc05541e7e6..b5023240650 100755 --- a/TAO/orbsvcs/tests/FT_App/run_test_rmnotifier.pl +++ b/TAO/orbsvcs/tests/FT_App/run_test_rmnotifier.pl @@ -12,7 +12,8 @@ eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' # Fault_Notifier # implements FaultNotifier interface. # Processes used in test: -# TODO: Document adding ReplicationManager +# ReplicationManager +# # FT_Replica # implements TestReplica interface. # implements PullMonitorable. |