diff options
author | Martin Polden <mpolden@mpolden.no> | 2020-01-03 13:31:44 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2020-01-03 14:43:22 +0100 |
commit | b8eda7a354895a6f2d41f9950c3aa6965862bd82 (patch) | |
tree | be7ef3ac88a954ec6b91ea66c9797a5096c00344 /config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java | |
parent | fac9b339288cf288390fe08920f27a5deaef9d25 (diff) |
Avoid changing allocation when switching to combined cluster type
Diffstat (limited to 'config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java')
-rw-r--r-- | config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java index 84b344791c8..f1a8b579866 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java @@ -85,14 +85,15 @@ public final class ClusterSpec { return true; } - /** Returns whether this is equal, disregarding the group value and wanted Vespa version */ - public boolean equalsIgnoringGroupAndVespaVersion(Object o) { - if (o == this) return true; - if ( ! (o instanceof ClusterSpec)) return false; - ClusterSpec other = (ClusterSpec)o; - if ( ! other.type.equals(this.type)) return false; - if ( ! other.id.equals(this.id)) return false; - return true; + /** + * Returns whether this satisfies other for allocation purposes. Only considers cluster ID and type, other fields + * are ignored. + */ + public boolean satisfies(ClusterSpec other) { + if ( ! other.id.equals(this.id)) return false; // ID mismatch + // TODO(mpolden): Remove this after January 2019, once all nodes in combined clusters have type combined. + if (other.type.isContent() || this.type.isContent()) return other.type.isContent() == this.type.isContent(); + return other.type.equals(this.type); } /** A cluster type */ |