mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Conway <neil.con...@gmail.com>
Subject Review Request 42688: Fixed equality semantics for Labels.
Date Sat, 23 Jan 2016 20:04:07 GMT

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/42688/
-----------------------------------------------------------

Review request for mesos and Michael Park.


Bugs: MESOS-4445
    https://issues.apache.org/jira/browse/MESOS-4445


Repository: mesos


Description
-------

The previous implementation was buggy in two scenarios: (1) the label sets
contained different #s of duplicate elements (2) the "left" label set contained
duplicates and the "right" label set contained a value that didn't appear in the
"left" set.


Diffs
-----

  src/Makefile.am 19bf3a7c2e43ca04ed6e6d506e052de5537f7c2f 
  src/common/type_utils.cpp 76f48f6a1f5467db032ded8acd296d03353b4172 
  src/tests/labels_tests.cpp PRE-CREATION 

Diff: https://reviews.apache.org/r/42688/diff/


Testing
-------

make check

REVIEW NOTES:

* This is a WIP.
* Rather than implement a correct equality algorithm myself, I decided to just use `std::unordered_multiset`.
Computing equality correctly is a bit involved.
* This requires a hash implementation for `Label`. I supplied this in new function object
in the `mesos` namespace, but we could also supply a specialization of `std::hash<Label>`.
Not sure which is better.
* The same bug occurs in other equality operators for repeated fields (`CommandInfo.uris`,
`Environment`, `DockerInfo`, etc.). I suppose we should probably fix these as well? Note that
the bugs in the old approach are a lot less likely to occur when the struct has a lot of fields.


Thanks,

Neil Conway


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message