Fixes #5214: Successfully invalidates metadata cache in some corner cases
Merge pull request #5223 from mrclay/5214-18

Fixes #5214: Successfully invalidates metadata cache in some corner cases