Skip to content

Commit

Permalink
Merge branch 'main' into augment-brkr-log
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-e1off authored Sep 6, 2024
2 parents 4ee0138 + 34be90f commit 0e558d8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
44 changes: 28 additions & 16 deletions src/applications/bmqtool/m_bmqtool_storageinspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ bool resetIterator(mqbs::MappedFileDescriptor* mfd,
/// opened by the iterator. Verify that the file and iterator are in a
/// valid state; reset them if this is not the case. Pass parameters to
/// indicate how many records to skip and whether that is forward
/// or backwards. Return true on success and false on error.
/// or backwards.
template <typename CHOICE, typename ITER>
void iterateNextPosition(CHOICE& choice,
mqbs::MappedFileDescriptor* mfd,
ITER* iter,
const char* filename)
{
int skip = -1;
bool reverse = false;
bool verbose = false;
bsls::Types::Uint64 skip = 0;
bool reverse = false;
bool verbose = false;

switch (choice.selectionId()) {
case CHOICE::SELECTION_ID_N: {
Expand All @@ -158,12 +158,22 @@ void iterateNextPosition(CHOICE& choice,
} break;
case CHOICE::SELECTION_ID_RECORD: {
skip = choice.record();

if (skip >= iter->recordIndex()) {
// If the skip is greater than our current index, than we are
// iterating forward to reach the specified index.
skip -= iter->recordIndex();
reverse = false;
}
else {
skip = iter->recordIndex() - skip;
reverse = true;
}
} break;
case CHOICE::SELECTION_ID_R: {
if (skip == -1) {
skip = choice.r();
}
if (skip >= static_cast<int>(iter->recordIndex())) {
skip = choice.r();

if (skip >= iter->recordIndex()) {
// If the skip is greater than our current index, than we are
// iterating forward to reach the specified index.
skip -= iter->recordIndex();
Expand All @@ -175,26 +185,28 @@ void iterateNextPosition(CHOICE& choice,
}
} break;
case CHOICE::SELECTION_ID_LIST: {
skip = choice.list();
verbose = true;
if (skip >= 0) {
int list = choice.list();
verbose = true;
if (list >= 0) {
reverse = false;
}
else {
reverse = true;
skip *= -1;
list *= -1;
}
skip = list;
} break;
case CHOICE::SELECTION_ID_L: {
skip = choice.l();
verbose = true;
if (skip >= 0) {
int list = choice.l();
verbose = true;
if (list >= 0) {
reverse = false;
}
else {
reverse = true;
skip *= -1;
list *= -1;
}
skip = list;
} break;
default:
BALL_LOG_ERROR << "Unsupported choice: " << choice.selectionId();
Expand Down
12 changes: 6 additions & 6 deletions src/groups/mqb/mqbstat/mqbstat_queuestats.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ static void test5_appIdMetrics()
ASSERT_EQ(1, sc->numSubcontexts());

const mwcst::StatContext* fooSc = sc->getSubcontext(k_APPID_FOO);
ASSERT_NE(bsl::nullptr_t(), fooSc);
ASSERT(fooSc);
}

// Add event for non-configured appId "bar", this value should not reach to
Expand All @@ -616,12 +616,12 @@ static void test5_appIdMetrics()
ASSERT_EQ(2, sc->numSubcontexts());

const mwcst::StatContext* fooSc = sc->getSubcontext(k_APPID_FOO);
ASSERT_EQ(bsl::nullptr_t(), fooSc);
ASSERT(!fooSc);

const mwcst::StatContext* barSc = sc->getSubcontext(k_APPID_BAR);
const mwcst::StatContext* bazSc = sc->getSubcontext(k_APPID_BAZ);
ASSERT_NE(bsl::nullptr_t(), barSc);
ASSERT_NE(bsl::nullptr_t(), bazSc);
ASSERT(barSc);
ASSERT(bazSc);
}

// Report some metrics and check that they reached subcontexts
Expand All @@ -644,8 +644,8 @@ static void test5_appIdMetrics()

const mwcst::StatContext* barSc = sc->getSubcontext(k_APPID_BAR);
const mwcst::StatContext* bazSc = sc->getSubcontext(k_APPID_BAZ);
ASSERT_NE(bsl::nullptr_t(), barSc);
ASSERT_NE(bsl::nullptr_t(), bazSc);
ASSERT(barSc);
ASSERT(bazSc);

ASSERT_EQ(900,
mqbstat::QueueStatsDomain::getValue(
Expand Down

0 comments on commit 0e558d8

Please sign in to comment.