public void FinaliseRows(Session session, object[] list, int start, int limit, bool commit)
        {
            bool flag = false;

            for (int i = start; i < limit; i++)
            {
                RowAction action = (RowAction)list[i];
                if (!action.IsMemory && (action.type == 0))
                {
                    this.RowActionMap.WriteLock();
                    try
                    {
                        lock (action)
                        {
                            if (action.type == 0)
                            {
                                this.RowActionMap.Remove(action.GetPos());
                            }
                        }
                    }
                    finally
                    {
                        this.RowActionMap.WriteUnLock();
                    }
                }
                if ((action.type == 3) && !action.DeleteComplete)
                {
                    try
                    {
                        action.DeleteComplete = true;
                        if (action.table.GetTableType() != 3)
                        {
                            Row row = action.MemoryRow ?? ((Row)action.Store.Get(action.GetPos(), false));
                            if (commit && action.table.hasLobColumn)
                            {
                                flag = true;
                            }
                            action.Store.CommitRow(session, row, action.type, this.TxModel);
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            if (flag && (this.TransactionCount == 0))
            {
                this.database.lobManager.DeleteUnusedLobs();
            }
        }
        public static void MergeRolledBackTransaction(Session session, long timestamp, object[] list, int start, int limit)
        {
            int index = start;

            while (index < limit)
            {
                RowAction action    = (RowAction)list[index];
                Row       memoryRow = action.MemoryRow;
                if (memoryRow != null)
                {
                    goto Label_003F;
                }
                if (action.type != 0)
                {
                    memoryRow = (Row)action.Store.Get(action.GetPos(), false);
                    goto Label_003F;
                }
Label_0039:
                index++;
                continue;
Label_003F:
                if (memoryRow == null)
                {
                    goto Label_0039;
                }
                lock (memoryRow)
                {
                    action.MergeRollback(session, timestamp, memoryRow);
                    goto Label_0039;
                }
            }
        }
Exemple #3
0
        public void RollbackPartial(Session session, int start, long timestamp)
        {
            object[] objArray = session.RowActionList.ToArray();
            int      count    = session.RowActionList.Count;

            if (start != count)
            {
                for (int i = count - 1; i >= start; i--)
                {
                    RowAction action = (RowAction)objArray[i];
                    if (((action != null) && (action.type != 0)) && (action.type != 3))
                    {
                        Row memoryRow = action.MemoryRow;
                        if (memoryRow == null)
                        {
                            memoryRow = (Row)action.Store.Get(action.GetPos(), false);
                        }
                        if (memoryRow != null)
                        {
                            action.Rollback(session, timestamp);
                            int changeAction = action.MergeRollback(session, timestamp, memoryRow);
                            action.Store.RollbackRow(session, memoryRow, changeAction, base.TxModel);
                        }
                    }
                }
                session.RowActionList.RemoveRange(start, session.RowActionList.Count - start);
            }
        }
        public void AddInsertAction(Session session, Table table, Row row)
        {
            RowAction rowAction = row.rowAction;

            session.RowActionList.Add(rowAction);
            if (!row.IsMemory())
            {
                base.RowActionMap.Put(rowAction.GetPos(), rowAction);
            }
        }
        public void PersistCommit(Session session, object[] list, int limit)
        {
            bool flag = false;

            for (int i = 0; i < limit; i++)
            {
                RowAction action = (RowAction)list[i];
                if (action.type != 0)
                {
                    int commitTypeOn = action.GetCommitTypeOn(session.ActionTimestamp);
                    Row row          = action.MemoryRow ?? ((Row)action.Store.Get(action.GetPos(), false));
                    if (action.table.hasLobColumn)
                    {
                        switch (commitTypeOn)
                        {
                        case 1:
                            session.sessionData.AdjustLobUsageCount(action.table, row.RowData, 1);
                            break;

                        case 2:
                            session.sessionData.AdjustLobUsageCount(action.table, row.RowData, -1);
                            flag = true;
                            break;
                        }
                    }
                    try
                    {
                        action.Store.CommitRow(session, row, commitTypeOn, this.TxModel);
                    }
                    catch (CoreException exception)
                    {
                        this.database.logger.LogWarningEvent(FwNs.Core.LC.cResources.SR.TransactionManagerCommon_PersistCommit_data_commit_failed, exception);
                    }
                }
            }
            try
            {
                if (flag && (this.TransactionCount == 0))
                {
                    this.database.lobManager.DeleteUnusedLobs();
                }
                session.LogSequences();
                if (limit > 0)
                {
                    this.database.logger.WriteCommitStatement(session);
                }
            }
            catch (CoreException)
            {
            }
        }