diff options
author | Alan Conway <aconway@apache.org> | 2010-03-31 16:52:50 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2010-03-31 16:52:50 +0000 |
commit | dda98127df553def41fb332f714c2f91858a7ea3 (patch) | |
tree | 85ce770251b694656176e4e29e055194293f430d /cpp | |
parent | f6f1900eb98cc1773a88a3ec309afa646438a384 (diff) | |
download | qpid-python-dda98127df553def41fb332f714c2f91858a7ea3.tar.gz |
Cluster: remove un-necessary code for config-seq.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@929616 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/qpid/cluster/Cluster.cpp | 6 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/ClusterMap.cpp | 13 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/ClusterMap.h | 6 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/Connection.cpp | 5 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/Connection.h | 3 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/StoreStatus.cpp | 20 | ||||
-rw-r--r-- | cpp/src/qpid/cluster/StoreStatus.h | 3 | ||||
-rw-r--r-- | cpp/src/tests/cluster_test.cpp | 2 | ||||
-rw-r--r-- | cpp/xml/cluster.xml | 1 |
9 files changed, 14 insertions, 45 deletions
diff --git a/cpp/src/qpid/cluster/Cluster.cpp b/cpp/src/qpid/cluster/Cluster.cpp index 858900be9e..0520503ad4 100644 --- a/cpp/src/qpid/cluster/Cluster.cpp +++ b/cpp/src/qpid/cluster/Cluster.cpp @@ -638,8 +638,6 @@ void Cluster::initMapCompleted(Lock& l) { } else { // I can go ready. discarding = false; - map.resetConfigSeq(); // Start from config-seq = 0 - store.setConfigSeq(map.getConfigSeq()); setReady(l); memberUpdate(l); mcast.mcastControl(ClusterReadyBody(ProtocolVersion(), myUrl.str()), self); @@ -658,8 +656,7 @@ void Cluster::configChange(const MemberId&, MemberSet members = decodeMemberSet(membersStr); MemberSet left = decodeMemberSet(leftStr); MemberSet joined = decodeMemberSet(joinedStr); - QPID_LOG(notice, *this << " Membership update " << map.getConfigSeq() << ": " - << members); + QPID_LOG(notice, *this << " Membership update: " << members); QPID_LOG_IF(notice, !left.empty(), *this << " Members left: " << left); QPID_LOG_IF(notice, !joined.empty(), *this << " Members joined: " << joined); @@ -671,7 +668,6 @@ void Cluster::configChange(const MemberId&, return; } bool memberChange = map.configChange(members); - store.setConfigSeq(map.getConfigSeq()); // Update initital status for members joining or leaving. initMap.configChange(members); diff --git a/cpp/src/qpid/cluster/ClusterMap.cpp b/cpp/src/qpid/cluster/ClusterMap.cpp index c050293717..040e129970 100644 --- a/cpp/src/qpid/cluster/ClusterMap.cpp +++ b/cpp/src/qpid/cluster/ClusterMap.cpp @@ -57,17 +57,16 @@ void assignFieldTable(FieldTable& ft, const ClusterMap::Map& map) { } -ClusterMap::ClusterMap() : frameSeq(0), configSeq(0) {} +ClusterMap::ClusterMap() : frameSeq(0) {} -ClusterMap::ClusterMap(const Map& map) : frameSeq(0), configSeq(0) { +ClusterMap::ClusterMap(const Map& map) : frameSeq(0) { transform(map.begin(), map.end(), inserter(alive, alive.begin()), bind(&Map::value_type::first, _1)); members = map; } ClusterMap::ClusterMap(const FieldTable& joinersFt, const FieldTable& membersFt, - framing::SequenceNumber frameSeq_, - framing::SequenceNumber configSeq_) - : frameSeq(frameSeq_), configSeq(configSeq_) + framing::SequenceNumber frameSeq_) + : frameSeq(frameSeq_) { for_each(joinersFt.begin(), joinersFt.end(), bind(&addFieldTableValue, _1, ref(joiners), ref(alive))); for_each(membersFt.begin(), membersFt.end(), bind(&addFieldTableValue, _1, ref(members), ref(alive))); @@ -83,7 +82,6 @@ void ClusterMap::toMethodBody(framing::ClusterConnectionMembershipBody& b) const b.getMembers().clear(); for_each(members.begin(), members.end(), bind(&insertFieldTableFromMapValue, ref(b.getMembers()), _1)); b.setFrameSeq(frameSeq); - b.setConfigSeq(configSeq); } Url ClusterMap::getUrl(const Map& map, const MemberId& id) { @@ -136,7 +134,7 @@ ostream& operator<<(ostream& o, const ClusterMap& m) { else o << "(unknown)"; o << " "; } - o << "frameSeq=" << m.getFrameSeq() << " configSeq=" << m.getConfigSeq(); + o << "frameSeq=" << m.getFrameSeq(); return o; } @@ -157,7 +155,6 @@ bool ClusterMap::ready(const MemberId& id, const Url& url) { } bool ClusterMap::configChange(const Set& update) { - ++configSeq; bool memberChange = false; Set removed; set_difference(alive.begin(), alive.end(), diff --git a/cpp/src/qpid/cluster/ClusterMap.h b/cpp/src/qpid/cluster/ClusterMap.h index 604d5c2d73..cfa4ad924a 100644 --- a/cpp/src/qpid/cluster/ClusterMap.h +++ b/cpp/src/qpid/cluster/ClusterMap.h @@ -50,7 +50,7 @@ class ClusterMap { ClusterMap(); ClusterMap(const Map& map); ClusterMap(const framing::FieldTable& joiners, const framing::FieldTable& members, - framing::SequenceNumber frameSeq, framing::SequenceNumber configSeq); + framing::SequenceNumber frameSeq); /** Update from config change. *@return true if member set changed. @@ -86,8 +86,6 @@ class ClusterMap { framing::SequenceNumber getFrameSeq() const { return frameSeq; } framing::SequenceNumber incrementFrameSeq() { return ++frameSeq; } - framing::SequenceNumber getConfigSeq() const { return configSeq; } - void resetConfigSeq() { configSeq = 0; } /** Clear out all knowledge of joiners & members, just keep alive set */ void clearStatus() { joiners.clear(); members.clear(); } @@ -97,7 +95,7 @@ class ClusterMap { Map joiners, members; Set alive; - framing::SequenceNumber frameSeq, configSeq; + framing::SequenceNumber frameSeq; friend std::ostream& operator<<(std::ostream&, const Map&); friend std::ostream& operator<<(std::ostream&, const ClusterMap&); diff --git a/cpp/src/qpid/cluster/Connection.cpp b/cpp/src/qpid/cluster/Connection.cpp index 1166f685d2..30828d7bd9 100644 --- a/cpp/src/qpid/cluster/Connection.cpp +++ b/cpp/src/qpid/cluster/Connection.cpp @@ -381,11 +381,10 @@ void Connection::shadowReady( } void Connection::membership(const FieldTable& joiners, const FieldTable& members, - const framing::SequenceNumber& frameSeq, - const framing::SequenceNumber& configSeq) + const framing::SequenceNumber& frameSeq) { QPID_LOG(debug, cluster << " incoming update complete on connection " << *this); - cluster.updateInDone(ClusterMap(joiners, members, frameSeq, configSeq)); + cluster.updateInDone(ClusterMap(joiners, members, frameSeq)); updateIn.consumerNumbering.clear(); self.second = 0; // Mark this as completed update connection. } diff --git a/cpp/src/qpid/cluster/Connection.h b/cpp/src/qpid/cluster/Connection.h index 2f72783418..000d00f7d9 100644 --- a/cpp/src/qpid/cluster/Connection.h +++ b/cpp/src/qpid/cluster/Connection.h @@ -130,8 +130,7 @@ class Connection : uint32_t sendMax); void membership(const framing::FieldTable&, const framing::FieldTable&, - const framing::SequenceNumber& frameSeq, - const framing::SequenceNumber& configSeq); + const framing::SequenceNumber& frameSeq); void retractOffer(); diff --git a/cpp/src/qpid/cluster/StoreStatus.cpp b/cpp/src/qpid/cluster/StoreStatus.cpp index b44c0e1a9a..ea5501aba2 100644 --- a/cpp/src/qpid/cluster/StoreStatus.cpp +++ b/cpp/src/qpid/cluster/StoreStatus.cpp @@ -36,7 +36,7 @@ namespace fs=boost::filesystem; using namespace std; StoreStatus::StoreStatus(const std::string& d) - : state(STORE_STATE_NO_STORE), dataDir(d), configSeq(0) + : state(STORE_STATE_NO_STORE), dataDir(d) {} namespace { @@ -44,7 +44,6 @@ namespace { const char* SUBDIR="cluster"; const char* CLUSTER_ID_FILE="cluster.uuid"; const char* SHUTDOWN_ID_FILE="shutdown.uuid"; -const char* CONFIG_SEQ_FILE="config.seq"; void throw_exceptions(ios& ios) { // Have stream throw an exception on error. @@ -104,7 +103,6 @@ void StoreStatus::load() { create_directory(dir); clusterId = loadUuid(dir/CLUSTER_ID_FILE); shutdownId = loadUuid(dir/SHUTDOWN_ID_FILE); - configSeq = loadSeqNum(dir/CONFIG_SEQ_FILE); if (clusterId && shutdownId) state = STORE_STATE_CLEAN_STORE; else if (clusterId) state = STORE_STATE_DIRTY_STORE; else state = STORE_STATE_EMPTY_STORE; @@ -121,14 +119,6 @@ void StoreStatus::save() { create_directory(dir); saveUuid(dir/CLUSTER_ID_FILE, clusterId); saveUuid(dir/SHUTDOWN_ID_FILE, shutdownId); - try { - fs::ofstream o(dir/CONFIG_SEQ_FILE); - throw_exceptions(o); - o << configSeq.getValue(); - } catch (const std::exception& e) { - QPID_LOG(error, "Cant save sequence number to " << (dir/CONFIG_SEQ_FILE).string() << ": " << e.what()); - throw; - } } catch (const std::exception&e) { throw Exception(QPID_MSG("Cannot save cluster store status: " << e.what())); @@ -156,11 +146,6 @@ void StoreStatus::clean(const Uuid& shutdownId_) { save(); } -void StoreStatus::setConfigSeq(framing::SequenceNumber seq) { - configSeq = seq; - save(); -} - const char* stateName(StoreState s) { switch (s) { case STORE_STATE_NO_STORE: return "none"; @@ -177,8 +162,7 @@ ostream& operator<<(ostream& o, framing::cluster::StoreState s) { return o << st ostream& operator<<(ostream& o, const StoreStatus& s) { o << s.getState(); if (s.getState() == STORE_STATE_DIRTY_STORE) - o << " cluster-id=" << s.getClusterId() - << " config-sequence=" << s.getConfigSeq(); + o << " cluster-id=" << s.getClusterId(); if (s.getState() == STORE_STATE_CLEAN_STORE) { o << " cluster-id=" << s.getClusterId() << " shutdown-id=" << s.getShutdownId(); diff --git a/cpp/src/qpid/cluster/StoreStatus.h b/cpp/src/qpid/cluster/StoreStatus.h index b496fe0dc2..d9e4549175 100644 --- a/cpp/src/qpid/cluster/StoreStatus.h +++ b/cpp/src/qpid/cluster/StoreStatus.h @@ -47,11 +47,9 @@ class StoreStatus const Uuid& getClusterId() const { return clusterId; } const Uuid& getShutdownId() const { return shutdownId; } - framing::SequenceNumber getConfigSeq() const { return configSeq; } void dirty(const Uuid& clusterId); // Mark the store in use by clusterId. void clean(const Uuid& shutdownId); // Mark the store clean at shutdownId - void setConfigSeq(framing::SequenceNumber seq); // Update the config seq number. void load(); void save(); @@ -62,7 +60,6 @@ class StoreStatus framing::cluster::StoreState state; Uuid clusterId, shutdownId; std::string dataDir; - framing::SequenceNumber configSeq; }; const char* stateName(framing::cluster::StoreState); diff --git a/cpp/src/tests/cluster_test.cpp b/cpp/src/tests/cluster_test.cpp index d572126fff..5e7409dd8e 100644 --- a/cpp/src/tests/cluster_test.cpp +++ b/cpp/src/tests/cluster_test.cpp @@ -87,7 +87,7 @@ ClusterFixture::Args prepareArgs(const bool durableFlag = false) { } // Timeout for tests that wait for messages -const sys::Duration TIMEOUT=sys::TIME_SEC/2; +const sys::Duration TIMEOUT=2*sys::TIME_SEC; ostream& operator<<(ostream& o, const cpg_name* n) { diff --git a/cpp/xml/cluster.xml b/cpp/xml/cluster.xml index c4750a3195..da0285f393 100644 --- a/cpp/xml/cluster.xml +++ b/cpp/xml/cluster.xml @@ -224,7 +224,6 @@ <field name="joiners" type="map"/> <!-- member-id -> URL --> <field name="members" type="map"/> <!-- member-id -> state --> <field name="frame-seq" type="sequence-no"/> <!-- frame sequence number --> - <field name="config-seq" type="sequence-no"/> <!-- config change seq no.--> </control> <!-- Updater cannot fulfill an update offer. --> |