SpillingAdaptiveSpanningRecordDeserializer doesn't have any consistency checks for usage calls or serializers behaving properly, e.g. to read only as many bytes as available/promised for that record. At least these checks should be added:
- Check that buffers have not been read from yet before adding them (this is an invariant SpillingAdaptiveSpanningRecordDeserializer works with and from what I can see, it is followed now.
- Check that after deserialization, we actually consumed recordLength bytes
- If not, in the spanning deserializer, we currently simply skip the remaining bytes.
- But in the non-spanning deserializer, we currently continue from the wrong offset.
- Protect against setNextBuffer being called before draining all available records