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

Remove ContainerID to Proto to ContainerID conversion in ContainerStateManagerImpl

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • SCM

    Description

      In ContainerManagerImpl, most of the methods accept a ContainerID object. This is then converted into `HddsProtos.ContainerID` to pass to ContainerStateManagerImpl. The data is stored in ContainerStateMap, where it is all keyed on ContainerID, so the `HddsProtos.ContainerID` has to be converted back to ContainerID again, which seems wasteful.

      I think this is left over from some previous implementation, but is there there any reason we cannot change ContainerStateManagerImpl to accept ContainerID directly? This is an internal class to ContainerManager, so the change should have minimal impact.

      There are also some TODO's in the code suggesting it was always the intention to make this change, but it never happened, eg:

        @Override
        public boolean contains(final HddsProtos.ContainerID id) {
          lock.readLock().lock();
          try {
            // TODO: Remove the protobuf conversion after fixing ContainerStateMap.
            return containers.contains(ContainerID.getFromProtobuf(id));
          } finally {
            lock.readLock().unlock();
          }
        }
      

       

      Attachments

        Issue Links

          Activity

            People

              sodonnell Stephen O'Donnell
              sodonnell Stephen O'Donnell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: