Skip to content

Regression: some daily reports disappear from UI, and weekly reports are corrupted #17428

@nelhefni

Description

@nelhefni

Hello,

We think PR #17216 has introduced some regressions to the archiving process since Matomo 4.2.0

FYI, browser archiving is disabled:

enable_browser_archiving_triggering = 0
browser_archiving_disabled_enforce = 1
archiving_range_force_on_browser_request = 0

For a given plugin, we are facing 2 issues since the update to Matomo 4.2.0,

  • Issue#1: Some daily reports disappear from the UI, even though delete_reports_enable is set to 0
  • Issue#2: Some weekly reports have inaccurate data: gather the values of only some days of the week.

This seems to be related to the changes made with the handling of partial archives.
Indeed, we have a lot of partial archives in our DB, which doesn't contain the reports of our impacted plugins:

MariaDB [matomo]> select * from matomo_archive_numeric_2021_03 where idarchive = 46176;

| idarchive | name        | idsite   | date1      | date2      | period    | ts_archived         | value    |

|     46176 | myPlugin    |        1 | 2021-03-22 | 2021-03-22 |         1 | 2021-03-23 00:05:52 |       10 |
|     46176 | otherPlugin |        1 | 2021-03-22 | 2021-03-22 |         1 | 2021-03-23 00:05:52 |       20 |
|     46176 | done        |        1 | 2021-03-22 | 2021-03-22 |         1 | 2021-03-23 00:05:52 |        1 |
MariaDB [matomo]> select * from matomo_archive_numeric_2021_03 where idarchive = 56405;

| idarchive | name        | idsite   | date1      | date2      | period    | ts_archived         | value    |

|     56405 | otherPlugin |        1 | 2021-03-22 | 2021-03-22 |         1 | 2021-04-05 18:52:03 |       20 |
|     56405 | done        |        1 | 2021-03-22 | 2021-03-22 |         1 | 2021-04-05 18:52:03 |        5 |

As you can see, myPlugin report is not part of partial archive 56405 (partial because the value of done row is 5), but it is nevertheless selected since Matomo 4.2.0, as ts_archived is more recent.

Since #17216, checkAuthorizedToArchive = false is passed to Rules::getSelectableDoneFlagValues during the retrival of archive to display in the UI

$possibleValues = Rules::getSelectableDoneFlagValues($includeInvalidated, null, $checkAuthorizedToArchive = false);

As a consequence, both ArchiveWriter::DONE_PARTIAL and ArchiveWriter::DONE_INVALIDATED are added to the list of accepted value. Which explains why archive 56405 is selected instead of 46176 in our case.

if (!$checkAuthorizedToArchive || !Rules::isRequestAuthorizedToArchive($params)) {

Thus, as soon as archive 56405 was created, myPlugin report disappeared from the UI.
I don't think ArchiveWriter::DONE_PARTIAL should be part of the list of accepted values.
We have been able to fix this issue#1 with this PR #17425

Concerning issue#2, we have been able to fix it by reverting the changes done in the same PR to ArchiveSelector::findArchiveDataWithLatestTsArchived, and then invalidating faulty reports and re-running the cron job.

Your Environment

Matomo 4.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    answeredFor when a question was asked and we referred to forum or answered it.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions