Skip to content

Commit

Permalink
Fix addRule for large number of categories (#4779)
Browse files Browse the repository at this point in the history
  • Loading branch information
osubboo authored and GitHub Enterprise committed Jun 5, 2024
1 parent 569c465 commit 3542892
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions groups/bal/ball/ball_categorymanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ void CategoryManager::privateApplyRulesToAllCategories(
done = (remaining == batch);
cachedCategories.assign(d_categories.begin() + offset,
d_categories.begin() + offset + batch);
offset += batch;
}
{
bslmt::LockGuard<bslmt::Mutex> guard(&d_ruleSetMutex);
Expand Down
26 changes: 26 additions & 0 deletions groups/bal/ball/ball_categorymanager.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,32 @@ int main(int argc, char *argv[])
}
mX.removeAllRules();
}

if (verbose) {
cout << "\tTest updating a large number of categories with a rule."
<< endl;
}
{

Obj mX(&ta);

// Adding a rule with 4K+ categories; DRQS 175529764
for (int j = 0; j < 4096*2; ++j) {
bsl::stringstream categoryPattern;
categoryPattern << "Category" << j;

bsl::string categoryName = categoryPattern.str();

const Entry *C = mX.addCategory(categoryName.c_str(),
255, 255, 255, 255);
ASSERT(C == mX.lookupCategory(categoryName.c_str()));
}

ball::Rule rule("C", 1, 2, 3, 4);
ASSERT(1 == mX.addRule(rule));

mX.removeAllRules();
}
} break;
case 11: {
// --------------------------------------------------------------------
Expand Down

0 comments on commit 3542892

Please sign in to comment.