Skip to content
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
4 changes: 3 additions & 1 deletion .github/workflows/ci-pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
sudo apt-get install -y libcurl4-openssl-dev libssl-dev \
protobuf-compiler libprotobuf-dev libboost-dev \
libboost-dev libboost-program-options-dev \
libzstd-dev libsnappy-dev libgmock-dev libgtest-dev libroaring-dev
libzstd-dev libsnappy-dev libgmock-dev libgtest-dev
- name: CMake
run: cmake -B build -DBUILD_PERF_TOOLS=ON -DCMAKE_CXX_STANDARD=20
- name: Build
Expand Down Expand Up @@ -341,6 +341,8 @@ jobs:
- name: Build packages
run: pkg/${{matrix.pkg.type}}/docker-build-${{matrix.pkg.type}}-${{matrix.cpu.platform}}.sh build:latest

# TODO: verify the pre-built package works without linking issue

cpp-build-macos:
timeout-minutes: 120
name: Build CPP Client on macOS with static dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
sudo apt-get install -y libcurl4-openssl-dev libssl-dev \
protobuf-compiler libprotobuf-dev libboost-dev \
libboost-dev libboost-program-options-dev \
libzstd-dev libsnappy-dev libroaring-dev
libzstd-dev libsnappy-dev

- name: Build
run: |
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,13 @@ if (INTEGRATE_VCPKG)
find_package(protobuf CONFIG REQUIRED)
find_package(zstd CONFIG REQUIRED)
find_package(Snappy CONFIG REQUIRED)
find_package(roaring CONFIG REQUIRED)
set(COMMON_LIBS CURL::libcurl
ZLIB::ZLIB
OpenSSL::SSL
OpenSSL::Crypto
protobuf::libprotobuf
$<IF:$<TARGET_EXISTS:zstd::libzstd_shared>,zstd::libzstd_shared,zstd::libzstd_static>
Snappy::snappy
roaring::roaring
)
if (USE_ASIO)
find_package(asio CONFIG REQUIRED)
Expand Down
22 changes: 0 additions & 22 deletions LegacyFindPackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,6 @@ if (NOT ZLIB_INCLUDE_DIRS OR NOT ZLIB_LIBRARIES)
message(FATAL_ERROR "Could not find zlib")
endif ()

find_package(roaring QUIET)
if (NOT ROARING_FOUND)
find_path(ROARING_INCLUDE_DIRS NAMES roaring/roaring.hh)
find_library(ROARING_LIBRARIES NAMES roaring libroaring)
endif ()
message("ROARING_INCLUDE_DIRS: " ${ROARING_INCLUDE_DIRS})
message("ROARING_LIBRARIES: " ${ROARING_LIBRARIES})
if (NOT ROARING_INCLUDE_DIRS OR NOT ROARING_LIBRARIES)
message(FATAL_ERROR "Could not find libroaring")
endif ()
file(READ "${ROARING_INCLUDE_DIRS}/roaring/roaring.hh" ROARING_HEADER_CONTENTS)
string(REGEX MATCH "namespace roaring" ROARING_HAS_NAMESPACE "${ROARING_HEADER_CONTENTS}")
if (ROARING_HAS_NAMESPACE)
message(STATUS "Roaring64Map is in namespace roaring")
else ()
message(STATUS "Roaring64Map is in global namespace")
add_definitions(-DROARING_NAMESPACE_GLOBAL)
endif ()

