Skip to content

Commit

Permalink
Fix[MQB]: misc warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
  • Loading branch information
678098 committed Oct 15, 2024
1 parent 71b4dab commit 3b9c381
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/groups/mqb/mqbblp/mqbblp_cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ void Cluster::startDispatched(bsl::ostream* errorDescription, int* rc)
bslma::Allocator* storageManagerAllocator = d_allocators.get(
"StorageManager");

// Make a temporal pointer to the dispatcher to avoid a false-positive
// "uninitialized variable" warning
mqbi::Dispatcher* clusterDispatcher = dispatcher();

// Start the StorageManager
d_storageManager_mp.load(
isFSMWorkflow()
Expand All @@ -185,7 +189,7 @@ void Cluster::startDispatched(bsl::ostream* errorDescription, int* rc)
&d_clusterData,
d_state,
d_clusterData.domainFactory(),
dispatcher(),
clusterDispatcher,
k_PARTITION_FSM_WATCHDOG_TIMEOUT_DURATION,
bdlf::BindUtil::bind(&Cluster::onRecoveryStatus,
this,
Expand Down Expand Up @@ -218,7 +222,7 @@ void Cluster::startDispatched(bsl::ostream* errorDescription, int* rc)
bdlf::PlaceHolders::_2, // status
bdlf::PlaceHolders::_3), // primary leaseId
d_clusterData.domainFactory(),
dispatcher(),
clusterDispatcher,
&d_clusterData.miscWorkThreadPool(),
storageManagerAllocator)),
storageManagerAllocator);
Expand Down Expand Up @@ -3853,7 +3857,8 @@ void Cluster::getPartitionPrimaryNode(int* rc,
d_state.partitions();

// Check boundary conditions for partitionId
if (partitionId < 0 || partitionId >= partitions.size()) {
if (partitionId < 0 ||
static_cast<int>(partitions.size()) <= partitionId) {
errorDescription << "Invalid partition id: " << partitionId;
*rc = rc_ERROR;
return; // RETURN
Expand Down
3 changes: 2 additions & 1 deletion src/groups/mqb/mqbblp/mqbblp_clustercatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,13 +376,14 @@ ClusterCatalog::ClusterCatalog(mqbi::Dispatcher* dispatcher,
, d_reversedClusterConnections(d_allocator_p)
, d_clusters(d_allocator_p)
, d_statContexts(statContexts)
, d_resources(resources)
, d_adminCb()
, d_requestManager(bmqp::EventType::e_CONTROL,
resources.bufferFactory(),
resources.scheduler(),
false, // lateResponseMode
d_allocator_p)
, d_stopRequestsManager(&d_requestManager, d_allocator_p)
, d_resources(resources)
{
// PRECONDITIONS
BSLS_ASSERT_SAFE(d_resources.scheduler()->clockType() ==
Expand Down
3 changes: 2 additions & 1 deletion src/groups/mqb/mqbc/mqbc_recoverymanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,7 +1255,8 @@ void RecoveryManager::setLiveDataSource(mqbnet::ClusterNode* source,
// PRECONDITIONS
BSLS_ASSERT_SAFE(source);
BSLS_ASSERT_SAFE(0 <= partitionId);
BSLS_ASSERT_SAFE(partitionId < d_recoveryContextVec.size());
BSLS_ASSERT_SAFE(partitionId <
static_cast<int>(d_recoveryContextVec.size()));

RecoveryContext& recoveryCtx = d_recoveryContextVec[partitionId];

Expand Down

0 comments on commit 3b9c381

Please sign in to comment.