Skip to content

Commit

Permalink
Change domain remove wait time to be a const
Browse files Browse the repository at this point in the history
Signed-off-by: Emelia Lei <[email protected]>
  • Loading branch information
emelialei88 committed Jan 6, 2025
1 parent c80be65 commit d52c0db
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/groups/mqb/mqba/mqba_domainmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ namespace BloombergLP {
namespace mqba {

namespace {
const int k_MAX_WAIT_SECONDS_AT_SHUTDOWN = 40;
const int k_MAX_WAIT_SECONDS_AT_SHUTDOWN = 40;
const int k_MAX_WAIT_SECONDS_AT_DOMAIN_REMOVE = 5;

/// This function is a callback passed to domain manager for
/// synchronization. The specified 'status' is a return status
Expand Down Expand Up @@ -707,9 +708,6 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result,

// First pass
if (command.remove().finalize().isNull()) {
BALL_LOG_INFO << "[First pass] DOMAINS REMOVE '" << name
<< "' called!!!";

DomainSp domainSp;

if (0 != locateOrCreateDomain(&domainSp, name)) {
Expand All @@ -731,8 +729,6 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result,
// 2. Mark DOMAIN PREREMOVE to block openQueue requests
domainSp->removeDomainReset();

BALL_LOG_INFO << "BEFORE PURGE";

// 3. Purge inactive queues
// remove virtual storage; add a record in journal file
mqbcmd::DomainResult domainResult;
Expand All @@ -756,8 +752,6 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result,
clusterResult.storageResult().purgedQueues().queues();
result->makeDomainResult(domainResult);

BALL_LOG_INFO << "BEFORE GC";

// 4. Force GC queues
// unregister Queue from domain;
// remove queue storage from partition
Expand All @@ -770,8 +764,6 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result,

// 5. Mark DOMAIN REMOVED to accecpt the second pass

BALL_LOG_INFO << "BEFORE WAIT FOR TEARDOWN";

bmqu::SharedResource<DomainManager> self(this);
bslmt::Latch latch(1, bsls::SystemClockType::e_MONOTONIC);

Expand All @@ -782,17 +774,17 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result,
&latch));

bsls::TimeInterval timeout =
bmqsys::Time::nowMonotonicClock().addSeconds(5);
bmqsys::Time::nowMonotonicClock().addSeconds(
k_MAX_WAIT_SECONDS_AT_DOMAIN_REMOVE);

rc = latch.timedWait(timeout);
if (0 != rc) {
BALL_LOG_ERROR << "DOMAINS REMOVE fail to finish in " << 5
BALL_LOG_ERROR << "DOMAINS REMOVE fail to finish in "
<< k_MAX_WAIT_SECONDS_AT_DOMAIN_REMOVE
<< " seconds. rc: " << rc << ".";
return rc;
}

BALL_LOG_INFO << "BEFORE CLEAN DOMAINRESOLVER CACHE";

// 6. Clear cache in domainResolver and configProvider
d_domainResolver_mp->clearCache(name);
d_configProvider_p->clearCache(name);
Expand All @@ -802,9 +794,6 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result,
}
// Second pass
else {
BALL_LOG_INFO << "[Second pass] DOMAINS REMOVE '" << name
<< "' finalize called!!!";

DomainSp domainSp;

int rc = locateDomain(&domainSp, name);
Expand Down

0 comments on commit d52c0db

Please sign in to comment.