Skip to content

Conversation

davidtrihy-genesys
Copy link
Contributor

Summary
When calling $sql_cached_value during a reload initiated by MI it locks the whole table and that read tries to acquire a lock and can only acquire it once the write has finished, this can block SIP processing unnecessarily as the cachedb implementations typically lock on their own values, eg. cachedb_local locks on each hash which corresponds to a row, this PR adds support to read during a full reload and only lock the row being read, if a reload is in progress you can read the previous version value during the reload if it is returned

Details and Solution
Uses stdatomic to set a boolean flag once the write lock is acquired, this can then be tested during reads and be more permissive with values returned as long as the version is only current version - 1 otherwise it returns null

Compatibility
Changes the default behaviour to now be more permissive but adds a new param to cache_table called full_caching_lock_scope which can be set to row or table, defaults to row and setting it to table provides support for the current way it works

@davidtrihy-genesys
Copy link
Contributor Author

@liviuchircu as we discussed in the ticket

@liviuchircu liviuchircu self-assigned this Oct 2, 2025
@liviuchircu liviuchircu added this to the 3.6.2 milestone Oct 2, 2025
@davidtrihy-genesys
Copy link
Contributor Author

@liviuchircu rather than pushing commits to fix any compiler warnings on all the platforms, I'll let you review first and then I can address any additional ones that pop up

@davidtrihy-genesys
Copy link
Contributor Author

The multi_arch build failed for an unrelated reason to my changes but I can't kick it off again so I consider this PR fully ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants