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: enable ReplyGuard in ReplyBuilder2 #3705

Merged
merged 1 commit into from
Sep 17, 2024
Merged

chore: enable ReplyGuard in ReplyBuilder2 #3705

merged 1 commit into from
Sep 17, 2024

Conversation

kostasrim
Copy link
Contributor

@kostasrim kostasrim commented Sep 13, 2024

This PR 1f36c99 disabled the ReplyGuard.

  • enable ReplyGuard

Resolves #3690

@kostasrim kostasrim self-assigned this Sep 13, 2024
Signed-off-by: kostas <kostas@dragonflydb.io>
@@ -856,11 +856,13 @@ void ReqSerializer::SendCommand(std::string_view str) {

void RedisReplyBuilder2Base::SendNull() {
ReplyScope scope(this);
has_replied_ = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

please set this flag when we drop a scope, not manually everywhere

Copy link
Contributor Author

@kostasrim kostasrim Sep 17, 2024

Choose a reason for hiding this comment

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

I am aware but this would break MCReplyBuilder2. ReplyScope accepts a SinkReplyBuilderv2. However, has_replied_ belongs to a different class, SinkReplyBuilder. The problem is that this argument for RedisReplyBuilder2 would work just fine because the RedisReplyBuilder2Base inherits from: SinkReplyBuilder2, RedisReplyBuilder so it's safe to cast it to RedisReplyBuilder. However this is not the case for MCReplyBuilder2.

I agree has_replied_ should be part of ReplyScope. For this we need:

  1. Clean up the hierarchy of inheritence
  2. Or even introduce a new has_replied_ flag. However this would no work very well because we use SinkReplyBuilder* which would poll the base class flag and we also can't really remove it because we don't want to break previously existed classes

Which both are beyond the scope of this pr

Copy link
Contributor

Choose a reason for hiding this comment

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

it should've been just part of the SinkReplyBuilder2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

uh I was not expecting you would reply early :( I will push a quick change on that once I get a 5 minute free time :)

Although that means we break SinkReplyBuilder. Imo what we can do is just make HasReplied virtual and it will solve all of our problems. I will take care of this.

P.s. glad to see you commenting ❤️

@kostasrim kostasrim merged commit 8a34b3e into main Sep 17, 2024
12 checks passed
@kostasrim kostasrim deleted the kpr2 branch September 17, 2024 10:37
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.

add ReplyGuard in ReplyBuilder2
3 participants