sync:data doesn't work in an edge case

mikko.ropanen
mikko.ropanen Spryker Solution Partner Posts: 27 ✨ - Novice

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

https://github.com/spryker-shop/suite/blob/3733f7c0cd479a4649ad8878176130c3d00fcba2/src/Pyz/Zed/Synchronization/SynchronizationDependencyProvider.php#L185

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.

Comments

  • ynnoig
    ynnoig Spryker Customer Posts: 13 ✨ - Novice
    edited June 7

    Die Sync plugin sollen in dieser Fall implementieren das Interface `SynchronizationDataMaxIterationLimitPluginInterface` und implementieren die Function `getMaxIterationLimit` um genau das Problem umzugehen

    Specification
    /**

     * Provides maxIterationLimit for SynchronizationDataPluginIterator.
    
     *
    
     * Implement this interface if you need to set an explicit maxIterationLimit.
    
     * The Iterator can proceed until maxIterationLimit is reached even if intermittent result sets are empty.
    
     *
    
     * @see \Spryker\Zed\Synchronization\Business\Iterator\SynchronizationDataBulkRepositoryPluginIterator
    
     */
    

  • ynnoig
    ynnoig Spryker Customer Posts: 13 ✨ - 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.