internal override void Visit(UpdateCommitLowerBoundRequest req)
 {
     byte[][] returnBytes = req.Result as byte[][];
     req.Result = returnBytes == null || returnBytes.Length == 0 ?
                  RedisVersionDb.REDIS_CALL_ERROR_CODE :
                  BitConverter.ToInt64(returnBytes.ValueBytes(), 0);
 }
        internal override void Visit(UpdateCommitLowerBoundRequest req)
        {
            TxTableEntry txEntry = req.RemoteTxEntry;

            if (txEntry == null)
            {
                if (!this.txTable.TryGetValue(req.TxId, out txEntry))
                {
                    throw new TransactionException("The specified tx does not exist.");
                }
            }

            while (Interlocked.CompareExchange(ref txEntry.latch, 1, 0) != 0)
            {
                ;
            }
            long commitTime = txEntry.CommitTime;

            if (commitTime == TxTableEntry.DEFAULT_COMMIT_TIME &&
                txEntry.CommitLowerBound < req.CommitTsLowerBound)
            {
                txEntry.CommitLowerBound = req.CommitTsLowerBound;
            }
            Interlocked.Exchange(ref txEntry.latch, 0);

            req.Result   = commitTime;
            req.Finished = true;
        }
        internal override void Visit(UpdateCommitLowerBoundRequest req)
        {
            this.HashId = req.TxId.ToString();
            string sha1 = this.redisLuaScriptManager.GetLuaScriptSha1(LuaScriptName.UPDATE_COMMIT_LOWER_BOUND);

            byte[][] keys =
            {
                Encoding.ASCII.GetBytes(this.HashId),
                BitConverter.GetBytes(req.CommitTsLowerBound),
                RedisVersionDb.NEGATIVE_ONE_BYTES,
                RedisVersionDb.NEGATIVE_TWO_BYTES,
            };

            this.RedisReq = new RedisRequest(keys, sha1, 1, RedisRequestType.EvalSha)
            {
                ParentRequest = req
            };
        }
Example #4
0
        internal override void Visit(UpdateCommitLowerBoundRequest req)
        {
            TxTableEntry txEntry = req.RemoteTxEntry;

            if (txEntry == null)
            {
                txEntry = this.txTable[req.TxId];
            }

            if (txEntry.CommitTime == TxTableEntry.DEFAULT_COMMIT_TIME)
            {
                txEntry.CommitLowerBound = Math.Max(txEntry.CommitLowerBound, req.CommitTsLowerBound);
                req.Result = txEntry.CommitTime;
            }
            else
            {
                req.Result = txEntry.CommitTime;
            }

            req.Finished = true;
        }
        internal override void Visit(UpdateCommitLowerBoundRequest req)
        {
            string hashId = req.TxId.ToString();

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

            string sha1 = this.redisLuaScriptManager.GetLuaScriptSha1(LuaScriptName.UPDATE_COMMIT_LOWER_BOUND);

            byte[][] keys =
            {
                Encoding.ASCII.GetBytes(hashId),
                BitConverter.GetBytes(req.CommitTsLowerBound),
                RedisVersionDb.NEGATIVE_ONE_BYTES,
                RedisVersionDb.NEGATIVE_TWO_BYTES,
            };

            RedisRequest redisReq = this.NextRedisRequest();

            redisReq.Set(keys, sha1, 1, RedisRequestType.EvalSha);
            redisReq.ParentRequest = req;
        }
Example #6
0
 internal virtual void Visit(UpdateCommitLowerBoundRequest req)
 {
 }