You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In DeliciousBrains\WPMDB\Common\Cli\Cli->migrate_tables(), we're updating the progress bar by comparing the rows processed to the total number of rows in the table. The total number of rows in the table is obtained by querying TABLE_ROWS from INFORMATION_SCHEMA.TABLES. The problem is that according to the MySQL INFORMATION_SCHEMA documentation, for InnoDB, the TABLE_ROWS value is estimated.
For tables with a large number of rows, this may cause the actual number of rows processed to exceed the total number of rows in the database, leading to the "must be greater than or equal to 0" error.
Workaround / Fix
As a simple fix, we can check that $increment is greater than or equal to zero before calling tick():
We encountered a bug while running
wp migrated export
on one of our databases with many rows in the wp_postmeta table.Error
Further research
In DeliciousBrains\WPMDB\Common\Cli\Cli->migrate_tables(), we're updating the progress bar by comparing the rows processed to the total number of rows in the table. The total number of rows in the table is obtained by querying TABLE_ROWS from INFORMATION_SCHEMA.TABLES. The problem is that according to the MySQL INFORMATION_SCHEMA documentation, for InnoDB, the TABLE_ROWS value is estimated.
For tables with a large number of rows, this may cause the actual number of rows processed to exceed the total number of rows in the database, leading to the "must be greater than or equal to 0" error.
Workaround / Fix
As a simple fix, we can check that $increment is greater than or equal to zero before calling tick():
The progress bar may not be accurate, but at least the entire export will not fail.
A better fix would be to call
select count(*)
to obtain the precise number of rows in the table, but that may come with performance implications.Lastly, I think it would make sense to add a flag to disable the progress bar if desired.
The text was updated successfully, but these errors were encountered: