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

EZP-30635: Fixed infinite loop in Reindex Command on the last iteration #2664

Merged
merged 2 commits into from
Jun 11, 2019

Conversation

andrerom
Copy link
Contributor

@andrerom andrerom commented Jun 6, 2019

Question Answer
JIRA issue EZP-30635
Bug/Improvement yes
Target version 6.7
BC breaks no
Tests pass yes
Doc needed no

When content-count % iteration-count === 0, aka when last iteration would have empty results, there would be faulty call to with empty ´--content-ids=´ causing whole new index process to start again with purge and everything.

TODO:

  • Implement feature / fix a bug.
  • Implement tests.
  • Fix new code according to Coding Standards ($ composer fix-cs).
  • Ask for Code Review.

@andrerom andrerom changed the base branch from master to 6.7 June 6, 2019 14:21
@andrerom andrerom force-pushed the reindexer_issue_on_fork branch from 8aa6ffe to a3c7a7a Compare June 6, 2019 14:21
@@ -387,6 +389,10 @@ private function fetchIteration(Statement $stmt, $iterationCount)
*/
private function getPhpProcess(array $contentIds, $commit)
{
if (empty($contentIds)) {
throw new RuntimeException("'--content-ids=' can not be empty on parallel sub process");
Copy link
Member

Choose a reason for hiding this comment

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

InvalidArgumentException seems to be a better choice here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@adamwojs InvalidArgumentException should be used when the argument is not of an expected type, but here we expect array and an array it is, but empty. I think that RuntimeException is ok.

Copy link
Contributor Author

@andrerom andrerom Jun 7, 2019

Choose a reason for hiding this comment

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

I think @adamwojs is right here, both exception about --iteration-count and this one should rather use InvalidArgumentException or InvalidArgumentValue exception. (among those I also prefer InvalidArgumentException here as it makes it possible to say what is wrong)

ok @mateuszbieniek and @adamwojs ?

Copy link
Contributor Author

@andrerom andrerom Jun 7, 2019

Choose a reason for hiding this comment

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

Updated in 6b2f78f

@alongosz alongosz changed the title EZP-30635: Reindex Command Infinite Loop on Content % Iteration == 0 EZP-30635: Fixed infinite loop in Reindex Command on the last iteration Jun 11, 2019
@alongosz alongosz added the Bug label Jun 11, 2019
@andrerom andrerom merged commit 78a4eef into 6.7 Jun 11, 2019
@andrerom andrerom deleted the reindexer_issue_on_fork branch June 11, 2019 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

5 participants