Cleaning up the metadata in preparation for the index cleanup