Arelationorfragmentofarelationisreplicatedifitis
storedredundantlyintwoormoresites.
Fullreplicationofarelationisthecasewherethe
relationisstoredatallsites.
Fullyredundantdatabasesarethoseinwhichevery
sitecontainsacopyoftheentiredatabase.
Data Replication
Data Replication
Advantages of Replication
Availability:failureofsitecontainingrelationrdoesnotresultin
unavailabilityofrifreplicasexist.
Parallelism:queriesonrmaybeprocessedbyseveralnodesin
parallel.
Reduceddatatransfer:relationrisavailablelocallyateachsite
containingareplicaofr.
Disadvantages of Replication
Increased cost of updates: each replica of relation r must be updated.
Increased complexity of concurrency control: concurrent updates to
distinct replicas may lead to inconsistent data unless special
concurrency control mechanisms are implemented.
One solution: choose one copy as primary copy and apply
concurrency control operations on primary copy
Properties of Transactions
Distributed Requests and Distributed Transactions
Remoterequest
LetsasingleSQLstatementaccessdatatobe
processedbyasingleremotedatabaseprocessor.
Remotetransaction
Accessesdataatasingleremotesite.
Distributed Requests and Distributed Transactions
(continued)
Distributed transaction
Allows a transaction to reference several different
(local or remote) DP sites
Distributed request
Lets a single SQL statement reference data located at
several different local or remote DP sites
Distributed Requests and Distributed Transactions
(continued)
Distributed Requests and Distributed Transactions
(continued)
Distributed Requests and Distributed Transactions
(continued)
Distributed Requests and Distributed Transactions
(continued)
Distributed Requests and Distributed Transactions
(continued)
Transactions in a Distributed Environment
More complicated
Example: A money transfer involving two
accounts, maintained in two separate and
remote databases
Commit Transaction
Commit signals a successful end-of-
transaction. It declares:
A logical unit of work has been
successfully completed.
The database is in a consistent state.
All of the updates made by that unit of work
can now be “committed” or made
permanent
Transactions in a Distributed
Environment
Rollback Transaction
ARollbacksignalsanunsuccessfulend-of-operation.
Itdeclares:
Somethinghasgonewrong.
Thedatabasemightbeinaninconsistentstate.
Alloftheupdatesmadebythatlogicalunitofworkso
farmustbe“rolledback”orundone
Transactions in a Distributed
Environment
The Two-PhaseCommit
Oneoftheparticipantsisdesignatedasthe
coordinatorofthe2-phasecommitprocess.
Thepreparephase:Thecoordinatoraskseach
participanttosignaltheirreadinesstocommit.
Thecommitphase:thecoordinatorbroadcaststhe
commitsignaltoalltheparticipants.