Repository: storm Updated Branches: refs/heads/master 2065dcada -> 2b6884b30
STORM-1189: Maintain wire compatability with 0.10.x versions of storm. Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/5c818b09 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/5c818b09 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/5c818b09 Branch: refs/heads/master Commit: 5c818b093350f572a38a5c59f9e083625b298ddd Parents: c12e28c Author: Robert (Bobby) Evans <[email protected]> Authored: Mon Nov 9 08:44:36 2015 -0600 Committer: Robert (Bobby) Evans <[email protected]> Committed: Mon Nov 9 08:44:36 2015 -0600 ---------------------------------------------------------------------- .../src/clj/backtype/storm/daemon/nimbus.clj | 11 +- .../storm/generated/ClusterSummary.java | 111 ++++++++++++++++++- storm-core/src/py/storm/ttypes.py | 16 ++- storm-core/src/storm.thrift | 2 + 4 files changed, 132 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/5c818b09/storm-core/src/clj/backtype/storm/daemon/nimbus.clj ---------------------------------------------------------------------- diff --git a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj index 75b2c80..2b77be3 100644 --- a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj +++ b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj @@ -1603,11 +1603,12 @@ (.getReplicationCount (:code-distributor nimbus) id) 1)) topo-summ - ))] - (ClusterSummary. supervisor-summaries - topology-summaries - nimbuses) - )) + )) + ret (ClusterSummary. supervisor-summaries + topology-summaries + nimbuses) + _ (.set_nimbus_uptime_secs ret nimbus-uptime)] + ret)) (^TopologyInfo getTopologyInfoWithOpts [this ^String storm-id ^GetInfoOptions options] (mark! nimbus:num-getTopologyInfoWithOpts-calls) http://git-wip-us.apache.org/repos/asf/storm/blob/5c818b09/storm-core/src/jvm/backtype/storm/generated/ClusterSummary.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/backtype/storm/generated/ClusterSummary.java b/storm-core/src/jvm/backtype/storm/generated/ClusterSummary.java index d23cdcb..c8c7c28 100644 --- a/storm-core/src/jvm/backtype/storm/generated/ClusterSummary.java +++ b/storm-core/src/jvm/backtype/storm/generated/ClusterSummary.java @@ -51,11 +51,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-10-9") +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-11-9") public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, ClusterSummary._Fields>, java.io.Serializable, Cloneable, Comparable<ClusterSummary> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ClusterSummary"); private static final org.apache.thrift.protocol.TField SUPERVISORS_FIELD_DESC = new org.apache.thrift.protocol.TField("supervisors", org.apache.thrift.protocol.TType.LIST, (short)1); + private static final org.apache.thrift.protocol.TField NIMBUS_UPTIME_SECS_FIELD_DESC = new org.apache.thrift.protocol.TField("nimbus_uptime_secs", org.apache.thrift.protocol.TType.I32, (short)2); private static final org.apache.thrift.protocol.TField TOPOLOGIES_FIELD_DESC = new org.apache.thrift.protocol.TField("topologies", org.apache.thrift.protocol.TType.LIST, (short)3); private static final org.apache.thrift.protocol.TField NIMBUSES_FIELD_DESC = new org.apache.thrift.protocol.TField("nimbuses", org.apache.thrift.protocol.TType.LIST, (short)4); @@ -66,12 +67,14 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C } private List<SupervisorSummary> supervisors; // required + private int nimbus_uptime_secs; // optional private List<TopologySummary> topologies; // required private List<NimbusSummary> nimbuses; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { SUPERVISORS((short)1, "supervisors"), + NIMBUS_UPTIME_SECS((short)2, "nimbus_uptime_secs"), TOPOLOGIES((short)3, "topologies"), NIMBUSES((short)4, "nimbuses"); @@ -90,6 +93,8 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C switch(fieldId) { case 1: // SUPERVISORS return SUPERVISORS; + case 2: // NIMBUS_UPTIME_SECS + return NIMBUS_UPTIME_SECS; case 3: // TOPOLOGIES return TOPOLOGIES; case 4: // NIMBUSES @@ -134,12 +139,17 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C } // isset id assignments + private static final int __NIMBUS_UPTIME_SECS_ISSET_ID = 0; + private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.NIMBUS_UPTIME_SECS}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUPERVISORS, new org.apache.thrift.meta_data.FieldMetaData("supervisors", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, SupervisorSummary.class)))); + tmpMap.put(_Fields.NIMBUS_UPTIME_SECS, new org.apache.thrift.meta_data.FieldMetaData("nimbus_uptime_secs", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); tmpMap.put(_Fields.TOPOLOGIES, new org.apache.thrift.meta_data.FieldMetaData("topologies", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TopologySummary.class)))); @@ -151,6 +161,8 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C } public ClusterSummary() { + this.nimbus_uptime_secs = 0; + } public ClusterSummary( @@ -168,6 +180,7 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C * Performs a deep copy on <i>other</i>. */ public ClusterSummary(ClusterSummary other) { + __isset_bitfield = other.__isset_bitfield; if (other.is_set_supervisors()) { List<SupervisorSummary> __this__supervisors = new ArrayList<SupervisorSummary>(other.supervisors.size()); for (SupervisorSummary other_element : other.supervisors) { @@ -175,6 +188,7 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C } this.supervisors = __this__supervisors; } + this.nimbus_uptime_secs = other.nimbus_uptime_secs; if (other.is_set_topologies()) { List<TopologySummary> __this__topologies = new ArrayList<TopologySummary>(other.topologies.size()); for (TopologySummary other_element : other.topologies) { @@ -198,6 +212,8 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C @Override public void clear() { this.supervisors = null; + this.nimbus_uptime_secs = 0; + this.topologies = null; this.nimbuses = null; } @@ -240,6 +256,28 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C } } + public int get_nimbus_uptime_secs() { + return this.nimbus_uptime_secs; + } + + public void set_nimbus_uptime_secs(int nimbus_uptime_secs) { + this.nimbus_uptime_secs = nimbus_uptime_secs; + set_nimbus_uptime_secs_isSet(true); + } + + public void unset_nimbus_uptime_secs() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __NIMBUS_UPTIME_SECS_ISSET_ID); + } + + /** Returns true if field nimbus_uptime_secs is set (has been assigned a value) and false otherwise */ + public boolean is_set_nimbus_uptime_secs() { + return EncodingUtils.testBit(__isset_bitfield, __NIMBUS_UPTIME_SECS_ISSET_ID); + } + + public void set_nimbus_uptime_secs_isSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __NIMBUS_UPTIME_SECS_ISSET_ID, value); + } + public int get_topologies_size() { return (this.topologies == null) ? 0 : this.topologies.size(); } @@ -326,6 +364,14 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C } break; + case NIMBUS_UPTIME_SECS: + if (value == null) { + unset_nimbus_uptime_secs(); + } else { + set_nimbus_uptime_secs((Integer)value); + } + break; + case TOPOLOGIES: if (value == null) { unset_topologies(); @@ -350,6 +396,9 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C case SUPERVISORS: return get_supervisors(); + case NIMBUS_UPTIME_SECS: + return Integer.valueOf(get_nimbus_uptime_secs()); + case TOPOLOGIES: return get_topologies(); @@ -369,6 +418,8 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C switch (field) { case SUPERVISORS: return is_set_supervisors(); + case NIMBUS_UPTIME_SECS: + return is_set_nimbus_uptime_secs(); case TOPOLOGIES: return is_set_topologies(); case NIMBUSES: @@ -399,6 +450,15 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C return false; } + boolean this_present_nimbus_uptime_secs = true && this.is_set_nimbus_uptime_secs(); + boolean that_present_nimbus_uptime_secs = true && that.is_set_nimbus_uptime_secs(); + if (this_present_nimbus_uptime_secs || that_present_nimbus_uptime_secs) { + if (!(this_present_nimbus_uptime_secs && that_present_nimbus_uptime_secs)) + return false; + if (this.nimbus_uptime_secs != that.nimbus_uptime_secs) + return false; + } + boolean this_present_topologies = true && this.is_set_topologies(); boolean that_present_topologies = true && that.is_set_topologies(); if (this_present_topologies || that_present_topologies) { @@ -429,6 +489,11 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C if (present_supervisors) list.add(supervisors); + boolean present_nimbus_uptime_secs = true && (is_set_nimbus_uptime_secs()); + list.add(present_nimbus_uptime_secs); + if (present_nimbus_uptime_secs) + list.add(nimbus_uptime_secs); + boolean present_topologies = true && (is_set_topologies()); list.add(present_topologies); if (present_topologies) @@ -460,6 +525,16 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C return lastComparison; } } + lastComparison = Boolean.valueOf(is_set_nimbus_uptime_secs()).compareTo(other.is_set_nimbus_uptime_secs()); + if (lastComparison != 0) { + return lastComparison; + } + if (is_set_nimbus_uptime_secs()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nimbus_uptime_secs, other.nimbus_uptime_secs); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(is_set_topologies()).compareTo(other.is_set_topologies()); if (lastComparison != 0) { return lastComparison; @@ -507,6 +582,12 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C sb.append(this.supervisors); } first = false; + if (is_set_nimbus_uptime_secs()) { + if (!first) sb.append(", "); + sb.append("nimbus_uptime_secs:"); + sb.append(this.nimbus_uptime_secs); + first = false; + } if (!first) sb.append(", "); sb.append("topologies:"); if (this.topologies == null) { @@ -554,6 +635,8 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); @@ -597,6 +680,14 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 2: // NIMBUS_UPTIME_SECS + if (schemeField.type == org.apache.thrift.protocol.TType.I32) { + struct.nimbus_uptime_secs = iprot.readI32(); + struct.set_nimbus_uptime_secs_isSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; case 3: // TOPOLOGIES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { @@ -660,6 +751,11 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C } oprot.writeFieldEnd(); } + if (struct.is_set_nimbus_uptime_secs()) { + oprot.writeFieldBegin(NIMBUS_UPTIME_SECS_FIELD_DESC); + oprot.writeI32(struct.nimbus_uptime_secs); + oprot.writeFieldEnd(); + } if (struct.topologies != null) { oprot.writeFieldBegin(TOPOLOGIES_FIELD_DESC); { @@ -722,6 +818,14 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C _iter98.write(oprot); } } + BitSet optionals = new BitSet(); + if (struct.is_set_nimbus_uptime_secs()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.is_set_nimbus_uptime_secs()) { + oprot.writeI32(struct.nimbus_uptime_secs); + } } @Override @@ -763,6 +867,11 @@ public class ClusterSummary implements org.apache.thrift.TBase<ClusterSummary, C } } struct.set_nimbuses_isSet(true); + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.nimbus_uptime_secs = iprot.readI32(); + struct.set_nimbus_uptime_secs_isSet(true); + } } } http://git-wip-us.apache.org/repos/asf/storm/blob/5c818b09/storm-core/src/py/storm/ttypes.py ---------------------------------------------------------------------- diff --git a/storm-core/src/py/storm/ttypes.py b/storm-core/src/py/storm/ttypes.py index a14d62d..36722ac 100644 --- a/storm-core/src/py/storm/ttypes.py +++ b/storm-core/src/py/storm/ttypes.py @@ -2794,6 +2794,7 @@ class ClusterSummary: """ Attributes: - supervisors + - nimbus_uptime_secs - topologies - nimbuses """ @@ -2801,13 +2802,14 @@ class ClusterSummary: thrift_spec = ( None, # 0 (1, TType.LIST, 'supervisors', (TType.STRUCT,(SupervisorSummary, SupervisorSummary.thrift_spec)), None, ), # 1 - None, # 2 + (2, TType.I32, 'nimbus_uptime_secs', None, 0, ), # 2 (3, TType.LIST, 'topologies', (TType.STRUCT,(TopologySummary, TopologySummary.thrift_spec)), None, ), # 3 (4, TType.LIST, 'nimbuses', (TType.STRUCT,(NimbusSummary, NimbusSummary.thrift_spec)), None, ), # 4 ) - def __init__(self, supervisors=None, topologies=None, nimbuses=None,): + def __init__(self, supervisors=None, nimbus_uptime_secs=thrift_spec[2][4], topologies=None, nimbuses=None,): self.supervisors = supervisors + self.nimbus_uptime_secs = nimbus_uptime_secs self.topologies = topologies self.nimbuses = nimbuses @@ -2831,6 +2833,11 @@ class ClusterSummary: iprot.readListEnd() else: iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I32: + self.nimbus_uptime_secs = iprot.readI32(); + else: + iprot.skip(ftype) elif fid == 3: if ftype == TType.LIST: self.topologies = [] @@ -2870,6 +2877,10 @@ class ClusterSummary: iter93.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() + if self.nimbus_uptime_secs is not None: + oprot.writeFieldBegin('nimbus_uptime_secs', TType.I32, 2) + oprot.writeI32(self.nimbus_uptime_secs) + oprot.writeFieldEnd() if self.topologies is not None: oprot.writeFieldBegin('topologies', TType.LIST, 3) oprot.writeListBegin(TType.STRUCT, len(self.topologies)) @@ -2900,6 +2911,7 @@ class ClusterSummary: def __hash__(self): value = 17 value = (value * 31) ^ hash(self.supervisors) + value = (value * 31) ^ hash(self.nimbus_uptime_secs) value = (value * 31) ^ hash(self.topologies) value = (value * 31) ^ hash(self.nimbuses) return value http://git-wip-us.apache.org/repos/asf/storm/blob/5c818b09/storm-core/src/storm.thrift ---------------------------------------------------------------------- diff --git a/storm-core/src/storm.thrift b/storm-core/src/storm.thrift index 51e1236..6f7fec1 100644 --- a/storm-core/src/storm.thrift +++ b/storm-core/src/storm.thrift @@ -174,6 +174,8 @@ struct NimbusSummary { struct ClusterSummary { 1: required list<SupervisorSummary> supervisors; + //@deprecated, please use nimbuses.uptime_secs instead. + 2: optional i32 nimbus_uptime_secs = 0; 3: required list<TopologySummary> topologies; 4: required list<NimbusSummary> nimbuses; }
