CURATOR-609 - ModeledCache attempts to deserialize empty ZNodes on deletion, resulting in exceptions
On event type NODE_REMOVED, an additional check was added to ensure that the ZNode actually contains data before attempting to deserialize it into a model.
If no model is present for the ZNode, the accept callback is not called (as this is not a valid ModeledFramework object).
This is already accounted for with events NODE_ADDED/NODE_UPDATED, as there was already a check for null data in the node.
Note: Triggering this bug via a unit test is quite easy, however detecting it is difficult as the exception is thrown by a Curator sub-thread. Therefore I did not add a matching unit test (though ensured all existing unit tests pass).
This issue was targeted 5.2.1 I am postponing to 5.2.2, I am sorry
@Ryan0751 Any interest to continue this ? I think you can construct a test with ModeledCacheListener.handleException. TestCachedModeledFramework should be the right place. I can take care of it in case you are not available. We are evaluating this and plan to conclude (merge or not) this before next release.
I will take another look!
I have gone ahead and added a unit test for this.
Thanks for your contribution @Ryan0751! It reminds me of one of my PRs merged after two years in apache/flink 🤣
Merging...
Thank you @Ryan0751!