fix(engine): update logical dump flow to start existing dump container (#383)
Description
Updated logic for logicalDump job to check if dump container is already present start it
Related issue
Examples
- start dblab server with logicalDump configuration and running
dblab_ld_xxx
container: - stopped
dblab_server
anddblab_ld_xxx
container - started
dblab_server
- logs from
dblab_server
,dblab_ld
container was identified and started:
Checklist
-
MR description has been reviewed -
MR changes are functionally tested -
MR does NOT have text changes OR there are text changes and they have been reviewed -
MR does NOT have API/CLI changes OR there are API/CLI changes and they have been reviewed -
MR does NOT have UI changes OR there are UI changes and they have been reviewed
Closes #383 (closed)
Edited by Artyom Kartasov
Merge request reports
Activity
added Bug Prioritymedium SizeS good first issue techbackend labels
assigned to @denis256
test
demonstrate the problem in the current version of DLE and fix it using an image from this MR.
Image:
postgresai/dblab-server:3.1.1
ubuntu@ip-172-31-11-169:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4463856524a9 postgresai/extended-postgres:14 "docker-entrypoint.s…" 7 seconds ago Up 7 seconds (health: starting) 5432/tcp dblab_ld_c8cic40rn5fmbqu0olo0 8ad58e3b73f9 postgresai/dblab-server:3.1.1 "docker-entrypoint.s…" 22 seconds ago Up 21 seconds 0.0.0.0:2345->2345/tcp, :::2345->2345/tcp dblab_server ubuntu@ip-172-31-11-169:~$ sudo docker stop dblab_server dblab_server ubuntu@ip-172-31-11-169:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ce418a65e674 postgresai/ce-ui:latest "/docker-entrypoint.…" 19 seconds ago Up 17 seconds 2346/tcp, 0.0.0.0:2346->80/tcp, :::2346->80/tcp dblab_embedded_ui_c8cic40rn5fmbqu0olo0 4463856524a9 postgresai/extended-postgres:14 "docker-entrypoint.s…" 27 seconds ago Up 26 seconds (healthy) 5432/tcp dblab_ld_c8cic40rn5fmbqu0olo0 ubuntu@ip-172-31-11-169:~$ sudo docker stop dblab_ld_c8cic40rn5fmbqu0olo0 dblab_ld_c8cic40rn5fmbqu0olo0 ubuntu@ip-172-31-11-169:~$ sudo docker start dblab_server dblab_server ubuntu@ip-172-31-11-169:~$ ubuntu@ip-172-31-11-169:~$ sudo docker logs -n 10 dblab_server 2022/06/16 17:26:56 runners.go:106: [DEBUG] Run(Local): "docker images postgresai/ce-ui:latest --quiet" 2022/06/16 17:26:56 dump.go:239: [INFO] Run job: logicalDump 2022/06/16 17:26:56 tools.go:402: [INFO] Docker image "postgresai/extended-postgres:14" already exists locally 2022/06/16 17:26:56 tools.go:133: [DEBUG] Virtualization system: docker 2022/06/16 17:26:56 tools.go:143: [DEBUG] [{bind /home/ubuntu/.dblab/engine/meta /home/dblab/meta false 0xc000493578 <nil> <nil>} {bind /var/lib/dblab/dblab_pool/dump /var/lib/dblab/dblab_pool/dump false 0xc000493590 <nil> <nil>} {bind /sys/kernel/debug /sys/kernel/debug false 0xc0004935a8 <nil> <nil>} {bind /lib/modules /lib/modules true 0xc0004935c0 <nil> <nil>} {bind /proc /host_proc true 0xc0004935d8 <nil> <nil>} {bind /var/run/docker.sock /var/run/docker.sock false 0xc0004935f0 <nil> <nil>} {bind /var/lib/dblab/dblab_pool/data /var/lib/dblab/dblab_pool/data false 0xc000493608 <nil> <nil>} {bind /home/ubuntu/.dblab/engine/configs /home/dblab/configs true 0xc000493620 <nil> <nil>}] 2022/06/16 17:26:56 dump.go:276: [ERROR] Error response from daemon: Conflict. The container name "/dblab_ld_c8cic40rn5fmbqu0olo0" is already in use by container "4463856524a9ee66984139dfd38ec7558573c72578272422ab041593e8746e28". You have to remove (or rename) that container to be able to reuse that name. 2022/06/16 17:26:56 main.go:179: [ERROR] Failed to run the data retrieval service: failed to create container "dblab_ld_c8cic40rn5fmbqu0olo0": Error response from daemon: Conflict. The container name "/dblab_ld_c8cic40rn5fmbqu0olo0" is already in use by container "4463856524a9ee66984139dfd38ec7558573c72578272422ab041593e8746e28". You have to remove (or rename) that container to be able to reuse that name. 2022/06/16 17:26:56 main.go:180: [INFO] If you have problems or questions, please contact Postgres.ai: https://postgres.ai/contact 2022/06/16 17:26:56 runners.go:151: [DEBUG] Run(Local): output "40e6283d6e61" 2022/06/16 17:26:56 main.go:172: [ERROR] Failed to start embedded UI container: failed to prepare Docker image for embedded UI: Error response from daemon: Conflict. The container name "/dblab_embedded_ui_c8cic40rn5fmbqu0olo0" is already in use by container "ce418a65e674441a96e68853d3e5909e38a2ecf421c7982fb3624dff221a7a70". You have to remove (or rename) that container to be able to reuse that name.
Image:
registry.gitlab.com/postgres-ai/database-lab/dblab-server:383-logical-dump-container-startup
ubuntu@ip-172-31-11-169:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 0bdd831517e3 postgresai/extended-postgres:14 "docker-entrypoint.s…" 1 second ago Up Less than a second (health: starting) 5432/tcp dblab_ld_c8cic40rn5fmbqu0olo0 0b207109efa3 registry.gitlab.com/postgres-ai/database-lab/dblab-server:383-logical-dump-container-startup "docker-entrypoint.s…" 15 seconds ago Up 14 seconds 0.0.0.0:2345->2345/tcp, :::2345->2345/tcp dblab_server ubuntu@ip-172-31-11-169:~$ sudo docker stop dblab_server dblab_server ubuntu@ip-172-31-11-169:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 25ed5ccc1fa7 postgresai/ce-ui:latest "/docker-entrypoint.…" 17 seconds ago Up 16 seconds 2346/tcp, 0.0.0.0:2346->80/tcp, :::2346->80/tcp dblab_embedded_ui_c8cic40rn5fmbqu0olo0 0bdd831517e3 postgresai/extended-postgres:14 "docker-entrypoint.s…" 21 seconds ago Up 20 seconds (healthy) 5432/tcp dblab_ld_c8cic40rn5fmbqu0olo0 ubuntu@ip-172-31-11-169:~$ sudo docker stop dblab_ld_c8cic40rn5fmbqu0olo0 dblab_ld_c8cic40rn5fmbqu0olo0 ubuntu@ip-172-31-11-169:~$ sudo docker start dblab_server dblab_server
from DLE log:
2022/06/16 17:32:20 dump.go:240: [INFO] Run job: logicalDump 2022/06/16 17:32:20 tools.go:402: [INFO] Docker image "postgresai/extended-postgres:14" already exists locally 2022/06/16 17:32:20 tools.go:133: [DEBUG] Virtualization system: docker 2022/06/16 17:32:20 tools.go:143: [DEBUG] [{bind /lib/modules /lib/modules true 0xc00000d908 <nil> <nil>} {bind /proc /host_proc true 0xc00000d920 <nil> <nil>} {bind /var/run/docker.sock /var/run/docker.sock false 0xc00000d938 <nil> <nil>} {bind /var/lib/dblab/dblab_pool/data /var/lib/dblab/dblab_pool/data false 0xc00000d950 <nil> <nil>} {bind /home/ubuntu/.dblab/engine/configs /home/dblab/configs true 0xc00000d968 <nil> <nil>} {bind /home/ubuntu/.dblab/engine/meta /home/dblab/meta false 0xc00000d980 <nil> <nil>} {bind /var/lib/dblab/dblab_pool/dump /var/lib/dblab/dblab_pool/dump false 0xc00000d998 <nil> <nil>} {bind /sys/kernel/debug /sys/kernel/debug false 0xc00000d9b0 <nil> <nil>}] 2022/06/16 17:32:20 dump.go:303: [INFO] Running container: dblab_ld_c8cic40rn5fmbqu0olo0. ID: 0bdd831517e36fe1a8be2cb6a3f55555c0a5210dd526ec82bf4cde45f1ef97dc 2022/06/16 17:32:20 dump.go:313: [INFO] Waiting for container readiness
Result: test passed
Edited by Vitaliy Kukharik- Resolved by Artyom Kartasov
test for logical restore container
Result:
Conflict. The container name "/dblab_lr_c8cic40rn5fmbqu0olo0" is already in use by container "7eefe3451a5933ca7213170e50c268e2246613aa5ee518ba30c4936965fa497f"
ubuntu@ip-172-31-11-169:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7eefe3451a59 postgresai/extended-postgres:14 "docker-entrypoint.s…" 1 second ago Up 1 second (health: starting) 5432/tcp dblab_lr_c8cic40rn5fmbqu0olo0 c59533ab3240 postgresai/ce-ui:latest "/docker-entrypoint.…" 44 seconds ago Up 42 seconds 2346/tcp, 0.0.0.0:2346->80/tcp, :::2346->80/tcp dblab_embedded_ui_c8cic40rn5fmbqu0olo0 579b51411fdb registry.gitlab.com/postgres-ai/database-lab/dblab-server:383-logical-dump-container-startup "docker-entrypoint.s…" 47 seconds ago Up 45 seconds 0.0.0.0:2345->2345/tcp, :::2345->2345/tcp dblab_server ubuntu@ip-172-31-11-169:~$ sudo docker stop dblab_server dblab_server ubuntu@ip-172-31-11-169:~$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7eefe3451a59 postgresai/extended-postgres:14 "docker-entrypoint.s…" 17 seconds ago Up 17 seconds (healthy) 5432/tcp dblab_lr_c8cic40rn5fmbqu0olo0 c59533ab3240 postgresai/ce-ui:latest "/docker-entrypoint.…" About a minute ago Up 58 seconds 2346/tcp, 0.0.0.0:2346->80/tcp, :::2346->80/tcp dblab_embedded_ui_c8cic40rn5fmbqu0olo0 ubuntu@ip-172-31-11-169:~$ sudo docker stop dblab_lr_c8cic40rn5fmbqu0olo0 dblab_lr_c8cic40rn5fmbqu0olo0 ubuntu@ip-172-31-11-169:~$ sudo docker start dblab_server dblab_server
From DLE log:
2022/06/16 17:41:09 restore.go:168: [INFO] Run job: logicalRestore 2022/06/16 17:41:09 restore.go:181: [INFO] The data directory "/var/lib/dblab/dblab_pool/data" is not empty. Existing data may be overwritten. 2022/06/16 17:41:09 tools.go:402: [INFO] Docker image "postgresai/extended-postgres:14" already exists locally 2022/06/16 17:41:09 tools.go:133: [DEBUG] Virtualization system: docker 2022/06/16 17:41:09 tools.go:143: [DEBUG] [{bind /home/ubuntu/.dblab/engine/configs /home/dblab/configs true 0xc00021b2c0 <nil> <nil>} {bind /home/ubuntu/.dblab/engine/meta /home/dblab/meta false 0xc00021b2 d8 <nil> <nil>} {bind /var/lib/dblab/dblab_pool/dump /var/lib/dblab/dblab_pool/dump false 0xc00021b2f0 <nil> <nil>} {bind /sys/kernel/debug /sys/kernel/debug false 0xc00021b308 <nil> <nil>} {bind /lib/module s /lib/modules true 0xc00021b320 <nil> <nil>} {bind /proc /host_proc true 0xc00021b338 <nil> <nil>} {bind /var/run/docker.sock /var/run/docker.sock false 0xc00021b350 <nil> <nil>} {bind /var/lib/dblab/dblab _pool/data /var/lib/dblab/dblab_pool/data false 0xc00021b368 <nil> <nil>}] 2022/06/16 17:41:09 main.go:179: [ERROR] Failed to run the data retrieval service: failed to create container "dblab_lr_c8cic40rn5fmbqu0olo0": Error response from daemon: Conflict. The container name "/dblab_ lr_c8cic40rn5fmbqu0olo0" is already in use by container "7eefe3451a5933ca7213170e50c268e2246613aa5ee518ba30c4936965fa497f". You have to remove (or rename) that container to be able to reuse that name. 2022/06/16 17:41:09 main.go:180: [INFO] If you have problems or questions, please contact Postgres.ai: https://postgres.ai/contact
Edited by Vitaliy Kukharik
mentioned in issue #383 (closed)
- Automatically resolved by Denis O
- Automatically resolved by Denis O
- Automatically resolved by Denis O
- Automatically resolved by Denis O
@denis256 Please select reviewers for a Merge Request when it is ready for review
added 1 commit
- 03b45d34 - Add generic logic for handling existing containers
added 1 commit
- f5d5bd4b - Add generic logic for handling existing containers
Please register or sign in to reply