Skip to content

Commit

Permalink
affinity set smoke test passed.
Browse files Browse the repository at this point in the history
+fix hyperscan library with -fPIC; C++ client feature.
  • Loading branch information
songweijia committed Jan 18, 2023
1 parent df27424 commit 626003f
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ target_link_libraries(cascade
derecho
spdlog::spdlog
${mutils_LIBRARIES}
OpenSSL::Crypto)
OpenSSL::Crypto
hs)
set_target_properties(cascade PROPERTIES
SOVERSION ${cascade_VERSION}
VERSION ${cascade_build_VERSION}
Expand Down
2 changes: 1 addition & 1 deletion include/cascade/detail/debug_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void make_workload(uint32_t payload_size, const KT& key_prefix, std::vector<VT>&
#endif // ENABLE_EVALUATION

template <typename KeyType>
std::string get_pathname(const std::enable_if_t<std::is_convertible<KeyType, std::string>::value, std::string>& key) {
std::string get_pathname(const std::enable_if_t<std::is_convertible<KeyType, std::string>::value, KeyType>& key) {
const std::string* pstr = dynamic_cast<const std::string*>(&key);
size_t pos = pstr->rfind(PATH_SEPARATOR);
if(pos != std::string::npos) {
Expand Down
4 changes: 2 additions & 2 deletions include/cascade/detail/service_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ template <typename... CascadeTypes>
ServiceClient<CascadeTypes...>::ObjectPoolMetadataCacheEntry::~ObjectPoolMetadataCacheEntry() {
if (this->database != nullptr) {
hs_free_database(database);
this->database == nullptr;
this->database = nullptr;
}
}

Expand Down Expand Up @@ -1835,7 +1835,7 @@ template <typename... CascadeTypes>
template <typename KeyType>
std::pair<ObjectPoolMetadata<CascadeTypes...>,std::string> ServiceClient<CascadeTypes...>::find_object_pool_and_affinity_set_by_key(
const KeyType& key) {
std::string object_pool_pathname = get_pathname(key);
std::string object_pool_pathname = get_pathname<KeyType>(key);
if (object_pool_pathname.empty()) {
throw derecho::derecho_exception(std::string("Key:") + key + " does not belong to any object pool.");
}
Expand Down
1 change: 1 addition & 0 deletions include/cascade/object_pool_metadata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ inline std::ostream& operator<<(std::ostream& out, const ObjectPoolMetadata<Casc
"\tsubgroup_index:" << std::to_string(opm.subgroup_index) << "\n" <<
"\tsharding_policy:" << std::to_string(opm.sharding_policy) <<"\n" <<
"\tobject_locations:[hidden]" << "\n" <<
"\taffinity_set_regex:" << opm.affinity_set_regex << "\n" <<
"\tis_deleted:" << std::to_string(opm.deleted) <<
std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/prerequisites/install-hyperscan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ echo "Using INSTALL_PREFIX=${INSTALL_PREFIX}"
cd ${WORKPATH}
git clone https://github.com/songweijia/hyperscan.git
cd hyperscan
git checkout 837992d79c49bc9bce04b19acc3d1275d96b5fd5
git checkout 5a95f964c99d09420166933936d4476c990e25e8
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} ..
Expand Down
18 changes: 14 additions & 4 deletions src/service/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,14 @@ void op_put_file_and_forget(ServiceClientAPI& capi, const std::string& key, cons
}

template <typename SubgroupType>
void create_object_pool(ServiceClientAPI& capi, const std::string& id, uint32_t subgroup_index) {
auto result = capi.template create_object_pool<SubgroupType>(id,subgroup_index);
void create_object_pool(ServiceClientAPI& capi, const std::string& id, uint32_t subgroup_index,
const std::string& affinity_set_regex) {
auto result = capi.template create_object_pool<SubgroupType>(
id,
subgroup_index,
sharding_policy_type::HASH,
{},
affinity_set_regex);
check_put_and_remove_result(result);
std::cout << "create_object_pool is done." << std::endl;
}
Expand Down Expand Up @@ -912,13 +918,17 @@ std::vector<command_entry_t> commands =
{
"create_object_pool",
"Create an object pool",
"create_object_pool <path> <type> <subgroup_index>\n"
"create_object_pool <path> <type> <subgroup_index> [affinity_set_regex]\n"
"type := " SUBGROUP_TYPE_LIST,
[](ServiceClientAPI& capi, const std::vector<std::string>& cmd_tokens) {
CHECK_FORMAT(cmd_tokens,4);
std::string opath = cmd_tokens[1];
uint32_t subgroup_index = static_cast<uint32_t>(std::stoi(cmd_tokens[3],nullptr,0));
on_subgroup_type(cmd_tokens[2],create_object_pool,capi,opath,subgroup_index);
std::string affinity_set_regex;
if (cmd_tokens.size() >= 5) {
affinity_set_regex = cmd_tokens[4];
}
on_subgroup_type(cmd_tokens[2],create_object_pool,capi,opath,subgroup_index,affinity_set_regex);
return true;
}
},
Expand Down

0 comments on commit 626003f

Please sign in to comment.