OpenAtomFoundation / pikiwidb

a high-performance, large-capacity, multi-tenant, data-persistent, strong data consistency based on raft, Redis-compatible elastic KV data storage system based on RocksDB
BSD 3-Clause "New" or "Revised" License
201 stars 63 forks source link

lock difference between PikiwiDB and pika about string set command implementation #254

Closed hahahashen closed 7 months ago

hahahashen commented 7 months ago

Is this a regression?

No

Description

When I compare pika and pikiwidb code, looking at storage code in redis_strings.cc related to string set command, pikiwidb has an extra line which aims to declare a ScopeRecordLock object to try to get a lock, why pika does not need a lock here, but pikiwidb needs it? 当我在对比pika和pikiwidb之间关于string类型set 命令的实现时,发现pikiwidb多了一行代码,这行代码声明一个对象去获取锁,为什么在这里pika不需要获取锁而pikiwidb却需要呢 1 2 3

Please provide a link to a minimal reproduction of the bug

No response

Screenshots or videos

1 2 3

Please provide the version you discovered this bug in (check about page for version information)

Commit Hash:e065fdfb0ec40215c125356b4362246f597a66d8

Anything else?

No response

hahahashen commented 7 months ago

comment from Mixficsol: Pika的cmd层有key锁,所以到storage这一层就不需要上了,pikiwidb的话目前还没有写binlog逻辑,在client层没有上key锁,所以需要在storage层上锁

Issues-translate-bot commented 7 months ago

Bot detected the issue body's language is not English, translate it automatically.


comment from Mixficsol: Pika's cmd layer has a key lock, so there is no need to lock it on the storage layer. Pikiwidb has not written binlog logic yet, and there is no key lock on the client layer, so it needs to be locked on the storage layer.