Support directory lock
- Dominant language
- C++
- Stars
- 2.8k
- Forks
- 551
- PR merge metrics
- No merged PRs in 30d
Description
- Store the lock mark in FileInfo
- Store the lock mark in namespace, and remove the mark when the lock is released. Keep a copy of lock list in memory.
- Rebuild the lock list when Nameserver restarts. For each locked dir, add all the files under this dir to incomplete list. (Nameserver restarts does not change the dir locking status)
- Regarding HA: the lock mark should send to slaves/followers via Sync
- API should includes LockDir and UnlockDir
- 在FileInfo中持久化locked标记
- 给目录加锁时将namespace中对应目录的标记位置位,解决锁时将对应标记位清除,同时内存中维护一个已加锁的目录列表
- nameserver重启时,Rebuild过程中发现该目录被锁,则scan时,将其下所有文件的block扔到incomplete列表中,将对应目录的状态恢复为已加锁(即name server重启时,并不掉锁)
- HA时的处理:lock unlock都是写namespace,所以天然持久化,若发生切主,则同nameserver重启走相同流程
- 结构:LockDir和UnlockDir
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the existing FileInfo and namespace persistence paths, then inspect Nameserver rebuild, Sync, and the API entry points mentioned in the issue. Verify how LockDir and UnlockDir should update the in-memory lock list, restore locks after restart or failover, and place files under locked directories in the incomplete list; done means these behaviors work for normal operation and HA.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- distributed-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100