This is an automated email from the ASF dual-hosted git repository. josephwu pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mesos.git
commit c1c866529cf53356b3fdbdb102c008f63ba40c61 Author: Joseph Wu <[email protected]> AuthorDate: Mon Oct 29 16:00:06 2018 -0700 Fixed FetcherTest.DuplicateFileURI on OSX. This test seems to fail because of a mismatch between the implementation of std::hash and operator== of the CommandInfo::URI object. The hash accounts for all fields except for 'cache'. The equality operator accounts for all fields except 'cache' **and** 'output_file'. This mismatch results in replacing the URI value in the fetcher's mapping, rather than adding a value. Why the std::unordered_map checks the equality operator rather than the hash value is unknown, but may be an implementation detail of clang's stdlib. Review: https://reviews.apache.org/r/69205 --- src/common/type_utils.cpp | 6 +++++- src/v1/mesos.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp index 33d6380..ef13eae 100644 --- a/src/common/type_utils.cpp +++ b/src/common/type_utils.cpp @@ -80,9 +80,13 @@ bool operator==(const CommandInfo& left, const CommandInfo& right) bool operator==(const CommandInfo::URI& left, const CommandInfo::URI& right) { + // NOTE: We purposefully do not compare the value of the `cache` field + // because a URI downloaded from source or from the fetcher cache should + // be considered identical. return left.value() == right.value() && left.executable() == right.executable() && - left.extract() == right.extract(); + left.extract() == right.extract() && + left.output_file() == right.output_file(); } diff --git a/src/v1/mesos.cpp b/src/v1/mesos.cpp index 9b2df2d..704ad76 100644 --- a/src/v1/mesos.cpp +++ b/src/v1/mesos.cpp @@ -79,9 +79,13 @@ bool operator==(const CommandInfo& left, const CommandInfo& right) bool operator==(const CommandInfo::URI& left, const CommandInfo::URI& right) { + // NOTE: We purposefully do not compare the value of the `cache` field + // because a URI downloaded from source or from the fetcher cache should + // be considered identical. return left.value() == right.value() && left.executable() == right.executable() && - left.extract() == right.extract(); + left.extract() == right.extract() && + left.output_file() == right.output_file(); }
