Operational semantics of transactions(3)
时间:2026-01-15
时间:2026-01-15
Mathematics is forcing towards a consistent framework of theory development. Computer Science is an engineering discipline and sometimes suffers from ad-hoc definitions. Transactions are a concept that is commonly used in the database area. It is often def
Rollback:The transaction has not been success-ful.Effects to the database must be undone.
Redo:The redo event causes the manager to re-peat the operation.
Undo:The undo event forces the manager to re-pair the effects of applying a singleton op-eration to the database.The ovals used in Figure 2show system activities,i.e.,state transitions:Active:The transaction sequence is currently ex-ecuted.
Partially committed:The sequence has been exe-cuted and the concurrency controller checks
whether there is an interference with other transactions.Furthermore,integrity con-straints are checked by the transaction en-gine.
Committed:The transaction has been success-fully completed.The auxiliary logs are re-moved.Failed:The effects of the transaction on the database are compensated.Terminated:The transaction has been success-fully completed or has failed.In the case that the transaction failed no effect on the database can be observed.The event model state transition diagram is pic-tured in Figure 2.
E BeginOf Transaction
Active c E EndOf Transaction Partially
Committed Commit Committed
c Failed
r r r
r r
r Terminated c r r r
j ¨
¨¨¨¨¨
¨¨¨%c Read Write Figure 2:The Event Model of Transactions Statechart model:The transaction engine starts
(Weikum 2002)at the Begin state.After calling
the transaction the transaction state is changed
to Active .The transaction is either running or
blocked by the engine due to the database state
or the state of other transactions.An active
transaction is either committed or aborted.
The statechart of transactions is displayed in Fig-ure 3.The three models use a transaction engine (or sched-uler or recovery engine)for the explanation what is
considered to be a transaction.It seems,however,that transactions should be defined without referring
to an engine or an implementation.
2General Definition of Transactions 2.1Basic Definitions
Transactions are defined over databases schemata.Let (S ,Σ)be a database schema and O B S the set of basic modification and retrieval operations defined on S .
Begin
Committed Aborted Active
c T Running Blocked
Resume
Block ££
£#t E
T ''Commit Reject
Restart ¢¢¢ t Figure 3:The Statechart Model of Transactions Typically,the elementary modification operation is the write operation defined on locations loc =(R,o )of an object o in a class R C defined on R .The elemen-tary retrieval operation is the read operation defined
on locations (R,o )of an object o in a class R C defined on R .
Basic modification operations are the insertion,deletion and the updating operations defined for an
object o in a class R C defined on R or a group of objects.These operations are typically bound by an identification predicate for the object or the group
of objects.In object-relational databases we assume that the identification predicate is value-based .Basic retrieval operations are the select expres-sions defined by structural recursion on the structur-ing S .Classical SQL expressions are expressions of the form map (filter (join (...),ψ),S )
where the filter predicate is again an expression,the target structure for the mapping (or construction)is S .The static constraints in the schema (S ,Σ)can be transformed to transition constraints (Thalheim 2000).A transition constraint (Ψpre ,Ψpost )defines the preconditions and postconditions for state transi-tions of databases defined over S .Given a transition τconverting the database S C 1to the database S C 2=τ(S C 1).The transition constraint (Ψpre ,Ψpost )is valid for the transition (S C 1,τ(S C 1))if S C 1|=Ψpre
entails S C 2|=Ψpost .
Static constraints Σare therefore converted to a
transition constraint (Σ,Σ).
2.2Syntax of Transactions Transactions are defined on the basis of elementary operations.Following (Levene/Loizou 1999),we de-fine a transaction T over (S ,Σ)as a finite sequence o 1;o 2;o 3;...;o m of basic modification and retrieval op-erations over (S ,Σ).
Transactions may be applied to the database state
S C
sequentially and form a transition
T (S C )=o m (...(o 2(o 1(S C )))).2.3Functional semantics of transactions Logical semantics is based on the validity of transi-tion constraints.The transaction is considered to be a singleton transition.Given a transaction T over
(S ,Σ)and a database S C .
The result of applying the transaction T to S C is the database T (S C ).
The effect of application of T to S C is defined as
…… 此处隐藏:2589字,全部文档内容请下载后查看。喜欢就下载吧 ……