Skip to content

Commit

Permalink
Cherry pick v2.6.0 1015 (#3107)
Browse files Browse the repository at this point in the history
* Expression test modify (#3041)

* modify expression test

* modify expression test 2

* complete coding

* fix bug

* modify expression test case

* clang-format

* fix bug:initialization-order-fiasco

* add some obj

* add test_path_function

Co-authored-by: cpw <[email protected]>

* add hash<set> & hash<map> (#3051)

* fix  dangling edge in path (#3008)

* fix dangling edge

* add test case

* fix ci error

* Fix graph/meta/storage version in show hosts (#3054)

* Fix graph version bug

* Fix storage version

* Print cpack config

* Decrease ubuntu compile parallelism

* fix bug #3048 (#3069)

Co-authored-by: haifei.zhao <[email protected]>
Co-authored-by: cpw <[email protected]>
Co-authored-by: jimingquan <[email protected]>
Co-authored-by: Yee <[email protected]>
  • Loading branch information
5 people authored Oct 18, 2021
1 parent 963ac9b commit 9243bba
Show file tree
Hide file tree
Showing 21 changed files with 844 additions and 317 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
-DENABLE_COVERAGE=on \
-B build
echo "::set-output name=j::10"
echo "::set-output name=t::10"
echo "::set-output name=t::7"
;;
esac
;;
Expand Down
9 changes: 5 additions & 4 deletions cmake/CPackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,11 @@ macro(package to_one name home_page scripts_dir)
set(HOST_SYSTEM_VER "Unknown")
endif()

message(STATUS "HOST_SYSTEM_NAME is ${HOST_SYSTEM_NAME}")
message(STATUS "HOST_SYSTEM_VER is ${HOST_SYSTEM_VER}")
message(STATUS "CPACK_GENERATOR is ${CPACK_GENERATOR}")
message(STATUS "CMAKE_HOST_SYSTEM_PROCESSOR is ${CMAKE_HOST_SYSTEM_PROCESSOR}")
print_config(NEBULA_BUILD_VERSION)
print_config(HOST_SYSTEM_NAME)
print_config(HOST_SYSTEM_VER)
print_config(CPACK_GENERATOR)
print_config(CMAKE_HOST_SYSTEM_PROCESSOR)

set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${HOST_SYSTEM_VER}.${CMAKE_HOST_SYSTEM_PROCESSOR})
if (${to_one})
Expand Down
4 changes: 1 addition & 3 deletions src/clients/meta/MetaClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2335,9 +2335,7 @@ folly::Future<StatusOr<bool>> MetaClient::heartbeat() {
req.set_host(options_.localHost_);
req.set_role(options_.role_);
req.set_git_info_sha(options_.gitInfoSHA_);
#if defined(NEBULA_BUILD_VERSION)
req.set_version(versionString(false));
#endif
req.set_version(getOriginVersion());
if (options_.role_ == cpp2::HostRole::STORAGE) {
if (options_.clusterId_.load() == 0) {
options_.clusterId_ = FileBasedClusterIdMan::getClusterIdFromFile(FLAGS_cluster_id_path);
Expand Down
11 changes: 11 additions & 0 deletions src/common/datatypes/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,14 @@ folly::dynamic Map::getMetaData() const {
}

} // namespace nebula

namespace std {
std::size_t hash<nebula::Map>::operator()(const nebula::Map& m) const noexcept {
size_t seed = 0;
for (auto& v : m.kvs) {
seed ^= hash<std::string>()(v.first) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
return seed;
}

} // namespace std
8 changes: 8 additions & 0 deletions src/common/datatypes/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,12 @@ struct Map {
inline std::ostream& operator<<(std::ostream& os, const Map& m) { return os << m.toString(); }

} // namespace nebula

namespace std {
template <>
struct hash<nebula::Map> {
std::size_t operator()(const nebula::Map& m) const noexcept;
};

} // namespace std
#endif // COMMON_DATATYPES_MAP_H_
11 changes: 11 additions & 0 deletions src/common/datatypes/Set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ folly::dynamic Set::getMetaData() const {
}

} // namespace nebula

namespace std {
std::size_t hash<nebula::Set>::operator()(const nebula::Set& s) const noexcept {
size_t seed = 0;
for (auto& v : s.values) {
seed ^= hash<nebula::Value>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
return seed;
}

} // namespace std
9 changes: 8 additions & 1 deletion src/common/datatypes/Set.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ struct Set {
};

inline std::ostream& operator<<(std::ostream& os, const Set& s) { return os << s.toString(); }

} // namespace nebula

namespace std {
template <>
struct hash<nebula::Set> {
std::size_t operator()(const nebula::Set& s) const noexcept;
};

} // namespace std
#endif // COMMON_DATATYPES_SET_H_
4 changes: 2 additions & 2 deletions src/common/datatypes/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ std::size_t hash<nebula::Value>::operator()(const nebula::Value& v) const noexce
return hash<nebula::Geography>()(v.getGeography());
}
case nebula::Value::Type::MAP: {
LOG(FATAL) << "Hash for MAP has not been implemented";
return hash<nebula::Map>()(v.getMap());
}
case nebula::Value::Type::SET: {
LOG(FATAL) << "Hash for SET has not been implemented";
return hash<nebula::Set>()(v.getSet());
}
case nebula::Value::Type::DATASET: {
LOG(FATAL) << "Hash for DATASET has not been implemented";
Expand Down
Loading

0 comments on commit 9243bba

Please sign in to comment.