Skip to content

Race condition in datetime-based indexes #583

@Gomez324

Description

@Gomez324

There is a race condition in time-based indexes. It's related to the fact that when multiple requests through the transaction API try to add products, it can happen that request A changes the alias in OS/ES, while request B doesn't have this state, which causes products to be added incorrectly (it may create the wrong index and add products to it).

The only possible solution to this is that products must be added in a more synchronous manner. Therefore, my idea, which I discussed with my team and which they made improvements to, is this: when the time-based indexes option is selected, queue them in Redis per collection. Then, after a specified time (e.g., 30 seconds) or number of products (e.g., 50), perform a bulk operation that will call the search_engine code, which will push them in bulks per collection. This way, race conditions will be avoided. I would add the script that pushes products from Redis to this repository.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions