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

chore: get back on the decision to put a hard limit on command interface #4203

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

romange
Copy link
Collaborator

@romange romange commented Nov 27, 2024

Limiting commands to only Transaction* and SinkReplyBuilder does not hold. We need sometimes to access context fields for multitude of reasons.

But I do not want to pass the huge ConnectionContext object because, it's hard then to track unusual access patterns.

The compromise: to introduce CommandContext that currently has tx, rb and extended fields. It will be relatively easy to identify irregular access patterns by tracking the extended field.

This commit is the first one in series of probably 10-15 commits. No functional changes here.

Limiting commands to only Transaction* and SinkReplyBuilder does not hold.
We need sometimes to access context fields for multitude of reasons.

But I do not want to pass the huge ConnectionContext object because, it's hard
then to track unusual access patterns.

The compromise: to introduce CommandContext that currently has tx, rb and extended fields.
It will be relatively easy to identify irregular access patterns by tracking the extended field.

This commit is the first one in series of probably 10-15 commits. No functional changes here.

Signed-off-by: Roman Gershman <[email protected]>
@romange romange requested a review from chakaz November 27, 2024 07:09
@@ -974,14 +974,14 @@ OpStatus SetCmd::CachePrevIfNeeded(const SetCmd::SetParams& params, DbSlice::Ite
return OpStatus::OK;
}

void StringFamily::Set(CmdArgList args, Transaction* tx, SinkReplyBuilder* builder,
ConnectionContext* cntx) {
void StringFamily::Set(CmdArgList args, const CommandContext& cmnd_cntx) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

all the changes here are search and replace

@romange romange requested a review from chakaz November 27, 2024 07:56
@@ -73,6 +73,16 @@ static_assert(!IsEvalKind(""));
// Per thread vector of command stats. Each entry is {cmd_calls, cmd_latency_agg in usec}.
using CmdCallStats = std::pair<uint64_t, uint64_t>;

struct CommandContext {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a thought: since this will be used quite a lot, maybe rename it to CmdContext or CmdCntx?
Feel free to say no obviously, I just don't think it makes the code less readable.

Copy link
Contributor

Choose a reason for hiding this comment

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

The only strange thing for me is that we don't have the class Command, but have CommandContext. From my point of view, the best naming for a context should look like Command::Context or Cmd::Cntx. The same for other contexts they are not self-sufficient so I would like to move them into other classes or they should lost the context part of the name

@romange romange merged commit 45f8e84 into main Nov 27, 2024
9 checks passed
@romange romange deleted the Evolve1 branch November 27, 2024 09:28
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.

3 participants