Esempio n. 1
0
    private static KuduTransaction MakeFakeTransaction(
        KuduClient client, KuduTransaction transaction)
    {
        var buf = transaction.Serialize();
        var pb  = TxnTokenPB.Parser.ParseFrom(buf);

        Assert.True(pb.HasTxnId);
        var txnId = pb.TxnId;

        Assert.True(txnId > KuduClient.InvalidTxnId);

        var fakeTxnId = txnId + 123;
        var message   = new TxnTokenPB
        {
            TxnId           = fakeTxnId,
            EnableKeepalive = false,
            KeepaliveMillis = 0
        };

        var fakeTxnBuf = ProtobufHelper.ToByteArray(message);

        return(client.NewTransactionFromToken(fakeTxnBuf));
    }