Unit 4
Unit 4
$
• Remote Backup Systems
• Transaction-Processing Monitors
• High-Performance Transaction Systems
• Long-Duration Transactions
• Real-Time Transaction Systems
• Weak Levels of Consistency
& %
• Transactional Workflows
& %
primary network backup
log
records
& %
primary
• To reduce delay in takeover, backup site periodically processes
the redo log records (in effect, performing recovery from
previous database state), performs a checkpoint, and can then
delete earlier parts of the log.
&
Database Systems Concepts 20.4 Silberschatz, Korth and Sudarshan c 1997
%
' Remote Backup Systems (Cont.)
$
• Ensure durability of updates by delaying transaction commit
until update is logged at backup; avoid this delay by permitting
lower degrees of durability.
• One-safe commits as soon as transaction’s commit log record
is written at primary — updates may not arrive at backup
before it has to take over.
• Two-very-safe commits when transaction’s commit log record
is written at primary and backup — reduces availability since
transactions cannot commit if either site fails.
& %
• Two-safe proceeds as in two-very-safe if both primary and
backup are active. If only the primary is active, the transaction
commits as soon as is commit log record is written at the
primary. Better availability than two-very-safe; avoids problem
of lost transactions in one-safe.
& %
– Coordination of two-phase commit when transactions
access multiple servers.
• Some commercial TP Monitors: CICS from IBM, Pathway from
Tandem, Top End from NCR, and Encina from Transarc
monitor
& %
remote router servers files remote routers servers files
clients clients
(c) Many-server, single-router model (d) Many-server, many-router model
& %
– Server process is multi-threaded; low cost for thread
switching
– No protection between applications
– Not suited for parallel or distributed databases
& %
– Client communication processes interact with router
processes that route their requests to the appropriate
server.
– Controller process starts up and supervises other
processes.
authorization
lock manager
recovery manager
application
servers
log manager
& %
database and
resource managers
output queue
network
& %
of a transaction
– once the transaction commits, the TP monitor guarantees
message is eventually delivered, regardless of crashes.
– ACID properties are thus provided even for messages sent
outside the database
& %
provides calls to enclose a series of RPC calls within a
transaction.
• Updates performed by an RPC are carried out within the scope
of the transaction, and can be rolled back if there is any failure.
& %
parallelism.
• We can reduce the degree to which a database system is disk
bound by increasing the size of the database buffer.
& %
– If the update rate for modified buffer blocks is high, the disk
data-transfer rate could become a bottleneck.
– If the system crashes, all of main memory is lost.
& %
• Improve implementation of operations such as locking and
latching, so they do not become bottlenecks.
• Optimize recovery algorithms, since pages rarely need to be
written out to make space for other pages.
& %
ions are ready to commit, or a transaction has been waiting
long enough – leads to slightly increased response time.
• The delay is acceptable in high-performance transaction
systems since it does not take much time for a large enough
group of transactions to be ready to commit.
& %
• Performance: fast response time is essential so user time is
not wasted
& %
transactions is more complex because of the long-duration
waits, and the possibility of aborts.
• Need alternatives to waits and aborts; alternative techniques
must ensure correctness without requiring serializability.
& %
• Treat some operations besides read and write as fundamental
low-level operations and extend concurrency control to deal
with them.
& %
write(B)
read(A)
A := A + 10
write(A)
& %
• An execution of T must not violate the partial order P, i.e., if an
edge ti → tj appears in the precedence graph, then tj → ti
must not be in the transitive closure of P.
& %
– Saga: multilevel long-duration transaction.
– Nested transaction: locks held by a subtransaction ti of T
are automatically assigned to T on completion of ti .
& %
∗ T2,1 , which subtracts 10 from B
∗ T2,2 , which adds 10 to A
• No ordering is specified on subtransactions; any execution
generates a correct result.
& %
– Instead of undoing all of Ti , the failure of Ti,3 is
compensated for by deleting the old hotel reservation and
making a new one.
• Requires use of semantics of the failed transaction.
& %
data item and the data-item name are stored in the log.
– Logging and shadow paging. Use logging from small
data items; use shadow paging for large data items. Only
modified pages need to be stored in duplicate.
& %
databases are thus often used.
• Design of a real-time system involves ensuring that enough
processing power exists to meet deadlines without requiring
excessive hardware resources.
&
Database Systems Concepts 20.27 Silberschatz, Korth and Sudarshan c 1997
%
' Example Schedule with Degree-Two Consistency
$
• Nonserializable schedule with degree-two consistency (Figure
20.5) where T3 reads the value of Q before and after that value
is written by T4 .
T3 T4
lock-S(Q)
read(Q)
unlock(Q)
lock-X(Q)
read(Q)
write(Q)
& %
unlock(Q)
lock-S(Q)
read(Q)
unlock(Q)
& %
• Used on heavily accessed relations as a means of increasing
concurrency and improving system performance.
• Use is limited to specialized situations with simple consistency
constraints.
& %
– If a mailer cannot deliver mail, failure must be handled
semantically (delivery failure message)
reject verification
loan superior
disbursement accept officer
& %
paper forms
• Computerized workflows aim to automate many of the tasks.
But humans still play a role e.g. in approving loans
& %
• Extend transaction concepts to the context of workflows.
• State of a workflow – consists of the collection of states of its
constituent tasks, and the states (i.e., values) of all variables in
the execution plan.
& %
“task ti can start if task tj returns a value greater than 25”
∗ External variables, that are modified by external events.
“task ti must be started within 24 hours of the completion
of task tj ”
&
Database Systems Concepts 20.34 Silberschatz, Korth and Sudarshan c 1997
%
' Failure-Atomicity Requirements of a Workflow
$
• Usual ACID transactional requirements are too
strong/unimplementable for workflow applications
• However, workflows must satisfy some limited transactional
properties that guarantee a process is not left in an
inconsistent state.
• Acceptable termination states – every execution of a workflow
will terminate in a state that satisfies the failure-atomicity
requirements defined by the designer.
– Committed – objectives of a workflow have been achieved.
& %
– Aborted – valid termination state in which a workflow has
failed to achieve its objectives.
• A workflow must reach an acceptable termination state even in
the presence of system failures.
&
Database Systems Concepts 20.36 Silberschatz, Korth and Sudarshan c 1997
%
' Workflow Management System Architectures
$
• Centralized – a single scheduler schedules the tasks for all
concurrently executing workflows.
– used in workflow systems where the data is stored in a
central database
– easier to keep track of the state of a workflow
• Partially distributed – has one (instance of a) scheduler for
each workflow.
• Fully distributed – has no scheduler, but the task agents
coordinate their execution by communicating with each other to
& %
satisfy task dependencies and other workflow execution
requirements.
– used in simplest workflow execution systems
– based on electronic mail
& %
subtransaction is committed and the other aborted. Both
cannot then be brought to the same state.
– Workflow specification is unsafe, and should be rejected.
• Determination of safety by the scheduler is not possible in
general, and is usually left to the designer of the workflow.
& %
Problem: Repeating handoff on recovery may lead to duplicate
execution of task; not repeating handoff may lead to task not
being executed.
Solution: Persistent messaging systems
& %
site recovers, if the message is not known to have reached
its destination.
– Messages must be logged in stable storage at the receiving
end to detect multiple receipts of a message.