Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authordiosmosis <diosmosis@users.noreply.github.com>2020-12-02 06:03:21 +0300
committerGitHub <noreply@github.com>2020-12-02 06:03:21 +0300
commit32ed3a8c83fed313d5859aef47574aa3bce5a635 (patch)
treec4fa7b65a945d00e4e165a5375a865506e001b23 /core
parent72dabb63267d431075169f6ada8c72bfd329e6e8 (diff)
only select invalidations that were added before a sites archiving began (#16844)
Diffstat (limited to 'core')
-rw-r--r--core/CronArchive/QueueConsumer.php9
-rw-r--r--core/DataAccess/Model.php10
2 files changed, 14 insertions, 5 deletions
diff --git a/core/CronArchive/QueueConsumer.php b/core/CronArchive/QueueConsumer.php
index 9dd07e4ba3..9bdbf3db96 100644
--- a/core/CronArchive/QueueConsumer.php
+++ b/core/CronArchive/QueueConsumer.php
@@ -101,6 +101,11 @@ class QueueConsumer
*/
private $siteTimer;
+ /**
+ * @var string
+ */
+ private $currentSiteArchivingStartTime;
+
public function __construct(LoggerInterface $logger, $websiteIdArchiveList, $countOfProcesses, $pid, Model $model,
SegmentArchiving $segmentArchiving, CronArchive $cronArchive, RequestParser $cliMultiRequestParser,
ArchiveFilter $archiveFilter = null)
@@ -151,6 +156,8 @@ class QueueConsumer
// NOTE: we do this on every site iteration so we don't end up processing say a single user entered invalidation,
// and then stop until the next hour.
$this->cronArchive->invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain($this->idSite);
+
+ $this->currentSiteArchivingStartTime = Date::now()->getDatetime();
}
// we don't want to invalidate different periods together or segment archives w/ no-segment archives
@@ -324,7 +331,7 @@ class QueueConsumer
while ($iterations < 100) {
$invalidationsToExclude = array_merge($this->invalidationsToExclude, $extraInvalidationsToIgnore);
- $nextArchive = $this->model->getNextInvalidatedArchive($idSite, $invalidationsToExclude);
+ $nextArchive = $this->model->getNextInvalidatedArchive($idSite, $this->currentSiteArchivingStartTime, $invalidationsToExclude);
if (empty($nextArchive)) {
break;
}
diff --git a/core/DataAccess/Model.php b/core/DataAccess/Model.php
index 6007994623..6ba5c165cf 100644
--- a/core/DataAccess/Model.php
+++ b/core/DataAccess/Model.php
@@ -705,19 +705,21 @@ class Model
/**
* Gets the next invalidated archive that should be archived in a table.
*
- * @param string[] $tables
- * @param int $count
+ * @param int $idSite
+ * @param string $archivingStartTime
+ * @param int[]|null $idInvalidationsToExclude
* @param bool $useLimit Whether to limit the result set to one result or not. Used in tests only.
*/
- public function getNextInvalidatedArchive($idSite, $idInvalidationsToExclude = null, $useLimit = true)
+ public function getNextInvalidatedArchive($idSite, $archivingStartTime, $idInvalidationsToExclude = null, $useLimit = true)
{
$table = Common::prefixTable('archive_invalidations');
$sql = "SELECT idinvalidation, idarchive, idsite, date1, date2, period, `name`, report
FROM `$table`
- WHERE idsite = ? AND status != ?";
+ WHERE idsite = ? AND status != ? AND ts_invalidated <= ?";
$bind = [
$idSite,
ArchiveInvalidator::INVALIDATION_STATUS_IN_PROGRESS,
+ $archivingStartTime,
];
if (!empty($idInvalidationsToExclude)) {