Coder Social home page Coder Social logo

Comments (11)

kennethfan avatar kennethfan commented on June 11, 2024 1

you are right
I agree with you

from lettuce.

kennethfan avatar kennethfan commented on June 11, 2024

io.lettuce.core.masterreplica.ReadOnlyCommands. READ_ONLY_COMMANDS contains geo like command

image
image

from lettuce.

kennethfan avatar kennethfan commented on June 11, 2024

redis/redis#4084

GEORADIUS cannot be executed on readonly slave node #4084

from lettuce.

tishun avatar tishun commented on June 11, 2024

redis/redis#4084

GEORADIUS cannot be executed on readonly slave node #4084

Oh man, what a mess ...

Would using the GEORADIUS_RO work in your case? Do you have a solution to your problem?

from lettuce.

kennethfan avatar kennethfan commented on June 11, 2024

I create a new class, and use reflection to modify the field ReadOnlyCommands. READ_ONLY_COMMANDS before my custom LettuceClientConfigurationBuilderCustomizer initialize
it works

however, i think is a bug in Lettuce, so i report it as a bug

from lettuce.

kennethfan avatar kennethfan commented on June 11, 2024
public class ReadOnlyCommandsFix {
    public static void fixRoCommands() throws NoSuchFieldException, IllegalAccessException {
        Class clazz = ReadOnlyCommands.class;
        Field field = clazz.getDeclaredField("READ_ONLY_COMMANDS");
        field.setAccessible(true);
        Set<CommandType> originReadOnlyCommands = (Set<CommandType>) field.get(null);
        Set<CommandType> geoCommands = originReadOnlyCommands.stream()
                .filter(e -> e.name().startsWith("GEO"))
                .collect(Collectors.toSet());
        originReadOnlyCommands.removeAll(geoCommands);
    }
}

this is my way to resolve it , it is ugly

from lettuce.

tishun avatar tishun commented on June 11, 2024

Can you elaborate more on why you need to remove them from the list in this way?
Is some part of your code depending on iterating over the list?
I assume you can't make a check there?

I agree that the GEORADIUS and GEORADIUSBYMEMBER commands do not belong to this list and we need to remove them. The other GEO* commands in the list should be read-only so they need not be removed.

from lettuce.

kennethfan avatar kennethfan commented on June 11, 2024

Beacause I have not fund a way to modify or extend the ReadOnlyCommands.isReadOnlyCommand method
So I use a bad way to resolve it
I have not test all the geo like commands, so I remove all the geo like commands, it is not exact

from lettuce.

kennethfan avatar kennethfan commented on June 11, 2024

Perhaps Eval should also be removed

from lettuce.

thachlp avatar thachlp commented on June 11, 2024

Hi @tishun, @kennethfan I checked and removed some not read-only commands on the list. Please help review 🙇

from lettuce.

tishun avatar tishun commented on June 11, 2024

Beacause I have not fund a way to modify or extend the ReadOnlyCommands.isReadOnlyCommand method So I use a bad way to resolve it I have not test all the geo like commands, so I remove all the geo like commands, it is not exact

There is a way to do that, see #2568 (comment)

Perhaps Eval should also be removed

This has been fixed since 6.3.x

from lettuce.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.