Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] Schema Dump (MariaDB) #32552

Closed
mvdnbrk opened this issue Apr 26, 2020 · 13 comments · Fixed by #34442
Closed

[8.x] Schema Dump (MariaDB) #32552

mvdnbrk opened this issue Apr 26, 2020 · 13 comments · Fixed by #34442
Assignees

Comments

@mvdnbrk
Copy link
Contributor

mvdnbrk commented Apr 26, 2020

  • Laravel Version: 8.x
  • PHP Version: 7.4
  • Database Driver & Version: 10.4.11-MariaDB

Description:

A schema:dump command is added in Laravel 8.x (PR #32275).
The baseDumpCommand uses --set-gtid-purged=OFF in the MySqlSchemaState class.

https://github.com/laravel/framework/blob/c389f0a4a0dfb411bf7f50edcf543a896299f73b/src/Illuminate/Database/Schema/MySqlSchemaState.php#L78-#L81

MariaDB does not have the --set-gtid-purged option which results in a ProcessFailedException.

Error Output:
mysqldump: unknown variable 'set-gtid-purged=OFF'

@mvdnbrk mvdnbrk changed the title Schema Dump (MariaDB) [8.x] Schema Dump (MariaDB) Apr 26, 2020
@taylorotwell
Copy link
Member

This should be fixed.

@iKlsR
Copy link

iKlsR commented Sep 17, 2020

Encountered this issue and just upgraded to 8.0, running latest MySQL 5.7

mysqldump: unknown variable 'set-gtid-purged=OFF'
mysqldump: unknown variable 'set-gtid-purged=OFF'

   Symfony\Component\Process\Exception\ProcessFailedException

  The command "mysqldump --set-gtid-purged=OFF --skip-add-drop-table --skip-add-locks --skip-comments --skip-set-charset --tz-utc --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" "${:LARAVEL_LOAD_DATABASE}" --routines --result-file="${:LARAVEL_LOAD_PATH}" --no-data" failed.

Exit Code: 7(Unknown error)

Working directory: /app

Output:
================


Error Output:
================
mysqldump: unknown variable 'set-gtid-purged=OFF'

  at vendor/symfony/process/Process.php:252
    248▕      */
    249▕     public function mustRun(callable $callback = null, array $env = []): self
    250▕     {
    251▕         if (0 !== $this->run($callback, $env)) {
  ➜ 252▕             throw new ProcessFailedException($this);
    253▕         }
    254▕
    255▕         return $this;
    256▕     }

      +18 vendor frames
  19  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

@Bouhnosaure
Copy link

Same here !

mysqldump: unknown variable 'set-gtid-purged=OFF'
mysqldump: unknown variable 'set-gtid-purged=OFF'

   Symfony\Component\Process\Exception\ProcessFailedException 

  The command "mysqldump --set-gtid-purged=OFF --skip-add-drop-table --skip-add-locks --skip-comments --skip-set-charset --tz-utc --host="${:LARAVEL_LOAD_HOST}" --port="${:LARAVEL_LOAD_PORT}" --user="${:LARAVEL_LOAD_USER}" --password="${:LARAVEL_LOAD_PASSWORD}" "${:LARAVEL_LOAD_DATABASE}" --routines --result-file="${:LARAVEL_LOAD_PATH}" --no-data" failed.

Exit Code: 7(Unknown error)

Working directory: /app

Output:
================


Error Output:
================
mysqldump: unknown variable 'set-gtid-purged=OFF'

  at vendor/symfony/process/Process.php:252
    248▕      */
    249▕     public function mustRun(callable $callback = null, array $env = []): self
    250▕     {
    251▕         if (0 !== $this->run($callback, $env)) {
  ➜ 252▕             throw new ProcessFailedException($this);
    253▕         }
    254▕ 
    255▕         return $this;
    256▕     }

      +18 vendor frames 
  19  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

Client config :

root@592ea3c7e066:/app# mysqldump --version
mysqldump  Ver 10.17 Distrib 10.3.23-MariaDB, for debian-linux-gnu (x86_64)

@mvdnbrk
Copy link
Contributor Author

mvdnbrk commented Sep 17, 2020

@driesvints can this be reopened?

@mvdnbrk
Copy link
Contributor Author

mvdnbrk commented Sep 17, 2020

I am getting the following. probably related,

  • Ver 15.1 Distrib 10.5.5-MariaDB
  • Laravel 8.4
mysqldump: unknown variable 'column-statistics=0'

@driesvints driesvints reopened this Sep 17, 2020
@taylorotwell
Copy link
Member

Opne a PR to fix what you want.

@taylorotwell
Copy link
Member

I have no idea if this works for MariaDB. I only use MySQL.

@driesvints
Copy link
Member

@iKlsR are you using the latest Laravel version?

@iKlsR
Copy link

iKlsR commented Sep 17, 2020

@driesvints Yes, latest everything. Fresh project and had just upgraded to 8.4 (1c57ab5) as well, php is 7.4, mysql 5.7.31. Running this with docker.

@mvdnbrk
Copy link
Contributor Author

mvdnbrk commented Sep 17, 2020

@iKlsR can you post the output of mysql --version ?

@iKlsR
Copy link

iKlsR commented Sep 17, 2020

Pulled from https://hub.docker.com/r/bitnami/mysql/tags

$ lando mysql --version
mysql  Ver 14.14 Distrib 5.7.29, for Linux (x86_64) using  EditLine wrapper

Ah...

$ lando ssh
www-data@2a89f33458dc:/app$ mysqldump --version
mysqldump  Ver 10.17 Distrib 10.3.23-MariaDB, for debian-linux-gnu (x86_64)

Could a fix be to check the dump command version as well? https://bugs.mysql.com/bug.php?id=72312

@iKlsR
Copy link

iKlsR commented Sep 17, 2020

Ok so poking around a bit, this seems to stem from the mariadb distrib. If I comment out the flag in baseDumpCommand() The schema gets dumped but then I run into #34303 so I guess that might warrant some looking at again as well.

Reading the entire issue listing with this as well as external fixes on this I propose stripping the flags --column-statistics=0 --set-gtid-purged=OFF if the dump version has mariadb or maybe entirely and allow access to the underlying dump executable to allow advanced? users to pass these. If I remove those works as expected and I don't think they are relevant either, you just want a schema dump.

@ludo237
Copy link

ludo237 commented Sep 21, 2020

I don't have any issue at all with MariaDB 10.5.x and latest Laravel 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants