FrancescoCastaldi commented on issue #45491:
URL: https://github.com/apache/superset/issues/45491#issuecomment-6524020953

   ### Root Cause Analysis & Solution
   
   In `superset/coordination/cache_backend.py:RedisSentinelCacheBackend`, the 
constructor did not accept a `username` argument, and `master_kwargs` passed to 
`self._sentinel.master_for(master, **master_kwargs)` omitted both `db` and 
`username`.
   
   Because `db` was not forwarded, Sentinel connections were always routed to 
database 0. Furthermore, environments utilizing Redis ACLs with 
`CACHE_REDIS_USER` failed to authenticate because the username was ignored.
   
   #### Solution
   1. Add `username: str | None = None` to `RedisSentinelCacheBackend.__init__`.
   2. Forward `master_kwargs["db"] = db` and `master_kwargs["username"] = 
username` when initializing the master connection.
   3. Read `config.get("CACHE_REDIS_USER", None)` in `from_config`.
   
   Verified with unit tests in 
`tests/unit_tests/coordination/test_cache_backend.py` and committed to branch 
`fix/community-unanswered-issues` (commit `1c4efaf7124`) at 
https://github.com/FrancescoCastaldi/superset/tree/fix/community-unanswered-issues.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to