Class SchemaOneChunkInfoListCodec

java.lang.Object
org.apache.hadoop.ozone.container.metadata.SchemaOneChunkInfoListCodec
All Implemented Interfaces:
org.apache.hadoop.hdds.utils.db.Codec<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList>

public final class SchemaOneChunkInfoListCodec extends Object implements org.apache.hadoop.hdds.utils.db.Codec<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList>
Codec for parsing ContainerProtos.ChunkInfoList objects from data that may have been written using schema version one. Before upgrading schema versions, deleted block IDs were stored with a duplicate copy of their ID as the value in the database. After upgrading the code, any deletes that happen on the DB will save the chunk information with the deleted blocks instead, even if those deletes are performed on a database created with schema version one.

Since the resulting database may contain a mix of values that could either be block IDs or chunk information, this codec will attempt to parse bytes as chunk information, and on failure, throw an exception with a message about the old schema format.

Note that there is currently no where in the code (except for tests) where the values associated with deleted block IDs are used. If it is added in the future, callers should be aware that the associated chunk information may not always be present.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final org.slf4j.Logger
     

    Fields inherited from interface org.apache.hadoop.hdds.utils.db.Codec

    EMPTY_BYTE_ARRAY
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList
    copyObject(org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList object)
     
    org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList
    fromPersistedFormat(byte[] rawData)
     
    static org.apache.hadoop.hdds.utils.db.Codec<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList>
    get()
     
    Class<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList>
     
    byte[]
    toPersistedFormat(org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList chunkList)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.hadoop.hdds.utils.db.Codec

    fromCodecBuffer, fromPersistedFormatImpl, supportCodecBuffer, toCodecBuffer, toDirectCodecBuffer, toHeapCodecBuffer, toPersistedFormatImpl
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
  • Method Details

    • get

      public static org.apache.hadoop.hdds.utils.db.Codec<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList> get()
    • getTypeClass

      public Class<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList> getTypeClass()
      Specified by:
      getTypeClass in interface org.apache.hadoop.hdds.utils.db.Codec<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList>
    • toPersistedFormat

      public byte[] toPersistedFormat(org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList chunkList)
      Specified by:
      toPersistedFormat in interface org.apache.hadoop.hdds.utils.db.Codec<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList>
    • fromPersistedFormat

      public org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList fromPersistedFormat(byte[] rawData) throws org.apache.hadoop.hdds.utils.db.CodecException
      Specified by:
      fromPersistedFormat in interface org.apache.hadoop.hdds.utils.db.Codec<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList>
      Throws:
      org.apache.hadoop.hdds.utils.db.CodecException
    • copyObject

      public org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList copyObject(org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList object)
      Specified by:
      copyObject in interface org.apache.hadoop.hdds.utils.db.Codec<org.apache.hadoop.ozone.container.common.helpers.ChunkInfoList>