Commits
Andrea Biscuola authored 2e27b4a8213
........S. [ZBXNEXT-3480] double buffering for host inventories The patch implement a second cache for the host inventories to be used for update the dynamic inventory data coming from the various agents. When the main configuration cache synchronization is started, three different situations can be applied to the second cache: 1 - If the inventory is new, it will be added to both the main and secondary cache and the one in the secondary cache will not have data. 2 - If the inventory need to be updated, the one present in the secondary cache will be invalidated. It mean that all the dynamic data present will be cleared for having the next macro resolution be performed either in the main cache, or when updated data are stored in the secondary cache and thus, in the database. 3 - If an inventory need to be removed, the one in the secondary cache will also be removed. All the static data will be looked up in the primary cache, even if there is no real distinction in the lookup routine between dynamic and static data. All the strings, for the moment, are kept in the same string pool. This will change once the configuration cache re-organization will go in. The new cache have it's own mutex for locking. Lock and unlock operations are performed through the new LOCK_INVENTORIES and UNLOCK_INVENTORIES macros and they are also used during the main configuration cache synchronization. The function DCconfig_update_inventory_values(), added in a previous commit, will not only update the secondary cache and not touch the main cache in any way. Discussed with Sasha, vso and wiper.