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

KeyInputStream should create BlockStreams lazily

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      In KeyInputStream, when the object is initialized, it pre-creates a BlockInputStream for every block in the Key. If the key is very large, this can be a lot of streams. For the Ratis read case, the BlockInputStream objects are lightweight and they don't setup the block read until they are read for the first time. However this is not the case with the EC readers, which allocate buffers and some resources when they are allocated.

      Additionally, when the KeyInputStream has read past a given block it does not close the previous stream. So even if the EC readers delayed allocation until first read, the resources will not be freed by close until after the Key has been read completely.

      We should make KeyInputStream open the Block stream on demand, and close it after its read position has moved outside the current block (either by seek or normal reads).

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated: