8000 Run tests with MySQL 8.0 by mneudert · Pull Request #23373 · matomo-org/matomo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Run tests with MySQL 8.0 #23373

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

Draft
wants to merge 9 commits into
base: 5.x-dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions .github/workflows/matomo-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,19 @@ jobs:
fail-fast: ${{ inputs.is_preview == true }}
matrix:
type: [ 'UnitTests', 'SystemTestsPlugins', 'SystemTestsCore', 'IntegrationTestsCore', 'IntegrationTestsPlugins' ]
php: [ '7.2', '8.2', '8.4' ]
engine: [ 'Mysql', 'Mariadb' ]
adapter: [ 'PDO_MYSQL', 'MYSQLI' ]
exclude:
environment:
- php: '7.2'
engine: 'Mariadb'
- php: '8.2'
engine: 'Mysql'
- php: '8.4'
engine: 'Mariadb'
- php: '7.2'
adapter: 'MYSQLI'
version: '5.7'
adapter: 'PDO_MYSQL'
- php: '8.2'
adapter: 'MYSQLI'
- php: '8.4'
engine: 'Mariadb'
version: '11.4'
adapter: 'PDO_MYSQL'
- php: '8.4'
engine: 'Mysql'
version: '8.0'
adapter: 'MYSQLI'
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -77,15 +74,16 @@ jobs:
path: matomo
ref: ${{ inputs.ref || github.ref }}
- name: running tests
uses: matomo-org/github-action-tests@main
uses: matomo-org/github-action-tests@mysql-version
with:
test-type: ${{ matrix.type }}
mysql-driver: ${{ matrix.adapter }}
mysql-engine: ${{ matrix.engine }}
php-version: ${{ matrix.php }}
mysql-driver: ${{ matrix.environment.adapter }}
mysql-engine: ${{ matrix.environment.engine }}
mysql-version: ${{ matrix.environment.version }}
php-version: ${{ matrix.environment.php }}
redis-service: true
artifacts-pass: ${{ secrets.ARTIFACTS_PASS }}
upload-artifacts: ${{ matrix.php == '7.2' }}
upload-artifacts: ${{ matrix.environment.php == '7.2' }}
testomatio: ${{ secrets.TESTOMATIO_INTEGRATION }}
Javascript:
runs-on: ubuntu-24.04
Expand All @@ -99,7 +97,7 @@ jobs:
path: matomo
ref: ${{ inputs.ref || github.ref }}
- name: running tests
uses: matomo-org/github-action-tests@main
uses: matomo-org/github-action-tests@mysql-version
with:
test-type: 'JS'
php-version: '7.2'
Expand All @@ -116,7 +114,7 @@ jobs:
path: matomo
ref: ${{ inputs.ref || github.ref }}
- name: running tests
uses: matomo-org/github-action-tests@main
uses: matomo-org/github-action-tests@mysql-version
with:
test-type: 'Client'
node-version: '16'
Expand All @@ -136,7 +134,7 @@ jobs:
path: matomo
ref: ${{ inputs.ref || github.ref }}
- name: running tests
uses: matomo-org/github-action-tests@main
uses: matomo-org/github-action-tests@mysql-version
with:
ui-test-options: '--num-test-groups=4 --test-group=${{ matrix.parts }}'
test-type: 'UI'
Expand Down
11 changes: 11 additions & 0 deletions core/Db/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,17 @@ public function optimizeTables(array $tables, bool $force = false): bool
return $this->getSchema()->optimizeTables($tables, $force);
}

/**
* Returns if the database engine can provide a rollup ranking query result
* without needing additional sorting.
*
* @return bool
*/
public function supportsRankingRollupWithoutExtraSorting(): bool
{
return $this->getSchema()->supportsRankingRollupWithoutExtraSorting();
}

/**
* Returns if the database engine is able to use sorted subqueries
*
Expand Down
5 changes: 5 additions & 0 deletions core/Db/Schema/Mariadb.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,9 @@ public function isOptimizeInnoDBSupported(): bool
$semanticVersion = strstr($version, '-', $beforeNeedle = true);
return version_compare($semanticVersion, '10.1.1', '>=');
}

public function supportsRankingRollupWithoutExtraSorting(): bool
{
return false;
}
}
5 changes: 5 additions & 0 deletions core/Db/Schema/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,11 @@ public function isOptimizeInnoDBSupported(): bool
return version_compare($semanticVersion, '10.1.1', '>=');
}

public function supportsRankingRollupWithoutExtraSorting(): bool
{
return true;
}

public function supportsSortingInSubquery(): bool
{
return true;
Expand Down
8 changes: 8 additions & 0 deletions core/Db/SchemaInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ public function isOptimizeInnoDBSupported(): bool;
*/
public function optimizeTables(array $tables, bool $force = false): bool;

/**
* Returns if the database engine can provide a rollup ranking query result
* without needing additional sorting.
*
* @return bool
*/
public function supportsRankingRollupWithoutExtraSorting(): bool;

/**
* Returns if the database engine is able to use sorted subqueries
*
Expand Down
19 changes: 18 additions & 1 deletion core/RankingQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public function generateRankingQuery($innerQuery, bool $withRollup = false)
";
}

if (false === strpos(' LIMIT ', $innerQuery) && !Schema::getInstance()->supportsSortingInSubquery()) {
if (false === strpos($innerQuery, ' LIMIT ') && !Schema::getInstance()->supportsSortingInSubquery()) {
// Setting a limit for the inner query forces the optimizer to use a temporary table, which uses the sorting
$innerQuery .= ' LIMIT 18446744073709551615';
}
Expand All @@ -389,6 +389,23 @@ public function generateRankingQuery($innerQuery, bool $withRollup = false)
( $innerQuery ) actualQuery
";

if (!empty($counterRollupExpression) && !Schema::getInstance()->supportsRankingRollupWithoutExtraSorting()) {
// MariaDB requires an additional sorting layer to return
// the counter/counterRollup values we expect
$rollupColumnSorts = [];

foreach ($withRollupColumns as $withRollupColumn) {
$rollupColumnSorts[] = "`$withRollupColumn` IS NULL";
}

$withCounter .= ' ORDER BY ' . implode(', ', $rollupColumnSorts);

if (preg_match_all('/\s+ORDER\s+BY\s+(.*)$/is', $innerQuery, $matches)) {
// copy ORDER BY from inner query to rollup sorting
$withCounter .= ', ' . trim(end($matches[1]));
}
}

// group by the counter - this groups "Others" because the counter stops at $limit
$groupBy = 'counter';

Expand Down
2 changes: 1 addition & 1 deletion plugins/Actions/VisitorDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ protected function queryActionsForVisits($idVisits)
ON log_link_visit_action.idaction_name = log_action_title.idaction
" . implode(" ", $customJoins) . "
WHERE log_link_visit_action.idvisit IN ('" . implode("','", $idVisits) . "')
ORDER BY log_link_visit_action.idvisit, server_time ASC
ORDER BY log_link_visit_action.idvisit, log_link_visit_action.server_time, log_link_visit_action.idlink_va
";
$actionDetails = $this->getDb()->fetchAll($sql);
return $actionDetails;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,23 @@ protected function trackFourthVisit()

$t = self::getTracker($this->idSite3, $this->dateTime, $defaultInit = true);
$t->setIp('56.11.55.99');
$t->enableBulkTracking();

for ($i = 1; $i < 6; $i++) {
for ($j = 1; $j < 6; $j++) {
for ($i = 1; $i <= 5; $i++) {
for ($j = 1; $j <= $i; $j++) {
$dateTime = $baseTime->addHour($i)->addHour($j * 0.1)->getDatetime();

$t->setCustomDimension("1", "site3 group$i");
$t->setForceVisitDateTime($dateTime);
$t->setUrl("http://example.com/page/$i/$j");
$t->setForceNewVisit();

self::checkResponse($t->doTrackPageView("Page $i $j"));
for ($k = 1; $k <= ($i * 5) + $j; $k++) {
$t->setCustomDimension("1", "site3 group$i");
$t->setForceVisitDateTime($dateTime);
$t->setUrl("http://example.com/page/$i/$j");
$t->doTrackPageView("Page $i $j");
}
}
}

self::checkBulkTrackingResponse($t->doBulkTrack());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<result>
<row>
<label>Others</label>
<nb_visits>25</nb_visits>
<nb_uniq_visitors>25</nb_uniq_visitors>
<nb_hits>25</nb_hits>
<nb_visits>15</nb_visits>
<nb_uniq_visitors>15</nb_uniq_visitors>
<nb_hits>310</nb_hits>
<sum_time_network>0</sum_time_network>
<nb_hits_with_time_network>0</nb_hits_with_time_network>
<min_time_network>0</min_time_network>
Expand Down Expand Up @@ -33,13 +33,13 @@
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
<min_bandwidth>0</min_bandwidth>
<max_bandwidth>0</max_bandwidth>
<sum_time_spent>7200</sum_time_spent>
<sum_time_spent>0</sum_time_spent>
<bounce_count>0</bounce_count>
<exit_nb_visits>5</exit_nb_visits>
<exit_nb_visits>15</exit_nb_visits>
<avg_bandwidth>0</avg_bandwidth>
<avg_time_on_dimension>288</avg_time_on_dimension>
<avg_time_on_dimension>0</avg_time_on_dimension>
<bounce_rate>0%</bounce_rate>
<exit_rate>20%</exit_rate>
<exit_rate>100%</exit_rate>
<segment>dimension1==-1</segment>
</row>
</result>
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<result>
<row>
<label>Others</label>
<nb_visits>25</nb_visits>
<nb_uniq_visitors>25</nb_uniq_visitors>
<nb_hits>25</nb_hits>
<nb_visits>15</nb_visits>
<nb_uniq_visitors>15</nb_uniq_visitors>
<nb_hits>310</nb_hits>
<sum_time_network>0</sum_time_network>
<nb_hits_with_time_network>0</nb_hits_with_time_network>
<min_time_network>0</min_time_network>
Expand Down Expand Up @@ -33,13 +33,13 @@
<nb_hits_with_bandwidth>0</nb_hits_with_bandwidth>
<min_bandwidth>0</min_bandwidth>
<max_bandwidth>0</max_bandwidth>
<sum_time_spent>7200</sum_time_spent>
<sum_time_spent>0</sum_time_spent>
<bounce_count>0</bounce_count>
<exit_nb_visits>5</exit_nb_visits>
<exit_nb_visits>15</exit_nb_visits>
<avg_bandwidth>0</avg_bandwidth>
<avg_time_on_dimension>288</avg_time_on_dimension>
<avg_time_on_dimension>0</avg_time_on_dimension>
<bounce_rate>0%</bounce_rate>
<exit_rate>20%</exit_rate>
<exit_rate>100%</exit_rate>
<segment>dimension1==-1</segment>
</row>
</result>
Loading
0