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

RenameKey request has memory leak

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.3.0
    • None

    Description

      Issue: The heap is full of keyInfo from TableCache after renameKey API test and the memory can not be evicted with manual FGC.

       

      During validateAndUpdateCache in OMKeyRenameRequest, the keyTable will add twice cache entry( fromKey and toKey). This process actually does this way:

      public void put(CACHEKEY cacheKey, CACHEVALUE value) {
        cache.put(cacheKey, value);
        epochEntries.add(new EpochEntry<>(value.getEpoch(), cacheKey));
      }
      

      this EpochEntry right now only supports the unary operation. 

      @Override
      public int compareTo(Object o) {
        if(this.epoch == ((EpochEntry<?>)o).epoch) {
          return 0;
        } else if (this.epoch < ((EpochEntry<?>)o).epoch) {
          return -1;
        } else {
          return 1;
        }
      } 

      hence, when renaming A to B in one transaction, the cache will add two cache entries but epochEntries cannot add B after adding A as they are compared as the same.

      keyTable.addCacheEntry(new CacheKey<>(fromKey),
          new CacheValue<>(Optional.absent(), trxnLogIndex));
      
      keyTable.addCacheEntry(new CacheKey<>(toKey),
          new CacheValue<>(Optional.of(fromKeyValue), trxnLogIndex)); 

      The solution is easy and should be no side effects. 

      We can simply add a check for EpochEntry's value.

      Attachments

        Issue Links

          Activity

            People

              Nibiruxu Xu Shao Hong
              Nibiruxu Xu Shao Hong
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: