Calling Developers!
We are reenergizing our code contribution process! Learn More

sync:data doesn't work in an edge case

mikko.ropanen Spryker Solution Partner Posts: 17 🧑🏻‍🚀 - Cadet

If getSynchronizationDataQueryExpanderStrategyPlugin() returns the "WhereBetween" plugin as it does in spryker-suite:

and the auto-increment id in spy_product_abstract_page_search and/or spy_product_concrete_page_search doesn't start from zero (or technically between 0 and chunk size), then sync:data product_abstract and sync:data product_concrete fail to query data from those tables.

The reason being that their iterators start by querying the tables like:
SELECT FROM `spy_product_abstract_page_search` WHERE id_product_abstract_page_search BETWEEN 0 AND 100 ORDER BY `spy_product_abstract_page_search`.`id_product_abstract_page_search` ASC

and obviously if the first id is 101 or 46249, the query returns nothing → iterator stops → nothing gets synced.

Changing the plugin to SynchronizationDataQueryExpanderOffsetLimitStrategyPlugin seems to work.


  • ynnoig
    ynnoig Technical Lead eBusiness Spryker Customer Posts: 12 ✨ - Novice

    To avoid this problem u have to implement the Interface \Spryker\Zed\SynchronizationExtension\Dependency\Plugin\SynchronizationDataMaxIterationLimitPluginInterface and implement the method getMaxIterationLimit . In this case the iteration is stopped at first the max iteration limit is reached.

    The specification of this interface say:
    The Iterator can proceed until maxIterationLimit is reached even if intermittent result sets are empty.