Skip to content

Feat: removing shutdown v1 #784

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

dorjesinpo
Copy link
Collaborator

this is intended to remove the previous shutdown logic assuming shutdown v2 is everywhere

@dorjesinpo dorjesinpo added the enhancement New feature or request label Jun 16, 2025
@dorjesinpo dorjesinpo requested a review from a team as a code owner June 16, 2025 20:21
@pniedzielski
Copy link
Collaborator

This is exciting.

@dorjesinpo dorjesinpo force-pushed the dev/remove-shutdown-v1 branch from 9c5c451 to ed55a70 Compare June 16, 2025 21:05
Signed-off-by: dorjesinpo <[email protected]>
@dorjesinpo dorjesinpo force-pushed the dev/remove-shutdown-v1 branch from ed55a70 to 5a135bd Compare June 16, 2025 21:57
@dorjesinpo dorjesinpo requested review from 678098 and removed request for a team June 16, 2025 21:57
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 2770 of commit 5a135bd has completed with FAILURE

BMQTST_ASSERT_EQ(callbackCounter, 1);
}

PV("Shutdown with unconfirmed messages and timeout");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why these UTs are gone?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

because ClientSession is not in the business of waiting for unconfirmed messages

initiateShutdown(const VoidFunctor& callback,
bool supportShutdownV2 = false) BSLS_KEYWORD_OVERRIDE;
/// sequence. Execute shutdown logic where upstream (not downstream) nodes
/// deconfigure queues and the shutting down node waits for CONFIRMS.
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
/// deconfigure queues and the shutting down node waits for CONFIRMS.
/// deconfigure queues and the shutting down node waits for CONFIRMS.

<< ": invalid cluster name in the StopRequest from "
<< source->nodeDescription() << ", " << request;
return; // RETURN
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you think it's worth adding a warning and early return if someone sends bmqp::Protocol::eStopRequestVersion::e_V1 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.

good question. this PR is based on the assumption of never having v1. At some point, we need to retire stopRequest.version.

Comment on lines 186 to 187
// Add callback to be invoked once V1 shuts down all client sessions or
// V2 finishes waiting for unconfirmed
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
// Add callback to be invoked once V1 shuts down all client sessions or
// V2 finishes waiting for unconfirmed
// Add callback to be invoked once V2 finishes waiting for unconfirmed

initiateShutdown(const VoidFunctor& callback,
bool supportShutdownV2 = false) BSLS_KEYWORD_OVERRIDE;
/// invoked. Execute shutdown logic where upstream (not downstream) nodes
/// deconfigure queues and the shutting down node waits for CONFIRMS.
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
/// deconfigure queues and the shutting down node waits for CONFIRMS.
/// deconfigure queues and the shutting down node waits for CONFIRMS.

@@ -321,8 +321,7 @@ int Cluster::start(BSLA_UNUSED bsl::ostream& errorDescription)
return 0;
}

void Cluster::initiateShutdown(BSLA_UNUSED const VoidFunctor& callback,
BSLA_UNUSED bool supportShutdownV2)
void Cluster::initiateShutdown(BSLA_UNUSED const VoidFunctor& callback)
{
// PRECONDITIONS
BSLS_ASSERT_OPT(!d_isStarted &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

The condition here looks odd, and the comment start() can only be called once on this object is irrelevant to shutdown.
Do we set d_isStarted = false before we call Cluster::initiateShutdown?

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 seems like an (old) bug. We never call mqbmock::Cluster::initiateShutdown
We can change this to

BSLS_ASSERT_OPT(d_isStarted &&
                    "start() must be called before initiateShutdown")

bsls::Types::Int64
countUnconfirmed(unsigned int subId) BSLS_KEYWORD_OVERRIDE;
/// Return number of unconfirmed messages across all handles.
bsls::Types::Int64 countUnconfirmed() BSLS_KEYWORD_OVERRIDE;
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::Types::Int64 countUnconfirmed() BSLS_KEYWORD_OVERRIDE;
bsls::Types::Int64 countUnconfirmed() const BSLS_KEYWORD_OVERRIDE;

@@ -245,7 +245,7 @@ Queue::setStats(const bsl::shared_ptr<mqbstat::QueueStatsDomain>& stats)
d_stats_sp = stats;
}

bsls::Types::Int64 Queue::countUnconfirmed(BSLA_UNUSED unsigned int subId)
bsls::Types::Int64 Queue::countUnconfirmed()
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::Types::Int64 Queue::countUnconfirmed()
bsls::Types::Int64 Queue::countUnconfirmed() const

BSLA_UNUSED const ShutdownCb& callback,
BSLA_UNUSED const bsls::TimeInterval& timeout,
BSLA_UNUSED bool supportShutdownV2)
void DummySession::initiateShutdown(const ShutdownCb& callback)
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
void DummySession::initiateShutdown(const ShutdownCb& callback)
void DummySession::initiateShutdown(BSLA_UNUSED const ShutdownCb& callback)

void initiateShutdown(const ShutdownCb& callback,
const bsls::TimeInterval& timeout,
bool supportShutdownV2 = false) BSLS_KEYWORD_OVERRIDE
void initiateShutdown(const ShutdownCb& callback) BSLS_KEYWORD_OVERRIDE
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
void initiateShutdown(const ShutdownCb& callback) BSLS_KEYWORD_OVERRIDE
void initiateShutdown(BSLA_UNUSED const ShutdownCb& callback) BSLS_KEYWORD_OVERRIDE

@678098 678098 assigned dorjesinpo and unassigned 678098 Jun 17, 2025
@678098 678098 changed the title removing shutdown v1 Feat: removing shutdown v1 Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants