Gidsik commented on issue #5909:
URL: https://github.com/apache/couchdb/issues/5909#issuecomment-3993790593
Yes it seems like volumes part is crucial...
But I am sure that both files and volumes stays intact on host part, I run
setup with different services inside containers with their data mounted to host
filesystem and there was no issue.
I was able to reproduce bug running all steps on other physical disk with
running Process Monitor in background to check if other processes interfere
with couchdb files.
There was windows defender, but i disabled it and result was the same.
Only com.docker.backend.exe was accessing ./data folder and only DllHost.exe
(so couchdb container) was accessing subfolders and files inside ./data folder.
### More info about my setup:
Windows 11 Pro 25H2, OS build 26200.7462
WSL version: 2.6.3.0
Kernel version: 6.6.87.2-1
Docker version 29.1.3, build f52814d
tried also with image: couchdb:3.5.0
> I'll be able to try to reproduce this on different physical machine with
similar setup within a week
### With binded host:container volumes:
all actions from temp folder on different physical disk for testing purpose
> `F:/.temp/compose.yaml`
```compose.yaml
name: test-couchdb
services:
couchdb:
image: couchdb:latest
container_name: couchdb
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=admin
restart: always
volumes:
- ${PWD}/data:/opt/couchdb/data
- ${PWD}/etc:/opt/couchdb/etc/local.d
ports:
- 5984:5984
```
> Clean setup powershell history:
```
PS F:\.temp> tree /F .\
Folder PATH listing
Volume serial number is <redacted>
F:\.TEMP
docker-compose.yml
PS F:\.temp> docker-compose up -d
[+] Running 2/2
✔ Network test-couchdb_default Created
0.3s
✔ Container couchdb Started
PS F:\.temp> curl -X PUT http://admin:admin@localhost:5984/test-db
{"ok":true}
PS F:\.temp> tree /F .\
Folder PATH listing
Volume serial number is <redacted>
F:\.TEMP
│ docker-compose.yml
│
├───data
│ │ _dbs.couch
│ │ _nodes.couch
│ │
│ ├───.delete
│ └───shards
│ ├───00000000-7fffffff
│ │ test-db.1772570414.couch
│ │
│ └───80000000-ffffffff
│ test-db.1772570414.couch
│
└───etc
docker.ini
PS F:\.temp> curl -H "Content-Type: application/json" -X POST
http://admin:admin@localhost:15984/test-db/_compact
{"ok":true}
PS F:\.temp> curl http://admin:admin@localhost:5984/test-db
{"error":"error","reason":"{badmatch,{error,enoent}}"}
```
### Without volumes, completely inside container
Works fine indeed, but in this case there is no way to preserve data
reliably except setting automated backups from within container to host over
some file transfer protocol...
> `F:/.temp/compose.yaml`
```compose.yaml
name: test-couchdb
services:
couchdb:
image: couchdb:latest
container_name: couchdb
environment:
- COUCHDB_USER=admin
- COUCHDB_PASSWORD=admin
restart: always
ports:
- 5984:5984
```
> Clean setup powershell history:
```
PS F:\.temp> docker-compose up -d
[+] Running 2/2
✔ Network test-couchdb_default Created
0.3s
✔ Container couchdb Started
0.7s
PS F:\.temp> curl http://admin:admin@localhost:15984/test-db
{"error":"not_found","reason":"Database does not exist."}
PS F:\.temp> curl -X PUT http://admin:admin@localhost:15984/test-db
{"ok":true}
PS F:\.temp> curl http://admin:admin@localhost:15984/test-db
{"instance_start_time":"1772570563","db_name":"test-db","purge_seq":"0-g1AAAABPeJzLYWBgYMpgTmHgzcvPy09JdcjLz8gvLskBCeexAEmGBiD1HwiyEhlwqEtkSKqHKMgCAIT2GV4","update_seq":"0-g1AAAACLeJzLYWBgYMpgTmHgzcvPy09JdcjLz8gvLskBCeexAEmGBiD1HwiyMpgTGXKBAuzmxoZJSamp6HpwmJLIkFSPot0oyTTRzDIJXXEWABp_Kt4","sizes":{"file":16692,"external":0,"active":0},"props":{},"doc_del_count":0,"doc_count":0,"disk_format_version":8,"compact_running":false,"cluster":{"q":2,"n":1,"w":1,"r":1}}
PS F:\.temp> curl -H "Content-Type: application/json" -X POST
http://admin:admin@localhost:15984/test-db/_compact
{"ok":true}
PS F:\.temp> curl http://admin:admin@localhost:15984/test-db
{"instance_start_time":"1772570563","db_name":"test-db","purge_seq":"0-g1AAAABPeJzLYWBgYMpgTmHgzcvPy09JdcjLz8gvLskBCeexAEmGBiD1HwiyEhlwqEtkSKqHKMgCAIT2GV4","update_seq":"0-g1AAAACLeJzLYWBgYMpgTmHgzcvPy09JdcjLz8gvLskBCeexAEmGBiD1HwiyMpgTGXKBAuzmxoZJSamp6HpwmJLIkFSPot0oyTTRzDIJXXEWABp_Kt4","sizes":{"file":33082,"external":0,"active":0},"props":{},"doc_del_count":0,"doc_count":0,"disk_format_version":8,"compact_running":false,"cluster":{"q":2,"n":1,"w":1,"r":1}}
```
> edited compose.yaml to bring back volumes within same setup
```
PS F:\.temp> docker-compose up -d
[+] Running 1/1
✔ Container couchdb Started
2.3s
PS F:\.temp> curl http://admin:admin@localhost:15984/test-db
{"error":"not_found","reason":"Database does not exist."}
PS F:\.temp> curl -X PUT http://admin:admin@localhost:15984/test-db
{"ok":true}
PS F:\.temp> curl http://admin:admin@localhost:15984/test-db
{"instance_start_time":"1772570647","db_name":"test-db","purge_seq":"0-g1AAAABPeJzLYWBgYMpgTmHgzcvPy09JdcjLz8gvLskBCeexAEmGBiD1HwiyEhlwqEtkSKqHKMgCAIT2GV4","update_seq":"0-g1AAAACLeJzLYWBgYMpgTmHgzcvPy09JdcjLz8gvLskBCeexAEmGBiD1HwiyMpgTGXKBAuyGScaWFqam6HpwmJLIkFSPot3S0NAsMdUcXXEWAOs0Kik","sizes":{"file":16692,"external":0,"active":0},"props":{},"doc_del_count":0,"doc_count":0,"disk_format_version":8,"compact_running":false,"cluster":{"q":2,"n":1,"w":1,"r":1}}
PS F:\.temp> curl -H "Content-Type: application/json" -X POST
http://admin:admin@localhost:15984/test-db/_compact
{"ok":true}
PS F:\.temp> curl http://admin:admin@localhost:15984/test-db
{"error":"error","reason":"{badmatch,{error,enoent}}"}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]