diff options
author | Morten Tokle <mortent@verizonmedia.com> | 2020-02-12 09:06:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-12 09:06:58 +0100 |
commit | b0e5e2de5a2d2909c9f2a7668a449063a63149d2 (patch) | |
tree | 252fd9118c9e70fc2472b96868808baf6616e241 /controller-api | |
parent | 9b2d74a9f81fc973a858ff80a2f9b3cc568526b2 (diff) | |
parent | 0e8cb5d429339e8ad5522d663ca963c92d334cdf (diff) |
Merge pull request #12150 from vespa-engine/mpolden/status-change-safeguard
Never remove all members from global endpoints
Diffstat (limited to 'controller-api')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java index 680613e8065..b54446c071e 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/dns/MemoryNameService.java @@ -45,7 +45,7 @@ public class MemoryNameService implements NameService { .map(target -> new Record(Record.Type.ALIAS, name, target.asData())) .collect(Collectors.toList()); // Satisfy idempotency contract of interface - removeRecords(findRecords(Record.Type.ALIAS, name)); + removeRecords(records); records.forEach(this::add); return records; } @@ -74,7 +74,17 @@ public class MemoryNameService implements NameService { "the FQDN name"); } return records.stream() - .filter(record -> record.type() == type && record.data().equals(data)) + .filter(record -> { + if (record.type() == type) { + if (type == Record.Type.ALIAS) { + // Unpack ALIAS record and compare FQDN of data part + return RecordData.fqdn(AliasTarget.from(record.data()).name().value()) + .equals(data); + } + return record.data().equals(data); + } + return false; + }) .collect(Collectors.toUnmodifiableList()); } |