You are on page 1of 8

CS704A

Group A
1. Attempt all the questions:

1 10

i) Express in one word: "Ability of a site in committing a transaction alone"


(a) Autonomy
(b) Atomicity
(c) Serializibility
(d) Durability
ii) Two Phase Commitment Protocol is a / an
(a) inherently non-blocking protocol
(b) centralized query commitment protocol
(c) inherently blocking protocol
(d) distributed database commitment protocol
iii) Two Phase Locking protocol has two phases viz.,
(a) Upward phase and downward phase
(b) Commit phase and abort phase
(c) Growing phase and shrinking phase
(d) Distributed phase and localized phase
iv) Horizontal fragmentation is of a relation is done by using
(a) Projection operation alone
(b) First projection and then selection operations
(c) First selection and then projection operations
(d) Selection operation alone
v) Derived horizontal fragmentation is of a relation is done by
(a) Adding a primary key to the relation
(b) Using the primary key of another relation
(c) Using semijoin operation
(d) Using natural join operation
vi) Which of the following statement is true:
(a) In general semijoin is more efficient than natural join.
(b) In general natural join is more efficient than semijoin.
(c) In general Cartesian product is more efficient than natural join.
(d) In general Cartesian product is more efficient than semijoin.
vii) Which of the following statement is true for distributed query processing:
(a) Only global optimization is sufficient and local optimization is not required.
(b) Both global optimization and local optimization are required.
(c) Only local optimization is sufficient and global optimization is not required.
(d) Both global optimization and local optimization are not required.

viii) Number of nodes in a query graph is equal to the


(a) Number of relations associated in the query
(b) Number of attributes associated in the query
(c) Number of relations associated in the query plus one
(d) Number of attributes associated in the query plus one
ix) Operator tree corresponding to a distributed query must be derived:
(a) At the last stage of query processing
(b) After evaluating the corresponding relational algebraic query of an SQL query
(c) Directly from the SQL query
(d) After evaluating the corresponding relational calculus query of an SQL query
x)
(a)
(b)
(c)
(d)

ensures correctness of transaction.


Atomicity
Consistency
Isolation
Durability
Group B
Answer any three questions.

3 5 = 15

2. Consider the following relations and the query on these relations:

3+2

Book(bookno, title, author, edition)


Member(memno, name, category, address, phone)
Lending(memno, bookno, duedate)
SELECT name, duedate
FROM Member M, Lending L
WHERE M.memno = L.memno and bookno = 81-203-1257-0;
Write the query in relational algebra and draw the query tree.
3. Explain horizontal, vertical, mixed and derived fragmentations with example.

1+1+1+2

4. Draw and explain reference architecture of distributed database.


5. Prove or disprove: 2PL cannot produce cycles. Does 2PL protocol ensure conflict
serializability?
6. (a) What do you mean by deadlock prevention?
(b) What do you mean by deadlock avoidance?
(c) Write down WAIT-DIE rule.
(d) Write down WOUND-WAIT rule.

5
2+3
1
1
1
1

Group C
Answer any three questions.

3 15 = 45

7. What is concurrency control? What is lock based protocol? Explain. What is validation
based protocol? Write insert and delete operations.
2+3+4+(3+3)
8. (a) Define query graph.
1
(b) Given the following relations and the query:
EMP = (eno, ename, title)
ASG = (eno, pno, responsibility, duration)
PROJ = (pno, pname, budget, loc)
Query: "Find the names and responsibilities of programmers who have been working
on the CAD/CAM project for more than 36 months"
i)
ii)
iii)

Write down the SQL for the above query.


Write down the relational algebraic expression of the above SQL.
Draw the query graph of the above query.

1
3
3

(c) Given the following query on the above relations:


Query: "Find the names of the employees other than J. Doe who worked on the
CAD/CAM project for one or two years."
i)
Write down the SQL for the above query.
ii)
Draw the operator tree and the reduced operator tree.

1
2+4

9. Write the basic 2 phase commitment protocol, assuming there is no failure. What are
different types of 2PC protocol based on communication paradigm? Explain each of them
briefly.
6+9
10. What is concurrent transaction? Define dirty read, non-repeatable or fuzzy read and
phantom. Explain distributed transaction execution with the help of a diagram.
1+3+3+3+5
11. How data dictionary management is done in distributed environment? What is 2PL
protocol? Briefly explain centralized, distributed and primary copy 2PL protocols. 4+2+9

Answer Key:
Group A Question 1:

i) A
vi) A

ii) C
vii) B

iii) C
viii) C

