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

Flushing Redis Cluster using Predis 2.0.2 is not supported #45530

Closed
ranbahar opened this issue Jan 5, 2023 · 3 comments · Fixed by #45544
Closed

Flushing Redis Cluster using Predis 2.0.2 is not supported #45530

ranbahar opened this issue Jan 5, 2023 · 3 comments · Fixed by #45544
Labels

Comments

@ranbahar
Copy link

ranbahar commented Jan 5, 2023

  • Laravel Version: 9..46.0
  • PHP Version: 8.1

Description:

When the cache driver is Redis the app isn't started (CACHE_DRIVER=redis)
I'm getting "Predis\Command\ServerFlushDatabase" not found when I searched this class on the Predis package I saw that they remove it from the current source code.

Steps To Reproduce:

Update predis/predis to version 2.0.2, update the env to CACHE_DRIVER=redis, and run the app.

Logs:

[2023-01-05 17:29:32] local.CRITICAL: []Class "Predis\Command\ServerFlushDatabase" not found  T:0.3708 M:40.50MB  
  
[2023-01-05 17:29:32] local.DEBUG: Exception class (Error) StackTrace:
#0 /var/www/vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(233): Illuminate\Redis\Connections\PredisClusterConnection->flushdb()
#1 /var/www/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(668): Illuminate\Cache\RedisStore->flush()
#2 /var/www/vendor/laravel/framework/src/Illuminate/Cache/Console/ClearCommand.php(80): Illuminate\Cache\Repository->__call('flush', Array)
#3 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Cache\Console\ClearCommand->handle()
#4 /var/www/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#5 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#6 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#7 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#8 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(178): Illuminate\Container\Container->call(Array)
#9 /var/www/vendor/symfony/console/Command/Command.php(308): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#10 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(148): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#11 /var/www/vendor/symfony/console/Application.php(1014): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Cache\Console\ClearCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symf
ony\Component\Console\Output\ConsoleOutput))
#13 /var/www/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Co
nsoleOutput))
#15 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\Con
soleOutput))
#16 /var/www/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
@driesvints driesvints added the bug label Jan 5, 2023
@driesvints
Copy link
Member

Thanks for reporting. @tillkruss what would be the upgrade path here?

@tillkruss
Copy link
Collaborator

It's Predis\Command\ServerFlushDatabase on 1.x and Predis\Command\Redis\FLUSHDB on 2.x

This needs to be adjusted in:
https://github.com/laravel/framework/blob/9.x/src/Illuminate/Redis/Connections/PredisClusterConnection.php

The method Predis\Connection\Cluster\PredisCluster::executeCommandOnNodes() has been removed as it is possible to achieve the same by iterating over the connection or, even better, over the client instance in order to execute the same command against all of the registered connections.

@tillkruss tillkruss changed the title Predis version 2.0.2 is not supported ("Predis\Command\ServerFlushDatabase" not found) Flushing Redis Cluster using Predis 2.0.2 is not supported Jan 5, 2023
@driesvints
Copy link
Member

@tillkruss can you give #45544 a review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants