internal override void Visit(DeleteVersionRequest req) { this.CQLExecute(string.Format(PartitionedCassandraVersionTable.CQL_DELETE_VERSION_ENTRY, req.TableId, req.RecordKey.ToString(), req.VersionKey)); req.Result = 1L; req.Finished = true; }
internal override void Visit(DeleteVersionRequest req) { bool applied = this.CQLExecuteWithIfApplied(string.Format(CassandraVersionTable.CQL_DELETE_VERSION_ENTRY, req.TableId, req.RecordKey.ToString(), req.VersionKey)); req.Result = applied ? 1L : 0L; req.Finished = true; }
internal override void Visit(DeleteVersionRequest req) { this.HashId = req.RecordKey as string; byte[] keyBytes = BitConverter.GetBytes(req.VersionKey); this.RedisReq = new RedisRequest(this.HashId, keyBytes, RedisRequestType.HDel) { ParentRequest = req }; }
internal override void Visit(DeleteVersionRequest request) { string hashId = GetHashKey(request); byte[][] args = { Encoding.ASCII.GetBytes(hashId), BitConverter.GetBytes(request.VersionKey) }; var redisRequest = CreateLuaRequest( LuaScriptName.DELETE_DIRTY_VERSION, args); redisRequest.ParentRequest = request; }
internal override void Visit(DeleteVersionRequest req) { VersionList versionList = req.RemoteVerList as VersionList; // Only get the version list location when version list is null if (versionList == null) { if (!this.dict.TryGetValue(req.RecordKey, out versionList)) { req.Result = true; req.Finished = true; return; } } versionList.TryRemove(req.SenderId, req.VersionKey); req.Result = true; req.Finished = true; }
internal override void Visit(DeleteVersionRequest req) { Dictionary <long, VersionEntry> versionList = req.RemoteVerList as Dictionary <long, VersionEntry>; if (versionList == null) { if (!dict.TryGetValue(req.RecordKey, out versionList)) { req.Result = true; req.Finished = true; } } VersionEntry verEntry = versionList[req.VersionKey]; VersionEntry tailEntry = versionList[SingletonDictionaryVersionTable.TAIL_KEY]; long tailKey = tailEntry.BeginTimestamp; long headKey = tailEntry.EndTimestamp; tailEntry.BeginTimestamp = tailKey - 1; if (headKey > 0) { versionList.Add(headKey - 1, verEntry); tailEntry.EndTimestamp = headKey - 1; } if (versionList.Remove(req.VersionKey)) { // should reset the lastVersionKey, set the lastVersionKey as the current - 1 req.Result = true; } else { req.Result = false; } req.Finished = true; }
internal override void Visit(DeleteVersionRequest req) { byte[][] returnBytes = req.Result as byte[][]; Debug.Assert(returnBytes.IsSuccess()); req.Result = returnBytes.IsSuccess(); }
internal override void Visit(DeleteVersionRequest req) { ConcurrentDictionary <long, VersionEntry> versionList = req.RemoteVerList as ConcurrentDictionary <long, VersionEntry>; // Only get the version list location when version list is null if (versionList == null) { if (!this.dict.TryGetValue(req.RecordKey, out versionList)) { req.Result = true; req.Finished = true; return; } } VersionEntry tailEntry = null; versionList.TryGetValue(SingletonDictionaryVersionTable.TAIL_KEY, out tailEntry); long headKey = Interlocked.Read(ref tailEntry.EndTimestamp); long tailKey = Interlocked.Read(ref tailEntry.BeginTimestamp); // Debug Assertion // if (tailKey != req.VersionKey) // { // throw new Exception("Abort isn't deleting it's dirty write?"); // } // As only if a tx uploads a version entry, it will change the value tailEntry // Here the dirty version entry hasn't been deleted, so there will no other txs update the tailEntry // We don't need to take Interlocked to update its value // when the deleted entry is the only one in version list if (headKey == tailKey) { ResetTailEntry(tailEntry); req.Result = true; req.Finished = true; return; } Interlocked.Exchange(ref tailEntry.BeginTimestamp, tailKey - 1); VersionEntry versionEntry = null; if (headKey > 0) { versionList.TryAdd(headKey - 1, versionEntry); Interlocked.Exchange(ref tailEntry.EndTimestamp, headKey - 1); } if (versionList.TryRemove(req.VersionKey, out versionEntry)) { // Debug Assertion // if (Interlocked.Read(ref versionEntry.TxId) != req.SenderId) // { // throw new Exception("I'm not deleting my own dirty write?"); // } this.recordPool.TryCache(versionEntry.Record); versionEntry.Record = null; req.Result = true; } else { req.Result = false; } req.Finished = true; }
internal virtual void Visit(DeleteVersionRequest req) { }