if (LINK_STATIC AND NOT VCPKG_TRIPLET)
find_library(LIB_ZSTD NAMES libzstd.a)
message(STATUS "ZStd: ${LIB_ZSTD}")
Expand All @@ -148,7 +129,6 @@ if (LINK_STATIC AND NOT VCPKG_TRIPLET)
elseif (LINK_STATIC AND VCPKG_TRIPLET)
find_package(Protobuf REQUIRED)
message(STATUS "Found protobuf static library: " ${Protobuf_LIBRARIES})
find_package(roaring REQUIRED)
if (MSVC AND (${CMAKE_BUILD_TYPE} STREQUAL Debug))
find_library(ZLIB_LIBRARIES NAMES zlibd)
else ()
Expand Down Expand Up @@ -251,7 +231,6 @@ include_directories(
${Boost_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
${ROARING_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
${Protobuf_INCLUDE_DIRS}
${GTEST_INCLUDE_PATH}
Expand All @@ -267,7 +246,6 @@ set(COMMON_LIBS
${CURL_LIBRARIES}
${OPENSSL_LIBRARIES}
${ZLIB_LIBRARIES}
${ROARING_LIBRARIES}
${ADDITIONAL_LIBRARIES}
${CMAKE_DL_LIBS}
)
Expand Down
2 changes: 1 addition & 1 deletion lib/NegativeAcksTracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void NegativeAcksTracker::add(const MessageId &m) {
auto trimmedTimestamp = trimLowerBit(now + nackDelay_, nackPrecisionBit_);
// If the timestamp is already in the map, we can just add the message to the existing entry
// Erase batch id to group all nacks from same batch
nackedMessages_[trimmedTimestamp][msgId.ledgerId()].add((uint64_t)msgId.entryId());
nackedMessages_[trimmedTimestamp][msgId.ledgerId()].insert(msgId.entryId());
}

scheduleTimer();
Expand Down
9 changes: 2 additions & 7 deletions lib/NegativeAcksTracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <map>
#include <memory>
#include <mutex>
#include <roaring/roaring64map.hh>
#include <unordered_map>
#include <unordered_set>

#include "AsioDefines.h"
#include "AsioTimer.h"
Expand All @@ -42,11 +42,6 @@ using ClientImplPtr = std::shared_ptr<ClientImpl>;
class ExecutorService;
using ExecutorServicePtr = std::shared_ptr<ExecutorService>;
using LedgerId = int64_t;
#ifdef ROARING_NAMESPACE_GLOBAL
using ConditionalRoaringMap = Roaring64Map;
#else
using ConditionalRoaringMap = roaring::Roaring64Map;
#endif

class NegativeAcksTracker : public std::enable_shared_from_this<NegativeAcksTracker> {
public:
Expand Down Expand Up @@ -74,7 +69,7 @@ class NegativeAcksTracker : public std::enable_shared_from_this<NegativeAcksTrac
std::chrono::milliseconds timerInterval_;
int nackPrecisionBit_;
typedef typename std::chrono::steady_clock Clock;
std::map<Clock::time_point, std::unordered_map<LedgerId, ConditionalRoaringMap>> nackedMessages_;
std::map<Clock::time_point, std::unordered_map<LedgerId, std::unordered_set<int64_t>>> nackedMessages_;

const DeadlineTimerPtr timer_;
std::atomic_bool closed_{false};
Expand Down
2 changes: 1 addition & 1 deletion pkg/mac/build-static-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ cp ./build-osx/libpulsarwithdeps.a $INSTALL_DIR/lib/
# Test the libraries
clang++ win-examples/example.cc -o dynamic.out -std=c++11 -arch $ARCH -I $INSTALL_DIR/include -L $INSTALL_DIR/lib -Wl,-rpath $INSTALL_DIR/lib -lpulsar
./dynamic.out
clang++ win-examples/example.cc -o static.out -std=c++11 -arch $ARCH -I $INSTALL_DIR/include $INSTALL_DIR/lib/libpulsarwithdeps.a $PWD/build-osx/vcpkg_installed/$VCPKG_TRIPLET/lib/libroaring.a
clang++ win-examples/example.cc -o static.out -std=c++11 -arch $ARCH -I $INSTALL_DIR/include $INSTALL_DIR/lib/libpulsarwithdeps.a
./static.out
4 changes: 0 additions & 4 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@
"name": "protobuf",
"version>=": "3.21.12"
},
{
"name": "roaring",
"version>=": "4.3.1"
},
{
"name": "snappy",
"version>=": "1.1.10"
Expand Down