diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-09-11 04:36:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-11 04:36:09 +0300 |
commit | b8e4d27f2151103df826e5dd643b433cdde05aaf (patch) | |
tree | b01853ecfd5ed05be679ed7e19bdc7956c64009d /core/ArchiveProcessor.php | |
parent | 13aad03773d4576188ebd2db7971337ad4edca4f (diff) |
Couple changes to aid debugging (#13269)
* Add ability to print arguments in fatal error trace.
* Add sum of blob content to analyze archive tables command.
* Fixing tests.
* Fixing tests.
* fixing test
* json_encode instead of strval
* fix test
Diffstat (limited to 'core/ArchiveProcessor.php')
-rw-r--r-- | core/ArchiveProcessor.php | 60 |
1 files changed, 33 insertions, 27 deletions
diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php index 2b5547b13b..10adb8fdc1 100644 --- a/core/ArchiveProcessor.php +++ b/core/ArchiveProcessor.php @@ -346,35 +346,41 @@ class ArchiveProcessor */ protected function aggregateDataTableRecord($name, $columnsAggregationOperation = null, $columnsToRenameAfterAggregation = null) { - // By default we shall aggregate all sub-tables. - $dataTable = $this->getArchive()->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false); - - $columnsRenamed = false; - - if ($dataTable instanceof Map) { - $columnsRenamed = true; - // see https://github.com/piwik/piwik/issues/4377 - $self = $this; - $dataTable->filter(function ($table) use ($self, $columnsToRenameAfterAggregation) { - - if ($self->areColumnsNotAlreadyRenamed($table)) { - /** - * This makes archiving and range dates a lot faster. Imagine we archive a week, then we will - * rename all columns of each 7 day archives. Afterwards we know the columns will be replaced in a - * week archive. When generating month archives, which uses mostly week archives, we do not have - * to replace those columns for the week archives again since we can be sure they were already - * replaced. Same when aggregating year and range archives. This can save up 10% or more when - * aggregating Month, Year and Range archives. - */ - $self->renameColumnsAfterAggregation($table, $columnsToRenameAfterAggregation); - } - }); - } + try { + ErrorHandler::pushFatalErrorBreadcrumb(__CLASS__, ['name' => $name]); + + // By default we shall aggregate all sub-tables. + $dataTable = $this->getArchive()->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false); + + $columnsRenamed = false; + + if ($dataTable instanceof Map) { + $columnsRenamed = true; + // see https://github.com/piwik/piwik/issues/4377 + $self = $this; + $dataTable->filter(function ($table) use ($self, $columnsToRenameAfterAggregation) { + + if ($self->areColumnsNotAlreadyRenamed($table)) { + /** + * This makes archiving and range dates a lot faster. Imagine we archive a week, then we will + * rename all columns of each 7 day archives. Afterwards we know the columns will be replaced in a + * week archive. When generating month archives, which uses mostly week archives, we do not have + * to replace those columns for the week archives again since we can be sure they were already + * replaced. Same when aggregating year and range archives. This can save up 10% or more when + * aggregating Month, Year and Range archives. + */ + $self->renameColumnsAfterAggregation($table, $columnsToRenameAfterAggregation); + } + }); + } - $dataTable = $this->getAggregatedDataTableMap($dataTable, $columnsAggregationOperation); + $dataTable = $this->getAggregatedDataTableMap($dataTable, $columnsAggregationOperation); - if (!$columnsRenamed) { - $this->renameColumnsAfterAggregation($dataTable, $columnsToRenameAfterAggregation); + if (!$columnsRenamed) { + $this->renameColumnsAfterAggregation($dataTable, $columnsToRenameAfterAggregation); + } + } finally { + ErrorHandler::popFatalErrorBreadcrumb(); } return $dataTable; |