Class AdminOperationSerializer

java.lang.Object
com.linkedin.venice.controller.kafka.protocol.serializer.AdminOperationSerializer

public class AdminOperationSerializer extends Object
  • Field Details

    • LATEST_SCHEMA_ID_FOR_ADMIN_OPERATION

      public static final int LATEST_SCHEMA_ID_FOR_ADMIN_OPERATION
  • Constructor Details

    • AdminOperationSerializer

      public AdminOperationSerializer()
  • Method Details

    • serialize

      public byte[] serialize(AdminOperation object, int targetSchemaId)
      Serialize AdminOperation object to bytes[] with the writer schema
      Parameters:
      object - AdminOperation object
      targetSchemaId - writer schema id that we will refer to for serialization and deserialization

      If targetSchemaId equals LATEST_SCHEMA_ID_FOR_ADMIN_OPERATION, return the bytes[] from the first serialization. Otherwise, serialize the object to the writer schema (lower version).

      This involves:

      1. Serializing the object to a GenericRecord with the latest schema.
      2. Deserializing it to a GenericRecord with the writer schema.
      3. Serializing it to bytes.

      This process ensures the object is serialized to the lower schema version. The normal serialization process may fail (ClassCastException) due to:

      • Differences in field types
      • New fields added in the middle of the schema instead of at the end

    • deserialize

      public AdminOperation deserialize(ByteBuffer byteBuffer, int writerSchemaId)
    • initProtocolMap

      public static Map<Integer,org.apache.avro.Schema> initProtocolMap()
    • getSchema

      public static org.apache.avro.Schema getSchema(int schemaId)