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

MTG-661 Add redis pool messenger #81

Merged
merged 12 commits into from
Oct 17, 2024

Conversation

n00m4d
Copy link
Contributor

@n00m4d n00m4d commented Oct 7, 2024

What

This PR adds the ability for the messenger to stream data to multiple, separate Redis instances (not a cluster). Additionally, the Redis feature was removed since it's redundant, as Redis is the only supported queue service.

Why

With these changes, a single Geyser plugin can stream data to two different Redis instances, allowing one Solana node to feed data to multiple, separate indexers.

How

The Messenger trait has been slightly refactored, and a new trait called MessageStreamer was introduced, which only handles write-related methods. A new entity, RedisPoolMessenger, was added to implement MessageStreamer and enable streaming to multiple Redis instances.

plerkle_messenger/src/plerkle_messenger.rs Show resolved Hide resolved
MessengerType::Redis => {
RedisMessenger::new(config).await.map(|a| Box::new(a) as Box<dyn Messenger>)
}
_ => Err(MessengerError::ConfigurationError {
msg: "This Messenger type is not valid, unimplemented or you dont have the right crate features on.".to_string()
msg: "This Messenger type is not valid, unimplemented or you don't have the right crate features on.".to_string()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Its no longer based on crate features right so could just delete last part of comment?

Copy link
Contributor

@danenbm danenbm Oct 15, 2024

Choose a reason for hiding this comment

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

I don't think the last part of comment was removed, but its fine it was a nit comment anyways so still approving the PR

Comment on lines -131 to +194
Value::Data(bytes) => bytes,
Value::BulkString(bytes) => bytes,
Copy link
Contributor

Choose a reason for hiding this comment

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

What causes this change to be needed? I see its handled as Value::BulkString in recv as well but I don't see a config change for this. Will this be a breaking change for someone with existing redis config? Should we match both Value::Data and Value::BulkString?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Redis crate update causes these changes. It was updated from 0.22.3 to 0.27.2, so Value enum was slightly changed. In previous version Data was representing arbitrary binary data and now BulkString is representing it.
Don't think that we should mathch it somehow because internal data type was not changed, it's still Vec<u8>.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok that should be fine then as it sounds like not a breaking change for users of previous versions of plerkle messenger.

danenbm
danenbm previously approved these changes Oct 15, 2024
Copy link
Contributor

@danenbm danenbm left a comment

Choose a reason for hiding this comment

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

Approved with couple minor comment

stream.local_buffer_last_flush.elapsed().as_millis()
);
return Ok(());
} else {

Choose a reason for hiding this comment

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

NIT: you not need else statement here as far as inside upper block you call return

RequescoS
RequescoS previously approved these changes Oct 16, 2024
@RequescoS
Copy link

Great work!

@n00m4d n00m4d dismissed stale reviews from RequescoS and danenbm via 4e41a9b October 17, 2024 10:00
@n00m4d n00m4d merged commit 63ae0d3 into metaplex-foundation:main Oct 17, 2024
1 check 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.

4 participants