-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
What happened?
After updating to Matomo 5.6.1 and enabling the AIAgents plugin, the database migration that should add the ai_agent_name column to matomo_log_visit (formerly piwik_log_visit) reports success in the CLI, but the column is not actually created.
When running:
php /var/www/matomo/console core:updatethe output shows something like:
Executing ALTER TABLE `matomo_log_visit` ADD COLUMN `ai_agent_name` VARCHAR(40) NULL;... Done. [1 / 1]
Matomo has been successfully updated!
However, when checking the table structure afterwards, the ai_agent_name column is missing.
Running the same statement manually:
ALTER TABLE `matomo_log_visit` ADD COLUMN `ai_agent_name` VARCHAR(40) NULL;fails with:
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126.
So the underlying ALTER TABLE fails due to the InnoDB row size limit, but core:update still reports success and hides the error, leaving the schema in an incomplete state while the AIAgents plugin assumes the column exists.
What should happen?
If the ALTER TABLE fails (e.g. with ERROR 1118: row size too large), core:update should:
- not print
Doneand - not report
Matomo has been successfully updated!.
Instead, the database error should be clearly shown in the CLI output and the update should be marked as failed or at least partially failed. This would avoid having a silently incomplete schema.
Additionally, for migrations on very wide tables like matomo_log_visit, Matomo could:
- detect or catch InnoDB row size issues, and
- show a helpful message (for example suggesting
ROW_FORMAT=DYNAMICor restructuring very wide rows) instead of hiding the error.
Right now, the AIAgents plugin ends up in a broken state on large installations: the column is missing, the plugin assumes it is present, and we have to manually debug the problem and perform a heavy operation on a ~30 GB table to fix it.
How can this be reproduced?
This is not reproducible on the public demo because it requires a very large and wide matomo_log_visit table. The issue occurs on a self-hosted installation with:
- Matomo 5.6.1
- AIAgents plugin enabled
- MySQL/MariaDB with InnoDB
matomo_log_visitbeing a very wide table (many columns, including custom dimensions) and ~30 GB in size.
Steps:
-
Use a Matomo instance with a very wide InnoDB
matomo_log_visittable that is close to the InnoDB row size limit (e.g. manyVARCHARcolumns, large table ~30 GB). -
Enable the AIAgents plugin:
php /var/www/matomo/console core:plugin:activate AIAgents
-
Run the update:
php /var/www/matomo/console core:update
-
Observe that the CLI reports:
Executing ALTER TABLE ... ADD COLUMN ai_agent_name ... Done.Matomo has been successfully updated!
-
Check the schema of
matomo_log_visit– theai_agent_namecolumn is missing. -
Execute the migration SQL manually:
ALTER TABLE `matomo_log_visit` ADD COLUMN `ai_agent_name` VARCHAR(40) NULL;
-
You will see:
ERROR 1118 (42000): Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126.
This shows that the migration failed at the DB level, but core:update did not surface the error and still reported a successful update.
Matomo version
5.6.1
PHP version
8.3
Server operating system
AlmaLinux
What browsers are you seeing the problem on?
No response
Computer operating system
No response
Relevant log output
Validations
- Read our Contributing Guidelines.
- Follow our Security Policy.
- Check that there isn't already an issue that reports the same bug to avoid creating duplicates.
- The provided steps to reproduce is a minimal reproducible of the Bug.