Thanks for taking a look, Steve Rowe.
I guess just always reloading - as is currently done for both fields and copyFields now too - is at least correct, if not the most performant solution.
That was my thought for this patch – get something in that works and we can refine later. I think that the idea of a checksum over the serialized pieces is a good one, though of course there's a question of the granularity. Here's a complementary optimization: let's say you have a checksum over all the copyFields and a single copy field is added. As things are now, you'd have to recreate all the copy fields just to add a single one, though that may at least happen rarely. It may make sense to put some unique identifier on each copyfield, so you can easily detect we already have that, so can just skip adding it. It also makes implementing deleting fields/copyFields easier if we ever want to implement that. Although this depends on what we decide in
SOLR-6155 I guess; if only one copyfield is allowed, the src/dst becomes a unique identifier.