Evaluating distributed database system transaction is processed in multiple

Evaluating Techniques to Ensure
Atomicity and Concurrency Control

 

There are many techniques
for managing concurrency control. I am going to describe 2-phase commit
technique. This is very useful for handle for distributed database based
application where many transactions are executed in daily basis.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

 

Two
phase commit protocol:

In the distributed
database system transaction is processed in multiple processes and on the
multiple machines and we have to preserve the properties of transactions and
also to achieve the atomicity in commit 
either all are involve in the transaction commit or otherwise they all
will abort the transaction and it will be not acceptable.  Two phase protocol achieve this type of atomic
commit.

Two phase commit protocol
is the simplest atomic commitment protocol. The two-phase commit Protocol for
atomicity ensured that the database commit operation must be divided in two
parts.

In the database management
systems commit (Saving of Data) and rollback (undoing the changes of Data) of
data can be achieved very easily using the transaction log. But when data is
spread over worldwide servers and each server has separate log.

The two phase commit
protocol is an algorithm which is used for computer network and the distributed
database system and it is used when we need to update the simultaneous data within
the distributed database system.

For this type of
distributed transaction two phase commit protocol required. Here the
coordinator arranges the activities and synchronization between the servers.

 

In the two-phase commit first phase is
implemented as follows:-

When the server wants to
commit or save the data write the data records to the log. If it’s unsuccessful
server responds with a failure message. In the other situation if its
successful server replies with an OK message.

Second phase is implemented as follows:-

The second phase begins
when all participants respond OK. After that the coordinator sends message or
signal to every server with commit instructions. After committing, each server writes
the commit in their log record and also sends the message to coordinator about
successful commit. If anyone server fails the coordinator sends the signal or
instructor to all the servers to roll back the transaction. After getting the
rollback message all servers rollback the transaction and each server also
sends feedback about the rollback has been completed.

 

The two-phase commit
protocol ensures that all the data processing will complete their component of
transaction before processing the final commit. So in this case when all the transaction
is committed we can say the durability is preserver.

 

It’s like the fail-stop
model where failed sites stop working and not sending any incorrect message.
Because the execution of the protocol is initiated by the coordinator after
completing last steps of successful transaction. And the protocol is involved the
entire local server where the transaction is executed.

 

Examples
of Two phases commit protocol:

In Funds transfer between
two banks the two phase commit block the updates on the accounts which is
involved in the fund transfer.  Source
bank account sends the debit money and a message to the other site (destination
site). The other site receive message and also credit the money to destination
account. When the transaction sends the message is committed the message must
be delivered (Destination site is must be up and reachable and also the code is
available to handle undeliverable message for example- Credit money will back
to the source account). If the transaction is aborted the message not sent.

 

 

Advantages
of using two phases commit protocol:

If the coordinator and all
the participants in one partition, in this case the failure has no effect on
the commit protocol.

If the sites are not in
the partition the coordinator think the coordinator has failed and it execute
the protocol with failure of coordinator. No harm results, But the sites wait
for decision message from the coordinator.

If the coordinator and all
the participants in one partition but the coordinator think that the sites in
the other partition have failed and will follow the usual commit protocol. But
there is no harm result.

In two phase commit
protocol we use recovery procedure for the site if they need to update the data
because of missed the transaction or absent during the transaction time. Sites
recover from the failure by using write-ahead-log it determine when the failure
occurred and also what decision is decided on that time except if the failure
is occurred in unsure state.

 

 

Disadvantages
of using two phases commit protocol:

Sometime because of
coordinator failure, the 2- phase commit protocol goes into blocking state. It
is because of the participants are in the uncertain state. On that time the
participants keep the locks upon resources until they get the message from coordinator.

 

References:

1.Moss,
Elliot, Nested Transactions : An Approach to Reliable Distributed
Computing, The MIT Press, Cambridge, Massachusetts, 1985, pp.31-38.

2.Singhal, M. and
Shivaratri, N., Advanced Concepts in Operating Systems, McGraw-Hill, 1994,
pp. 302-303, pp. 334-335, p. 337

x

Hi!
I'm Angelica!

Would you like to get a custom essay? How about receiving a customized one?

Check it out