Skip to content

Commit fb1a50c

Browse files
committed
Merge branch 'bewaremypower/fix-release-ci' into branch-4.2.0
2 parents a86cbc6 + 342ec7c commit fb1a50c

17 files changed

Lines changed: 93 additions & 24 deletions

.github/workflows/ci-build-binary-artifacts.yaml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131

3232
package-linux:
3333
name: Build ${{matrix.pkg.name}} ${{matrix.cpu.platform}}
34-
runs-on: ubuntu-22.04
34+
runs-on: ${{matrix.cpu.runner}}
3535
timeout-minutes: 500
3636

3737
strategy:
@@ -42,15 +42,20 @@ jobs:
4242
- { name: 'Deb', type: 'deb', path: 'pkg/deb/BUILD/DEB' }
4343
- { name: 'Alpine', type: 'apk', path: 'pkg/apk/build' }
4444
cpu:
45-
- { arch: 'x86_64', platform: 'x86_64' }
46-
- { arch: 'aarch64', platform: 'arm64' }
45+
- { arch: 'x86_64', platform: 'x86_64', runner: 'ubuntu-22.04' }
46+
- { arch: 'aarch64', platform: 'arm64', runner: 'ubuntu-22.04-arm' }
4747

4848
steps:
4949
- name: checkout
5050
uses: actions/checkout@v3
5151

52-
- name: Set up QEMU
53-
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a
52+
- name: Restore vcpkg binary cache
53+
uses: actions/cache@v4
54+
with:
55+
path: ~/.cache/vcpkg/archives
56+
key: vcpkg-linux-${{matrix.pkg.type}}-${{matrix.cpu.platform}}-${{hashFiles('vcpkg.json')}}
57+
restore-keys: |
58+
vcpkg-linux-${{matrix.pkg.type}}-${{matrix.cpu.platform}}-
5459
5560
- name: Package Pulsar source
5661
run: build-support/generate-source-archive.sh
@@ -65,8 +70,8 @@ jobs:
6570
tags: build:latest
6671
platforms: linux/${{matrix.cpu.platform}}
6772
build-args: PLATFORM=${{matrix.cpu.arch}}
68-
cache-from: type=gha
69-
cache-to: type=gha,mode=max
73+
cache-from: type=gha,scope=${{matrix.pkg.type}}-${{matrix.cpu.platform}}
74+
cache-to: type=gha,mode=max,scope=${{matrix.pkg.type}}-${{matrix.cpu.platform}}
7075

7176
- name: Build packages
7277
run: pkg/${{matrix.pkg.type}}/docker-build-${{matrix.pkg.type}}-${{matrix.cpu.platform}}.sh build:latest
@@ -211,6 +216,14 @@ jobs:
211216
fetch-depth: 0
212217
submodules: recursive
213218

219+
- name: Restore vcpkg binary cache
220+
uses: actions/cache@v4
221+
with:
222+
path: ~/Library/Caches/vcpkg/archives
223+
key: vcpkg-macos-${{ matrix.arch }}-${{ hashFiles('vcpkg.json') }}
224+
restore-keys: |
225+
vcpkg-macos-${{ matrix.arch }}-
226+
214227
- name: Install dependencies
215228
run: |
216229
export ARCH=${{ matrix.arch }}

build-support/download-release-artifacts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
for artifact in data['artifacts']:
4848
name = artifact['name']
4949
# Skip debug artifact
50-
if name.endswith("-Debug"):
50+
if name.endswith("-Debug") or name.find("dockerbuild") >= 0:
5151
continue
5252
dest_dir = os.path.join(dest_path, name)
5353
if name.find("windows") >= 0 and os.path.exists(dest_dir + ".tar.gz"):

