public void MergeExpiredTransactions(Session session) { long firstLiveTransactionTimestamp = base.GetFirstLiveTransactionTimestamp(); while (true) { long timestamp = 0L; object[] list = null; lock (this.committedTransactionTimestamps) { if (this.committedTransactionTimestamps.IsEmpty()) { break; } timestamp = this.committedTransactionTimestamps.GetFirst(); if (timestamp >= firstLiveTransactionTimestamp) { break; } this.committedTransactionTimestamps.RemoveFirst(); list = this.committedTransactions.RemoveFirst(); } TransactionManagerCommon.MergeTransaction(session, list, 0, list.Length, timestamp); base.FinaliseRows(session, list, 0, list.Length, true); } }
public void MergeExpiredTransactions(Session session) { long firstLiveTransactionTimestamp = base.GetFirstLiveTransactionTimestamp(); while (true) { long first; object[] objArray; lock (this._committedTransactionTimestamps) { if (this._committedTransactionTimestamps.IsEmpty()) { break; } first = this._committedTransactionTimestamps.GetFirst(); if (first >= firstLiveTransactionTimestamp) { break; } this._committedTransactionTimestamps.RemoveFirst(); objArray = this._committedTransactions.RemoveFirst(); } TransactionManagerCommon.MergeTransaction(session, objArray, 0, objArray.Length, first); base.FinaliseRows(session, objArray, 0, objArray.Length, true); } }
public bool BeingActionTpl(Session session, Statement cs) { if (cs != null) { if (session.AbortTransaction) { return(false); } session.TempSet.Clear(); if (cs.IsCatalogChange()) { if (this._catalogWriteSession == null) { this.GetTransactionSessions(session.TempSet); session.TempSet.Remove(session); if (session.TempSet.IsEmpty()) { this._catalogWriteSession = session; this._isLockedMode = true; } else { this._catalogWriteSession = session; this._isLockedMode = true; TransactionManagerCommon.SetWaitingSessionTpl(session); } return(true); } this._catalogWriteSession.WaitingSessions.Add(session); session.Latch.CountUp(); return(true); } if (this._isLockedMode) { if ((cs.GetTableNamesForRead().Length == 0) && (cs.GetTableNamesForWrite().Length == 0)) { return(true); } if (cs.GetTableNamesForWrite().Length != 0) { if (cs.GetTableNamesForWrite()[0].schema == SqlInvariants.LobsSchemaQname) { return(true); } } else if ((cs.GetTableNamesForRead().Length != 0) && (cs.GetTableNamesForRead()[0].schema == SqlInvariants.LobsSchemaQname)) { return(true); } this._catalogWriteSession.WaitingSessions.Add(session); session.Latch.CountUp(); } } return(true); }
public bool CommitTransaction(Session session) { if (session.AbortTransaction) { return(false); } int count = session.RowActionList.Count; RowAction[] list = session.RowActionList.ToArray(); lock (base.Lock) { for (int i = 0; i < count; i++) { if (!list[i].CanCommit(session, session.TempSet)) { return(false); } } this.EndTransaction(session); session.ActionTimestamp = base.NextChangeTimestamp(); session.TransactionEndTimestamp = session.ActionTimestamp; for (int j = 0; j < count; j++) { list[j].Commit(session); } for (int k = 0; k < session.TempSet.Size(); k++) { session.TempSet.Get(k).AbortTransaction = true; } base.PersistCommit(session, list, count); if (base.GetFirstLiveTransactionTimestamp() > session.ActionTimestamp) { TransactionManagerCommon.MergeTransaction(session, list, 0, count, session.ActionTimestamp); base.FinaliseRows(session, list, 0, count, true); } else { list = session.RowActionList.ToArray(); this.AddToCommittedQueue(session, list); } this.EndTransactionTpl(session); CountDownLatches(session); } session.TempSet.Clear(); if ((session != base.LobSession) && (base.LobSession.RowActionList.Count > 0)) { base.LobSession.IsTransaction = true; base.LobSession.ActionIndex = base.LobSession.RowActionList.Count; base.LobSession.Commit(false); return(true); } return(true); }
public void BeginAction(Session session, Statement cs) { if (!session.HasLocks(cs)) { lock (base.Lock) { if (base.SetWaitedSessionsTpl(session, cs)) { if (session.TempSet.IsEmpty()) { base.LockTablesTpl(session, cs); } else { TransactionManagerCommon.SetWaitingSessionTpl(session); } } } } }
public void RollbackPartial(Session session, int start, long timestamp) { object[] list = session.RowActionList.ToArray(); int count = session.RowActionList.Count; if (start != count) { for (int i = start; i < count; i++) { RowAction action = (RowAction)list[i]; if (action != null) { action.Rollback(session, timestamp); } } TransactionManagerCommon.MergeRolledBackTransaction(session, timestamp, list, start, count); base.FinaliseRows(session, list, start, count, false); session.RowActionList.RemoveRange(start, session.RowActionList.Count - start); } }
public bool CommitTransaction(Session session) { if (session.AbortTransaction) { return(false); } int count = session.RowActionList.Count; object[] list = session.RowActionList.ToArray(); lock (base.Lock) { this.EndTransaction(session); session.ActionTimestamp = base.NextChangeTimestamp(); for (int i = 0; i < count; i++) { ((RowAction)list[i]).Commit(session); } base.PersistCommit(session, list, count); if (base.GetFirstLiveTransactionTimestamp() > session.ActionTimestamp) { TransactionManagerCommon.MergeTransaction(session, list, 0, count, session.ActionTimestamp); base.FinaliseRows(session, list, 0, count, true); } else { list = session.RowActionList.ToArray(); this.AddToCommittedQueue(session, list); } this.EndTransactionTpl(session); } session.TempSet.Clear(); if ((session != base.LobSession) && (base.LobSession.RowActionList.Count > 0)) { base.LobSession.IsTransaction = true; base.LobSession.ActionIndex = base.LobSession.RowActionList.Count; base.LobSession.Commit(false); } return(true); }