Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[HttpFoundation] Allow RedisCluster class for RedisSessionHandler#28251

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@michaelperrin
Copy link
Contributor

QA
Branch?4.1
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR

TheRedisSessionHandler added in Symfony 4.1 was supposed to acceptRedisCluster instances but that possibility was not in the condition, leading to anInvalidArgumentException.

I formatted the object type condition to allow theRedisCluster instance value and also added a test for it.

A double space formatting issue has been fixed too (which is included in the same commit, I can change that if needed).

I could not add a test using RedisCluster, as the installed Redis instance on Travis doesn't use clusters.

@michaelperrinmichaelperrinforce-pushed thefix/redis-session-allow-cluster branch fromec7d4aa to0ed7dbdCompareAugust 23, 2018 18:23
@michaelperrinmichaelperrin changed the titleAllow RedisCluster class for RedisSessionHandler[HttpFoundation] Allow RedisCluster class for RedisSessionHandlerAug 23, 2018
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

Thanks

!$redisinstanceof \RedisArray &&
!$redisinstanceof \RedisCluster &&
!$redisinstanceof \Predis\Client &&
!$redisinstanceof RedisProxy

Choose a reason for hiding this comment

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

Missing\, same in the docblock

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Do you talk about the RedisProxy class? That one is imported at the top of the class.

Choose a reason for hiding this comment

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

Right sorry!

michaelperrin reacted with thumbs up emoji
if (
!$redisinstanceof \Redis &&
!$redisinstanceof \RedisArray &&
!$redisinstanceof \RedisCluster &&
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@nicolas-grekas Just to make things easier to see, this is the condition I added

!$redisinstanceof \RedisArray &&
!$redisinstanceof \RedisCluster &&
!$redisinstanceof \Predis\Client &&
!$redisinstanceof RedisProxy

Choose a reason for hiding this comment

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

Right sorry!

michaelperrin reacted with thumbs up emoji
nicolas-grekas added a commit that referenced this pull requestAug 24, 2018
This PR was merged into the 3.4 branch.Discussion----------[travis] enable Redis cluster| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Will allow testing#28251 alsoCommits-------f245df4 [travis] enable Redis cluster
@nicolas-grekasnicolas-grekas added this to the4.1 milestoneAug 24, 2018
@nicolas-grekas
Copy link
Member

@michaelperrin I added a Redis cluster in#28255. Can you please rebase and add a test case by taking inspiration from this PR?

@michaelperrinmichaelperrinforce-pushed thefix/redis-session-allow-cluster branch 2 times, most recently fromd10fa94 to08e92bfCompareAugust 24, 2018 16:31
@michaelperrin
Copy link
ContributorAuthor

Thank you very much@nicolas-grekas, that is indeed useful to have a Redis cluster for tests.

I updated tests in order to use it for tests usingRedisSessionHandler.

I didn't get why an extraRedis instance was created to make checks after values are written, instead of using the same Redis connection instance.
The "validator" instance was always using theRedis class connecting to a given host (thus not working when using RedisCluster).

To make everything work, I removed the validator in tests and used instead theredisClient instance, which is of the correct type whatever the test.

Maybe you or@dkarlovi will know purpose of thevalidator Redis instance.

Could you make sure that my changes are alright then? If everything looks fine, I will squash commits into one.

@dkarlovi
Copy link
Contributor

Validator is supposed to be used to connect to the test version of Redis and confirm the intended action happened regardless of the adapter used. Probably shouldn't be changed, but you be the judge, I'm on mobile.

@stof
Copy link
Member

@dkarlovi but shouldn't thisredisClient be used to connect to redis ? That way, it works for RedisCluster too (otherwise, you would connect to the wrong redis)

@michaelperrin
Copy link
ContributorAuthor

Thanks@dkarlovi for your insight :) I better understand now why you added this other instance.
I would say that it may not be necessary as it is like testing if the Redis libraries work correctly, but I would prefer to be sure.

If we decide it is better to keep the "validator" instance, I will override the other methods in the newRedisClusterSessionHandlerTest class to make things work.

@dkarlovi
Copy link
Contributor

The idea is to have a stand-alone instance which independently confirms the intended action happened. Otherwise the adapter is testing itself and we're supposed to trust it implicitly.

@nicolas-grekas
Copy link
Member

it is like testing if the Redis libraries work correctly

I agree with this statement, so I'm fine with a single Redis connection personally.

@nicolas-grekasnicolas-grekasforce-pushed thefix/redis-session-allow-cluster branch from08e92bf tod2ecea0CompareAugust 26, 2018 08:23
@nicolas-grekas
Copy link
Member

Thank you@michaelperrin.

@nicolas-grekasnicolas-grekas merged commitd2ecea0 intosymfony:4.1Aug 26, 2018
nicolas-grekas added a commit that referenced this pull requestAug 26, 2018
…Handler (michaelperrin)This PR was squashed before being merged into the 4.1 branch (closes#28251).Discussion----------[HttpFoundation] Allow RedisCluster class for RedisSessionHandler| Q             | A| ------------- | ---| Branch?       | 4.1 <!-- see below -->| Bug fix?      | yes| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->| BC breaks?    | no     <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets |    <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        |The `RedisSessionHandler` added in Symfony 4.1 was supposed to accept `RedisCluster` instances but that possibility was not in the condition, leading to an `InvalidArgumentException`.I formatted the object type condition to allow the `RedisCluster` instance value and also added a test for it.A double space formatting issue has been fixed too (which is included in the same commit, I can change that if needed).I could not add a test using RedisCluster, as the installed Redis instance on Travis doesn't use clusters.Commits-------d2ecea0 [HttpFoundation] Allow RedisCluster class for RedisSessionHandler
@michaelperrin
Copy link
ContributorAuthor

Thanks@nicolas-grekas for the merge and the help!
Looking forward to next Symfony (minor) release :)

@dkarlovi
Copy link
Contributor

Nice work@michaelperrin! 👍

@michaelperrin
Copy link
ContributorAuthor

@dkarlovi It is based on your work, so thanks to you ;)

@fabpotfabpot mentioned this pull requestAug 28, 2018
@xabbuhxabbuh added the Cache labelMar 8, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@stofstofstof approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

6 participants

@michaelperrin@nicolas-grekas@dkarlovi@stof@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp