Author: aconway
Date: Thu Oct 16 11:45:56 2008
New Revision: 705322

URL: http://svn.apache.org/viewvc?rev=705322&view=rev
Log:
Add UUID generated for each new cluster instance.

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml
    incubator/qpid/trunk/qpid/cpp/xml/cluster.xml

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp?rev=705322&r1=705321&r2=705322&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp Thu Oct 16 
11:45:56 2008
@@ -78,7 +78,7 @@
     void dumpRequest(const std::string& url) { cluster.dumpRequest(member, 
url, l); }
     void ready(const std::string& url) { cluster.ready(member, url, l); }
     void configChange(const std::string& addresses) { 
cluster.configChange(member, addresses, l); }
-    void dumpOffer(uint64_t dumpee) { cluster.dumpOffer(member, dumpee, l); }
+    void dumpOffer(uint64_t dumpee, const Uuid& id) { 
cluster.dumpOffer(member, dumpee, id, l); }
     void dumpStart(uint64_t dumpee, const std::string& url) { 
cluster.dumpStart(member, dumpee, url, l); }
     void shutdown() { cluster.shutdown(member, l); }
 
@@ -110,8 +110,6 @@
         mgmtObject = new qmf::Cluster (agent, this, 
&broker,name.str(),myUrl.str());
         agent->addObject (mgmtObject);
         mgmtObject->set_status("JOINING");
-        // FIXME aconway 2008-09-24: 
-        // if first cluster up set new UUID to set_clusterID() else set UUID 
of cluster being joined.
     }
     broker.getKnownBrokers = boost::bind(&Cluster::getUrls, this);
     failoverExchange.reset(new FailoverExchange(this));
@@ -372,6 +370,7 @@
 
     if (state == INIT) {        // First configChange
         if (map.aliveCount() == 1) {
+            setClusterId(true);
             QPID_LOG(info, *this << " first in cluster at " << myUrl);
             state = READY;
             if (mgmtObject!=0) mgmtObject->set_status("ACTIVE");
@@ -395,7 +394,7 @@
     if (state == READY && map.isNewbie(id)) {
         state = OFFER;
         QPID_LOG(debug, *this << " send dump-offer to " << id);
-        mcastControl(ClusterDumpOfferBody(ProtocolVersion(), id), l);
+        mcastControl(ClusterDumpOfferBody(ProtocolVersion(), id, clusterId), 
l);
     }
 }
 
@@ -432,7 +431,7 @@
     }
 }
 
