Skip to content

Commit

Permalink
Fix Uri ctor and clusterutil print bug
Browse files Browse the repository at this point in the history
Signed-off-by: Emelia Lei <[email protected]>
  • Loading branch information
emelialei88 committed Jan 21, 2025
1 parent 005a33d commit a456bee
Show file tree
Hide file tree
Showing 3 changed files with 372 additions and 15 deletions.
21 changes: 15 additions & 6 deletions src/groups/bmq/bmqt/bmqt_uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,36 @@ Uri::Uri(const bslstl::StringRef& uri, bslma::Allocator* allocator)
: d_uri(allocator)
, d_wasParserInitialized(false)
{
UriParser::initialize();
UriParser::initialize(allocator);
d_wasParserInitialized = true;
UriParser::parse(this, 0, uri);
const int rc = UriParser::parse(this, 0, uri);
if (rc != 0) {
BALL_LOG_ERROR << "Uri '" << uri << "' failed to parse, rc = " << rc;
}
}

Uri::Uri(const char* uri, bslma::Allocator* allocator)
: d_uri(allocator)
, d_wasParserInitialized(false)
{
UriParser::initialize();
UriParser::initialize(allocator);
d_wasParserInitialized = true;
UriParser::parse(this, 0, uri);
const int rc = UriParser::parse(this, 0, uri);
if (rc != 0) {
BALL_LOG_ERROR << "Uri '" << uri << "' failed to parse, rc = " << rc;
}
}

Uri::Uri(const bsl::string& uri, bslma::Allocator* allocator)
: d_uri(allocator)
, d_wasParserInitialized(false)
{
UriParser::initialize();
UriParser::initialize(allocator);
d_wasParserInitialized = true;
UriParser::parse(this, 0, uri);
const int rc = UriParser::parse(this, 0, uri);
if (rc != 0) {
BALL_LOG_ERROR << "Uri '" << uri << "' failed to parse, rc = " << rc;
}
}

Uri::~Uri()
Expand Down
18 changes: 9 additions & 9 deletions src/groups/mqb/mqbc/mqbc_clusterutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,11 +1675,11 @@ int ClusterUtil::validateState(bsl::ostream& errorDescription,
// Validate partition information
bsl::vector<ClusterStatePartitionInfo> incorrectPartitions;
for (size_t pid = 0; pid < state.partitions().size(); ++pid) {
const ClusterStatePartitionInfo& stateInfo = state.partitions()[pid];
const ClusterStatePartitionInfo& stateInfo = state.partition(pid);
BSLS_ASSERT_SAFE(stateInfo.partitionId() == pid);

const ClusterStatePartitionInfo& referenceInfo =
reference.partitions()[pid];
const ClusterStatePartitionInfo& referenceInfo = reference.partition(
pid);
BSLS_ASSERT_SAFE(referenceInfo.partitionId() == pid);
if (stateInfo.primaryLeaseId() != referenceInfo.primaryLeaseId()) {
// Partition information mismatch. Note that we don't compare
Expand All @@ -1699,7 +1699,7 @@ int ClusterUtil::validateState(bsl::ostream& errorDescription,
bdlb::Print::newlineAndIndent(out, level);
out << "---------------------------";
bdlb::Print::newlineAndIndent(out, level);
out << "Incorrect Partition Infos :";
out << "Incorrect Partition Infos:";
bdlb::Print::newlineAndIndent(out, level);
out << "---------------------------";
for (bsl::vector<ClusterStatePartitionInfo>::const_iterator citer =
Expand Down Expand Up @@ -1791,9 +1791,9 @@ int ClusterUtil::validateState(bsl::ostream& errorDescription,
citer != incorrectQueues.cend();
++citer) {
bdlb::Print::newlineAndIndent(out, level + 1);
out << citer->first;
out << *citer->first;
bdlb::Print::newlineAndIndent(out, level + 1);
out << "(correct queue info) " << citer->second;
out << "(correct queue info) " << *citer->second;
}
}

Expand All @@ -1809,7 +1809,7 @@ int ClusterUtil::validateState(bsl::ostream& errorDescription,
citer != extraQueues.cend();
++citer) {
bdlb::Print::newlineAndIndent(out, level + 1);
out << *citer;
out << **citer;
}
}

Expand Down Expand Up @@ -1862,7 +1862,7 @@ int ClusterUtil::validateState(bsl::ostream& errorDescription,
citer != missingQueues.cend();
++citer) {
bdlb::Print::newlineAndIndent(out, level + 1);
out << *citer;
out << **citer;
}
}

Expand All @@ -1885,7 +1885,7 @@ int ClusterUtil::validateState(bsl::ostream& errorDescription,
citer != domCit->second->queuesInfo().cend();
++citer) {
bdlb::Print::newlineAndIndent(out, level + 1);
out << citer->second;
out << *citer->second;
}
}
}
Expand Down
Loading

0 comments on commit a456bee

Please sign in to comment.