iv) D
ix) B

v) B
x) B

Group B Question 2:
Relational algebraic query:

name, duedate (Member.memno = Lending.memno bookno = '81-203-1257-0' MemberLending)


Query tree:

name, duedate
Member.memno = Lending.memno bookno = '81-203-1257-0'

Membe
r

Lendin
g

Group B Question 3:
Horizontal fragmentation: Definition - mark & Explanation - mark
Vertical fragmentation: Definition - mark & Explanation - mark
Mixed fragmentation: Definition - mark & Explanation - mark
Derived fragmentation: Definition - 1 mark & Explanation - 1 mark
Group B Question 5:
2PL cannot produce cycles: Without loss of generality, let us assume that the following cycle
exists in the precedence graph: T0 T1 T2 ...Tn1 T0. Let i be the time at which Ti
obtains its last lock (i.e. Tis lock point). Then for all transactions such that Ti Tj , i < j .
Then for the cycle we have
0 < 1 < 2 < ... < n1 < 0
Since 0 < 0 is a contradiction, no such cycle can exist.
Yes, 2PL ensures serializability.
Suppose two-phase locking does not ensure serializability. Then there exists a set of transactions
T0, T1 ... Tn1 which obey 2PL and also produce a non-serializable schedule. A nonserializable schedule implies a cycle in the precedence graph, and we know that 2PL cannot
produce such cycles.
Hence 2PL cannot produce non-serializable schedules. Because of the property that for all
transactions such that Ti Tj , i < j , the lock point ordering of the transactions is also a
topological sort ordering of the precedence graph. Thus transactions can be serialized according
to their lock points.
Group B Question 6:
4

(c) WAIT-DIE rule: If Ti requests a lock on a data item that is already locked by Tj, Ti is
permitted to wait and if only if Ti is older than Tj. If Ti is younger than Tj,
then Ti is aborted and restarted with the same timestamp.
(d) WOUND-WAIT rule: If Ti requests a lock on a data item that is already locked by Tj, Ti is
permitted to wait if and only if it is younger than Tj; otherwise Tj is
aborted and the lock is granted to Ti.
Group C Question 8:
(b) SQL:
SELECT
FROM
WHERE

Ename, Responsibility
EMP, ASG, PROJ
EMP.Eno = ASG. Eno AND
ASG.Pno = PROJ.Pno AND
Pname = 'CAD/CAM' AND
Duration >= 36 AND
Title = 'Programmer'

Query graph:
Dur >= 36
AS
G

EMP.Eno = ASG.Eno
Title = 'Programmer'

(c) SQL: SELECT


FROM
WHERE

ASG.Pno = PROJ.Pno

Resp
EM
P

Ename

Resul
t

PRO
PnameJ = 'CAD/CAM'

Ename
PROJ, ASG, EMP
ASG.Eno = EMP.Eno AND
ASG.Pno = PROJ.Pno AND
Ename != 'J. Doe' AND
PROJ.Pname = 'CAD/CAM AND
(Duration = 12 OR Duration = 24)

Operator tree:
Ename
Dur = 12 Dur = 24
Pname = 'CAD/CAM'
Ename != 'J. Doe'

Pno

Eno

PROJ

ASG

EMP

which after reduction becomes:


Ename
Pname = 'CAD/CAM' (Dur = 12 Dur = 24) Ename != 'J. Doe'

Pno Eno

ASG

PROJ

EMP

Group C Question 9:
The basic 2 phase commitment protocol (assuming no failure)
Coordinator : Write "prepare" record in the log
Send PREPARE message and activate timeout
Participant

: Wait for prepare message;


If the participant is willing to commit then
Begin
Write substransactions records in the log
Write ready record in the log
Send READY answer message to coordinator
End
Else
Begin
Write abort record in the log
Send ABORT answer message to coordinator
End

Coordinator : Wait for ANSWER message (READY or ABORT) from all participant or timeout
If timeout expired or at least one answer message is ABORT then
Begin
Write global_abort record in the log
Send ABORT command message to all participants
End
Else // all the sites are READY
Begin
Write global_commit record in the log
Send COMMIT command message to all participants
End
Participant

: Wait for command message


Write abort or commit record in the log
Send the ACK message to coordinator
Execute command

Coordinator : Wait for ACK message from all participants


Write complete record in the log

2nd part
Explain Centralized 2PC, Linear 2PC and Distributed 2PC with diagram.

Group C Question 10:


Last part
Distributed transaction execution

TM: Transaction manager


SC: Schedular
RM: Recovery Manager

You might also like