kaizendorks / kaizendorks/pymongo_inmemory
`is_locked` does not work in a persistent context
- Dominant language
- Python
- Stars
- 53
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
I’m working with a persistent storage behind a « in memory » instance of Mongodb. It seems that `Mongod.is_locked` check for lock presence, while `mongod` leave the file (empty of PID) after a successful shutdown..
To reproduce the issue, you simply need to reuse the same directory after a successful shutdown.
I’d suggest that you move the `is_locked` method to something similar to this:
```
@property
def is_locked(self):
lock_file = os.path.join(self.data_folder, "mongod.lock")
if not os.path.exists(lock_file):
return False
return os.path.getsize(lock_file) != 0
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Search the repository for the `is_locked` method and inspect how the persistent data directory is reused after shutdown. Reproduce the issue by starting and stopping a MongoDB instance, then starting another instance with the same directory. Done means an existing empty `mongod.lock` is treated as unlocked and the reuse case succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- databases, testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100