Skip to content

Commit aabe86e

Browse files
committed
st: fix CI - static-lib object-name collision and missing Transaction defs
Two platform-build failures on this PR, both from Phase 0, both invisible to the in-tree build and the Linux shared-lib link: macOS-static / Alpine: the static "withdeps" archive is assembled by build-support/merge_archives.sh, which extracts every input archive with `ar -x` into one flat directory. Merging ST_OBJECT_LIB into libpulsar.a gave it two members named ClientImpl.cc.o (lib/ClientImpl.cc and lib/st/ClientImpl.cc) and two MessageId.cc.o, so `ar -x` overwrote the classic objects and libpulsarwithdeps.a lost pulsar::ClientImpl::* and pulsar::MessageId::* - the example link then failed. Rename the two colliding st sources to StClientImpl.cc / StMessageId.cc (and the header to StClientImpl.h) so no two objects in the archive share a basename. The classes are unchanged; the source GLOB picks the new names up. Windows: pulsar::st::Transaction::commitAsync()/abortAsync()/state() were declared and used by the inline commit()/abort() but defined nowhere. Transaction is PULSAR_PUBLIC (dllexport), so MSVC emits those inline members and the DLL link needs the out-of-line async defs - a hard error on Windows, silently tolerated by the mac/Linux .so. Add lib/st/Transaction.cc with not-implemented-yet stubs (fail with ResultOperationNotSupported), matching the existing stub pattern; the real implementation lands in the transaction phase. Verified on macOS arm64: libpulsar.a has no duplicate members, the real merge_archives + static example link succeeds, the Transaction symbols resolve, clang-tidy and clang-format-11 are clean, st tests pass.
1 parent ada08fc commit aabe86e

6 files changed

Lines changed: 49 additions & 3 deletions

File tree

lib/st/ClientCore.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#include <utility>
2222

23-
#include "ClientImpl.h"
23+
#include "StClientImpl.h"
2424

2525
namespace pulsar::st::detail {
2626

lib/st/PulsarClientBuilder.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <string>
2525
#include <utility>
2626

27-
#include "ClientImpl.h"
27+
#include "StClientImpl.h"
2828

2929
namespace pulsar::st {
3030

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
#include "ClientImpl.h"
19+
#include "StClientImpl.h"
2020

2121
#include <string>
2222
#include <utility>

lib/st/Transaction.cc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
#include <pulsar/st/Transaction.h>
20+
21+
namespace pulsar::st {
22+
23+
namespace {
24+
25+
// Transactions are not implemented yet in the scalable-topics client. These
26+
// out-of-line members still need definitions: Transaction is an exported
27+
// (PULSAR_PUBLIC) class, so its inline commit()/abort() — which call the async
28+
// variants — are emitted and must link. They become real in the transaction
29+
// phase. Until then no live Transaction is handed out (newTransaction fails with
30+
// ResultOperationNotSupported), so none of these run at runtime.
31+
Future<void> notImplementedYet() {
32+
detail::Promise<void> promise;
33+
promise.setError(Error{ResultOperationNotSupported,
34+
"transactions are not implemented yet in the scalable-topics client"});
35+
return promise.getFuture();
36+
}
37+
38+
} // namespace
39+
40+
TransactionState Transaction::state() const { return TransactionState::Error; }
41+
42+
Future<void> Transaction::commitAsync() const { return notImplementedYet(); }
43+
44+
Future<void> Transaction::abortAsync() const { return notImplementedYet(); }
45+
46+
} // namespace pulsar::st

0 commit comments

Comments
 (0)