Azure / Azure/azure-functions-host
Check for storage SDK/extension version before using FunctionDataCache
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
Recent work on adding a `FunctionDataCache` ([here](https://github.com/Azure/azure-functions-host/issues/7310)) relies on support from the storage SDK ([here](https://github.com/Azure/azure-sdk-for-net/pull/20209)). If there is a version of the storage SDK that is older than the one where `FunctionDataCache` support was added *AND* the user has enabled `FUNCTIONS_DATA_CACHE_ENABLED` = `1` then binding will break on runtime.
In particular, the logic to check whether `FunctionDataCache` is enabled will succeed and the binding process will attempt to retrieve a `ICacheAwareReadObject` from the storage SDK (which will not succeed as the older SDK will not know how to do this binding) and hence [this](FUNCTIONS_DATA_CACHE_ENABLED) line will throw an Exception resulting in failure.
We need to add a check, perhaps in `FunctionDataCache::GetIsEnabled()` method [here](https://github.com/Azure/azure-functions-host/blob/e61b901782ce35f835513dab7eeb060f0680d830/src/WebJobs.Script/Workers/FunctionDataCache/FunctionDataCache.cs#L284) to also check if the storage SDK or extension version is at least greater than equal to a minimum. If not, even if the AppSetting `FUNCTIONS_DATA_CACHE_ENABLED` is enabled, the `FunctionDataCache` should remain disabled.
Contributor guide
Research direction
Start in src/WebJobs.Script/Workers/FunctionDataCache/FunctionDataCache.cs at GetIsEnabled(), then inspect how the storage SDK or extension version is available to the host. Reproduce the FUNCTIONS_DATA_CACHE_ENABLED=1 path with an older storage SDK and verify that the cache remains disabled instead of causing binding to fail.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100