eclipse-cyclonedds / cyclonedds-python

Other
59 stars 47 forks source link

Fix key field order in key-only CDR #197

Closed dpotman closed 1 year ago

dpotman commented 1 year ago

The CDR serialization for keys was incorrectly using the rules for key serialization for key hash calculation wrt field order and extensibility (same issue existed in Cyclone's C implementation).

This commit changes the order of the key fields in the CDR serialization of a sample to use definition order and not member-id order. In addition, for key-only CDR the extensibility of the original type is used.

Note that the py-c keys that are extracted using the cdrkeyvm implementation are still using the old incorrect order. This code will be updated in a future PR to use Cyclone's CDR stream serializer for key extraction (based on the xtypes type meta-data generated by the python binding, that can be transformed into CDR stream serializer VM instructions using Cyclone's type-builder).

See https://github.com/eclipse-cyclonedds/cyclonedds/pull/1750 for the fixes in the C implementation.