After removing _g_dirty field in
GORA-326, dirty field is not serialized. In GORA-321 PersistentSerializer went from using PersistentDatumWriter(/Reader) to Avro's SpecificDatumWriter, delegating the serialization of the dirty field to Avro (but really not desirable to have that field as a main field in the entities).
The proposal is to reintroduce the PersistentDatumWriter/Reader which will serialize the internal fields of the entities.
This bug affects, for example, Nutch, which loads only some fields in it's phases, serializes entities (from Map to Reduce), and when deserializes finds all fields as "dirty", independently of what fields were modified in the Map, and overwrite all data in datastore (deleting much things: downloaded content, parsed content, etc).
This effect can be seen in TestPersistentSerialization#testSerderEmployeeTwoFields, when debuging in TestIOUtils#testSerializeDeserialize. Proper breakpoints an inspections shows that, entities are "equal" when it's fields are equal. This is fine as "equal" definition, but another test must be added to check that serialization an deserialization keeps the dirty state.