Closed chejinge closed 2 weeks ago
In these changes, the PikaServer
class has been updated to improve clarity and accuracy in slot management processes. The primary focus was renaming bgsave_protector_
to bgslots_protector_
to better reflect its role. Furthermore, the related slot operations were adjusted and conditioned checks were refined. This ensures better code readability and synchronization in background slot management.
File | Change Summary |
---|---|
include/pika_server.h | Renamed bgsave_protector_ to bgslots_protector_ and updated associated slot management methods |
src/pika_server.cc | Updated Bgslotsreload and Bgslotscleanup to use bgslots_protector_ and refined condition checks |
sequenceDiagram
participant User
participant PikaServer
participant DB
User->>PikaServer: Trigger Bgslotsreload
PikaServer->>DB: Check IsBgSaving
alt IsBgSaving = false
PikaServer->>PikaServer: Acquire bgslots_protector_
PikaServer->>DB: Reload Slots
PikaServer->>PikaServer: Release bgslots_protector_
end
User->>PikaServer: Trigger Bgslotscleanup
PikaServer->>DB: Check IsBgSaving
alt IsBgSaving = false
PikaServer->>PikaServer: Acquire bgslots_protector_
PikaServer->>DB: Cleanup Slots
PikaServer->>PikaServer: Release bgslots_protector_
end
In the server's code so bright, Slots are managed with delight. Renamed to protect and reload, Ensuring data flows in a constant mode. With
bgslots
guards standing tall, PikaServer now heeds the performance call.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
这里是为了bgsave和slots cleanup相互制衡,但是使用了 pika server中的bgsaveinfo,但是pika_server中的bgsave_info_没有赋值,应该使用 DB中的,考虑到codis slot迁移只能支持一个DB这里暂时没有考虑多DB 场景
Summary by CodeRabbit
Refactor
Bug Fixes