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
Optimise Matomo 4 updates #16490
Optimise Matomo 4 updates #16490
Conversation
tsteur
commented
Sep 29, 2020
•
edited
edited
- Fix regression in Matomo 4 that dimension updates where no longer shown see Fix when there are dimension updates they aren't shown in the update screen #16491
- Have quick required schema changes first so UI works mostly (eg user and invalidations table)
- Group more console updates next to each other by reorganising plugin activates etc
- Make sure other dimension updates are executed right away so they don't show a second update screen like below
@@ -53,9 +54,6 @@ public function getMigrations(Updater $updater) | |||
$columnsToAdd = []; | |||
|
|||
$migrations = []; | |||
$migrations[] = $this->migration->db->changeColumnType('log_action', 'name', 'VARCHAR(4096)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should avoid slow updates in the beginning and have some required faster ones first
{ | ||
$updater->executeMigrations(__FILE__, $this->getMigrations($updater)); | ||
|
||
if ($this->usesGeoIpLegacyLocationProvider()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was already present in b1 upgrade
@@ -211,7 +241,23 @@ public function getMigrations(Updater $updater) | |||
$migrations[] = $this->migration->config->set('mail', 'type', 'Cram-md5'); | |||
} | |||
|
|||
// keep piwik_ignore for existing installs | |||
$migrations[] = $this->migration->config->set('Tracker', 'ignore_visits_cookie_name', 'piwik_ignore'); | |||
|
|||
$migrations[] = $this->migration->plugin->activate('PagePerformance'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grouping these config and plugin console updates together
core/Updates/4.0.0-b1.php
Outdated
$migrations[] = $this->migration->db->changeColumnType('log_action', 'name', 'VARCHAR(4096)'); | ||
$migrations[] = $this->migration->db->changeColumnType('log_conversion', 'url', 'VARCHAR(4096)'); | ||
$migrations[] = $this->migration->db->changeColumn('log_link_visit_action', 'interaction_position', 'pageview_position', 'MEDIUMINT UNSIGNED DEFAULT NULL'); | ||
$migrations[] = $this->migration->db->changeColumnTypes('log_visit', array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these dimension updates were missing before
core/Updates/4.0.0-b1.php
Outdated
|
||
/** APP SPECIFIC TOKEN END */ | ||
$migrations[] = $this->migration->db->sql("UPDATE `" . Common::prefixTable('option') | ||
. "` SET option_value = 'VARCHAR(40) NULL1' WHERE option_name= 'version_log_visit.config_browser_name'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO still needs an update for version_log_link_visit_action.pageview_position
* @return Migration[] | ||
* @api | ||
*/ | ||
public function getMigrations(PiwikUpdater $updater) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes dimension updates were no longer executed (or at least not shown in the UI anymore) see #16491
@@ -18,7 +18,6 @@ | |||
class PageViewPosition extends ActionDimension | |||
{ | |||
protected $columnName = 'pageview_position'; | |||
protected $columnType = 'MEDIUMINT UNSIGNED DEFAULT NULL'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to move this into the schema. Otherwise it would generate an update like this:
ALTER TABLE `matomo_log_link_visit_action` ADD COLUMN `pageview_position ` MEDIUMINT UNSIGNED DEFAULT NULL;
That's because Matomo thinks it is a new dimension and doesn't realise the dimension was actually renamed. This add column
alone wouldn't be a problem since the column would already exist and the failure would be ignored. However, it becomes a problem when other dimensions are also changed and the generated SQL looks like this:
ALTER TABLE `matomo_log_link_visit_action` ADD COLUMN `pageview_position ` MEDIUMINT UNSIGNED DEFAULT NULL, ADD COLUMN `other_dimension ` MEDIUMINT UNSIGNED DEFAULT NULL;;
If then the column pageview_position
already exists, the SQL would fail and it would not add the second column anymore.
Updated the PR so things should work now |
@@ -106,10 +128,6 @@ public function getMigrations(Updater $updater) | |||
// Prepare all installed tables for utf8mb4 conversions. e.g. make some indexed fields smaller so they don't exceed the maximum key length | |||
$allTables = DbHelper::getTablesInstalled(); | |||
|
|||
$migrations[] = $this->migration->db->changeColumnType('session', 'id', 'VARCHAR(191)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved those further up since they are quick to execute