ioredis icon indicating copy to clipboard operation
ioredis copied to clipboard

zdiff commande ignore keyPrefix

Open liavsitruk opened this issue 3 years ago • 2 comments

Hi,

It looks like zdiff command ignores the keyPrefix variable in the RedisOptions (inherited from CommanderOptions.) I used redis-cli monitor command to validate this. In other commands (like zrange for example) the prefix added to the key.

Example: this.redis = new Redis(redisAddress, {keyPrefix: 'myKeyPrefix:', db: redisDbIndex});

this.redis.zdiff(2, key1, key2); // in monitor: "zdiff" "2" "key1" "key2"

this.redis.zrange(key1, 0, -1); // in monitor: "zrange" "myKeyPrefix:key1" "0" "-1"

Thanks

liavsitruk avatar May 30 '22 18:05 liavsitruk

Hi @liavsitruk 👋 ,

This is a bug that some newly added commands do not support keyPrefix well. I created a PR for this: https://github.com/luin/ioredis/pull/1610.

However, I'm not sure we should release this bugfix as a non-major version as it could break your code if you manually prefix myKeyPrefix: to zdiff. I'd like to learn how did you mitigate the issue in your code? Did you ditch keyPrefix at all or patch newly added commands manually?

luin avatar Jun 25 '22 03:06 luin

Hi zihua,

Thank you for your comment. I patch newly added commands manually, so fix this bug as non major version will indeed break my code.

Hope this will help you. Thank, Liav

On Jun 25, 2022 06:29, Zihua Li @.***> wrote:

Hi @liavsitrukhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fliavsitruk&data=05%7C01%7Cliav.sitruk%40centrical.com%7Cb7dc3a12810c4480a12508da565ae790%7Cba06581fd8b240a09e9c8194052a8828%7C0%7C0%7C637917245704410681%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=nOCfKQUkd7zgyuIcQyrMavKhR%2FAh%2Fy9FmHLjD7DiQ7M%3D&reserved=0 👋 ,

This is a bug that some newly added commands do not support keyPrefix well. I created a PR for this: #1610https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fluin%2Fioredis%2Fpull%2F1610&data=05%7C01%7Cliav.sitruk%40centrical.com%7Cb7dc3a12810c4480a12508da565ae790%7Cba06581fd8b240a09e9c8194052a8828%7C0%7C0%7C637917245704410681%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=3SxLiw7x0MasMvJxCExqJTQpEwnAMmiBVLzxUYAdiDM%3D&reserved=0.

However, I'm not sure we should release this bugfix as a non-major version as it could break your code if you manually prefix myKeyPrefix: to zdiff. I'd like to learn how did you mitigate the issue in your code? Did you ditch keyPrefix at all or patch newly added commands manually?

— Reply to this email directly, view it on GitHubhttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fluin%2Fioredis%2Fissues%2F1591%23issuecomment-1166181871&data=05%7C01%7Cliav.sitruk%40centrical.com%7Cb7dc3a12810c4480a12508da565ae790%7Cba06581fd8b240a09e9c8194052a8828%7C0%7C0%7C637917245704410681%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5VvkxifFTjqKSTsJ6I%2F5tKrs9BeHUdENKrRXUvvDLHg%3D&reserved=0, or unsubscribehttps://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAOAM7XWDU5VCJJPJJANJIODVQZ4JLANCNFSM5XLK7WZA&data=05%7C01%7Cliav.sitruk%40centrical.com%7Cb7dc3a12810c4480a12508da565ae790%7Cba06581fd8b240a09e9c8194052a8828%7C0%7C0%7C637917245704410681%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zKk%2F%2FR3F%2F4cVjWOV6J2Hx%2F9P5omF7O8aRMsgrqzc3s0%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

liavsitruk avatar Jun 27 '22 11:06 liavsitruk