Dave Borowitz b30a414171 Serialize TagSetHolder with protobuf
TagSetHolder and TagSet have some slightly exotic properties:
  * A subclass of AtomicReference<ObjectId> with additional fields,
    CachedRef.
  * An ObjectIdOwnerMap, which requires a custom subclass of ObjectId
    with additional fields.
  * BitSets.
  * Volatile field references.

However, it still boils down to collections of value types, so the
resulting TagSetProto structure is pretty straightforward.

The most annoying thing is that the AtomicReference and ObjectId
subclasses can't reasonably implement equals(), so the tests need to
have more detailed assertions which reach into what would otherwise be
private fields.

While we're in there, eliminate the intermediate EntryVal class, which
was serving no purpose other than to hold the readObject/writeObject
methods for Java serialization.

It is quite possible that this change will be slower to deserialize than
using Java serialization, since it was previously able to directly
deserialize the internal data structures, whereas we now have to build
these structures piece by piece. However, as with the rest of the
serialization code, we assume that proto is good enough until proven
otherwise.

Beyond that, we don't attempt to further rework the tag cache types or
the cache as a whole. In particular:
  * Continue to use volatile types to handle incrementally updating
    specific cache entries.
  * Using composition instead of inheritance for CachedRef is out of
    scope. However, note that using protobuf for serialization means
    that we can make this change without flushing the cache.
  * Using a less exotic type than ObjectIdOwnerMap would probably
    require some benchmarking to prove that it's worth making the
    change.

Change-Id: I08623b3f51ef1a0541559bbb2360c0d06a9de9d4
2018-07-30 10:39:02 -07:00
..