include/pulsar/Message.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,14 @@ class PULSAR_PUBLIC Message {
220220
*/
221221
const std::string& getProducerName() const noexcept;
222222

223+
/**
224+
* Get the source cluster from which the message was replicated.
225+
*
226+
* @return the optional pointer to the source cluster name if the message was replicated, the pointer is
227+
* valid as the Message instance is alive
228+
*/
229+
std::optional<const std::string*> getReplicatedFrom() const;
230+
223231
/**
224232
* @return the optional encryption context that is present when the message is encrypted, the pointer is
225233
* valid as the Message instance is alive

include/pulsar/c/message.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,15 @@ PULSAR_PUBLIC void pulsar_message_set_schema_version(pulsar_message_t *message,
230230
*/
231231
PULSAR_PUBLIC const char *pulsar_message_get_producer_name(pulsar_message_t *message);
232232

233+
/**
234+
* Get the source cluster from which the message was replicated.
235+
*
236+
* The pointer points to internal storage owned by the message wrapper, so the caller should not free it.
237+
*
238+
* @return the source cluster name, or NULL if the message is not replicated
239+
*/
240+
PULSAR_PUBLIC const char *pulsar_message_get_replicated_from(pulsar_message_t *message);
241+
233242
/**
234243
* Check if the message has a null value.
235244
*

lib/ConsumerImpl.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,14 +1117,6 @@ Result ConsumerImpl::receiveHelper(Message& msg, int timeout) {
11171117
if (state_ != Ready) {
11181118
return ResultAlreadyClosed;
11191119
}
1120-
auto cnx = getCnx().lock();
1121-
if (cnx) {
1122-
LOG_WARN(getName() << " Receive timeout after " << timeout << " ms, connection: "
1123-
<< cnx->cnxString() << ", queue size: " << incomingMessages_.size());
1124-
} else {
1125-
LOG_WARN(getName() << " Receive timeout after " << timeout
1126-
<< " ms, no connection, queue size: " << incomingMessages_.size());
1127-
}
11281120
return ResultTimeout;
11291121
}
11301122
}

lib/Message.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,13 @@ const std::string& Message::getProducerName() const noexcept {
239239
return impl_->metadata.producer_name();
240240
}
241241

242+
std::optional<const std::string*> Message::getReplicatedFrom() const {
243+
if (!impl_ || !impl_->metadata.has_replicated_from()) {
244+
return std::nullopt;
245+
}
246+
return &impl_->metadata.replicated_from();
247+
}
248+
242249
std::optional<const EncryptionContext*> Message::getEncryptionContext() const {
243250
if (!impl_ || !impl_->encryptionContext_.has_value()) {
244251
return std::nullopt;

lib/MultiTopicsConsumerImpl.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -603,14 +603,6 @@ Result MultiTopicsConsumerImpl::receive(Message& msg, int timeout) {
603603
if (state_ != Ready) {
604604
return ResultAlreadyClosed;
605605
}
606-
auto cnx = getCnx().lock();
607-
if (cnx) {
608-
LOG_WARN(getName() << " Receive timeout after " << timeout << " ms, connection: "
609-
<< cnx->cnxString() << ", queue size: " << incomingMessages_.size());
610-
} else {
611-
LOG_WARN(getName() << " Receive timeout after " << timeout
612-
<< " ms, no connection, queue size: " << incomingMessages_.size());
613-
}
614606
return ResultTimeout;
615607
}
616608
}

lib/ProducerImpl.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,9 @@ void ProducerImpl::handleSendTimeout(const ASIO_ERROR& err) {
873873
}
874874

875875
lock.unlock();
876+
if (pendingMessages.empty()) {
877+
return;
878+
}
876879
auto cnx = getCnx().lock();
877880
if (cnx) {
878881
LOG_WARN(getName() << "Send timeout due to queueing delay, connection: " << cnx->cnxString()

lib/c/c_Message.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,9 @@ const char *pulsar_message_get_producer_name(pulsar_message_t *message) {
151151
return message->message.getProducerName().c_str();
152152
}
153153

154+
const char *pulsar_message_get_replicated_from(pulsar_message_t *message) {
155+
const auto replicatedFrom = message->message.getReplicatedFrom();
156+
return replicatedFrom ? replicatedFrom.value()->c_str() : nullptr;
157+
}
158+
154159
int pulsar_message_has_null_value(pulsar_message_t *message) { return message->message.hasNullValue(); }

pkg/apk/docker-build-apk-arm64.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ ROOT_DIR=$(git rev-parse --show-toplevel)
2424

2525
IMAGE_NAME=${1:-apachepulsar/pulsar-build:alpine-3.16-arm64}
2626

27+
mkdir -p $HOME/.cache/vcpkg/archives
2728
docker run -v $ROOT_DIR:/pulsar-client-cpp \
29+
-v $HOME/.cache/vcpkg/archives:/root/.cache/vcpkg/archives \
2830
--env PLATFORM=aarch64 \
2931
$IMAGE_NAME \
3032
/pulsar-client-cpp/pkg/apk/build-apk.sh

0 commit comments

Comments
 (0)