Interface XidGenerator

    • Method Detail

      • generateXid

        Xid generateXid​(org.apache.flink.api.common.functions.RuntimeContext runtimeContext,
                        long checkpointId)
        Generate new Xid. Requirements for generated Xids:
        • Global Transaction Id MUST be unique across Flink job, and probably across Xids generated by other jobs and applications - depends on the usage of this class
        • SHOULD be immutable
        • SHOULD override hashCode and equals
        Parameters:
        runtimeContext - can be used for example to derive global transaction id
        checkpointId - can be used for example to derive global transaction id
      • open

        default void open()
      • belongsToSubtask

        boolean belongsToSubtask​(Xid xid,
                                 org.apache.flink.api.common.functions.RuntimeContext ctx)
        Returns:
        true if the provided transaction belongs to this subtask
      • semanticXidGenerator

        static XidGenerator semanticXidGenerator()
        Creates a XidGenerator that generates xids from:
        1. job id
        2. subtask index
        3. checkpoint id
        4. four random bytes generated using SecureRandom)

        Each created XidGenerator instance MUST be used for only one Sink instance (otherwise Xids could collide).