Skip to content

Commit c98f8cc

Browse files
authored
docs(readme): document COCOINDEX_LMDB_MAP_SIZE for large codebases (#185) (#187)
Add a Troubleshooting entry for `MDB_MAP_FULL: Environment mapsize limit reached`, explaining the 4 GiB LMDB default and how to raise it via `COCOINDEX_LMDB_MAP_SIZE` (both global_settings.yml `envs:` and shell forms). Note the value is read at daemon startup and that the workaround is temporary pending cocoindex#2108. Cross-link from the Large codebase section.
1 parent 72f6283 commit c98f8cc

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,33 @@ Using uv (install or upgrade):
750750
uv tool install --upgrade cocoindex-code
751751
```
752752

753+
### `MDB_MAP_FULL: Environment mapsize limit reached`
754+
755+
The index is stored in an LMDB database whose maximum size is fixed when the daemon starts. The default ceiling is **4 GiB**, which is plenty for most projects but can be exhausted by very large codebases (tens of thousands of files), especially with high-dimensional embedding models like `nomic-ai/CodeRankEmbed`.
756+
757+
Raise the ceiling with the `COCOINDEX_LMDB_MAP_SIZE` environment variable (value in **bytes**). LMDB only grows the file as data is written, so a high limit doesn't pre-allocate disk — it's safe to set it generously:
758+
759+
```yaml
760+
# ~/.cocoindex_code/global_settings.yml
761+
envs:
762+
COCOINDEX_LMDB_MAP_SIZE: "34359738368" # 32 GiB (= 32 * 1024^3)
763+
```
764+
765+
Or, if you prefer to set it in your shell environment (the daemon inherits it):
766+
767+
```bash
768+
export COCOINDEX_LMDB_MAP_SIZE=$((32 * 1024 * 1024 * 1024)) # 32 GiB
769+
```
770+
771+
The map size is read when the daemon starts, so restart it to pick up the change, then re-index:
772+
773+
```bash
774+
ccc daemon restart
775+
ccc index
776+
```
777+
778+
> This manual step is temporary. Once [cocoindex#2108](https://github.com/cocoindex-io/cocoindex/issues/2108) lands, the map size grows automatically when needed and `COCOINDEX_LMDB_MAP_SIZE` won't be necessary.
779+
753780
## Legacy: Environment Variables
754781

755782
If you previously configured `cocoindex-code` via environment variables, the `cocoindex-code` MCP command still reads them and auto-migrates to YAML settings on first run. We recommend switching to the YAML settings for new setups.
@@ -777,6 +804,8 @@ export COCOINDEX_DISABLE_USAGE_TRACKING=1
777804
## Large codebase / Enterprise
778805
[CocoIndex](https://github.com/cocoindex-io/cocoindex) is an ultra efficient indexing engine that also works on large codebases at scale for enterprises. In enterprise scenarios it is a lot more efficient to share indexes with teammates when there are large or many repos. We also have advanced features like branch dedupe etc designed for enterprise users.
779806

807+
> Indexing a very large codebase and hitting `MDB_MAP_FULL`? Raise the LMDB map size — see [`MDB_MAP_FULL: Environment mapsize limit reached`](#mdb_map_full-environment-mapsize-limit-reached) under Troubleshooting.
808+
780809
If you need help with remote setup, please email our maintainer linghua@cocoindex.io, happy to help!
781810

782811
## Contributing

0 commit comments

Comments
 (0)