Skip to content

Commit

Permalink
Merge branch 'main' into add-depends-on
Browse files Browse the repository at this point in the history
  • Loading branch information
pts95 authored Oct 31, 2024
2 parents d500aaa + 844ba5c commit cd9b7dd
Show file tree
Hide file tree
Showing 103 changed files with 5,037 additions and 3,336 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@ jobs:
--reruns=3 \
-n 4 -v
- name: Upload failure-logs as artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: failure_logs_${{ matrix.mode }}_${{ matrix.cluster }}
path: ${{ github.workspace }}/src/integration-tests/failure-logs
retention-days: 5

fuzz_tests_ubuntu:
name: Fuzz test [${{ matrix.request }}]
strategy:
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Generate documentation

on:
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
documentation-main:
name: Build Doxygen documentation on `main`

runs-on: ubuntu-latest

permissions:
# Let the default GITHUB_TOKEN commit and push.
contents: write

steps:
- name: Checkout `main`
uses: actions/checkout@v4

- name: Clear out `docs/` subdirectory
run: rm -rf docs

- name: Checkout `gh-pages` into `docs/`
uses: actions/checkout@v4
with:
path: docs
ref: gh-pages

- name: Set up dependencies
run: |
sudo apt-get update
sudo apt-get install -qy doxygen
- name: Build documentation
# Best way to pass Doxygen config overrides on the command line is
# using stdin.
run: |
( cat Doxyfile ; echo "PROJECT_NUMBER=${{ github.sha }}" ) | doxygen -
- name: Commit new API documentation to `gh-pages`
run: |
cd docs/
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git add docs/apidocs/cpp_apidocs/ && git commit -s -am "Update C++ API docs from commit ${{ github.sha }} on main" && git push || true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ settings.json
.cache/
.venv/

# fuzz-test output folder
**/boofuzz-results

# Symlink from 'src/applications/bmqbrkr/run'
src/applications/bmqbrkr/etc/etc

Expand Down
2 changes: 1 addition & 1 deletion src/groups/bmq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ set(BMQ_PRIVATE_PACKAGES
bmqst
bmqstm
bmqsys
bmqt
bmqtsk
bmqtst
bmqu
bmqvt
)
target_bmq_style_uor( bmq PRIVATE_PACKAGES ${BMQ_PRIVATE_PACKAGES} )

Expand Down
4 changes: 2 additions & 2 deletions src/groups/bmq/bmqa/bmqa_messageeventbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
/// // Session start up logic omitted for brevity.
///
/// // Obtain a valid instance of message properties.
/// bmqt::MessageProperties properties;
/// bmqa::MessageProperties properties;
/// session.loadMessageProperties(&properties);
///
/// // Set common properties that will be applicable to all messages sent by
Expand Down Expand Up @@ -160,7 +160,7 @@
/// // Session start up logic omitted for brevity.
///
/// // Obtain a valid instance of message properties.
/// bmqt::MessageProperties properties;
/// bmqa::MessageProperties properties;
/// session.loadMessageProperties(&properties);
///
/// // Set common properties that will be applicable to all messages sent by
Expand Down
13 changes: 8 additions & 5 deletions src/groups/bmq/bmqa/bmqa_mocksession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <bmqp_protocol.h>
#include <bmqp_protocolutil.h>
#include <bmqp_pusheventbuilder.h>
#include <bmqst_statcontext.h>
#include <bmqsys_time.h>
#include <bmqt_messageguid.h>
#include <bmqt_uri.h>
Expand Down Expand Up @@ -742,7 +743,7 @@ void MockSession::initializeStats()
start.setLevel(0).setIndex(0);
end.setLevel(0).setIndex(1);
bmqimp::QueueStatsUtil::initializeStats(d_queuesStats_sp.get(),
&d_rootStatContext,
d_rootStatContext_mp.get(),
start,
end,
d_allocator_p);
Expand Down Expand Up @@ -961,8 +962,9 @@ MockSession::MockSession(const bmqt::SessionOptions& options,
bslma::Default::allocator(allocator)),
bslma::Default::allocator(allocator))
, d_postedEvents(bslma::Default::allocator(allocator))
, d_rootStatContext(bmqst::StatContextConfiguration("MockSession", allocator),
allocator)
, d_rootStatContext_mp(bslma::ManagedPtrUtil::makeManaged<bmqst::StatContext>(
bmqst::StatContextConfiguration("MockSession", allocator),
allocator))
, d_queuesStats_sp(new(*bslma::Default::allocator(allocator))
bmqimp::Stat(bslma::Default::allocator(allocator)),
bslma::Default::allocator(allocator))
Expand Down Expand Up @@ -1004,8 +1006,9 @@ MockSession::MockSession(bslma::ManagedPtr<SessionEventHandler> eventHandler,
bslma::Default::allocator(allocator)),
bslma::Default::allocator(allocator))
, d_postedEvents(bslma::Default::allocator(allocator))
, d_rootStatContext(bmqst::StatContextConfiguration("MockSession", allocator),
allocator)
, d_rootStatContext_mp(bslma::ManagedPtrUtil::makeManaged<bmqst::StatContext>(
bmqst::StatContextConfiguration("MockSession", allocator),
allocator))
, d_queuesStats_sp(new(*bslma::Default::allocator(allocator))
bmqimp::Stat(bslma::Default::allocator(allocator)),
bslma::Default::allocator(allocator))
Expand Down
8 changes: 5 additions & 3 deletions src/groups/bmq/bmqa/bmqa_mocksession.h
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
/// `emitting` on the @ref BMQA_EXPECT_CALL macro in synchronous mode is
/// meaningless.
///
///```
/// ```
/// void unitTest()
/// {
/// // MockSession created without an eventHandler.
Expand Down Expand Up @@ -548,7 +548,6 @@
#include <bmqa_openqueuestatus.h>
#include <bmqa_queueid.h>
#include <bmqa_session.h> // for 'bmqa::SessionEventHandler'
#include <bmqst_statcontext.h>
#include <bmqt_queueoptions.h>
#include <bmqt_sessionoptions.h>

