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

Java: Address pubsub PR comments #1773

Merged

Conversation

jduo
Copy link
Collaborator

@jduo jduo commented Jul 3, 2024

Issue #, if available:

Description of changes:
Address some of the comments in #1662 about aligning with Python:

  • Remove spublish() and provide a cluster-only publish() overload that takes a boolean.
  • Match argument order for publish() with Python.
  • Add missing integration tests.
  • Undo splitting of integration tests.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jduo
Copy link
Collaborator Author

jduo commented Jul 3, 2024

@ikolomi FYI

@jduo jduo mentioned this pull request Jul 3, 2024
5 tasks
@jduo
Copy link
Collaborator Author

jduo commented Jul 3, 2024

FYI @eifrah-aws

@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from aeeb2c8 to f3a0600 Compare July 3, 2024 15:12
@jduo jduo marked this pull request as ready for review July 3, 2024 15:12
@jduo jduo requested a review from a team as a code owner July 3, 2024 15:12
@jduo
Copy link
Collaborator Author

jduo commented Jul 3, 2024

@ikolomi @eifrah-aws @Yury-Fridlyand
I'll work on adding the missing integration tests in a separate PR.

@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from 8472e14 to f5e9262 Compare July 3, 2024 17:29
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand left a comment

Choose a reason for hiding this comment

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

I think we need a new IT which proves that GS approach works.

@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from 09b5e49 to 29828b4 Compare July 4, 2024 01:30
@jduo
Copy link
Collaborator Author

jduo commented Jul 4, 2024

I think we need a new IT which proves that GS approach works.

All tests use the GlideString variants of functions and PubSubMessage internally use GlideString. Do you mean to test messages that are non-UTF-8-encodable?

@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from 29828b4 to d66b9c6 Compare July 4, 2024 16:12
@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from c66172c to 6cbcf46 Compare July 4, 2024 17:37
cause.printStackTrace();

// Unwrap. Only works for Exceptions and not Errors.
throw ((MessageHandler.MessageCallbackException) cause).getCause();
Copy link
Collaborator

Choose a reason for hiding this comment

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

where it goes to after rethrowing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Netty catches and logs it. I think Netty will re-use the thread after.

@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from 6cbcf46 to 3cd69eb Compare July 4, 2024 18:55
@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from 3cd69eb to 1bcbbe9 Compare July 4, 2024 20:51
@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from 1bcbbe9 to 00abbdb Compare July 4, 2024 21:37
@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from 4b000d5 to b1e01d5 Compare July 4, 2024 23:29
jduo added 15 commits July 4, 2024 17:33
Also add GlideString version of OK constant (named TOK from Python)
* Use GlideString for MessageHandler responses
* Have GlideString overloads for PubSub comamnds return String instead of GlideString OKs.
Add the following tests from Python:
* pubsub_exact_max_size_message
* pubsub_sharded_max_size_message
* pubsub_exact_max_size_message_callback
* pubsub_sharded_max_size_message_callback
Supply a message with the exception being logged and fix the output when printing an exception
* Senders do not need subscriptions/callbacks.
* Correct validating the pattern by checking that the optional is empty instead of null.
* Use 512MB messages for max-size tests
* Make client cleanup match the other tests
@jduo jduo force-pushed the java/dev_jduo_pubsub_pr_comments branch from b1e01d5 to aeb8ee7 Compare July 5, 2024 00:35
jduo added 2 commits July 4, 2024 17:42
Exceptions from the callback now escape the netty handler.
This will get Netty to log it.
We also explicitly log the the Glide log and System.err
@Elen-Ghulam Elen-Ghulam merged commit 43f1017 into valkey-io:main Jul 5, 2024
17 checks passed
cyip10 pushed a commit to Bit-Quill/valkey-glide that referenced this pull request Jul 16, 2024
* Remove spublish and provide two overloads for publish

* Change publish argument order to match Python

* Explicitly prevent the context being non-null and the callback being null

* Parameterize three_publishing_clients_same_name_with_sharded

* Address PR feedback

* Add GlideString versions of pubsub commands

Also add GlideString version of OK constant (named TOK from Python)

* PubSubMessages should use GlideStrings instead of String

* Spotless

* Address PR comments

* Use GlideString for MessageHandler responses
* Have GlideString overloads for PubSub comamnds return String instead of GlideString OKs.

* Have GlideString log byte array hash

* Add pubsub MaxSize integration tests (disabled)

Add the following tests from Python:
* pubsub_exact_max_size_message
* pubsub_sharded_max_size_message
* pubsub_exact_max_size_message_callback
* pubsub_sharded_max_size_message_callback

* Improve exception logging.

Supply a message with the exception being logged and fix the output when printing an exception

* Add exception-from-callback test

* Make the callback exception error handling test pass

* PubSub Test fixes

* Senders do not need subscriptions/callbacks.
* Correct validating the pattern by checking that the optional is empty instead of null.
* Use 512MB messages for max-size tests
* Make client cleanup match the other tests

* Add pub-sub testing with non-UTF-8 data

* Simplify the non-String PubSub test

* Remove stale TODOs

* Change pubsub callback exception handling to pass through Netty

Exceptions from the callback now escape the netty handler.
This will get Netty to log it.
We also explicitly log the the Glide log and System.err
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants