Skip to content

Commit ca9982f

Browse files
authored
Fix[BMQ,MQB]: default allocations (#830)
Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
1 parent 546fd67 commit ca9982f

5 files changed

Lines changed: 35 additions & 29 deletions

File tree

src/groups/bmq/bmqimp/bmqimp_application.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@ bmqt::GenericResult::Enum Application::startChannel()
381381
bsls::TimeInterval attemptInterval;
382382
attemptInterval.setTotalMilliseconds(k_RECONNECT_INTERVAL_MS);
383383

384-
bmqio::Status status;
385-
bmqio::ConnectOptions options;
384+
bmqio::Status status(&d_allocator);
385+
bmqio::ConnectOptions options(&d_allocator);
386386
options.setEndpoint(out.str())
387387
.setNumAttempts(k_RECONNECT_COUNT)
388388
.setAttemptInterval(attemptInterval)
@@ -392,12 +392,13 @@ bmqt::GenericResult::Enum Application::startChannel()
392392
&status,
393393
&d_connectHandle_mp,
394394
options,
395-
bdlf::BindUtil::bind(&Application::channelStateCallback,
396-
this,
397-
options.endpoint(),
398-
bdlf::PlaceHolders::_1, // event
399-
bdlf::PlaceHolders::_2, // status
400-
bdlf::PlaceHolders::_3)); // channel
395+
bdlf::BindUtil::bindS(&d_allocator,
396+
&Application::channelStateCallback,
397+
this,
398+
options.endpoint(),
399+
bdlf::PlaceHolders::_1, // event
400+
bdlf::PlaceHolders::_2, // status
401+
bdlf::PlaceHolders::_3)); // channel
401402
if (!status) {
402403
BALL_LOG_ERROR << id() << "Failed to connect to broker at '"
403404
<< d_sessionOptions.brokerUri()
@@ -453,7 +454,7 @@ void Application::printStats(bool isFinal)
453454
// executed by the *SCHEDULER* thread
454455
// (and by the *MAIN* thread (in destructor))
455456

456-
bmqu::MemOutStream os;
457+
bmqu::MemOutStream os(&d_allocator);
457458

458459
os << "#### stats [delta = last "
459460
<< d_sessionOptions.statsDumpInterval().seconds() << " seconds] ####\n";
@@ -482,8 +483,8 @@ void Application::printStats(bool isFinal)
482483
os << "::::: TCP Channels >>";
483484
if (isFinal) {
484485
// For the final stats, no need to print the 'delta' columns
485-
bmqst::Table table;
486-
bmqst::BasicTableInfoProvider tip;
486+
bmqst::Table table(&d_allocator);
487+
bmqst::BasicTableInfoProvider tip(&d_allocator);
487488
bmqio::StatChannelFactoryUtil::initializeStatsTable(
488489
&table,
489490
&tip,
@@ -577,14 +578,15 @@ Application::Application(
577578
bmqp::BlobPoolUtil::createBlobPool(&d_blobBufferFactory,
578579
d_allocators.get("BlobSpPool")))
579580
, d_scheduler(bsls::SystemClockType::e_MONOTONIC, &d_allocator)
580-
, d_channelFactory(ntcCreateInterfaceConfig(sessionOptions, allocator),
581+
, d_channelFactory(ntcCreateInterfaceConfig(sessionOptions, &d_allocator),
581582
&d_blobBufferFactory,
582-
allocator)
583+
&d_allocator)
583584
, d_resolvingChannelFactory(
584585
bmqio::ResolvingChannelFactoryConfig(
585586
&d_channelFactory,
586587
bmqex::ExecutionPolicyUtil::oneWay().alwaysBlocking().useExecutor(
587-
bmqex::SystemExecutor())),
588+
bmqex::SystemExecutor()),
589+
allocator),
588590
allocator)
589591
, d_reconnectingChannelFactory(
590592
bmqio::ReconnectingChannelFactoryConfig(&d_resolvingChannelFactory,

src/groups/bmq/bmqimp/bmqimp_brokersession.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4533,7 +4533,7 @@ void BrokerSession::cancel(const bsl::shared_ptr<Queue>& queue,
45334533
// Cancel pending configureQueue
45344534
if (queue->pendingConfigureId() != Queue::k_INVALID_CONFIGURE_ID) {
45354535
// Prepare canceled response.
4536-
bmqp_ctrlmsg::ControlMessage controlMessage;
4536+
bmqp_ctrlmsg::ControlMessage controlMessage(d_allocator_p);
45374537
controlMessage.rId().makeValue(queue->pendingConfigureId());
45384538

45394539
bmqp::ControlMessageUtil::makeStatus(&controlMessage,
@@ -4569,7 +4569,7 @@ void BrokerSession::cancel(int groupId,
45694569
BSLS_ASSERT_SAFE(d_fsmThreadChecker.inSameThread());
45704570

45714571
// Cancel all pending requests with CANCELED reason.
4572-
bmqp_ctrlmsg::ControlMessage controlMessage;
4572+
bmqp_ctrlmsg::ControlMessage controlMessage(d_allocator_p);
45734573
bmqp::ControlMessageUtil::makeStatus(&controlMessage, status, -1, reason);
45744574
if (groupId >= 0) {
45754575
d_requestManager.cancelAllRequests(controlMessage, groupId);
@@ -4695,7 +4695,8 @@ void BrokerSession::cancelPendingMessages(
46954695
bmqp::AckEventBuilder ackBuilder(d_blobSpPool_p, d_allocator_p);
46964696
bsl::shared_ptr<Event> ackEvent = createEvent();
46974697

4698-
MessageCorrelationIdContainer::KeyIdsCb callback = bdlf::BindUtil::bind(
4698+
MessageCorrelationIdContainer::KeyIdsCb callback = bdlf::BindUtil::bindS(
4699+
d_allocator_p,
46994700
&BrokerSession::cancelPendingMessageImp,
47004701
this,
47014702
&ackBuilder,
@@ -5924,12 +5925,13 @@ int BrokerSession::startAsync()
59245925
// Add to the FSM event queue
59255926
bsl::shared_ptr<Event> queueEvent = createEvent();
59265927
queueEvent->configureAsRequestEvent(
5927-
bdlf::BindUtil::bind(&BrokerSession::doStart,
5928-
this,
5929-
&fsmAcceptedSemaphore,
5930-
&startStatus,
5931-
bdlf::PlaceHolders::_1, // eventImpl
5932-
createDTSpan("bmq.session.start")));
5928+
bdlf::BindUtil::bindS(d_allocator_p,
5929+
&BrokerSession::doStart,
5930+
this,
5931+
&fsmAcceptedSemaphore,
5932+
&startStatus,
5933+
bdlf::PlaceHolders::_1, // eventImpl
5934+
createDTSpan("bmq.session.start")));
59335935

59345936
if (enqueueFsmEvent(queueEvent) != bmqt::GenericResult::e_SUCCESS) {
59355937
return bmqt::GenericResult::e_REFUSED; // RETURN

src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ EventQueue::timedPopFront(const bsls::TimeInterval& timeout,
579579
BSLS_PERFORMANCEHINT_UNLIKELY_HINT;
580580

581581
bmqt::SessionEventType::Enum type;
582-
bsl::string errorDescription;
582+
bslstl::StringRef errorDescription;
583583
if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY(rc == -1)) {
584584
// We timed out.. create a timeout event
585585
type = bmqt::SessionEventType::e_TIMEOUT;

src/groups/bmq/bmqst/bmqst_tableschema.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,12 @@ TableSchemaColumn& TableSchema::addColumn(const bslstl::StringRef& name,
167167

168168
void TableSchema::addDefaultIdColumn(const bslstl::StringRef& name)
169169
{
170-
Column::ValueFn columnFn = bdlf::BindUtil::bind(defaultIdColumn,
171-
bdlf::PlaceHolders::_1,
172-
bdlf::PlaceHolders::_2,
173-
bdlf::PlaceHolders::_3,
174-
bdlf::PlaceHolders::_4);
170+
Column::ValueFn columnFn = bdlf::BindUtil::bindS(d_allocator_p,
171+
defaultIdColumn,
172+
bdlf::PlaceHolders::_1,
173+
bdlf::PlaceHolders::_2,
174+
bdlf::PlaceHolders::_3,
175+
bdlf::PlaceHolders::_4);
175176

176177
addColumn(name, columnFn);
177178
}

src/groups/mqb/mqbs/mqbs_inmemorystorage.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ InMemoryStorage::InMemoryStorage(const bmqt::Uri& uri,
7575
, d_virtualStorageCatalog(
7676
this,
7777
allocatorStore ? allocatorStore->get("VirtualHandles") : d_allocator_p)
78+
, d_queueOpRecordHandles(d_allocator_p)
7879
, d_ttlSeconds(config.messageTtl())
7980
, d_isEmpty(1)
8081
, d_currentlyAutoConfirming()

0 commit comments

Comments
 (0)