[
https://issues.apache.org/jira/browse/MESOS-4445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15140158#comment-15140158
]
Michael Park commented on MESOS-4445:
-------------------------------------
Had a discussion with [~neilconway] regarding this. This bug only arises when
# 2 labels {{L1}} and {{L2}} have the same number of key/value pairs and,
# Duplicate keys are present.
Based on the way the comparison is written (compare the size followed by a
subset test), it's clear that the intention is to *not* allow duplicate keys in
{{Labels}}.
As such, for now we propose to simply document that duplicate keys are not
permitted in {{Labels}}.
We considered adding validation for such violation, however, this could have a
performance impact on all operations of {{Resources}} since we perform
validation on {{Resources}} on every operation.
As we move to the world where we have corresponding C++ objects for which we
can assume to have validated, we'll be able to resolve these issues easily.
We should also consider moving to {{protobuf-2.6.1}} in order to pick up
features such as {{map}} and {{oneof}}.
> Labels equality behavior is wrong
> ---------------------------------
>
> Key: MESOS-4445
> URL: https://issues.apache.org/jira/browse/MESOS-4445
> Project: Mesos
> Issue Type: Bug
> Components: general
> Reporter: Neil Conway
> Assignee: Neil Conway
> Priority: Minor
> Labels: labels, mesosphere
>
> {noformat}
> TEST(RevocableResourceTest, LabelSemantics)
> {
> Labels labels1;
> Labels labels2;
> labels1.add_labels()->CopyFrom(createLabel("foo", "bar"));
> labels1.add_labels()->CopyFrom(createLabel("foo", "bar"));
> labels2.add_labels()->CopyFrom(createLabel("foo", "bar"));
> labels2.add_labels()->CopyFrom(createLabel("baz", "qux"));
> bool eq = (labels1 == labels2);
> LOG(INFO) << "Equal? " << (eq ? "true" : "false");
> }
> {noformat}
> Output:
> {noformat}
> [ RUN ] RevocableResourceTest.LabelSemantics
> I0120 13:15:25.207223 2078158848 resources_tests.cpp:1990] Equal? true
> [ OK ] RevocableResourceTest.LabelSemantics (0 ms)
> {noformat}
> This behavior seems pretty problematic.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)