Code Monkey home page Code Monkey logo

Comments (5)

TBeijen avatar TBeijen commented on June 17, 2024

The aforementioned change makes tests fail so more investigation is needed.

I'd really like to look into this but any hints in how to reproduce would be very helpful.

The pattern that emerges so far is that when the bug occurs, the idx value in the following line (hash_ring.py) is always number_of_redis_backends*128:

return (self.ring[self.sorted_keys[idx]], idx)

This problem occurs when using the sharding client.

from django-redis.

niwinz avatar niwinz commented on June 17, 2024

Hi!

Thanks for report it!

You can give me a number of redis backends are you using? Is just for try reproduce this bug an make a test case for it.

from django-redis.

 avatar commented on June 17, 2024

Nice! Thanks a lot for the fix :)

from django-redis.

TBeijen avatar TBeijen commented on June 17, 2024

Nice to know that it's fixed.

I was recently looking into it a bit but hadn't had the time too create a testcase for it.

What I found out was that in all cases where the error occured, the idx resulting from the bisect was replicas*nodes: 256 for 2 shards set-up, 512 for a system where we have 4 redis shards.
As to be expected the hash generated from the keys was always something in the 'fff...rest_of_hash' range.

What puzzles me though is why the min() statement doesn't correct the index to become (replicas*nodes)-1. I'm probably overlooking something but debug efforts until now showed this should have worked as expected (meaning: prevent indexError by correcting the bisect result to the highest available index).

Anyway, the fix has the nice side-effect that hashes starting like '000....' will result in idx -1, which turns the sorted hashes in a true ring without the last ranges being merged to the last node.

Thx again!

from django-redis.

niwinz avatar niwinz commented on June 17, 2024

Thank you for reporting errors and help make this library more robust :D

from django-redis.

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.