Skip to content

Database backup doesn't include triggers #9036

Closed
@domeglic

Description

@domeglic

Preconditions

Magento CE 2.1.5, PHP 7.0.15, MariaDB 10.0.29.
Have Index in scheduled mode.

Steps to reproduce

  1. Do a database backup with setup:backup --db.
  2. Do a database restore with setup:rollback -d.

Expected result

Database is restored and includes triggers.

Actual result

Database is missing triggers, so indexing doesn't work correctly.

I noticed this problem after several product changes failed to show in the front. I realized the index was not updated and after some debugging found that there were no triggers.
I tried switching index mode to realtime and saving the product so the changes would appear. When switching back to scheduled the triggers were recreated.
I could reliably reproduce the problem afterwards which leads me to assume the problem is in the backup CLI command.

Short way to reproduce:

  1. Magento CE 2.1.8
  2. Create empty test trigger:
    mysql> CREATE TRIGGER test_trigger AFTER INSERT ON catalog_product_entity FOR EACH ROW BEGIN END;
  3. To make sure that trigger was created:
    mysql> SHOW TRIGGERS;
  4. create backup
    php bin/magento setup:backup --db.
  5. Create New DB:
    CREATE DATABASE magento_backup;
  6. import data form backup
    mysql -u root -p magento_backup < "/var/backups/1506349239_db.sql"
  7. Show trigers from buckup:
    mysql> SHOW TRIGGERS from magento_backup;

Expected result

magento_backup have trigger "test_trigger"

Actual result

magento_backup do not have trigger "test_trigger"

Metadata

Metadata

Assignees

Labels

Fixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releasebug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions