eclipse-threadx/filex

_fx_fault_tolerant_apply_logs not updates fx_media_available_clusters of FAT logs when called after power down

smithBraun opened this issue · 9 comments

When _fx_fault_tolerant_apply_logs called in regular situation, the fx_media_available_clusters is already updated in advanced, except of the FAT chain, and hence no need to update fx_media_available_clusters.
But when _fx_fault_tolerant_apply_logs is called after power down (in _fx_fault_tolerant_enable), still just the FAT chain cleanup changes fx_media_available_clusters.
This may cause long time wasting for searching on non existing free cluster (when the FAT log captured cluster), or refusing to use available clusters because thinking there is no more (when the FAT logs released cluster).
I suggest that in _fx_fault_tolerant_apply_logs if fx_media_fault_tolerant_enabled is false (which means it was called from _fx_fault_tolerant_enable), check for each FAT log if it changing the cluster state and if it is - update fx_media_available_clusters.

It important to notice this issue effects just the RAM, so after power down things become normal.

@smithBraun , thanks for your suggestion! We will optimize the logic of calculating available clusters in the future and let you know when it is ready.

thanks @TiejunMS .
I will be happy to get the fix as soon as it implemented and not wait to official release, to re-run my tests and ensure I can't find more corner cases.

Hi @TiejunMS ,
Any updates about this issue?

@smithBraun , there is no update yet.

Is there is problem with the suggestion above?
Or it is not investigated yet?

@smithBraun , we didn't get a chance to improve the logic yet. You can simply apply it in your local environment. We will update this issue when it is ready.

Hi,
Same issue exist if operation failed, _fx_fault_tolerant_recover should revert fx_media_available_clusters state

There are also multiple places (not related to fault tolerance) where flow can fail between updating fx_media_available_clusters to updating the FAT chain itself, hence I think maybe this update should be done inside fx_media_available_clusters itself.
This approach is bit complicated with fault tolerance, but it is the clean way to update when actually it changes.