Expand Down Expand Up @@ -586,6 +585,9 @@ class MessageCorrelationIdContainer;
namespace bmqimp {
struct Stat;
}
namespace bmqst {
class StatContext;
}

namespace bmqa {

Expand Down Expand Up @@ -1040,7 +1042,7 @@ class MockSession : public AbstractSession {
mutable bslmt::Mutex d_mutex;

/// Top level stat context for this mocked Session.
bmqst::StatContext d_rootStatContext;
bslma::ManagedPtr<bmqst::StatContext> d_rootStatContext_mp;

/// Stats for all queues
StatImplSp d_queuesStats_sp;
Expand Down
42 changes: 25 additions & 17 deletions src/groups/bmq/bmqp/bmqp_puteventbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,31 @@ bool isWordAligned(const bdlbb::Blob& blob)
#endif
} // close unnamed namespace

// ---------------------------------
// class PutEventBuilder::ResetGuard
// ---------------------------------

inline PutEventBuilder::ResetGuard::ResetGuard(
PutEventBuilder& putEventBuilder)
: d_putEventBuilder(putEventBuilder)
{
// NOTHING
}

inline PutEventBuilder::ResetGuard::~ResetGuard()
{
d_putEventBuilder.resetFields();
}

// ---------------------
// class PutEventBuilder
// ---------------------

void PutEventBuilder::resetFields(void* ptr)
void PutEventBuilder::resetFields()
{
PutEventBuilder* builder = static_cast<PutEventBuilder*>(ptr);
builder->d_flags = 0;
builder->d_messageGUID = bmqt::MessageGUID();
builder->d_crc32c = 0;
d_flags = 0;
d_messageGUID = bmqt::MessageGUID();
d_crc32c = 0;
}

bmqt::EventBuilderResult::Enum
Expand Down Expand Up @@ -219,9 +234,7 @@ PutEventBuilder::packMessageInOldStyle(int queueId)

// Guid and flags need to be reset after this method (irrespective of its
// success or failure). Create a proctor to auto reset them.
const bsl::function<void()> f =
bdlf::BindUtil::bind(&PutEventBuilder::resetFields, this);
bdlb::ScopeExitAny resetter(f);
const ResetGuard guard(*this);

// Calculate length of entire application data (includes payload, message
// properties and padding, if any).
Expand Down Expand Up @@ -304,12 +317,9 @@ bmqt::EventBuilderResult::Enum PutEventBuilder::packMessage(int queueId)

typedef bmqt::EventBuilderResult Result;

// CorrelationId, guid and flags need to be reset after this method
// (irrespective of its success or failure). Create a proctor to auto
// reset them.
const bsl::function<void()> f =
bdlf::BindUtil::bind(&PutEventBuilder::resetFields, this);
bdlb::ScopeExitAny resetter(f);
// Guid and flags need to be reset after this method (irrespective of its
// success or failure). Create a proctor to auto reset them.
const ResetGuard guard(*this);

// Calculate length of entire application data (includes payload, message
// properties and padding, if any).
Expand Down Expand Up @@ -398,9 +408,7 @@ bmqt::EventBuilderResult::Enum PutEventBuilder::packMessageRaw(int queueId)

// Guid and flags need to be reset after this method (irrespective of its
// success or failure). Create a proctor to auto reset them.
const bsl::function<void()> f =
bdlf::BindUtil::bind(&PutEventBuilder::resetFields, this);
bdlb::ScopeExitAny resetter(f);
const ResetGuard guard(*this);

// Note that the 'd_blobPayload_p' has the entire application data.
return packMessageInternal(*d_blobPayload_p, queueId);
Expand Down
22 changes: 15 additions & 7 deletions src/groups/bmq/bmqp/bmqp_puteventbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
//

// BMQ

#include <bmqp_messageproperties.h>
#include <bmqp_protocol.h>
#include <bmqt_compressionalgorithmtype.h>
Expand Down Expand Up @@ -92,6 +91,18 @@ class PutEventBuilder {
typedef bdlb::NullableValue<bmqp::Protocol::MsgGroupId> NullableMsgGroupId;

private:
// TYPES
/// Mechanism to automatically reset PutEventBuilder on a built message
struct ResetGuard {
// DATA
PutEventBuilder& d_putEventBuilder;

// CREATORS
explicit ResetGuard(PutEventBuilder& putEventBuilder);

~ResetGuard();
};

// DATA
bdlbb::BlobBufferFactory* d_bufferFactory_p;

Expand Down Expand Up @@ -169,13 +180,10 @@ class PutEventBuilder {
PutEventBuilder& operator=(const PutEventBuilder&) BSLS_CPP11_DELETED;

private:
// CLASS LEVEL METHODS

/// Reset flags and message guid of PutEventBuilder instance pointed by
/// the specified `ptr`.
static void resetFields(void* ptr);

// PRIVATE MANIPULATORS
/// Reset flags and message guid of this object.
void resetFields();

bmqt::EventBuilderResult::Enum
packMessageInternal(const bdlbb::Blob& appData, int queueId);

Expand Down
2 changes: 2 additions & 0 deletions src/groups/mqb/mqba/mqba_adminsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ void AdminSession::finalizeAdminCommand(

response.choice().adminCommandResponse().text() = commandExecResults;

BALL_LOG_INFO << description() << ": Send response message: " << response;

int rc = d_state.d_schemaEventBuilder.setMessage(
response,
bmqp::EventType::e_CONTROL);
Expand Down
49 changes: 21 additions & 28 deletions src/groups/mqb/mqbblp/mqbblp_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2209,27 +2209,16 @@ void Cluster::onRecoveryStatusDispatched(
const bmqt::Uri uri(itMp->uri().canonical());
BSLS_ASSERT_SAFE(itMp->storage()->partitionId() ==
static_cast<int>(pid));
if (isCSLModeEnabled()) {
AppIdKeyPairs appIdKeyPairs;
itMp->storage()->loadVirtualStorageDetails(&appIdKeyPairs);
AppIdInfos appIdInfos(appIdKeyPairs.cbegin(),
appIdKeyPairs.cend());

d_clusterOrchestrator.registerQueueInfo(
uri,
pid,
itMp->storage()->queueKey(),
appIdInfos,
false); // Force-update?
}
else {
d_clusterOrchestrator.registerQueueInfo(
uri,
pid,
itMp->storage()->queueKey(),
AppIdInfos(),
false); // Force-update?
}

AppInfos appIdInfos;
itMp->storage()->loadVirtualStorageDetails(&appIdInfos);

d_clusterOrchestrator.registerQueueInfo(
uri,
pid,
itMp->storage()->queueKey(),
appIdInfos,
false); // Force-update?

++(*itMp);
}
Expand Down Expand Up @@ -2844,18 +2833,22 @@ void Cluster::onDomainReconfigured(const mqbi::Domain& domain,
}

// Compute list of added and removed App IDs.
bsl::vector<bsl::string> oldCfgAppIds(oldDefn.mode().fanout().appIDs(),
d_allocator_p);
bsl::vector<bsl::string> newCfgAppIds(newDefn.mode().fanout().appIDs(),
d_allocator_p);

bsl::vector<bsl::string> addedIds, removedIds;
bsl::unordered_set<bsl::string> oldCfgAppIds(
oldDefn.mode().fanout().appIDs().cbegin(),
oldDefn.mode().fanout().appIDs().cend(),
d_allocator_p);
bsl::unordered_set<bsl::string> newCfgAppIds(
newDefn.mode().fanout().appIDs().cbegin(),
newDefn.mode().fanout().appIDs().cend(),
d_allocator_p);

bsl::unordered_set<bsl::string> addedIds, removedIds;
mqbc::StorageUtil::loadAddedAndRemovedEntries(&addedIds,
&removedIds,
oldCfgAppIds,
newCfgAppIds);

bsl::vector<bsl::string>::const_iterator it = addedIds.begin();
bsl::unordered_set<bsl::string>::const_iterator it = addedIds.cbegin();
for (; it != addedIds.cend(); ++it) {
dispatcher()->execute(
bdlf::BindUtil::bind(&ClusterOrchestrator::registerAppId,
Expand Down
4 changes: 1 addition & 3 deletions src/groups/mqb/mqbblp/mqbblp_cluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,9 @@ class Cluster : public mqbi::Cluster,

private:
// PRIVATE TYPES
typedef mqbi::Storage::AppIdKeyPairs AppIdKeyPairs;

typedef mqbc::ClusterStatePartitionInfo ClusterStatePartitionInfo;

typedef mqbc::ClusterStateQueueInfo::AppIdInfos AppIdInfos;
typedef mqbc::ClusterStateQueueInfo::AppInfos AppInfos;

typedef mqbc::ClusterMembership::ClusterNodeSessionSp ClusterNodeSessionSp;

Expand Down
Loading

0 comments on commit cd9b7dd

Please sign in to comment.