Class RocksDBIncrementalCheckpointUtils


  • public class RocksDBIncrementalCheckpointUtils
    extends Object
    Utils for RocksDB Incremental Checkpoint.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean beforeThePrefixBytes​(byte[] bytes, byte[] prefixBytes)
      check whether the bytes is before prefixBytes in the character order.
      static <T extends org.apache.flink.runtime.state.KeyedStateHandle>
      T
      chooseTheBestStateHandleForInitial​(Collection<T> restoreStateHandles, org.apache.flink.runtime.state.KeyGroupRange targetKeyGroupRange, double overlapFractionThreshold)
      Choose the best state handle according to the stateHandleEvaluator(KeyedStateHandle, KeyGroupRange, double) to init the initial db.
      static void clipDBWithKeyGroupRange​(org.rocksdb.RocksDB db, List<org.rocksdb.ColumnFamilyHandle> columnFamilyHandles, org.apache.flink.runtime.state.KeyGroupRange targetKeyGroupRange, org.apache.flink.runtime.state.KeyGroupRange currentKeyGroupRange, int keyGroupPrefixBytes)
      The method to clip the db instance according to the target key group range using the RocksDB.delete(ColumnFamilyHandle, byte[]).
    • Constructor Detail

      • RocksDBIncrementalCheckpointUtils

        public RocksDBIncrementalCheckpointUtils()
    • Method Detail

      • clipDBWithKeyGroupRange

        public static void clipDBWithKeyGroupRange​(@Nonnull
                                                   org.rocksdb.RocksDB db,
                                                   @Nonnull
                                                   List<org.rocksdb.ColumnFamilyHandle> columnFamilyHandles,
                                                   @Nonnull
                                                   org.apache.flink.runtime.state.KeyGroupRange targetKeyGroupRange,
                                                   @Nonnull
                                                   org.apache.flink.runtime.state.KeyGroupRange currentKeyGroupRange,
                                                   @Nonnegative
                                                   int keyGroupPrefixBytes)
                                            throws org.rocksdb.RocksDBException
        The method to clip the db instance according to the target key group range using the RocksDB.delete(ColumnFamilyHandle, byte[]).
        Parameters:
        db - the RocksDB instance to be clipped.
        columnFamilyHandles - the column families in the db instance.
        targetKeyGroupRange - the target key group range.
        currentKeyGroupRange - the key group range of the db instance.
        keyGroupPrefixBytes - Number of bytes required to prefix the key groups.
        Throws:
        org.rocksdb.RocksDBException
      • beforeThePrefixBytes

        public static boolean beforeThePrefixBytes​(@Nonnull
                                                   byte[] bytes,
                                                   @Nonnull
                                                   byte[] prefixBytes)
        check whether the bytes is before prefixBytes in the character order.
      • chooseTheBestStateHandleForInitial

        @Nullable
        public static <T extends org.apache.flink.runtime.state.KeyedStateHandle> T chooseTheBestStateHandleForInitial​(@Nonnull
                                                                                                                       Collection<T> restoreStateHandles,
                                                                                                                       @Nonnull
                                                                                                                       org.apache.flink.runtime.state.KeyGroupRange targetKeyGroupRange,
                                                                                                                       double overlapFractionThreshold)
        Choose the best state handle according to the stateHandleEvaluator(KeyedStateHandle, KeyGroupRange, double) to init the initial db.
        Parameters:
        restoreStateHandles - The candidate state handles.
        targetKeyGroupRange - The target key group range.
        Returns:
        The best candidate or null if no candidate was a good fit.