-void Cluster::dumpOffer(const MemberId& dumper, uint64_t dumpeeInt, Lock& l) {
+void Cluster::dumpOffer(const MemberId& dumper, uint64_t dumpeeInt, const 
Uuid& uuid, Lock& l) {
     if (state == LEFT) return;
     MemberId dumpee(dumpeeInt);
     boost::optional<Url> url = map.dumpOffer(dumper, dumpee);
@@ -450,6 +449,7 @@
     else if (dumpee == myId && url) {
         assert(state == NEWBIE);
         QPID_LOG(debug, *this << " accepted dump-offer from " << dumper);
+        setClusterId(uuid);
         state = DUMPEE;
         deliverQueue.stop();
         checkDumpIn(l);
@@ -580,4 +580,11 @@
     return broker; // Immutable,  no need to lock.
 }
 
+void Cluster::setClusterId(const Uuid& uuid) {
+    clusterId = uuid;
+    if (mgmtObject)
+        mgmtObject->set_clusterID(clusterId.str());
+    QPID_LOG(debug, *this << " cluster-id = " << clusterId);
+}
+
 }} // namespace qpid::cluster

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h?rev=705322&r1=705321&r2=705322&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.h Thu Oct 16 
11:45:56 2008
@@ -42,6 +42,12 @@
 #include <map>
 
 namespace qpid {
+
+namespace framing {
+class AMQBody;
+class Uuid;
+}
+
 namespace cluster {
 
 class Connection;
@@ -118,7 +124,7 @@
     // May be called in CPG thread via deliver() OR in deliverQueue thread.
     // 
     void dumpRequest(const MemberId&, const std::string&, Lock&);
-    void dumpOffer(const MemberId& dumper, uint64_t dumpee, Lock&);
+    void dumpOffer(const MemberId& dumper, uint64_t dumpee, const 
framing::Uuid&, Lock&);
     void dumpStart(const MemberId& dumper, uint64_t dumpeeInt, const 
std::string& urlStr, Lock&);
     void ready(const MemberId&, const std::string&, Lock&);
     void configChange(const MemberId&, const std::string& addresses, Lock& l);
@@ -166,6 +172,8 @@
     void dumpOutError(const std::exception&);
     void dumpOutDone(Lock&);
 
+    void setClusterId(const framing::Uuid&);
+    
     mutable sys::Monitor lock;
 
     broker::Broker& broker;
@@ -181,6 +189,7 @@
     PollableEventQueue deliverQueue;
     PlainEventQueue mcastQueue;
     uint32_t mcastId;
+    framing::Uuid clusterId;
 
     qmf::org::apache::qpid::cluster::Cluster* mgmtObject; // mgnt owns 
lifecycle
 

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml?rev=705322&r1=705321&r2=705322&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml 
(original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/cluster/management-schema.xml Thu 
Oct 16 11:45:56 2008
@@ -1,39 +1,39 @@
 <schema package="org.apache.qpid.cluster">
 
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-  
-    http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
--->
+  <!--
+      Licensed to the Apache Software Foundation (ASF) under one
+      or more contributor license agreements.  See the NOTICE file
+      distributed with this work for additional information
+      regarding copyright ownership.  The ASF licenses this file
+      to you under the Apache License, Version 2.0 (the
+      "License"); you may not use this file except in compliance
+      with the License.  You may obtain a copy of the License at
+      
+      http://www.apache.org/licenses/LICENSE-2.0
+      
+      Unless required by applicable law or agreed to in writing,
+      software distributed under the License is distributed on an
+      "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+      KIND, either express or implied.  See the License for the
+      specific language governing permissions and limitations
+      under the License.
+  -->
 
   <!-- Type information:
 
-       Numeric types with "_wm" suffix are watermarked numbers.  These are 
compound
-       values containing a current value, and a low and high water mark for 
the reporting
-       interval.  The low and high water marks are set to the current value at 
the
-       beginning of each interval and track the minimum and maximum values of 
the statistic
-       over the interval respectively.
-
-       Access rights for configuration elements:
-
-           RO => Read Only
-           RC => Read/Create, can be set at create time only, read-only 
thereafter
-           RW => Read/Write
+Numeric types with "_wm" suffix are watermarked numbers.  These are compound
+values containing a current value, and a low and high water mark for the 
reporting
+interval.  The low and high water marks are set to the current value at the
+beginning of each interval and track the minimum and maximum values of the 
statistic
+over the interval respectively.
+
+Access rights for configuration elements:
+
+RO => Read Only
+RC => Read/Create, can be set at create time only, read-only thereafter
+RW => Read/Write
 
-           If access rights are omitted for a property, they are assumed to be 
RO.
+If access rights are omitted for a property, they are assumed to be RO.
 
   -->
 
@@ -44,8 +44,7 @@
     <property name="publishedURL"     type="sstr"   access="RC" desc="URL this 
node advertizes itself as"/>
     <property name="clusterSize"      type="uint16" access="RO" desc="Number 
of brokers currently in the cluster"/>
     <property name="status"           type="sstr"   access="RO" desc="Cluster 
node status (STALLED,ACTIVE,JOINING)"/>
-       <property name="members"          type="lstr"    access="RO" desc="List 
of 'host:port' of member nodes in the cluster delimited by ';'"/>
-       
+    <property name="members"          type="lstr"    access="RO" desc="List of 
member URLs delimited by ';'"/> 
 
     <method name="stopClusterNode"/>
     <method name="stopFullCluster"/>

Modified: incubator/qpid/trunk/qpid/cpp/xml/cluster.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/xml/cluster.xml?rev=705322&r1=705321&r2=705322&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/xml/cluster.xml (original)
+++ incubator/qpid/trunk/qpid/cpp/xml/cluster.xml Thu Oct 16 11:45:56 2008
@@ -33,6 +33,7 @@
 
     <control name = "dump-offer" code="0x2" label="Member offering to be 
dumper for dumpee.">
       <field name="dumpee" type="uint64"/>
+      <field name="cluster-id" type="uuid"/>
     </control>
 
     <control name = "dump-start" code="0x3" label="Used internally by dumper 
to mark stall point.">


Reply via email to