Class StreamGraphHasherV2

java.lang.Object
org.apache.flink.streaming.api.graph.StreamGraphHasherV2
All Implemented Interfaces:
StreamGraphHasher

public class StreamGraphHasherV2 extends Object implements StreamGraphHasher
StreamGraphHasher from Flink 1.2. This contains duplicated code to ensure that the algorithm does not change with future Flink versions.

DO NOT MODIFY THIS CLASS

  • Constructor Details

    • StreamGraphHasherV2

      public StreamGraphHasherV2()
  • Method Details

    • traverseStreamGraphAndGenerateHashes

      public Map<Integer,byte[]> traverseStreamGraphAndGenerateHashes(StreamGraph streamGraph)
      Returns a map with a hash for each StreamNode of the StreamGraph. The hash is used as the JobVertexID in order to identify nodes across job submissions if they didn't change.

      The complete StreamGraph is traversed. The hash is either computed from the transformation's user-specified id (see Transformation.getUid()) or generated in a deterministic way.

      The generated hash is deterministic with respect to:

      • node-local properties (node ID),
      • chained output nodes, and
      • input nodes hashes
      Specified by:
      traverseStreamGraphAndGenerateHashes in interface StreamGraphHasher
      Returns:
      A map from StreamNode.id to hash as 16-byte array.
    • generateUserSpecifiedHash

      public static byte[] generateUserSpecifiedHash(String operatorUid)
    • generateHashesByStreamNodeId

      public boolean generateHashesByStreamNodeId(int streamNodeId, StreamGraph streamGraph, Map<Integer,byte[]> hashes)
      Description copied from interface: StreamGraphHasher
      Generates a hash for StreamNode with the specified stream node id in the StreamGraph. This hash is stored in the provided map and can be used to uniquely identify the StreamNode across job submissions, assuming its configuration remains unchanged.
      Specified by:
      generateHashesByStreamNodeId in interface StreamGraphHasher