UPDATES in Optimistic Transactions truncate records through Network Binary Protocol

OrientDB Version: <3.0.x>

We’re using the NetworkBinaryProtocol at version 36, using CSV serialization.

To reproduce the problem (I couldn’t get it to happen with the Java classes, but every time using our C++ library):
We create a schema with the following: Class Person, name, birthdate.
We create a record in a transaction: Person@name:“John”
Query the record back out: #50:0 v.1 Person@name:“John”

Add a birthdate to the record, and commit to the transaction: 50:0 v.1 Person@birthdate:“1900-01-01”,name:“John”
Requery the record back out: #50:0 v.2 Person@

All of the fields are lost.

I dug through the code to find the fix. In OTransactionOptimisticProxy.java, under begin(), case ORecordOperation.CREATED, there’s a line:

serializer.fromStream(operation.getRecord(), record, null);

There’s no matching line for ORecordOperation.UPDATED! Thus, after the following line (line 95):

      ORecord updated = Orient.instance().getRecordFactoryManager().newInstance(operation.getRecordType(), rid.getClusterId(), getDatabase());

add the following line:

      serializer.fromStream(operation.getRecord(), updated, null);

This fixes the problem for me.

Steve