Skip to content
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

Day range archiving issue #15462

Merged
merged 4 commits into from Jan 28, 2020
Merged

Day range archiving issue #15462

merged 4 commits into from Jan 28, 2020

Conversation

diosmosis
Copy link
Member

No description provided.

@diosmosis diosmosis added the Needs Review PRs that need a code review label Jan 26, 2020
@diosmosis diosmosis added this to the 3.13.2 milestone Jan 26, 2020
@diosmosis diosmosis changed the base branch from 4.x-dev to 3.x-dev January 26, 2020 23:08
// TODO: revisit in matomo 4
// period=range&date=last1/period=range&date=previous1 can cause problems during archiving due to Parameters::isDayArchive()
if (preg_match('/[&?]period=range/', $this->url)) {
$this->changeParam('period', 'day');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diosmosis not sure I understand. Wouldn't we only replace the period = range when date is last1 or previous1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, missed that

Copy link
Member

@tsteur tsteur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diosmosis I reckon eg in https://github.com/matomo-org/matomo/blob/3.13.1/core/CronArchive.php#L1111 we need to change it to something like

$urlBefore = $request->getUrl(); 
$request->changeDate()...
 if ($request->getUrl() !== $urlBefore && $self->isAlreadyArchivingUrl($request->getUrl(), $idSite, $period, $date)) {
      return Request::ABORT;
}

The idea behind it be basically, that if it suddenly changes from range to day, then we need to check again if a day archive is already running and if so, abort it.

Probably also needed here: https://github.com/matomo-org/matomo/blob/3.13.1/core/CronArchive.php#L1979-L1984


// TODO: revisit in matomo 4
// period=range&date=last1/period=range&date=previous1 can cause problems during archiving due to Parameters::isDayArchive()
if (preg_match('/[&?]period=range/', $this->url)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diosmosis could you maybe add a simple test?

@diosmosis
Copy link
Member Author

@tsteur added a test and applied review feedback

@@ -1976,9 +1976,17 @@ private function getUrlsWithSegment($idSite, $period, $date)
return Request::ABORT;
}

$url = $request->getUrl();
$url = preg_replace('/([&?])date=[^&]*/', '$1date=' . $newDate, $url);
$urlBefore = $request->getUrl();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, will add

$this->changeParam('date', $newDate);
}

public function makeSureDateIsNotSingleDayRange()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this changed in recent commit... shouldn't setUrl basically call this method?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that then thought it might be a bad idea to do it every time the request url is set. Seems like it could cause strange side effects, and if we did, we'd have to check for an already running job after every setUrl() call.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move it back if needed, though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be needed I reckon 👍

@tsteur tsteur merged commit 02c0286 into 3.x-dev Jan 28, 2020
@tsteur tsteur deleted the day-range-archiving-issue branch January 28, 2020 03:05
sgiehl added a commit that referenced this pull request Feb 11, 2020
* Updates search engine and social definitions (#15384)

* updates device detector to latest release (#15388)

* updates device detector to latest release

* updates tests

* translation update (#15389)

* Fix Could not get the lock for ID, when creating a site (#15401)

* Lock key start

* do not empty key lock

Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>

* 3.13.1

* submodule updates

* Use correct name in update available message (#15423)

* Fix removing user capabilities (#15422)

* Order of implode() args, avoid E_NOTICE in PHP7.4 (#15428)

* Fixes possible php warning in visitor log (#15442)

* silence is_executable call (#15446)

* Make sure geolocation admin experience is consistent if user is not using GeoIp2 plugin. (#15447)

* Fix referrers test. (#15448)

* Ensure to close visitor popover correctly (#15443)

* Fixes possible warning (#15453)

* Forward instance_id from local config when reseting config during tests. (#15445)

* Add event that allows plugins to disable archiving for certain periods/sites if they want. (#15457)

* Add event that allows plugins to disable archiving for certain periods/sites if they want.

* apply review feedback

* Fix possible warning for columns without index (#15467)

* Day range archiving issue (#15462)

* Improve lock ID check for max length (#15407)

Better patch for #15401 which was merged last minute...

This way it always works even when someone calls `acquireLock` directly instead of `execute`

Pushing this for now into 3.x-dev but can also put it into 4.x-dev directly but then there might be merge conflicts when merging 3.x-dev into 4.x-dev

* Use SameSite none for session token when embedded into iframe (#15439)

* Make sure tracking works in IE9 and lower (#15480)

* Mention Joomla install FAQ (#15481)

* Make sparklines work when mbstring extension is not installed (#15489)

1) Too few arguments to function mb_strtolower(), 1 passed in matomo/vendor/davaxi/sparkline/src/Sparkline/StyleTrait.php on line 129 and exactly 2 expected

2) mb_strlen is not defined

* update screenshots (#15488)

* 3.13.2-rc1

* Use safemode when running CLI commands (#15472)

* update icons submodule (#15490)

* update icons submodule

* update UI tests

* Fix possible undefined index notice (#15502)

* Use latest davaxi/sparkline release (#15464)

* translation update

* submodule updates

* Fix deprecation notice (#15530)

see #15467 (comment)

* 3.13.2-rc2

* update cache component (#15536)

*  fixes copy dashboard to user for more than 100 users (#15538)

cherry picking  #15424  to fix #15420 in 3.x-dev

* Add missing return statement. (#15539)

* 3.13.2

* update tests

* update tests

Co-authored-by: Matthieu Aubry <mattab@users.noreply.github.com>
Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>
Co-authored-by: Peter Upfold <pgithub@upfold.org.uk>
Co-authored-by: diosmosis <diosmosis@users.noreply.github.com>
Co-authored-by: Lukas Winkler <github@lw1.at>
jonasgrilleres pushed a commit to 1024pix/pix-analytics that referenced this pull request Sep 22, 2020
jbuget pushed a commit to 1024pix/pix-analytics that referenced this pull request Sep 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants