Test cache invalidation issue for dense nodes.

The issue that causes invalid cache invalidation on rollback is
extra likely to occur for dense nodes, so a particular test case
for that scenario is desirable.