[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Evolving a Coder for an added field

I'm adding a new lastModifiedMillis field to MatchResult.Metadata [0] which requires also updating MetadataCoder, but it's not clear to me whether there are guidelines to follow when evolving a type when that changes the encoding.

Is a user allowed to update Beam library versions as part of updating a pipeline? If so, there could be a situation where an updated pipeline is reading state that includes Metadata encoded without the new lastModifiedMillis field, which would cause a CodingException to be thrown.

Is there prior art for evolving a type and its Coder? Should I be defensive and catch CodingException when attempting to decode the new field, providing a default value?

[0] https://github.com/apache/beam/pull/6914