preaction / Minion-Backend-mysql

MySQL backend for the 🐙 Minion job runner
Other
7 stars 14 forks source link

flair.minion_workers doesn't exist #39

Closed toddbruner closed 1 year ago

toddbruner commented 2 years ago

I'm trying to run the following on a Ubuntu 18.04 system with Mysql Ver 8.0.29. (Minion::Backend::mysql v.1.000, Minion v.10.25, Mojolicious 9.26, perl 5.34.1)

my $minion  = Minion->new(mysql => 'mysql://user:pass@localhost/db1');
my $worker  = $minion->worker;
$worker->run;

I get the following error: DBD::mysql::st execute failed: Table 'flair.minion_workers' doesn't exist at /opt/perl/lib/site_perl/5.34.1/Minion/Backend/mysql.pm line 604.

On another 18.04 system with the same versions EXCEPT Mysql (5.7 in this case), I do not get the error.

I start with a "clean" database before hand, e.g. drop database and create the database and application tables using Migrations in Mojo::mysql. After running on mysql 5.7 system, I see the following minion related tables:

minion_jobs
minion_jobs_depends 
minion_locks          
minion_notes          
minion_workers  
minion_workers_inbox

on the mysql 8 system, I only see:

minion_jobs 
minion_jobs_depends

Am I doing something wrong, or could there be an error in the "built-in" minion table migration for mysql backend? Thanks, Todd

toddbruner commented 2 years ago

I extracted the migrations from data section of ./Minion/Backend/mysql.pm and tried running them using:

$db->migrations->from_file('my_minion_extract.sql')->migrate(0)->migrate;

where $db is a Mojo::mysql instance. The resulting error is:

DBD::mysql::st execute failed: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) at /opt/perl/lib/site_perl/5.34.1/Mojo/mysql/Migrations.pm line 125.

Going to investigate what this means.

toddbruner commented 2 years ago

Looking further at this, Stack Overflow had this helpful article: https://stackoverflow.com/questions/56389698/why-super-privileges-are-disabled-when-binary-logging-option-is-on

So I disabled this protection as suggested by one of the replies and now the migration fully completes. Maybe you can add this to documentation for others facing this problem. Thanks for the excellent module!

preaction commented 1 year ago

Yeah, that's a great idea, thanks! I've added the new docs to v1.001 and pushed it to CPAN.