Docsity

Database Replication-Transaction Processing For E Commerce-Assignment Solution, Exercises of Transaction Processing for E Commerce

Toggle sidebar
bg1
CSEP 545 Transaction Processing for E-Commerce 2/29/2012
Assignment 8 1
Assignment 8 – Solution
Problem 1.
a) Database DB1 is read-only.
1. Every transaction accesses one copy only. Therefore, availability improves
with more replicas.
2. There is no bound on system throughput insofar as the database system is
concerned. More replicas give more throughput. However, the network may
impose a bound, depending on the capacity of connections between clients
and the database.
b) Database DB1 processes update transactions. The major challenge is
synchronizing the updates, which have to be applied and synchronized at all
replicas.
1. There are several ways availability can be reduced. Here is one way: The
system uses an algorithm that requires a transaction to update more than one
replica to commit. For example, the replication protocol could specify that all
replicas must be updated within the transaction. In this case, the failure of one
replica makes the whole system unavailable for updates. The more replicas,
the higher the probability that one of them will fail.
2. System throughput is capped by the number of updates a single replica can
perform because updates are performed on all replicas. This is an upper bound
on system throughput for any number of replicas. In a primary-copy system
with synchronous updates of replicas, network latency bounds the update rate,
since each transaction must be acknowledged by (a quorum of) the replicas
before committing at the primary. Two-phase commit imposes another limit.
The latter two factors reduce the maximum throughput as the number of
replicas increase.
Problem 2.
No. 1SR is not guaranteed even if each site uses 2PL (providing local serializability) and
2PC (providing atomic commitment). To show this, suppose the database has two
elements x and y and is replicated on two servers A and B.
T1 = r1(x), w1(y)
T2 = r2(y), w2(x)
Site A rl1(xa) r1(xa) wl1(ya) w1(ya) ru1(xa) wl2(xa) w2(xa) C1 C2
Site B rl2(y
b
) r2(y
b
) wl2(xa) w2(xa) ru2(ya) wl1(y
b
) w1(y
b
) C1 C2
docsity.com
pf2

Partial preview of the text

Download Database Replication-Transaction Processing For E Commerce-Assignment Solution and more Exercises Transaction Processing for E Commerce in PDF only on Docsity!

CSEP 545 Transaction Processing for E-Commerce 2/29/

Assignment 8 1

Assignment 8 – Solution

Problem 1.

a) Database DB1 is read-only.

  1. Every transaction accesses one copy only. Therefore, availability improves with more replicas.
  2. There is no bound on system throughput insofar as the database system is concerned. More replicas give more throughput. However, the network may impose a bound, depending on the capacity of connections between clients and the database.

b) Database DB1 processes update transactions. The major challenge is synchronizing the updates, which have to be applied and synchronized at all replicas.

  1. There are several ways availability can be reduced. Here is one way: The system uses an algorithm that requires a transaction to update more than one replica to commit. For example, the replication protocol could specify that all replicas must be updated within the transaction. In this case, the failure of one replica makes the whole system unavailable for updates. The more replicas, the higher the probability that one of them will fail.
  2. System throughput is capped by the number of updates a single replica can perform because updates are performed on all replicas. This is an upper bound on system throughput for any number of replicas. In a primary-copy system with synchronous updates of replicas, network latency bounds the update rate, since each transaction must be acknowledged by (a quorum of) the replicas before committing at the primary. Two-phase commit imposes another limit. The latter two factors reduce the maximum throughput as the number of replicas increase.

Problem 2.

No. 1SR is not guaranteed even if each site uses 2PL (providing local serializability) and 2PC (providing atomic commitment). To show this, suppose the database has two elements x and y and is replicated on two servers A and B.

T 1 = r 1 (x), w 1 (y) T 2 = r 2 (y), w 2 (x)

Site A rl 1 (xa) r 1 (xa) wl 1 (ya) w 1 (y (^) a) ru1 (xa) wl 2 (x (^) a) w 2 (xa) C 1 C 2 Site B rl 2 (yb ) r 2 (yb) wl 2 (xa) w 2 (x (^) a) ru2 (ya) wl 1 (y (^) b ) w 1 (yb ) C 1 C 2

docsity.com

CSEP 545 Transaction Processing for E-Commerce 2/29/

Assignment 8 2

Each transaction obeys 2PL. It holds its read locks until just before it commits and holds its write locks until after it commits on both servers A and B. 2PC steps are omitted (since they don’t change the example) as are unlock operations after commits.

The execution is not 1SR since in a serial execution on a one-copy database, one of the transactions would have read the other one’s output, which did not occur in this execution.

The problem here is the early release of read locks. If read locks were held until after commit, then the execution couldn’t arise.

Problem 3.

T is non-deterministic, writing different values with each execution.

If T is used for update propagation, replicas will contain different values for data item w. To remedy the non-determinism, time.now() can be replaced with a time value, such as Feb 29, 2012 12:00 am. Non-determinism should be resolved before execution on the resource manager, for example, at the client or in replication middleware.

The answer is unchanged when T executes multiple times. Ordinarily, it matters that transactions execute in the same order on both replicas. However, with T, the only effect of transaction order is the value returned by time.now(), which is the same problem noted above. However, if the system ran transactions that don’t commute, then it would be important that they executed in the same order on both systems.

docsity.com