From 76f97b195695e70952ea8421908319e5b065a0f4 Mon Sep 17 00:00:00 2001 From: wuwenchi Date: Wed, 7 May 2025 11:58:44 +0800 Subject: [PATCH] [fix](iceberg)Fix the inconsistency between the data in pg and the data in MinIO. (#50578) ### What problem does this PR solve? Problem Summary: Part of the metadata of an Iceberg table is stored in PostgreSQL (PG), while the remaining data files are stored in MinIO. However, the data in PG is saved on the local disk, whereas the data in MinIO is not saved on the local disk. Therefore, when a user modifies the Iceberg table and then restarts Docker, at this time, the data in PG is the data after the user's modification, but the data in MinIO has not been updated to the modified version. So, the data in MinIO should also be saved on the local disk. In this way, we can ensure the consistency of the data between PG and MinIO. --- .../docker-compose/iceberg/iceberg.yaml.tpl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docker/thirdparties/docker-compose/iceberg/iceberg.yaml.tpl b/docker/thirdparties/docker-compose/iceberg/iceberg.yaml.tpl index 43e786e4e48e78..9ba8987d02bf97 100644 --- a/docker/thirdparties/docker-compose/iceberg/iceberg.yaml.tpl +++ b/docker/thirdparties/docker-compose/iceberg/iceberg.yaml.tpl @@ -107,6 +107,8 @@ services: - MINIO_ROOT_USER=admin - MINIO_ROOT_PASSWORD=password - MINIO_DOMAIN=minio + volumes: + - ./data/input/minio_data:/data networks: doris--iceberg: aliases: @@ -130,11 +132,14 @@ services: entrypoint: > /bin/sh -c " until (/usr/bin/mc config host add minio http://minio:9000 admin password) do echo '...waiting...' && sleep 1; done; - /usr/bin/mc rm -r --force minio/warehouse; - /usr/bin/mc mb minio/warehouse; - /usr/bin/mc policy set public minio/warehouse; - echo 'copy data'; - mc cp -r /mnt/data/input/minio/warehouse/* minio/warehouse/; + if /usr/bin/mc ls minio/warehouse > /dev/null 2>&1; then + echo 'minio/warehouse already exists, skipping creation and copy.'; + else + echo 'Creating minio/warehouse and copying data...'; + /usr/bin/mc mb minio/warehouse; + /usr/bin/mc policy set public minio/warehouse; + /usr/bin/mc cp -r /mnt/data/input/minio/warehouse/* minio/warehouse/; + fi " networks: