Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry pick v2.6.0 1015 #3107

Merged
merged 5 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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