Uploaded image for project: 'Apache Ozone'
  1. Apache Ozone
  2. HDDS-10744

Standardize byte array conversion to String for LiveFileMetaData in RocksDB

    XMLWordPrintableJSON

Details

    Description

      LiveFileMetaData class in RocksDB has three methods that are returning a byte[] which we convert to String after any call.
      These methods are:

      • columnFamilyName()
      • smallestKey()
      • largestKey()

      We use 3 different conversion to String for the returned byte arrays.
      For largestKey and smallestKey we use FixedLengthStringCodec.bytes2String and new String(byte[], UTF_8)
      For columnFamilyName we use org.apache.hadoop.hdds.StringUtils.bytes2String, new String(byte[], UTF_8), and org.bouncycastle.util.Strings.fromByteArray.

      From these methods, FixedLengthStringCodec throws an exception if the conversion can not be done, and it uses ISO_8859_1 as the charset for the conversion, while the rest uses UTF_8 charset for the conversion, and replaces the characters that UTF-8 can not represent.

      Based on how and where we use these it seems to be safe to settle on UTF-8 as the target charset, and use StringUtils.bytes2String from our own utilities which uses the String constructor as of now by the way.

      Removing org.bouncycastle.util.Strings usage is also beneficial for crypto compliance related development.

      Attachments

        Issue Links

          Activity

            People

              pifta István Fajth
              pifta István Fajth
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: