Skip to content

Refactor Magento_Indexer module so that the "indexer_reindex_all_invalid" cronjob and "bin/magento indexer:reindex" command use the same code #29297

Closed
@hostep

Description

@hostep

Summary (*)

This was discovered while working on #29196

The cronjob indexer_reindex_all_invalid (Magento\Indexer\Model\Processor::reindexAllInvalid) and manually executing bin/magento indexer:reindex {all-invalid-indexers} (Magento\Indexer\Console\Command\IndexerReindexCommand::execute) should execute the exact same thing.
Currently both those entry points have separate codebases for executing their logic which can lead to subtle inconsistencies if only one of both codebases are touched.

We should try to refactor the code into one shared codebase for both entry points.

Examples

It looks like this (probably) accidentally happened at least once in MAGETWO-51540

Proposed solution

@rogyar proposed the following solution:

Additionally, I would create a separate service i.e. validateSharedIndex and put the logic of getIndexerIdsBySharedIndex and validateSharedIndex there. So we can reuse the newly created class for the indexer processor and IndexerReindexCommand.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users with no workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Event: MageCONF CD 2020Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions