Exemple #1
0
        protected override async ValueTask OnFinshTransaction(long transactionId)
        {
            if (transactionId > 0)
            {
                if (!TransactionOptions.RetainTxEvents)
                {
                    if (Snapshot.Base is TxSnapshotBase <PrimaryKey> snapshotBase &&
                        BackupSnapshot.Base is TxSnapshotBase <PrimaryKey> backupSnapshotBase)
                    {
                        //删除最后一个TransactionCommitEvent
                        await EventStorage.DeleteByVersion(Snapshot.Base.StateId, snapshotBase.TransactionStartVersion, snapshotBase.TransactionStartTimestamp);

                        var txCommitEvent = WaitingForTransactionTransports.Single(o => o.FullyEvent.Base.Version == snapshotBase.TransactionStartVersion);
                        WaitingForTransactionTransports.Remove(txCommitEvent);
                        snapshotBase.ClearTransactionInfo(true);
                        backupSnapshotBase.ClearTransactionInfo(true);
                    }
                    else
                    {
                        throw new SnapshotNotSupportTxException(Snapshot.GetType());
                    }
                }
                else
                {
                    await base.RaiseEvent(new TxFinishedEvent(transactionId));
                }
            }
        }