Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-14997

Avoid to call unnecessary delete within RocksDBState's mergeNamespaces implementation

    XMLWordPrintableJSON

Details

    Description

      After FLINK-7700, we delete old state when merging namespaces of RocksDB state. However, this change still leaves some performance space to improve:

      byte[] valueBytes = backend.db.get(columnFamily, sourceKey);
      backend.db.delete(columnFamily, writeOptions, sourceKey);
      
      if (valueBytes != null) {
         backend.db.merge(columnFamily, writeOptions, targetKey, valueBytes);
      }
      

      As you can see, we would call delete instantly after we get the valueBytes. However, since we did not allow null in list state value and the delete operation could be removed to the statement block which has verified the valueBytes is not null. By doing this, we could avoid unnecessary delete calls if sourceKey not existed actually.

      Attachments

        Issue Links

          Activity

            People

              yunta Yun Tang
              yunta Yun Tang
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m