Skip to content

[Issue] Prevent flushing same tags several times #29890

Closed
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #29885: Prevent flushing same tags several times

Preconditions (*)

  1. Magento 2.4-develop

Description (*)

If a product is saved in admin - changed name, price, stock, weight, added category to product. Then after indexing, the same tags are flushed several times.
Here is an example of default Magento behaviour on cleaning cache tags during indexing (different arrays belong to different indexers cleaning the cache):

root@c119d6a06fcb:/var/www/m2clean$  bin/magento cron:run --group=index --bootstrap=standaloneProcessStarted=1

Array
(
)


Array
(
)


Array
(
    <0] => cat*p*1
    [1] => cat*c*2
    [2] => cat*c*1
    [3] => cat*c*2
    [4] => cat*c*3
    [5] => cat*c*1
)

Array
(
    [0] => cat*p*1
    [1] => cat*c*2
    [2] => cat*c*1
    [3] => cat*c*2
    [4] => cat*c*3
    [5] => cat*c*1
)


Array
(
    [0] => cat*p*1
    [1] => cat*c*2
    [2] => cat*c*1
    [3] => cat*c*2
    [4] => cat*c*3
    [5] => cat*c*1
)


Array
(
    [0] => cat*p*1
)

Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*c*2
    [5] => cat*c*1
    [6] => cat*c*2
    [7] => cat*c*3
    [8] => cat*c*1
)


Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*c*2
    [5] => cat*c*1
    [6] => cat*c*2
    [7] => cat*c*3
    [8] => cat*c*1
)

Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*p*1
    [5] => cat*c*2
    [6] => cat*c*1
    [7] => cat*c*2
    [8] => cat*c*3
    [9] => cat*c*1
)


Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*p*1
    [5] => cat*c*2
    [6] => cat*c*1
    [7] => cat*c*2
    [8] => cat*c*3
    [9] => cat*c*1
)

Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*p*1
    [5] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [8] => cat*c*2
    [9] => cat*c*3
    [10] => cat*c*1
)


Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*p*1
    [5] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [8] => cat*c*2
    [9] => cat*c*3
    [10] => cat*c*1
)


Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*p*1
    [5] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [8] => cat*c*2
    [9] => cat*c*3
    [10] => cat*c*1
)


Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*p*1
    [5] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [8] => cat*c*2
    [9] => cat*c*3
    [10] => cat*c*1
)


Array
(
    [0] => cat*p*1
    [1] => cat*p*1
    [2] => cat*p*1
    [3] => cat*p*1
    [4] => cat*p*1
    [5] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [8] => cat*c*2
    [9] => cat*c*3
    [10] => cat*c*1
)
{code}

Here is the same output with the changes applied:
{code}
root@c119d6a06fcb:/var/www/m2clean$  bin/magento cron:run --group=index --bootstrap=standaloneProcessStarted=1
Array
(
)


Array
(
)


Array
(
    [0] => cat*p*1
    [1] => cat*c*2
    [2] => cat*c*1
    [4] => cat*c*3
)

Array
(
    [0] => cat*p*1
    [1] => cat*c*2
    [2] => cat*c*1
    [4] => cat*c*3
)


Array
(
    [0] => cat*p*1
    [1] => cat*c*2
    [2] => cat*c*1
    [4] => cat*c*3
)


Array
(
    [0] => cat*p*1
)

Array
(
    [0] => cat*p*1
    [4] => cat*c*2
    [5] => cat*c*1
    [7] => cat*c*3
)


Array
(
    [0] => cat*p*1
    [4] => cat*c*2
    [5] => cat*c*1
    [7] => cat*c*3
)

Array
(
    [0] => cat*p*1
    [5] => cat*c*2
    [6] => cat*c*1
    [8] => cat*c*3
)


Array
(
    [0] => cat*p*1
    [5] => cat*c*2
    [6] => cat*c*1
    [8] => cat*c*3
)

Array
(
    [0] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [9] => cat*c*3
)

Array
(
    [0] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [9] => cat*c*3
)

Array
(
    [0] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [9] => cat*c*3
)

Array
(
    [0] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [9] => cat*c*3
)


Array
(
    [0] => cat*p*1
    [6] => cat*c*2
    [7] => cat*c*1
    [9> => cat*c*3
)

Steps to reproduce (*)

  1. Go to System - Index Management
  2. Select All Indexers_ and change the _Actions to Update by Schedule
  3. Go to Catalog - Categories, and change the Category Name for at least two Categories, for example
  4. Go to Catalog - Products and change the Price, Quantity, Weight for at least two Products
  5. Run bin/magento cron:run --group=index --bootstrap=standaloneProcessStarted=1
  6. Observe the return of \Magento\Framework\Indexer\CacheContext::getIdentities

Expected result (*)

before

Actual Result (*)

after

Metadata

Metadata

Assignees

Labels

Component: IndexerFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentPriority: P3May be fixed according to the position in the backlog.Progress: doneReported on 2.4.0Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions