Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring App registration #493

Merged
merged 2 commits into from
Nov 11, 2024
Merged

Refactoring App registration #493

merged 2 commits into from
Nov 11, 2024

Conversation

dorjesinpo
Copy link
Collaborator

  1. Fix the race when reconfiguring domain in FSM
  2. Generate AppKey only once when reconfiguring domain.

@dorjesinpo dorjesinpo requested a review from a team as a code owner October 30, 2024 22:40
@dorjesinpo dorjesinpo force-pushed the dev/squeaky-2 branch 5 times, most recently from 7b9493f to b0f355e Compare November 4, 2024 19:49
@dorjesinpo dorjesinpo changed the title WIP Refactoring App registration Nov 4, 2024
@dorjesinpo dorjesinpo requested a review from kaikulimu November 4, 2024 21:28
Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build 356 of commit d687443 has completed with FAILURE

src/groups/mqb/mqbblp/mqbblp_rootqueueengine.h Outdated Show resolved Hide resolved
<< "never be called for a non-Fanout queue. Received "
<< "call to register appId '" << appIdKeyPair.first
<< "', appKey '" << appIdKeyPair.second << "'.";
<< "never be called for a non-Fanout queue.";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove printing of appId and appKey? They help with debugging.

In fact, it could help to also print the queue uri here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer singular. Not sure we want to print the entire collection. Note that this code never executes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just printing the queue uri would be nice.

BALL_LOG_ERROR << "It should be not possible to unregister appId '"
<< appIdKeyPair.first << "', appKey '"
<< appIdKeyPair.second << "' for a non-Fanout queue.";
BALL_LOG_ERROR << "Invalid queue type for unregistering appId.";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Printing queue uri, offending appId and appKey can be helpful

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just printing the queue uri would be nice.

{
// NOTHING
}

void QueueEngine::afterAppIdUnregistered(
BSLS_ANNOTATION_UNUSED const mqbi::Storage::AppInfo& appIdKeyPair)
BSLS_ANNOTATION_UNUSED const mqbi::Storage::AppInfos& appIdKeyPairs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BSLS_ANNOTATION_UNUSED const mqbi::Storage::AppInfos& appIdKeyPairs)
BSLS_ANNOTATION_UNUSED const mqbi::Storage::AppInfos& removedAppIds)

to be consistent with RootQE

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs to be changed in this .cpp file.

src/integration-tests/test_appids.py Outdated Show resolved Hide resolved
src/integration-tests/test_appids.py Outdated Show resolved Hide resolved
src/integration-tests/test_appids.py Outdated Show resolved Hide resolved
src/integration-tests/test_appids.py Show resolved Hide resolved
src/integration-tests/test_appids.py Outdated Show resolved Hide resolved
@kaikulimu kaikulimu assigned dorjesinpo and unassigned kaikulimu Nov 8, 2024
@kaikulimu
Copy link
Collaborator

kaikulimu commented Nov 8, 2024

Added thought, I think we should never generate appKey at

if (cluster->isCSLModeEnabled() || !appIdKeyPairs.empty()) {
for (AppInfosCIter citer = appIdKeyPairs.begin();
citer != appIdKeyPairs.end();
++citer) {
rc = storageSp->addVirtualStorage(errorDesc,
citer->first,
citer->second);
}
appIdKeyPairsToUse = appIdKeyPairs;
}
else {
// If fanout queue, generate unique appKeys for the configured
// appIds, and create virtual storages for them. Caller expects
// virtual storages to be created when 'registerQueue' returns.
const mqbconfm::QueueModeFanout& fanoutMode = queueMode.fanout();
const bsl::vector<bsl::string>& cfgAppIds = fanoutMode.appIDs();
typedef bsl::vector<bsl::string>::const_iterator ConstIter;
for (ConstIter citer = cfgAppIds.begin(); citer != cfgAppIds.end();
++citer) {
mqbu::StorageKey appKey = generateAppKey(appKeys,
appKeysLock,
*citer);
rc = storageSp->addVirtualStorage(errorDesc, *citer, appKey);
appIdKeyPairsToUse.emplace(bsl::make_pair(*citer, appKey));
}
}

Our end goal is to only generate appKey at the CSL layer.

Be courageous and not be afraid of changing existing code :)

@dorjesinpo
Copy link
Collaborator Author

Added thought, I think we should never generate appKey at
We have been over it at the previous commit when we have added || !appIdKeyPairs.empty()

Copy link

@bmq-oss-ci bmq-oss-ci bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build 366 of commit cdd9c32 has completed with FAILURE

@kaikulimu kaikulimu assigned dorjesinpo and unassigned kaikulimu Nov 11, 2024
Copy link
Collaborator

@kaikulimu kaikulimu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments

<< "never be called for a non-Fanout queue. Received "
<< "call to register appId '" << appIdKeyPair.first
<< "', appKey '" << appIdKeyPair.second << "'.";
<< "never be called for a non-Fanout queue.";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just printing the queue uri would be nice.

BALL_LOG_ERROR << "It should be not possible to unregister appId '"
<< appIdKeyPair.first << "', appKey '"
<< appIdKeyPair.second << "' for a non-Fanout queue.";
BALL_LOG_ERROR << "Invalid queue type for unregistering appId.";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just printing the queue uri would be nice.

{
// NOTHING
}

void QueueEngine::afterAppIdUnregistered(
BSLS_ANNOTATION_UNUSED const mqbi::Storage::AppInfo& appIdKeyPair)
BSLS_ANNOTATION_UNUSED const mqbi::Storage::AppInfos& appIdKeyPairs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs to be changed in this .cpp file.

@@ -36,13 +36,13 @@ QueueEngine::~QueueEngine()
}

void QueueEngine::afterAppIdRegistered(
BSLS_ANNOTATION_UNUSED const mqbi::Storage::AppInfo& appIdKeyPair)
BSLS_ANNOTATION_UNUSED const mqbi::Storage::AppInfos& appIdKeyPairs)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still needs to be changed in this .cpp file.

Signed-off-by: dorjesinpo <[email protected]>
Copy link
Collaborator

@kaikulimu kaikulimu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dorjesinpo dorjesinpo merged commit 759da3c into main Nov 11, 2024
30 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants