コード例 #1
0
        internal override void Visit(RecycleTxRequest req)
        {
            // RecycleTxRequest will be called at the begining of tx, the remoteEntry is supposed to be null
            TxTableEntry txEntry = null;

            if (!this.txTable.TryGetValue(req.TxId, out txEntry))
            {
                txEntry = new TxTableEntry(req.TxId);
                if (!this.txTable.TryAdd(req.TxId, txEntry))
                {
                    req.Result   = false;
                    req.Finished = true;
                    return;
                }
            }

            while (Interlocked.CompareExchange(ref txEntry.latch, 1, 0) != 0)
            {
                ;
            }
            txEntry.Reset();
            Interlocked.Exchange(ref txEntry.latch, 0);

            req.RemoteTxEntry = txEntry;
            req.Result        = true;
            req.Finished      = true;
        }
コード例 #2
0
        internal override void Visit(RecycleTxRequest req)
        {
            string hashId = req.TxId.ToString();

            if (this.redisVersionDbMode == RedisVersionDbMode.Cluster)
            {
                hashId = RedisVersionDb.PACK_KEY(RedisVersionDb.TX_KEY_PREFIX, hashId);
            }

            byte[][] keysBytes =
            {
                Encoding.ASCII.GetBytes(TxTableEntry.TXID_STRING),
                Encoding.ASCII.GetBytes(TxTableEntry.STATUS_STRING),
                Encoding.ASCII.GetBytes(TxTableEntry.COMMIT_TIME_STRING),
                Encoding.ASCII.GetBytes(TxTableEntry.COMMIT_LOWER_BOUND_STRING)
            };
            byte[][] valuesBytes =
            {
                Encoding.ASCII.GetBytes(hashId),
                BitConverter.GetBytes((int)TxStatus.Ongoing),
                BitConverter.GetBytes(TxTableEntry.DEFAULT_COMMIT_TIME),
                BitConverter.GetBytes(TxTableEntry.DEFAULT_LOWER_BOUND)
            };

            RedisRequest redisReq = this.NextRedisRequest();

            redisReq.Set(hashId, keysBytes, valuesBytes, RedisRequestType.HMSet);
            redisReq.ParentRequest = req;
        }
コード例 #3
0
        internal override void Visit(RecycleTxRequest req)
        {
            // RecycleTxRequest is supposed to has no remoteTxEntry reference
            TxTableEntry txEntry = null;

            this.txTable.TryGetValue(req.TxId, out txEntry);

            if (txEntry == null)
            {
                txEntry = new TxTableEntry(req.TxId);
                this.txTable.Add(req.TxId, txEntry);
            }
            else
            {
                txEntry.Reset();
                req.RemoteTxEntry = txEntry;
                req.Result        = true;
                req.Finished      = true;
            }
        }
コード例 #4
0
        internal override void Visit(RecycleTxRequest req)
        {
            this.HashId = req.TxId.ToString();
            byte[][] keysBytes =
            {
                Encoding.ASCII.GetBytes(TxTableEntry.STATUS_STRING),
                Encoding.ASCII.GetBytes(TxTableEntry.COMMIT_TIME_STRING),
                Encoding.ASCII.GetBytes(TxTableEntry.COMMIT_LOWER_BOUND_STRING)
            };
            byte[][] valuesBytes =
            {
                BitConverter.GetBytes((int)TxStatus.Ongoing),
                BitConverter.GetBytes(TxTableEntry.DEFAULT_COMMIT_TIME),
                BitConverter.GetBytes(TxTableEntry.DEFAULT_LOWER_BOUND)
            };

            this.RedisReq = new RedisRequest(this.HashId, keysBytes, valuesBytes, RedisRequestType.HMSet)
            {
                ParentRequest = req
            };
        }
コード例 #5
0
 internal override void Visit(RecycleTxRequest req)
 {
     // There is no response from HMSet, always set the result as successful
     req.Result = true;
 }
コード例 #6
0
 internal virtual void Visit(RecycleTxRequest req)
 {
 }