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

FIX: Redis to handle event metadata. #3320

Merged
merged 4 commits into from Jan 25, 2024

Conversation

artursouza
Copy link
Member

@artursouza artursouza commented Jan 19, 2024

Description

Redis does not handle event metadata at all. We had a P0 issue in runtime that was discovered because of Pulsar pubsub and it could not be reproduced with Redis because of inconsistency of handling event metadata - in this case, Redis simply drops it. This PR brings the Redis component (stable) at the same level of compatibility we should have across beta and stable pubsub components (IMO) regarding event metadata handling. This is not a P0 (IMO), it will just block the E2E test to reproduce the P0 bug we will need to fix.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Related to the following issues:

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

RELEASE_NOTE: FIXED Redis pubsub now handles event metadata.

Signed-off-by: Artur Souza <asouza.pro@gmail.com>
@artursouza artursouza requested review from a team as code owners January 19, 2024 23:46
metadataBytes := metadataValue.(string)
err := json.Unmarshal([]byte(metadataBytes), &metadata)
if err != nil {
r.logger.Warnf("Could not extract metadata for Redis message %s: %v", msg.ID, err)
Copy link
Member Author

Choose a reason for hiding this comment

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

This seems to be better than getting the message stuck because metadata could not be handled.

Signed-off-by: Artur Souza <asouza.pro@gmail.com>
yaron2
yaron2 previously approved these changes Jan 20, 2024
Copy link
Contributor

@ItalyPaleAle ItalyPaleAle left a comment

Choose a reason for hiding this comment

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

Since there's no linked issue, can you please explain what this PR does and why it's needed?

We are past the code freeze phase, so this should probably be merged when the 1.14 merge window opens, unless there's a P0 issue attached to it.

@artursouza
Copy link
Member Author

artursouza commented Jan 20, 2024

I can create a specific issue if this needs further discussion. I created two issues that this PR is part of. Basically, bringing consistency across pubsub components regarding handling of pubsub metadata.

This will only block our integration or E2E tests to reproduce the bug I am fixing for 1.13 - which is a P0 as it makes pubsub unusable for some components with gRPC subscriber.

@artursouza
Copy link
Member Author

artursouza commented Jan 20, 2024

Since there's no linked issue, can you please explain what this PR does and why it's needed?

We are past the code freeze phase, so this should probably be merged when the 1.14 merge window opens, unless there's a P0 issue attached to it.

See the updated description and my comment. This fix can wait until 1.14 but we will not have E2E tests to validate the hotfix for 1.13 - which I can do manually. Of course, we can add yet-another-pubsub to E2E tests, but I don't think it is the right path since this is a basic inconsistency in pubsub that should be fixed (not P0).

@ItalyPaleAle
Copy link
Contributor

@artursouza my .02:

  • If this is needed primarily to unblock an E2E test in runtime, I'd prefer if it were added to the in-memory pubsub component for 1.13
  • If we agree that all components should support metadata (or at least expose a feature flag for those who do support that or not), then we should have a conformance test to validate this, or the implementation could end up being "patchwork-y"

I'd prefer avoiding adding new features to a "tier 1" component (with a large user base like Redis) when we're already in endgame. But I can be open if other maintainers agree this is the best path forward.

@artursouza
Copy link
Member Author

@artursouza my .02:

  • If this is needed primarily to unblock an E2E test in runtime, I'd prefer if it were added to the in-memory pubsub component for 1.13

  • If we agree that all components should support metadata (or at least expose a feature flag for those who do support that or not), then we should have a conformance test to validate this, or the implementation could end up being "patchwork-y"

I'd prefer avoiding adding new features to a "tier 1" component (with a large user base like Redis) when we're already in endgame. But I can be open if other maintainers agree this is the best path forward.

In-memory pubsub does not work for e2e because the subscriber is not the same app as the publisher. While the test can exist with another pubsub, I found it odd for such a basic feature not be supported by all beta and stable pubsub. If this behavior is not standard, then we should add a new column to the feature set of pubsub components. As you see, I opened an issue to discuss the expected behavior for pubsubs and see what others think.

In the worst case, I can add this feature behind a component metadata flag for those that need it.

@berndverst
Copy link
Member

@artursouza @yaron2
please update conformance tests to introduce a new test that we can use to check metadata is passed to the subscriber. We should enable that for Redis here and the other pubsub components for which we know this to be working.

Copy link
Member

@berndverst berndverst left a comment

Choose a reason for hiding this comment

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

I will approve this, but I really think you should add conformance tests.

I will not block on conformance tests, but that is the right thing to do.

My only blocking comment is to please prefix the error message with the component name as I have suggested. This helps with troubleshooting or grepping for similar logs (to see prevalence of an issue etc etc).

Beyond that I am fine merging this.

pubsub/redis/redis.go Outdated Show resolved Hide resolved
pubsub/redis/redis.go Show resolved Hide resolved
ItalyPaleAle
ItalyPaleAle previously approved these changes Jan 25, 2024
Copy link
Contributor

@ItalyPaleAle ItalyPaleAle left a comment

Choose a reason for hiding this comment

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

Given that @berndverst and @yaron2 both agree to include this, I'm fine too. Thanks for your patience :)

Signed-off-by: Bernd Verst <github@bernd.dev>
@berndverst berndverst dismissed stale reviews from ItalyPaleAle and yaron2 via 7dbbc24 January 25, 2024 20:24
@berndverst
Copy link
Member

I took the liberty to apply my suggested log prefix. LGTM now.

@berndverst berndverst modified the milestones: v1.12, v1.13 Jan 25, 2024
@berndverst berndverst merged commit 0c687df into dapr:main Jan 25, 2024
85 of 87 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.

None yet

4 participants