Skip to content

Commit cb02ae4

Browse files
authored
Merge branch 'apache:main' into fix-531-batch-last-sequence-id
2 parents 8c9ce21 + 0c6a7c0 commit cb02ae4

5 files changed

Lines changed: 37 additions & 19 deletions

File tree

.github/workflows/ci-pr-validation.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ jobs:
9292

9393
- name: Restore vcpkg installed cache
9494
uses: actions/cache@v4
95+
id: vcpkg-cache
96+
if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
9597
with:
9698
path: build/vcpkg_installed
97-
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
99+
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
98100
restore-keys: vcpkg-${{ runner.os }}-
99101

100102
- name: Build the project
@@ -126,11 +128,13 @@ jobs:
126128

127129
- name: Restore vcpkg installed cache
128130
uses: actions/cache@v4
131+
id: vcpkg-cache
132+
if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
129133
with:
130134
path: |
131135
build/vcpkg_installed
132136
build-boost-asio/vcpkg_installed
133-
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
137+
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
134138
restore-keys: vcpkg-${{ runner.os }}-
135139

136140
- name: Build core libraries
@@ -168,11 +172,6 @@ jobs:
168172
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DBUILD_PERF_TOOLS=ON
169173
cmake --build build -j8
170174
171-
- name: Verify custom vcpkg installation
172-
run: |
173-
mv vcpkg /tmp/vcpkg-custom
174-
cmake -B build-2 -DINTEGRATE_VCPKG=ON -DCMAKE_TOOLCHAIN_FILE="/tmp/vcpkg-custom/scripts/buildsystems/vcpkg.cmake"
175-
176175
cpp20-build:
177176
name: Build with the C++20 standard
178177
needs: lint
@@ -229,7 +228,7 @@ jobs:
229228
- name: Restore vcpkg and its artifacts.
230229
uses: actions/cache@v4
231230
id: vcpkg-cache
232-
continue-on-error: true
231+
if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
233232
with:
234233
path: |
235234
${{ github.workspace }}/vcpkg_installed
@@ -238,7 +237,6 @@ jobs:
238237
key: ${{ runner.os }}-${{ matrix.triplet }}-vcpkg-${{ hashFiles('vcpkg.json') }}
239238
restore-keys: |
240239
${{ runner.os }}-${{ matrix.triplet }}-vcpkg-
241-
save-always: true
242240
243241
- name: Get vcpkg(windows)
244242
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
@@ -387,9 +385,11 @@ jobs:
387385

388386
- name: Restore vcpkg installed cache
389387
uses: actions/cache@v4
388+
id: vcpkg-cache
389+
if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
390390
with:
391391
path: build-osx/vcpkg_installed
392-
key: vcpkg-${{ runner.os }}-arm64-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
392+
key: vcpkg-${{ runner.os }}-arm64-${{ hashFiles('vcpkg.json') }}
393393
restore-keys: vcpkg-${{ runner.os }}-arm64-
394394

395395
- name: Build libraries

build-support/run_clang_tidy.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ SCRIPT=$(which run-clang-tidy)
3434
set +e
3535
nproc
3636
if [[ $? == 0 ]]; then
37-
python3 $SCRIPT -p build -j$(nproc) $(cat files.txt)
37+
NUM_THREADS=$(nproc)
3838
else
39-
python3 $SCRIPT -p build -j8 $(cat files.txt)
39+
NUM_THREADS=8
4040
fi
41+
set -e
42+
python3 $SCRIPT -p build -j$NUM_THREADS $(cat files.txt)
4143
rm -f files.txt

lib/ClientConnection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ void ClientConnection::tcpConnectAsync() {
597597

598598
auto weakSelf = weak_from_this();
599599
resolver_->async_resolve(service_url.host(), std::to_string(service_url.port()),
600-
[weakSelf](const ASIO_ERROR& err, tcp::resolver::results_type results) {
600+
[weakSelf](auto err, const auto& results) {
601601
auto self = weakSelf.lock();
602602
if (self) {
603603
self->handleResolve(err, results);

tests/ReaderTest.cc

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@
2121
#include <pulsar/Reader.h>
2222
#include <time.h>
2323

24+
#include <atomic>
25+
#include <functional>
2426
#include <future>
27+
#include <set>
2528
#include <string>
2629
#include <thread>
30+
#include <vector>
2731

2832
#include "HttpHelper.h"
2933
#include "PulsarFriend.h"
@@ -110,15 +114,27 @@ TEST_P(ReaderTest, testAsyncRead) {
110114
ASSERT_EQ(ResultOk, producer.send(msg));
111115
}
112116

117+
// readNextAsync callbacks may complete in any order (e.g. with partitioned topic); collect all 10 then
118+
// verify set
119+
std::string received[10];
120+
std::atomic<int> receivedCount{0};
113121
for (int i = 0; i < 10; i++) {
114-
reader.readNextAsync([i](Result result, const Message& msg) {
122+
reader.readNextAsync([&](Result result, const Message& msg) {
115123
ASSERT_EQ(ResultOk, result);
116-
std::string content = msg.getDataAsString();
117-
std::string expected = "my-message-" + std::to_string(i);
118-
ASSERT_EQ(expected, content);
124+
int idx = receivedCount.fetch_add(1);
125+
if (idx < 10) received[idx] = msg.getDataAsString();
119126
});
120127
}
121128

129+
waitUntil(
130+
std::chrono::seconds(5), [&]() { return receivedCount.load() == 10; }, 1000);
131+
ASSERT_EQ(10, receivedCount.load()) << "Expected 10 messages";
132+
133+
std::set<std::string> receivedSet(received, received + 10);
134+
for (int i = 0; i < 10; i++) {
135+
ASSERT_TRUE(receivedSet.count("my-message-" + std::to_string(i))) << "Missing my-message-" << i;
136+
}
137+
122138
waitUntil(
123139
std::chrono::seconds(5),
124140
[&]() {

tests/TlsNegotiationTest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ TEST(TlsNegotiationTest, testTls12) {
135135
// It will fail to create producer because mock server doesn't speak Pulsar,
136136
// but we only care about the handshake.
137137
Producer producer;
138-
client.createProducerAsync("topic", [](Result, Producer) {});
138+
client.createProducerAsync("topic", [](auto, const auto&) {});
139139

140140
// Wait for handshake
141141
ASSERT_TRUE(handshakeFuture.get());
@@ -170,7 +170,7 @@ TEST(TlsNegotiationTest, testTls13) {
170170

171171
Client client(serviceUrl, config);
172172

173-
client.createProducerAsync("topic", [](Result, Producer) {});
173+
client.createProducerAsync("topic", [](auto, const auto&) {});
174174

175175
ASSERT_TRUE(handshakeFuture.get());
176176

0 commit comments

Comments
 (0)