









































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










































Cornell
University.
Fall^ 2008.
y^ How^ transactional
systems
really^ work
y^ Implementation
considerations Implementation
considerations y^ Limitations
and^ performance
challenges
y^ Scalability
of^ transactional
systems
y^ Seen^ at
the^ server
as^ a^ series
of^ reads
and^ writes.
y^ There
are^ multiple
simultaneous
client^ transactions
running
at^ the^ server running
at^ the^ server
y^ Client/Server
could^ fail
at^ any^ time.
y^ Are^ the
four^ desirable
properties
for^ reliable
handling
of
concurrent
transactions. y^ Atomicity
y y The “All^ or^ Nothing”
behavior.
y^ C:^ stands
for^ either y^ Concurrency:
Transactions
can^ be^ executed
concurrently
Concurrency:
Transactions
can^ be^ executed
concurrently
y^ …^ or^ Consistency:
Each^ transaction,
if^ executed
by^ itself,
maintains
the^ correctness
of^ the^ database.
y^ Isolation
(Serializability) y^ Isolation
(Serializability) y Concurrent^ transaction
execution
should^ be
equivalent
(in
effect)^ to
a^ serialized
execution.
y^ Durabilityy^ Durability^ y^ Once
a^ transaction
is^ done ,^ it
stays^ done.
y^ begin^ transaction y^ Perform
a^ series^ of
read^ update
operations
y^ Perform
a^ series^ of
read ,^ update
operations
y^ Terminate
by^ commit
or^ abort.
application
is^ the^ transaction
manager
y^ The^ data
manager is
presented
with^ operations
from
concurrently
active^ t
ransactions co cu^
e t y act ve t a sact o s y^ It^ schedules them
in^ an^ interleaved
but^ serializable
order
y^ Application
runs y^ And^ as
it^ runs,
it^ issues
operations
y^ The^ data
manager
sees^ them
one^ by^
one
careful^
to^ do^ this
in^ ways
that^ make
sense
y^ We re
careful^
to^ do^ this
in^ ways
that^ make
sense
y^ In^ any
case,^ we
usually
don’t^ need
to^ say^ anything
until^ a
“commit”
is^ issued
y^ Before
accessing
“x”^ get^
a^ lock^ on
“x”
Before^ accessing
x^ get^
a^ lock^ on
x
y^ Usually
we^ assume
that^ the
application
knows^
enough
to
get^ the^ right
kind^ of
lock.^ It
is^ not^ good
to^ get^ a
read
lock^ if^ you
’ll^ later^
need^ to
update
the^ object
lock^ if^ you ll
later^ need
to^ update
the^ object
y^ We^ could
have^ one
lock^ per
object
y^ …^ or^ one
lock^ for
the^ whole
database l^ k^ f^
f^ bj
y^ …^ or^ one
lock^ for
a^ category
of^ objects
y^ In^ a^ tree,
we^ could
have^ one
lock^ for^ the
whole^ tree
associated
with
the^ root y In^ a^ table
we^ could
have^ one
lock^ for^ row,
or^ one^ for
each^ column,
or
one^ for^ the
whole^ table y^ All^ transactions
must^ use
the^ same
rules!
All^ transactions
must^ use
the^ same
rules!
y^ And^ if
you^ will
update
the^ object,
the^ lock
must^ be
a^ “write”
lock,^ not
a^ “read”
lock
y^ Operations
and^ order
they^ executed C^ i f^
d^ i^
hi h^
i
y^ Can^ infer
order^ in
which^ transactions
ran
T:^ R(X) R^1^1
(Y) W(X) commit 1
1 T:^ R(X) W2^2^2
(X) W2(Y) commit
2 (^ )^ (^ 2 2 2 )^ (^ )^2
2 DB:^ R(X) R^1
(X) W(X) R(Y) W 2 1
(X) W2(Y) commit 1
commit^1
Data manager interleaves operations to improve concurrency
1 T:^ R(X) W2^2^2
(X) W2(Y) commit
2 (^ )^ (^ 2 2 2 )^ (^ )^2
2 DB:^ R(X) W^2
(X) R(X) W(X) W2 2 1 1
(Y) R(Y) commit 1
commit^2
Data manager interleaves operations to improve concurrency but schedules them so thatit looks as if one transaction ran at a time
This schedule “looks” like T
ran first 2
it looks as if one transaction ran at a time. This schedule
looks^ like T
ran first. 2
b^ d^
l^
ff^
h^ d
b
y^ Aborted
transactions
leave^ no
effect,^ either
in^ database
itself^ or
in^ terms
of^ indirect
side‐effects
y^ Only^ need
to^ consider
committed
operations
in
Only^ need
to^ consider
committed
operations
in
determining
serializability