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

Archiving job prioritization and safety precautions #15991

Merged
merged 9 commits into from Jun 2, 2020

Conversation

diosmosis
Copy link
Member

Refs #15117

@diosmosis diosmosis added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels May 26, 2020
@diosmosis diosmosis added this to the 4.0.0 milestone May 26, 2020
@@ -235,6 +240,8 @@ public function __construct($processNewSegmentsFrom = null, LoggerInterface $log
$this->periodIdsToLabels = array_flip(Piwik::$idPeriods);

$this->rawLogDao = new RawLogDao();

$this->cliMultiRequestParser = new RequestParser($this->makeCliMulti()->supportsAsync());
Copy link
Member

Choose a reason for hiding this comment

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

@diosmosis did you maybe forget to commit this file?

Copy link
Member Author

Choose a reason for hiding this comment

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

added

@tsteur
Copy link
Member

tsteur commented May 27, 2020

@diosmosis now getting an exception isPeriodInThisPeriod method not defined

@diosmosis
Copy link
Member Author

Oh, huh, I forgot to implement that, but the tests were passing for me... interesting, will fix.

@diosmosis
Copy link
Member Author

@tsteur pushed

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 found one more notice. Also not sure if I missed it or if this is covered by a lock. Should the very same archive already be in process (same site, period, date and segment (if given)) to then skip as well?

}

if ($this->isArchiveNonSegmentAndInProgressArchiveSegment($archiveToProcess, $archiveBeingProcessed)) {
return "segment archive in progress for same site/period ({$archiveBeingProcessed['segment']})";
Copy link
Member

Choose a reason for hiding this comment

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

fyi segment might not be defined here
image

got Notice - Undefined index: segment

if (empty($invalidatedArchive)) {
$this->logger->debug("No next invalidated archive.");
break;
}

if ($this->hasDifferentPeriod($archivesToProcess, $invalidatedArchive['period'])) {
Copy link
Member

Choose a reason for hiding this comment

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

good one 👍

@diosmosis
Copy link
Member Author

Also not sure if I missed it or if this is covered by a lock. Should the very same archive already be in process (same site, period, date and segment (if given)) to then skip as well?

Covered by two things, first is that if the archive is DONE_IN_PROGRESS we shouldn't handle it. Second is if it is locked and not expired, we shouldn't handle it. We could also just do <= when checking period ID and that would also prevent it in a third check. I'll just add that for fun.

@diosmosis
Copy link
Member Author

FYI, I'm planning on refactoring/testing all of CronArchive in #11974

@tsteur
Copy link
Member

tsteur commented May 27, 2020

@diosmosis don't have to add it unless it's easy. The DONE IN PROGRESS should be fine too

@diosmosis
Copy link
Member Author

@tsteur single character change, so definitely easy

@tsteur
Copy link
Member

tsteur commented May 27, 2020

👍 feel free to change it and I have another look

@diosmosis
Copy link
Member Author

@tsteur you can take another look

@tsteur
Copy link
Member

tsteur commented May 27, 2020

@diosmosis some tests are failing now. Otherwise looks good to merge

@diosmosis diosmosis merged commit 7c12ec1 into 4.x-dev Jun 2, 2020
@diosmosis diosmosis deleted the 15117-prioritization branch June 2, 2020 23:33
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 not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants