Search code examples
docker-composeprestominio

Cannot PUT/GET objects in MinIO (MacOS)


Thank you for reading!

We are running Presto along with Minio using docker-compose:

  minio:
    image: minio/minio:RELEASE.2021-08-31T05-46-54Z
    container_name: minio
    ports:
      - 9094:9000
      - 9001:9001
    environment:
      MINIO_ACCESS_KEY: minio
      MINIO_SECRET_KEY: minio123
      MINIO_REGION: us-east-1
    command: server /data --console-address ":9001"
    mem_limit: 512m

  presto:
    image: ahanaio/prestodb-sandbox:0.250
    container_name: presto
    ports:
      - 9095:8080
    volumes: 
      - ./presto/minio.properties:/opt/presto-server/etc/catalog/minio.properties
      - ./presto/create-table.sql:/opt/create-table.sql
      - ./presto/sync-partitions.sql:/opt/sync-partitions.sql
    mem_limit: 1024m

We upload a bunch of data to minio, and then create a subdirectory with the following Presto SQL:

use minio.default;

CREATE TABLE orders ( 
  "name" array(varchar)
  "year" int, 
  "month" tinyint, 
  "day" tinyint) 
WITH (
  format='JSON', 
  external_location='s3a://orders-local/json/',
  partitioned_by=ARRAY['year', 'month', 'day']
  );

After executing the SQL statement, developers on our team are seeing inconsistent results in the orders-local bucket. In some cases, the json directory is present. In others, it is not present.

We are all running the same docker containers. So far, we are only seeing the issue on some MacOS instances, but not all. We have also ruled out OS version as we see successes and failures in Big Sur as well as Catalina.

Does anyone have experience with this kind of inconsistency?


Solution

  • Our environment variables are being overwritten by values in ~/.aws

    We can't resolve why the env vars are not being honored, but we know this line is the culprit:

    config.WithDefaultRegion(os.Getenv("STORAGE_REGION"))

    We successfully get the right region with the os.Getenv() call, however config still pulls the value from our $HOME/.aws/config file.

    So it seems that the presence of a .aws/config file takes precedence over the environment variables.