kestra-io / kestra

:zap: Workflow Automation Platform. Orchestrate & Schedule code in any language, run anywhere, 500+ plugins. Alternative to Zapier, Rundeck, Camunda, Airflow...
https://kestra.io
Apache License 2.0
14.43k stars 1.23k forks source link

MySQL 8.0.32 fails with SQL syntax error #2621

Open Ben8t opened 1 year ago

Ben8t commented 1 year ago

Explain the bug

When using MySQL backend (8.0.32) it raises this error:

SQL State  : 42000
Error Code : 1064
Message    : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS PARSE_ISO8601_DURATION(duration VARCHAR(20))
    RETURNS bigint
  ' at line 1
Location   : migrations/mysql/V1_1__initial.sql (/app/file:/app/kestra-ee!/migrations/mysql/V1_1__initial.sql)
Line       : 2
Statement  : CREATE FUNCTION IF NOT EXISTS PARSE_ISO8601_DURATION(duration VARCHAR(20))

@Skraye reproduced and has no problem in MySQL 8.0.31 On arm chipset (mac m2) the error doesn't show up on either 8.0.31 or 8.0.32

Here is a docker-compose to reproduce:

volumes:
  mysql-data:
    driver: local
  kestra-data:
    driver: local

services:

  mysql:
    image: mysql:8.0.32
    environment:
      MYSQL_DATABASE: kestra
      MYSQL_USER: kestra
      MYSQL_PASSWORD: k3str4
      MYSQL_ROOT_PASSWORD: "p4ssw0rd"
    command:
      - --log-bin-trust-function-creators=1
      - --character-set-server=utf8mb4
      - --collation-server=utf8mb4_unicode_ci
      - --server-id=12345
      - --log-bin=mysql-bin
      - --binlog_format=ROW
      - --binlog_row_image=FULL
      - --binlog_expire_logs_seconds=864000
      - --gtid_mode=ON
      - --enforce_gtid_consistency=ON
      - --binlog_rows_query_log_events=ON
    ports:
      - 3306:3306
    volumes:
      - mysql-data:/var/lib/mysql
    networks:
      - local

  kestra:
    image: kestra/kestra:develop-full
    entrypoint: /bin/bash
    user: "root"
    command:
      - -c
      - /app/kestra server standalone --worker-thread=128
    volumes:
      - kestra-data:/app/storage
      - /var/run/docker.sock:/var/run/docker.sock
      - /tmp/kestra-wd:/tmp/kestra-wd
    environment:
      KESTRA_CONFIGURATION: |
        datasources:
          mysql:
            url: jdbc:mysql://mysql:3306/kestra
            driverClassName: com.mysql.cj.jdbc.Driver
            username: kestra
            password: k3str4
            dialect: MYSQL
        kestra:
          variables:
            globals:
                my-var: hello
          repository:
            type: mysql
          storage:
            type: local
            local:
              base-path: "/app/storage"
          queue:
            type: mysql
          server:
            basic-auth:
              enabled: true
              username: admin
              password: kestra
          tasks:
            scripts:
              docker:
                volume-enabled: true
            tmp-dir:
              path: /tmp/kestra-wd/tmp
          url: http://localhost:8080/
          variables:
            env-vars-prefix: ""
    ports:
      - "8080:8080"
    depends_on:
      mysql:
        condition: service_started
    networks:
      - local

networks:
  local: {}

Environment Information

Ben8t commented 1 year ago

cc @Skraye for more details

Ben8t commented 1 year ago

Have the issue on 8.0.mysql_aurora.3.03.2 AWS RDS (MySQL 8.0.26 compatible) but works on 8.0.mysql_aurora.3.05.1 (compatible with MySQL 8.0.32) ✅