Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ideawu,您好:
对于Redis协议中del命令无法删除除Key-value以外(hash,zset,queue)的数据,在#810与#1178中均有提到.
对于这个问题您在问题#810中的答复为先知道类型再进行删除的方案,这一点我是认同的,从您的源码也能看出这样的设计原则.但是在某些情况下,使用SSDB自定的命令可能不太合适.
如果是单实例的SSDB,客户端直接连接SSDB,直接发送自定义命令hclear/zclear/qclear即可删除对应的数据,但是如果是SSDB集群,并且使用twemproxy进行负载均衡以及容量扩充,由于twemproxy的问题,其本身连一些redis的命令都无法做到支持(比如flushdb,keys之类的,不支持也情有可原),对于SSDB所定义的这些更加特殊的自定义方法并不能很好的进行转发(会导致TwemProxy断开连接).在此场景下,唯一能够对数据库中数据进行删除的命令就只剩del了,而ssdb的del专指(key)del,这将导致在此环境下,SSDB只能增加hash/zset/queue的存储,而不能进行数据的删除.
请您原谅我冒昧提出的Pr.我所更改的部分只是将原本属于key-value的del命令更改为kdel,并将原来del/hclear/zclear/qclear四个函数所做工作集中整合至新的del命令,代码与原来的部分基本一致,所以对于主从部分场景下的功能没有做测试,如果有什么bug在里边,还希望您能斧正,谢谢.