You are on page 1of 58

Distributed DBMS

Syllabus Introduction to DDMBS, Features and Needs, Reference architecture, levels of distribution transparency, replication, and Distributed database design, Fragmentation and allocation criteria, and Storage mechanisms, Translation of global queries, global query optimization, queries execution and access plan. Concurrency control, 2-phase locks, distributed deadlocks, quorum based, time based protocols, comparison, reliability, non-blocking commitment protocols 3-phased), partitioned networks checkpoints and cold starts Management of distributed transactions 2-phase unit protocols, architectural aspects, nodes and link failure recoveries, distributed data dictionary management distributed database administration Heterogeneous database-federated data reference architecture, loosely and tightly coupled alternative architectures, development tasks, operational global task management client server database, SQL Server, Open database connectivity, constructing an application.

Introduction
Independent or centralized systems were the norm in the earlier days of information management. There was duplication of hardware and facilities. Incompatible procedures and lack of management control were the consequences of the evolving nature of the field. In a centralized database system the DBMS and the data reside at a single location and control and processing is limited to this location. However many organizations have geographically dispersed operations. The reliability of the system is compromised since loss of messages between sites or failure of the communication links may occurs. The excessive load on the system at the central site would likely cause all accesses to be delayed. An organization located in a single building with quazi – independent operational divisions, each with its own information processing needs and using a centralized database on a local network, would have similar problems. The current trend is toward a distributed system. This is a central system connected to intelligent remote devices, each of which can itself be a computer or interconnected, possibly heterogeneous computers. The distribution of processing power creates a feasible environment for data distribution. All distributed data must still be accessible from each site. Thus, distributed database can be defined as consisting of a collection of data with different parts under the control of separate DBMS, running on independent computer systems. All the computers are interconnected and each system has autonomous processing capability, serving local applications. Each system participates as well in the execution of one or more global applications. Such applications require data from more than one site. Another typical definition of a distributed database is the following: A distributed database is a collection of data which belong logically to the same system but are spread over the sites of a computer network. Third definition emphasizes two equally important aspects of a distributed database. 1. Distribution: The fact that the data are not resident at the same site, so that we can distinguish a distributed database from a single, centralized database.

2. Logical co-relation: The fact that the data have some properties which tie them together, so that we can distinguish a distributed database from a set of local databases or files which are resident at different sites of a computer network. The problem with the above definition is that properties, distribution and logical correlation are too vaguely defined. In order to develop a more specific definition, let us consider an example.

Fig. A distributed database on a geographically dispersed network. Consider a bank that has 3 branches at different locations. At each branch a computer controls the teller terminals of the branch and the account database of that branch. Each computer with its local account database at one branch constitutes one site of the distributed database; computers are connected by a communication network. During normal operations the applications which are requested from the terminals of a branch need only to access the database of that branch. These applications are completely executed by the computer of the branch where they are issued, and will therefore be called local applications.

An example of a local applications is a debit or credit application performed on an account stored at the same branch at which the application is required. Therefore the definition of a distributed database is a collection of data which are distributed over different computers of a computer network. Each site of the network has autonomous processing capability and can perform local applications. Each site also participates in the execution of at least one global applications, which requires the accessing data at several sites using a communication subsystem.

 Need of Distributed DBMS
There are several reasons why distributed databases are developed. 1. Organizational and economic reasons: Many organizations are decentralized and a distributed database approach fits more naturally the structure of the organizations. The problems of a distributed organizational structure and of the corresponding into systems are the subject of several books and papers. With the recent developments in computer technology, the economy of scale motivates for having large centralized computer centers is becoming questionable. The organizational and economic reasons are probably the most important reasons for developing distributed databases. 2. Interconnection of existing databases: Distributed databases are the natural solution when several databases already exist in an organization and the necessity of performing global applications arises. In this case, the distributed database is created bottom up from the pre-existing local databases. This process may require a certain degree of local restructuring; however the effort which is required by this restructuring in much less than that needed for the creation of a completely new centralized database. 3. Incremental Growth:

if an organization grows by adding new, relatively autonomous organizational units (new branches, warehouses, etc.) then the distributed database approach supports a smooth incremental growth with a minimum degree of impact on the already existing units. With a centralized approach it is very difficult to add new branches. 4. Reduced Communication Overhead: In a geographically distributed database, any applications are local clearly reduces the communication overhead with respect to a centralized database. 5. Performance considerations: The existence of several autonomous processors results in the increase of performance through a high degree of parallelism. This consideration can be applied to any multiprocessor system and not only to distributed databases. Distributed databases have the advantage in that the decomposition of data reflects application dependent criteria which maximize application locality; in this way the natural interference between different processors is maximized. The load is shared between the different processors, and critical bottlenecks are avoided.

 Features of DDBMS
Distributed database can be defined as consisting of a collection of data with different parts under the control of separate DBMSs, running on independent computer systems. All the computers are interconnected and each system has autonomous processing capability, serving local applications. There are various features of DDBMS are as follows: 1. Autonomy: in distributed database it is possible to identify a hierarchical control structure based on a global database administrator, who has the central responsibility of the whole database and on local database administrators, who have the responsibility of their respective local databases. However, it must be emphasized that local database administrator may have a high degree of autonomy, up to the point that a global database administrator is completely missing

Distribution or Network Transparency: this refers to freedom for the users from the operational details of the network. Naming transparency implies that once a name is specified. the system remains available. If most of the data used at a given site is available locally. relation) is physically stored within the system. If data can be obtained from a site other than the one that has failed. Distributed data: Data distribution in DBMS with redundant copies can be used to increase system availability and reliability. a DBMS should be distribution transparent in the sense of hiding the details of where each file (table. 4. 7. Data distribution can also be used to decrease communication costs. the named object can be accessed unambiguously without additional specifications. The greater accessibility enhances the reliability of the system. 6. Location transparency refers to the fact that the command issued to perform a task is independent of the location of data and the location of the system where the command was issued. This characteristic is usually called site autonomy. the communication cost compared with that of a remote centralized system obviously reduced. and as the system can still run. Availability & Reliability: Even when a portion of a system (i. With replicated data. 2. then availability improves. reliability does too. continue to function. 3. It may be divided into location transparency and naming transparency. Sharing: Data sharing is also provided by DDBMS. The remaining site. 5. Management of distributed Data with different levels of transparency: ideally. Users at a given site are able to access data stored at other sites and at the same time retain control over the data at their own site.e.and the inter-site coordination is performed by the local administrators themselves. . a local site) is down. the failure of one site staff allows access to the replicated copy of the data from another site. Parallel Evaluation: A query involving data from several sites can be subdivided into sub queries and the parts evaluated in parallel. Data Distribution Transparency: Data independence means that the actual organization of data is transparent to the application programmer. 8.

Vertical fragmentation decomposes attributes of a relation into several subsets that are referred as fragments. local queries and transaction accessing data at a single site have better performance because of the smaller local database. Data localization reduces the contention for CPU and I/O services and simultaneously reduces access delays involved in WAN. 12. 10. When a large database is distributed over multiple sites smaller databases exist at each site. Replication Transparency: copies of data may be stored at multiple sites for better availability.9. Improved Performance: A distributed DBMS fragments the database by keeping the data closer to where it is needed most. Replication transparency makes the user unaware of the existence of copies. Fragmentation Transparency: two types of fragmentation are possible. Easier Expansion: In a distributed environment. 11. A global query by the user must be transformed into several fragment queries. performance and reliability. Fragmentation transparency makes the user unaware of the existence of fragments. or adding more processors much easier.  Reference Architecture for Distributed Database . expansion of the system in terms of adding more data. minimizing databases sizes. Horizontal fragmentation decomposes all the rows of relation into several subsets that are called fragments of that relation. As a result.

For this reason. it levels are conceptually relevant in order to understand the organization of any distributed database. However. This architecture is not explicitly implemented in all distributed data base. The global schema defines all the data which are contained in the distributed database as if the database were not distributed at all. Above figure shows reference architecture for distributed database. Fragmentation Schema . And also the global schema consists the definition of a set of global relations. The major components of reference architecture are as follows: Global Schema :At the top level of the reference architecture is the global schema. the global schema can defined exactly in the same way as in a nondistributed database.Fig: Reference Architecture for Distributed Database.

Example: Physical image Rj Where. Allocation schema The allocation schema defines at which sites a fragment is located. This mapping is one to many.“Each global relation can be spilt in to several non overlapping parts which are called fragments”. the mapping between global relations and fragments is defined in the fragmentation schema. . This image is indicated by global relation name and a site index. R is the global relation at site j . Fragments are logical portion of global relation which is physically located at one or several sites of the network. There are several different ways in which to perform the spitting operation. All the fragments which correspond to the same global relation R and are located at same site j constitute the physical image of global relation are at site j. Fragments are indicated by a global relation name with an index.

R1 is a copy of R2. this mapping is called a local mapping schema & depends on the type of local DBMS . A global relation R is split into four fragments R 1. To complete the terminology. Objectives . R2. The three top level of reference architecture are site independent. it is necessary to map the physical image to the object which are manipulated by the local DBMS. R2& R3. R3 & R4 are located redundantly at three sites. Example: . we will refer to a copy of a fragment at a given site and denote it using the global relation name and two indexes and two physical images can be identical that is it is a copy of another physical image.Fig: fragments and physical images for global relation. at a lower level. and thus building three physical images are R 1.

the control of redundancy and the independence from local DBMS. There are three types of transparencies. 2) Location transparency (user does not know the location of the data). however their speed of execution is affected. Thus the correctness of data from site to. 3) Independence from local DBMS or Local mapping transparency It allows us to study several problems of distributed DBMS without having to take into account these specific data models of local DBMS. a) Fragmentation transparency: It is the highest degree of transparency and consists of fact that the user work on global relation. . Fragmentation transparency is the highest degree of transparency and consists of the fact that the user or application programmer works on global relations. which are as follows: 1) Fragmentation transparency (user need not be aware of the data). 2) Explicit control of redundancy reference architecture provides explicit control of redundancy at fragment level in above fig R 2 & R3 physical images contain common data. 1) Separating the concept of data fragmentation from the concept of data allocation: This separation allows us to distinguish two different level of distribution transparency these are as follows .  Distribution Transparency Distribution transparency means that program can be written as if the databases were not distributed. and 3) Allocation transparency. b) Location transparency It is the lower degree of transparency and requires the user to work on the fragments instead of global relation.The three most important objectives which motivate the features of this architecture are the separation of data fragmentation and allocation. The definition of disjoin fragments as a building block of physical images allows us to refer explicitly to overlapping part: replicated fragment R2.

$SNUM). application.g. finding the corresponding supplier name. here consider a simple e. which consists in accepting a supplier number from a terminal. Select NAME into $NAME From SUPPLIER Where $NUM=$SNUM. To understand the concept of Distribution transparency. however. NAME). because the determination of relevant portions of the data is thus distinguished from the problem of optimal allocation.Location transparency is lower degree of transparency and requires the user or application programmer to work on fragments instead of global relations. Level 1 Fragmentation Transparency The way in which the application access the database if the DDBMS provides fragmentation transparency in shown in fig a Read (terminal. The separation between concept of fragmentation and allocation is very convenient in distributed database design. called SUPINQUIRY. WRITE (terminal. and displaying it at the terminal. he or she Does not know where the fragments are located. .

First. this naïve implementation assumes Read (terminal. The request for the supplier with the given number in first issued referring to fragment.SUPPLIER1. which is applied to all schemata which are below the global schema in reference architecture. At this point. and if the DDBMS returns a negative answer in the control variable #FOUND. the same application can be written as shown in the fig. the application accepts a supplier number from the terminal. completely ignoring the fact that the database is distributed . $SNUM). then it accesses the database. Level 2 Location Transparency If the DDBMS provides locate ion transparency but not fragmentation transparency. a similar request is issued with request to fragment SUPPLIER2. Select Name into $NAME From SUPPLIER2 .notice that the application refers to the global relation name SUPPLIER. The whole SQL statement repeats a single distributed database access primitive. the application is completely not distributed by any change. The DDBMS interprets the primitive by accessing the database at one of the three sites in a way in which is completely determined by the system. which receives the variable $SUPNUM as the input parameter and returns the variable $NAME as the o/p parameter.in this way. From the viewpoint of distribution transparency .

however this does not change the distribution transparency characteristics. because the fragmentation structure is incorporated in the application. it is very effective to write advantage of knowing the fragmentation structure. This application is clearly independent from the changes in the allocation schema.$SNUM). for instance. therefore allowing copies to be moved from one site to another. Write (terminal. Select NAME into $NAME From SUPPLIER1AT SITE1 Where SNUM=$SNUM. issuing both requests in parallel in order to exploit to the parallelism of the distributed system. However location transparency is by itself very useful. but not from changes in the fragmentation schema. Level 3 Local Mapping Transparency Read(terminal.Where SNUM=$SNUM. NAME). and allowing the creation of new copies without affecting the application when allocation transparency is provided without fragmentation transparency. . because it allows the application to ignore which copies exist of which fragment. that the supplier has been found and displays the result. Of course several variations of this solutions are possible.

In this case each database access primitive is routed by the DDBMS to a specific site.$SNUM). This choice allows for the . Select NAME into $NAME From SUPPLIER1AT SITE1 Where SNUM=$SNUM. Fully redundant: when complete database copies are distributed at all sites 3. however it has to specify at which site names are indicated in the SQL statements by adding an at clause to the from clause. the application would incorporate directly the filenames. it is meaningless to replicate data at nodes where it is unlikely to be accessed Choice 3: Is responsible for allowing reduced access time for frequently reading of local data or that from a near by site. these primitives use site-independent fragment names. At this level we assume that the application will refer to objects using names which are independent from the individual local system. However updates incur greater overhead and the requirement that all replicates of data be updated and consistent adds complexity to a distributed database system. A database said to be: 1. Partially redundant: when only certain fragments are replicated Choice 1: for data replication would lead to relatively expensive query evaluation due to the unavailability of the data locally or at some near by site Choice 2: Is very expensive in terms of storage space and the overhead to maintain consistency.  Replication Replication improves the performance of simple read operation in a distributed system and improves it’s reliability. If this mapping were not provided.If not #FOUND then Read(terminal. However. Strictly partitioned: when no replicates of the fragments are allowed 2. which are not used by the local systems.

Because the copies are distributed over different sites of the network. otherwise we would have inconsistent data. the sites must reach a consensus on the possibility of an update failed sites may not participate in the agreement and sites may fail after the process has started. A write operation. several fragments correspond to one global relation but only one relation correspond to one fragment fragments are indicated by a global relation name with an index (fragment index) Fragments are logical portions of global relation which are physically located at or several sites of the network all the fragments which correspond to the same global relation R and are located at the same site j constitute the physical image of global relation R at site j.e. (i. Fragmentation Schema The mapping between global relations and fragments is defined in the fragmentation schema this mapping is one to many i. These issue are deal with later in this section on con-currency control and recovery. Although a major aim of the database system is to reduce if not eliminate redundancy. Updates require access to all copies of the data item. However because of the replication. R) There are some rules which must be followed when defining fragments: (a) Completeness Condition: All the data of the global relation must be mapped into the fragments i. however must update all copies. planned data redundancy can improve distributed database performance Ex : if a number of copies of a data item are available a read operation can be directed to any one of these copies.e.e. updates are expensive.  Fragmentation Fragment Each global relation can be split into several non-overlapping portions which are called fragments. The system is required to ensure that any update operation is done on all replicates this results in increased overhead a price to be paid in distributed databases.higher reliability and availability during site crashes. it must not happen that a data item which belongs to a global relation does not belong to any fragment. .

CITY) Then the horizontal fragmentation can be defined in the following way: SUPPLIER1=SL CITY = “SF” SUPPLIER SUPPLIER2=SL CITY =”LA” SUPPLIER . this is clearly useful in Database where each subset can contain data which have common geographical properties. Horizontal fragmentation 2. however this condition is useful mainly with horizontal fragmentation. Mixed fragmentation We will first consider these two types of fragmentation separately and then consider more complex fragmentation which can be obtained by applying combination of both.(b) Reconstruction Condition: It must always be possible to reconstruct each global relation from its fragments.NAME. in fact only fragments are stored in the distributed database and global relation have to be built through this reconstruction operation if necessary. Horizontal fragmentation Horizontal fragmentation consist of partitioning the tuples of a global relation into subset. while for vertical fragmentation we will sometimes allow this condition to be violated the reason for this exception will be discussed when dealing with vertical fragmentation Types of Fragmentation The decomposition of global relations into fragments can be performed by applying two different types of fragmentation 1. Vertical fragmentation 3. It can be defined by expressing each fragment as a selection operation on the global relation Ex : SUPPLIER(SNUM. 1. (c) Disjointness Condition It is convenient that fragments be disjoint. the necessity of this condition is obvious. so that the replication of the data can be controlled explicitly at the allocation level.

The above fragmentation satisfies the completeness condition if “SF” and “LA” are the only possible values of the city attribute otherwise we would not know to which fragment the tuples with other CITY values belong The reconstruction condition is easily verified because it is always possible to reconstruct the SUPPLIER global relation through the following operation: SUPPLIER = SUPPLIER1 UN SUPPLIER2 The Disjointness condition is clearly verified we will call the predicate which is used in the selection operation which defines a fragments its qualification q1: CITY = “SF” q2: CITY = “LA” The above example that in order to satisfy the completeness condition the set of qualifications of all fragments must be complete. The derived fragmentation of supply can be therefore defined as follows: SUPPLY1=SUPPLY SJ SNUM=SNUM SUPPLIER1 SUPPLY2=SUPPLY SJ SNUM=SNUM SUPPPLIER2 . DEPTNUM. QUAN) SNUM is a supplier number it is meaningful to partition this relation so that a fragment contains the tuples for suppliers which are in a given city. Therefore we need a semi-join operation in order to determine the tuples of supply which corresponds to the suppliers in given city. Ex: SUPPLY (SNUM. PNUM. However city is not an attribute of the SUPPLY relation it is an attribute of the SUPPLIER relation considered in the above example. Derived Horizontal Fragmentation: In some cases the horizontal fragmentation of a relation cannot be based on a property of its own attributes but is derived from the horizontal fragmentation of another relation. The reconstruction condition is always satisfied through the union operation and the Disjointness condition requires that qualifications be mutually exclusive. at least with respect to the set of allowed values.

NUM AND SUPPLIER.TAX.The effect of the semi-joint operations is to select from SUPPLY the tuples which satisfy the join condition between SUPPLIER1 OR SUPPLIER2 and supply. VERTICAL FRAGMENTATION: The vertical fragmentation of a global relation is the subdivision of its attributes into groups. This can be useful in distributed database where each group of attributes can contain data which have common geographical properties.SAL. The reconstruction of relation EMP can be obtained as: EMP = EMP1 JN EMPNUM = EMPNUM EMP2 Notice that the above formula for the reconstruction of global relation EMP is not complete. The fragmentation is correct if each attributes is mapped into at least one attribute of the fragments moreover it must be possible to reconstruct the original relation by joining the fragments together. The reconstruction of the global relation SUPPLY can be performed through the union as shown for SUPPLIER. MGRNUM. Ex: the following vertical fragmentation of relation EMP EMP1 =PJ EMONUM.SNUM=SUPPLIER.CITY =”SF” Q2 :SUPPLY. NAME. MGRNUM. SAL. This undesired replication can be eliminated by a projection operation that we omit to indicate. NAME.NUM AND SUPPLIER. DEPTNUM EMP EMP2= PJ EMPNUM. TAX EMP . Q1 : SUPPLY. Fragments are obtained by projecting the global relation over each group. TAX EMP This fragmentation could for instance reflect an organization in which salaries and taxes are managed separately.CITY = “LA” 2. DEPTNUM EMP EMP2 = PJ EMPNUM. SAL.SNUM=SUPPLIER. NAME.DEPTNUM) A vertical fragmentation of this relation can be defined as EMP1 =PJ EMPNUM. because the result of joining EMP1 and EMP2 contains th column EMPNUM twice. Ex: EMP(EMPNUM.MGRNUM.NAME.

TAX EMP The reconstruction of EMP relation EMP is defined by the following expression: EMP = UN( EMP1.MGRNUM.NAME. SAL.The attribute NAME is replicated in both fragments.EMP3) JN EMPNUM =EMPNUM PJ EMPNUM.NAME.TAX EMP4 Mixed fragmentation fragmentation tree can be conveniently represented by a .DEPTNUM EMP EMP4 = PJ RMPNUM.TAX.DEPTNUM EMP EMP2 = SL 10 < DEPTNUM> 20 PJ EMPNUM.SAL. EMP= EMP1 JN EMPNUM = EMPNUM PJ EMPNUM. TAX EMP2 3. Ex: EMP(EMPNUM.NAME.SAL. we can explicitly eliminate this attribute when EMP through an additional projection operation.DEPTNUM EMP EMP3 = SL DEPTNUM >20 PJ EMPNUM. The reconstruction can be obtained by applying the reconstruction rules in inverse order.DEPTNUM) The following is a mixed fragmentation which is obtained by applying the vertical fragmentation .MGRNUM.NAME.MGRNUM.EMP2. MIXED FRAGMENTATION: The fragments which are obtained by the above fragmentation operations are relation themselves so that it is possible to apply the fragmentation operation recursively provided that the correctness condition are satisfied each time . followed by a horizontal fragmentation on DEPTNUM EMP1 = SL DEPTNUM<= 10 PJ EMPNUM.NAME.MGRNUM. SAL.

The set of nodes which are sons of a given node represent the decomposition of this node by a fragmentation operation (vertical or horizontal) Ex: The fragmentation tree of relation EMP.the leaves corresponds to the fragments and the intermediate nodes correspond to the intermediate results of the fragment defining expression. The technical problem is the interconnection of sites by a computer network and the optimal distribution of data and applications to the sites for meeting the requirements of applications and for optimizing performances.EMP v EMP4 h EMP1 EMP2 EMP3 In a fragmentation tree the root corresponds to a global relation . The root (relation EMP) is vertically fragmented into two portions one portion corresponds to a leaf node of the tree (EMP1) the other portion is horizontally partitioned thus generating the other three leaves corresponding to fragments EMP1. From the . EMP2 and EMP3.  Distributed Database Design Designing a distributed database has many technical and organizational issues that become more difficult in a multiple site system.

Distributing an application has a major impact on the organization. in the near future. determining how global relations are subdivided into horizontal. The distribution of the database adds to the above problems two new ones: 3. Framework for Distributed Database Design The term “Distributed Database Design” has a very broad and imprecise meaning. The distinction between these two problems is conceptually relevant. Since fragmentation has been established as a distinguishing feature of distributed databases.e. Designing the “physical database”. Mathematical foundation has been given to “design aids” that. The mathematical problem of optimally distributing data over a computer network has been widely analyzed in the context of distributed the system and distributed databases. The design of a centralized database amounts to: 1. . 2. Designing the “conceptual schema” which describes the integrated database (all the data which are used by the database applications). Designing the fragmentation i. In a distributed database these two problems become the design of the global schema and the design of the local physical databases at each site.organizational viewpoint. since distributed systems typically substitute for large centralized systems. while the second one deals with the “physical” placement of data at the various sites. These two problems fully characterize the design of data distribution. will help the designer in determining data distribution. determining how fragments are mapped to physical images. mapping the conceptual schema to storage areas and determining appropriate access methods.e. vertical or mixed fragments. The techniques which can be applied to these problems are the same as in centralized databases. Several design criteria have been established about how data can be conveniently distributed.e. The major outcomes of this research are: 1. i. in this way. i. the issue of decentralization is crucial. 4. Designing the allocation of fragments. 2. since the first one deal with the “logical criteria” which motivate the fragmentation of global relation. also the replication of fragments is determined.

The simplest way of characterizing processing locality is to consider two types of references to data: “local” reference and “remote” reference. 2. In the application requirements we include: 1. 2. since schemata must be able to support applications efficiently. The number.e. Availability and Reliability of Distributed Data: A high degree of availability is achieved by storing multiple copies of the same information. once the sites of origin of applications are known. those which will be executed frequently or whose performances are critical.e. Clearly. i. The advantage of complete locality is not only the reduction of remote accesses. sufficiently precise knowledge of application requirements is needed. Objectives of the design of Data Distribution In the design of data distribution. and selecting the best solution among them. type and the statistical distribution of accesses made by each application to each required data “object”. the knowledge of application requirements influences schema design. Processing Locality: Distributing data to maximize processing locality corresponds to the simple principle of placing data as close as possible to the applications which use them. this knowledge is required only for the more “important” applications. clearly.Although the design of application programs is made after the design of schemata. Thus. the number of activation requests in the unit time) 3. but also the increased simplicity in controlling the execution of the applications. the following objectives should be taken in to account: 1. locality and remoteness of references depend only on data distribution. Designing data distribution for maximizing processing locality can be done by adding the number of local and remote references corresponding to each candidate fragmentation and fragment allocation. The site from which the application is issued (also called site of origin) The frequency of activation of the application (i. The term complete locality designates those applications which can be completely executed at their sites of origin. the system must be able to switch to an alternative copy . in the design of a distributed database.

when the one that should be accessed under normal conditions is not available. The top down and The bottom up approach In the top-down approach. and we proceed by designing the fragmentation of the database. at each site. and to maximize the degree of parallelism of execution of applications. 2. if compared with CPU. it is relevant to store replicated copies in geographically dispersed locations. The approach is completed by performing. . earthquake. Storage Cost and Availability: Database distribution should reflect the cost and availability of storage at the different sites. 1. we start by designing the global schema. and then by allocating the fragments to the sites. Workload distribution is done in order to take advantage of the utilization of computers at each site. the “physical design” of the data which are allocated to it. or sabotage). since it allows performing the design rationally. Reliability is also achieved by storing multiple copies of the same information. creating the physical images. rather than objectives. 4. This approach is the most attractive for systems which are developed from scratch. Typically. Top-Down and Bottom-Up Approaches to the Design of Data Distribution There are two alternative approaches to the design of data distribution. It is possible to recover from crashes or from the physical destruction of one of the copies by using the other. It is possible to consider some of the above features as constraints. the cost of data storage is not relevant. since this leads to complex optimization models. Workload Distribution: Distributing the workload over the sites in an important feature of distributed computer systems. and transmission costs of applications (but the limitation of available storage at each site must be considered. I/O. Using all the criteria at the same time is extremely difficult. still available copies. 3. Since physical destruction can be caused by events such as fire.

The integration of the local schemata into a common global schema. we mean the merging of common data definitions and the resolution of conflicts among different representations given to the same data. global schema. the integration process should attempt to modify the definitions of local relations.When the distributed database is developed as the aggregation of existing databases. This approach is based on the integration of existing schemata into a single. it is possible that they use different DBMS. Since horizontal fragments are a relevant and useful feature of a distributed database. 3. while it is difficult to “discover”. In summary. it is possible to make a one-to-one translation between each pair of different DBMS. It is even possible that each pair of existing databases is independently interfaced using a different translation schema. When existing databases are aggregated into a distributed database. In this case the global schema is often produced as a compromise between existing data descriptions. this feature is easily enforced in a top-down design. When existing databases are aggregated. without the notion of a global schema. However the approach which is mostly used in the prototypes of heterogeneous systems is to select a common data model. It should be noticed that the bottom-up approach lends itself less easily to the development of horizontally fragmented relations. A heterogeneous system adds to the complexity of data integration the need for a translation between different representations. Horizontal fragments of a same global relation must have the same relation schema. 2. it is not easy to follow the top-down approach. By integration. global relations. and then to translate it into unique representations all the different schemata of the involved DBMS. a bottom-up approach to the design of data distribution can be used. The translation of each local schema into the common data model. In this case.  Concurrency Control . the bottom-up design of a distributed database requires: 1. This leads to systems which are different in conception from distributed database architecture. The selection of a common database model for describing the global schema of the database. so that they can be regarded as horizontal fragments of common.

A concurrency control method is responsible for maintaining consistency among the multiple copies of the data items placed in the DDBMS. A distributed database management system (D–DBMS) is the software that manages the DDB and provides an access mechanism that makes this distribution transparent to the users where transparency is the separation of the higher level semantics of a system from the lower level implementation issues. 2-Phase Locking The 2-phase locking ensures the serializability. An atomicity is a property of transaction where either all the operations of the transactions are reflected properly or none of them operation is performed. In serial execution. In distributed systems the synchronization problem is harder than centralized system. is known as concurrency control. such situation is controlled by any of the concurrency control schema or protocols and prevents the deadlocks. Example 1) Two-Phase Locking-based (2PL) 2) Timestamp Ordering (TO) A concurrency control deals with the ensuring transactions atomicity in the presence of concurrent execution of transactions.MAN etc. logically interrelated databases distributed over a computer network. it is a situation where several transactions execute concurrently in the database and there may be possibility of deadlock detection. the transaction is serializable if it produces the same result as some serial execution of the transaction. like LAN. A concurrency control is defined as. such problem occurs in the synchronization..A distributed database (DDB) is a collection of multiple. . WAN . A transaction is a collection of actions that make consistent transformations of system states while preserving system consistency. each transaction runs for completion before any statements from any other transaction are executed.

Suppose a distributed data A is stored S1 and B at sites S2 then for execution of these two transactions.A lock is a variable associated with each data item and the manipulation of such variable is called locking. The execution schedule in shown in following fig. (a) Two modifying Transactions. Transaction T1 Lock x (A) A : = 100 Write (A) Unlock (A) Lock x (B) B : = 1000 Write (B) Unlock (B) Transaction T2 lockx (A) A : = 200 Write (A) Unlock (A) Lock x (B) B : = 2000 Write (B) Unlock (B) Fig. Site S1 Site S2 . Both the phases are monoatomic. This shrinking phase start once all subtractions acquired there locks. Therefore subtraction released a lock and subsequently has another sub transaction request another lock which required each sub transaction notify all other sub transactions acquired all its locks. Consider two transactions T 1 & T2 and sites S1 & S2. because it has two phases as follows: 1) Growing Phase: A transaction may obtain locks but may not release any lock. The exchange of massages between the sites are done by using two phase commit protocol. All locks request by transaction or its sub transactions should be made in the growing phase and released in the shrinking phase. The two phase locking is so called. When all sub transactions finished their growing phase the number of massages involved is high. When a transaction issues and unlock instruction phase starts indicating that all required locks are obtained. T1s2 & T2s1. T2s2 respectively executed at site S1 & S2. Where data is replicated all sub transaction of the transaction which modify the replicated data item would be observed the two phase locking protocol. the number of locks are only increasing at first phase and decreasing at second phase. Ex. 2) Shrinking Phase: A transaction may not obtain any new locks. each transactions generates two local sub transactions as T1s1.

when a cycle is produced in the execution of the transaction in Distributed Wait-For-Graph (DWFG). Consider there exists a set of existing transactions are T0. Tn such that T0 is waiting for a data item that hold by T 1. A distributed deadlock is more difficult than that of centralized database. A deadlock occurs when each transaction T from the set of one or more transactions is waiting for some item which is locked by some other transaction T’ in that set. Hence each transaction which is in a waiting queue in that set is waiting for one of the other transaction release the lock. and ……. & is called a deadlock detection. T1. ……… . .Time t1 t2 t3 t4 t5 t6 t7 t8 Transaction T1s1 Lock x(A) A : = 100 Write (A) Unlock (A) T2s1 Transaction T1s2 Lockx(A) A : = 200 Write (A) Unlock (A) Transaction Transaction T2s2 Lock x(B) B : = 2000 Write (B) Unlock(B) Lockx(B) B : = 1000 Write (B) Unlock(B) Fig. A deadlock determines the cycles in the wait-for-graph. and Tn-1 is waiting for a data item that hold by T0.  Distributed Deadlocks A system is in deadlock state if there exists several transactions such that every transaction is in the set is waiting for another transaction in the set. when more than one transactions are executes their operations for the same resource. and these transactions are aborted or restarted repeated. Therefore none of the transaction gets processed in such situation. as shown in following fig.(b) A schedule for transactions. T3. Site-1 site-2 site-1 T1 A1 T1 A1 T1 A2 T2 A1 T2 A1 . such complex situation produced in system is known as distributed deadlock. A deadlock is occurred in distributed database system. T1 is waiting for a data item that hold by T 2.

two agents belongs from same transaction. In fig. Fig. It is detected when and exchange of information takes place the cycle gets produced and deadlock occurs. Assume that each transaction has only one agent at each site where it is executed. consist of two sites. As shown in fig (a) with dashed lines. 1. Ti and Tr are different transactions and two agents are at same site.T1 A2 T2 A2 T2 A2 Fig a. . A local wait for graph. A distributed wait for graph showing fig b. The square nodes are called input parts if they have an edge entering the local wait for graph and output ports if they receive an edge existing the LWFG. It is a different task than local deadlocks. Such wait is shown in fig. (b) which shows local wait for graph. Here. two transaction T1 & T2 & two agents as A1 & A2. 2. There are following two reasons to an agent for waiting another one. Agent Ti Aj waits for agent Ti As to perform some required function. Here. A deadlock occurs in LWFG by a cycle in it. Agent Ti Aj waits for agent Tr Aj to release a resource which it needs. distributed deadlock Labeling:TTransactions AAgenda A distributed wait for graph as shown in fig (a) consist of a cycle which corresponds to the deadlock detection. because agents request only local resources. The agent Ti Aj has requested that agent Ti As perform some function at a different site. A directed edge from an agent Ti Aj to an agent Tr As means that Ti Aj is blocked and waiting for Tr As. (a) where T1 A1 waiting for T2 A1 to release the resource at site 1. In a distributed system a deadlock is occurred when a cycle is produced in DWFG.

2) Distributed deadlock detection. Hence. Methods of deadlock detection 1) Deadlock detection using centralized or hierarchical control. T1 waits. two transactions T1 & T2 both of which must lock same data item exclusively. T2 waits T2 locks x2 . The deadlock detector receives the information from all sites in a distributed database. If x 1 & x2 are two copies at site 1 & 2 and both transactions wants to obtain lock then deadlock occurs.A deadlock resolves the one or more transactions to be aborted or restarted. Following are the criteria’s for aborting the transactions. 1) Deadlock detection using centralized or Hierarchical control: In a centralized control method a deadlock detector is placed which has a responsibility to discover or find the cycles in DWFG. b) Abort the transaction which owns less resources c) Abort the transaction with smallest abort cost. 3) Deadlock prevention. If ‘x’ is replicated i. At each local site there is a local deadlock detector which has responsibility to find all potential deadlocks at that particular site. d) Abort the transaction with the longest excepted time to complete. so that it releases its resources for other transactions. as x. deadlock occurs. A redundancy increases the deadlocks probability in distributed DBMS. Site 1 Site 1 .e. a) Abort the youngest transaction. AT AT Site 1 : site 2 : T1 locks x1 . Consider.

2.T1 A1 T2 A1 T3 A1 T4 T3 A1 T5 A1 T1 A2 T1 A1 T1 A3 T4 A1 T3 A2 A2 Fig. (b). shows deviation of a potential global deadlock cycle from a local wait for graph. It requires large communication cost.(a) Lacal wait for graph at site 1 at site 1 Fig. It is unprotected to failures of the site where the centralized detector runs. A deadlock detector collects these massages forms a DWFG. finds cycles and selects the transactions for abort. To reducing a communication cost an hierarchical controllers are used. Hierarchical controllers NLLDD 0 NLDD NLDD 2 1 . Only the initial and final agents of each potential cycle must be transmitted as shown in fig. Such part is a potential deadlock cycle. the local deadlock detector starts from an input port and searches backward along the local graph until it reaches an output port. Drawbacks Of Centralized Deadlock 1. To determine potential deadlock cycles.(b) Potential global deadlock The above fig.

Each site has same responsibility while exchanging an information to determine global deadlocks. The performance of hierarchical deadlock detection mechanism depends on the choice of hierarchy.Site 1 Site 4 Site 5 Site 2 Fig. 4 & 5 has a common detector as NLDD 2 finally all of them are controlled by NLDD 0. no distinction between local and non-local deadlocks detectors. LDD – Local deadlock detector. A tree for deadlock detectors Site 3 Labeling : NLDD – Non local deadlock detector. The local deadlock detectors determine local deadlocks and transmit information to the potential global cycles to non local deadlock detectors. Site 1 T1 T2 Site 1 T1 T2 Site 1 EX T1 T2 EX . In LWFG all the input and output parts are collected into a single node called the external (EX). The potential deadlock cycles detected at local sites are transmitted through an algorithms. (2) Distributed Deadlock Detection Here. Main difference between centralized & distributed deadlock is that in centralized all the potential deadlocks cycles are sent to the designated site while in distributed deadlock detectors need a rule for determining to which site the potential deadlock cycles are transmitted. site 1 & 2 have a common detector as LDD1 While site 3. The following algorithm consist of distributed deadlock detection. Here. This rule must attempt to minimize amount of transmitted information.

a) For each transaction in massage add it to LWFG if it does not already exist. Which must be transmitted to different site. 2) The received massage perform following modifications of LWFG. 3) Cycles without EX node in LWFG indicate existence of end lock. If a transaction T1 request a resources which hold by T2 then “prevention test” is applied. A local deadlock detectors performs at each site the following actions. 4) Cycles with EX node are the potential deadlock cycles. This can be obtain by ordering transaction using lexicographical ordering. (3) Distributed Deadlock Prevention Deadlock prevention eliminates the need for Dead lock detection & resolution. b) For each transaction n massage. starting with EX create an edge to the next transaction in the massage.EX T1 T2 T1 T2 EX T1 T2 Site 2 Fig (a) Site 2 Fig(b) Site 2 fig(c) Fig. While either T1 is aborted restarted or T2 is aborted & restarted. If this test indicates a risk of dead lock. then T1 is not allowed to enter wait stats. 1) Forms LWFG including EX node. It is done in following ways. Prevention test must insure that if T1 is allowed to wait for T2 then dead lock can never occur. Distributed Deadlock detection algorithm. .

Let Ti is allowed to wit for TJ . because it is impossible to built a closed chain.k. i1 Such that if iJ i2 ------in i1. These measures includes following parts 1) Mean time between failures(MTBF) .  Reliability :“A reliability is a measure of the success on the basis of that the system conforms to some authorities specification on its behavior” “The deviation of such specified behavior is known as failures. jk then ij < ik ∀ J. 1) Non preemptive method: For deadlock prevention based on timestamps is the following: In preemptive method older transaction which already hold a resources & not allow younger transaction to wait for older ones. 2) Preemptive method. Reliability means the consistency of good quality which is acquired by the DDBMS. A reliability of a system is measured in several ways which are based on the incidence of failures. 2) Preemptive method: In Preemptive method older transaction preempts younger transaction therefore younger transaction waits for older. Following are methods of deadlock prevention. 1) Non preemptive method. Where i<J.” The reliability of a system is inversely related to the frequency of failures.

the reliability problem is divided in two parts as below 1) Application dependent It requires that specification. power supply.2) Mean time to repair (MTTR) 3) Availability (fraction of time that system meets its specification) In a database system application. durability. the transaction fulfills the general system’s 2) Application independent:It requires that the transactions maintains their atomicity. Media failures • • Failure of secondary storage devices such that the stored data is lost Head crash/controller failure (?) 4. … Main memory contents are lost. serializability & isolation properties. System (site) failures • • Failure of processor. Communication failures   Lost/undeliverable messages Network partitioning . Types of Failures There are following types of Failures in the transactions 1. 3% of transactions abort abnormally 2. but secondary storage contents are safe 3. Transaction failures • • Transaction aborts (unilaterally or due to deadlock) Avg. main memory.

It is different from centralized DB. Issue: how to ensure atomicity and durability?    • Termination protocols: Designed for the sites that are affected by a failed site.   • Recover protocols: Address the recovery procedure for a failed site once it restarts. When a failure occurs. how can the remaining operational sites deal with it. The basic 2-phase-commitment protocol are assures that transactions are correctly committed or aborted at all sites even in presence of failures. tell a site how to commit/abort properly when other site fails.Components of Distributed Reliability Protocols • Commit protocols: How to commit a transaction properly when more than one site are involved in the commitment. that effects the some of the participating sites for wait until the failure is repaired before terminating the transaction & the transaction which is not terminated at sites called the pending at that site.    Non blocking commitment protocol A commitment protocol is called blocking if the occurrences failures. If a failure occurs. . Independent: a failed site can determine the outcome of a transaction without having to obtain remote information. Non-blocking: the occurrence of failures should not force the sites to wait until the failure is repaired to terminate the transaction. just opposite to the termination protocols. How to execute commit command for distributed transactions. how do the sites where the failure occurred deal with it.

shows state diag. The input & output massages are indicated for each transaction.Also. for 2-phase-commitment protocol without ACK massages. A transaction occurs when input massage arrives and which sends the output massage. which blocks resources and reduce the system’s availability The following fig. The state information of the transaction is recorded into stable storage for recovery purpose. I I PM / RM tm/ACM CM / -U -ua/PM/AAM / R PM RM A C / CM ACM/-- C A AAM/ACM Coordinator I = initial state U = uncertain(waiting for some information) R = ready to commit A = abort (transaction) C = commit (transaction) Participants Massages PM = prepare massage RM = ready answer massage AAM = abort answer massage ACM = abort command massage CM = commit command Local conditions = transactions which are due to an exchange of massages ua = local unilateral abort tm = timeout = unilateral transitions(timeout) Fig. in some cases transactions are blocked until the failure is repaired. state diagram for the 2-phase-commit protocol The problems due to 2-Phase-Commit are as follows .

it creates a situation where termination is impossible. This problem can be eliminated by modifying 2-phase-protocol as the 3-phase-protocol as shown following fig. If the coordinator site gets failed. therefore. here the operational participants are blocked because in the second phase of commitment the participants goes through R state which is ready to abort or commit transaction to A or C. 2) None of the participants has received the command. which must not performed. In both the above cases the transaction is terminated correctly. 3-Phase Protocol:It is a nonblocking protocol. To eliminate the above blocking as shown in fig. which gives massage to the other participant to terminate the transaction. which overcomes the 2-phase-protocol and solves the problems of failures at the sites in the DDBMS. then also the failed participants perform the abort or commit action. all the participant sites are operational and choose another coordinator site. while only the coordinator site gets crashed. a of 2-phase-protocol. but consider the situation where no one of the operational participant receive any command and one of them gets failed. there are two possible cases as 1) At least one of the participants receives the command. PM/AAM I U -. site is blocked until recovery o Blocking reduces availability Independent recovery is not possible These problems are solved by 3-phase protocol. if all the operational participants does not receive the command. When a failure occurs at coordinator sites./ PM R PM/RM A ua / -- U A B C C P C C . such problem can also be arrived at the coordinator site since the coordinator is also a participant of another coordinator site.• • Blocking o Ready implies that the participant waits for the coordinator o If coordinator fails.

Finally. Hence it is entered in the new PCM state and records it to stable storage.tm ACM/-AAM/ACM RM / PCM PCM/ OK /ACM New states PC = prepared to commit state New massage tm /ACM OK /CM CM / -- Coordinator Participants PCM = enter the PC state OK = entered the PC state Fig. . The third phase consist of multiple sites are involved in the decision to commit. Network Partition A network partitions are created the following two possibility arise 1) The coordinator& all its participants remain in one participant here the failure has no effect on the commit protocol. it is an extension of 2phase-protocol which avoids the blocking problem. state diag. consists of new state as prepared-to-commit-state. assuming that the site in the other partitions have failed. Sites that are not in partition containing the coordinator simply executed the protocol to deal with failure of the coordinator. for 3-phase-commit = possible protocol restart transitions from The 3-phase-protocol consist of three phases. when coordinator receive OK massage it enters in the final commit state (C) and sends final commit command (CM) which eliminates the blocking problem. The coordinator & the sites that are in the same partition as the coordinator follows the usual commit protocol. When the PCM massage send the coordinator enters the new Before-commitment (BC) state then participant must sends OK massage. The above fig. The coordinator issues the command in second phase either ACM command or PCM massage. which commits the transaction. 2) The coordinator & its participants belong to several partitions then it is observed the sites in the one of the partitions failed.

and…. 2) We can allow the system to enter the deadlock state.and T1 is waiting for the data item that T2 holds. a transaction may be rolled back to the point where it obtained a lock whose release resolves the deadlock.T1.. such as rolling back some of the transactions involved in dead lock. None of the transactions can make progress in such situations. and then try to recover by using a deadlock detection and deadlock detection scheme. .and Tn-1 is waiting for the data item that Tn holds. DEADLOCK PREVENTION There are two approaches to deadlock prevention: 1. There are two principal methods for dealing with the problem of deadlock: 1) DEADLOCK PREVENTION protocol to ensure that the systems will NEVER a deadlock state. and perform transaction rollback instead of waiting for a lock.e. Both the methods may result in transaction rollback. if there exist a set of transactions such that every transaction in a set is waiting for another transaction in set. 2. Rollback of a transaction may be partial: i. The only remedy to this undesirable situation is for the system to invoke some drastic action. One approach ensures that no cyclic waits can occur by ordering the request for locks.…Tn} such that T0 is waiting for the data item that T1 holds . Prevention is commonly used if the probability that the system would enter a state of deadlock state is relatively high. detection and recovery are more efficient. The other approach is closer to deadlock recovery. otherwise..DEADLOCK HANDLING A system is said to be in deadlock state. Suppose there exists a set of waiting transactions {T 0. and Tn is waiting for the data item that T 0 holds.. or requiring all locks to be acquired together. whenever the wait could potentially result in rollback.

either all are locked in one step or none are locked. when a transaction T2 requests a lock that transaction T1 holds. 2) Wound-wait Scheme: this scheme is a preemptive technique. In preemption.and T24 requests a data item held by T23 .T23..Ti is older than Tj).and granting of the lock to T2. Another approach for preventing deadlock is to impose an ordering of all data items. When transactions requests a data item currently held by Tj. what data items need to be locked.Ti is allowed to wait only if it had a timestamp smaller than that of T j (i.The simplest scheme under the first approach requires that each transaction locks all its data items before it begins execution. When transaction Ti requests a data item currently held by T j . . The second approach for preventing dead lock is to use PREEMPTION and TRANSACTION ROLLBACKS. the lock granted to T 1 be preempted by rolling back of T 1 . There are 2 main disadvantages of this protocol: 1. it retains its old timestamp when restarted. It is often hard to predict. Data items utilization may be very low. and to require that a transaction is locked.e. It is a counterpart to the wait-die scheme. 2. Example.Otherwise.Ti is allowed to wait if it has a . suppose that transactions T22. before the transaction begins. TI is rolled back (dies).To control the preemption. Moreover. The system uses these timestamps only to decide whether a transaction is rolled back. Two different deadlock-prevention scheme using timestamps have been proposed: 1) Waite-die Scheme: this is the nonpreemptive technique. since many of the data items may be locked but unused for long time. we assign a unique timestamp to each transaction.then T24 will be rolled back.

i. then Ti may reissue the same sequence of requests when it is restarted. If the data item is still held by Tj then Ti will die again.e. T i may die several times before acquiring the needed data item. 1) In the wait-die scheme. This transaction cannot be required to rollback in either scheme.e. with transaction T22. Ti is younger than Tj). When T i is restarted and requests the data item now being held by Tj.. From above example. Since timestamp always increase. then the data item will be preempted from T23. at which point it will be rolled back again. Tj is rolled back(Tj is wounded by Ti). and T23 will be rolled back. Thus. Both the wound-wait and the wait-die scheme avoid starvation: At any time. there is a transaction with the smallest timestamp. Ti waits. Otherwise. . no transaction gets rolled back repeatedly and is never allowed to make progress. the older the transaction gets. then T24 will wait. On the other hand. T23.timestamp larger than that of T j (i. On the other hand in wound-wait scheme transaction T i is wounded and rolled back Tj requested a data item that it holds. it is important to ensure that there is no STARVATION. . Thus. 2) In the wait-die scheme. There are some differences in the way that the two schemes operate. Thus. in the wound-wait scheme. the more it tends to wait. a transaction that is rolled back repeatedly will eventually have the smallest timestamp. there may be fewer rollbacks in the wound-wait scheme. if T22 requests a data item held by T23. If T24 requests a data item held by T23. Whenever the system rollback transactions. and T24. if a transaction Ti dies and is rolled back because it requested a data item held by transaction T j . an older transaction never waits for younger transactions. an older transaction must wait for the younger one to release its data items. and since transactions are not assigned new timestamps when they are rolled back.

committed or aborted. then a detection and recovery scheme must be used. To do so. Moreover. a log record is written on in the log file. recording all the update activities in the database. a begin transaction.DEADLOCK DETECTION & RECOVERY If the system does not employ some protocol that ensures deadlock freedom. A log contains information for undoing or redoing all actions which are performed by transactions. If one has. when a transaction is started. NODES RECOVERY At such site a local transaction manager is available & it can use the following techniques for local recovery LOGS A most widely used structure for recording database modifications in the log. To undo the actions of a transaction means to reconstruct the database as prior to its execution. the system must: 1) Maintain information about the current allocation of data items to transaction. Whenever a transaction performs an action on the database. 2) Provide an algorithm that uses this information to determine whether the system has entered a deadlock state. . 3) Recover from the deadlock when the detection algorithm determines that a deadlock exists. commit or abort record is written in the log. To redo the actions of a transaction means to perform again its actions A log record contains the required information for undoing or redoing actions. as well as any outstanding data item requests. An algorithm that examines the state of the system is invoked periodically to determine whether a deadlock has occurred. then the system must attempt to recover from the deadlock. The log is sequence of log records.

Before committing a transition. the corresponding log record would in fact not be available. Before performing a database update. The existence of checkpoints facilitates the recovery procedure. at least the undo portion of the corresponding log record must have been already recorded on stable storage 2. Chokepoints are operations which are periodically performed (typically. this set includes all transactions which have a commit record in the log file.The writing of a database update & the writing of the corresponding log record are two distinct operations. Determine all non committed transactions that have to be undone. Steps 1 & 2 of the recovery procedure are substituted by the following . the recovery procedure would be unable of undoing the update. In this case if the database update were performed before writing the log record. it is possible that a failure occurs between them. a) Writing to stable storage all log records and all database updates which are still in volatile storage.which consists of two basic rules 1. 3. all log record of the transaction must have already been recorded on stable storage. RECOVERY PRODEDURES When a failure with loss of volatile storage occurs.without having a commit or abort record. most of them were safely stored in stable storage before the failure. therefore. In principle. hence they do not need to be redone . and checkpoints are used. b) Writing to stable storage a checkpoint record. In practice. Non committed transaction are recognized because they have a begin transaction record in the log file . In order to avoid this problem. every 5 min) in order to simplify the first 2 steps of the recovery procedure performing a checkpoint requires the following operations. 2. a recovery procedure reads the log file and performs the following operations. A checkpoint record in the log contains the indication of transactions which are active at the time when the checkpoint is done.In order to distinguish transactions which need to be redone from those which do not. Undo the transactions determined at step 1 and redo the transactions determined at step 2. Determine all transactions which need to be redone. 1. the log write a head protocol is used .

information may be lost. move the corresponding transaction from the undo set to the redo set. Put all transactions written in the checkpoint record into the indo set. a log contains the whole history of the database. Therefore. If a begin transaction record in found. data not found. However. There are various types of failures 1. Transaction Failure System crash Disk Failure Failure with loss of stable storage Communication or Link Failure 1) Transaction Failure: There are two types of errors that may cause a transaction to fail.  VARIOUS TYPES OF FAILURES IN DDBMS SITE FAILURES/ NODE FAILURE A computer system. a fire in the machine room etc. overflow. like any other device is subject to failure from a variety of causes: disk crash. such as bad input. If a commit record is found. only this latest portion of the log must be kept online. In any failure. Read the log file starting from the checkpoint record until its end. The redo set contains the transactions to be redone which is initially empty 3. Conceptually. Definition The deviation of a system from the behavior that is described in its specification. 2. power outage. a) Logical error: The transaction can no longer continue with its normal execution because of some internal condition. while the remainder of the log can be kept in offline storage. Find and read the last checkpoint recorded 2. only the latest portion refers to transactions which might be undone or redone. . 3. or resource limit exceeded.1. which contains the transactions to be undone. put the corresponding transaction in the undo set. 5. software error. 4.

There failures includes. The probability of failures of the third types in again reduced by using Stable storage technique. deadlock). There is hardware. the abort of transactions because an error condition in discovered. However all the information which is recorded on disks in not affected by the failure. A disk block loses its content as a result of either a head crash or failure during a data transfer operation. The assumption that hardware errors and bugs in the software bring the system to a halt. but do not corrupt the non-volatile storage contents in known as the Fail-Stop assumption. the content of disk storage in lost. 3) Disk Failure (Failure with loss of non volatile storage): In these failures. Well designed systems have numerous internal checks at the hardware and the software level that brings the system to a halt whenever there in an error. for e.g.g. then the correctness of the update is verified and finally the second copy is updated. we introduced a new type of failure . The transaction however can be reexecuted at a later time 2) System crash (Failure with loss of volatile storage) In these failure the content of main memory is lost. are used to recover from the failure The probability of failures of the third type is less than that of the other two types. It is also called as Media failures. Copies of data on other disks (backups) such as tapes. and brings transaction processing to a halt.as a result of which a transaction cannot continue with its normal execution. b) System error: The system has entered an undesirable state (for e. first one copy of the information is updated. like an arithmetic overflow or a division by zero. malfunction. Hence Fail-stop assumption is a reasonable one. With this stable storage. or a bug in the database software or the operating system that causes the loss of the content of volatile storage. At every update operation. Stable storage technique is typically implemented by replicating the same information on several disks with independent failure modes and using the socalled Careful replacement strategy.

two basic types of possible communication errors are: Lost messages and partitions Dealing with network partitions is a harder problem than dealing with site crashes or lost message.For example the message might not be correct. All the operational sites which belong to the same sub network can communicate with each other. With the modern communication networks. Fortunately.We cannot reduce this probability to zero. in many computers network partitions are much less frequent the site crashes. In this case.4) Failure with loss of stable storage: Information stored in stable storage is lost because of several. and the other one including y.  MAJORITY PROTOCOLS The majority protocols works as follows:If data item Q is replicated in n different sites. x might not receive the acknowledge with the message being delivered . Simultaneous failures of the third type. then a lock-request message must be sent to more than one-half of the n sites in which Q is stored. which are capable of routing messages.one including x. Again careful replacement strategies are applied . we require a communication network. There is great variety of possible failures during the process of message transmission . Each lock manager determines whether the lock can be granted . the system behaves in an erroneous way. Therefore. Hence if a communication failure occurs. the message might be out of order. 5) Communication or Link Failure: When a message is sent from site x to site y. x might receive the acknowledgements without the message being delivered and so on. the following assumption about the network is also reasonable: If site x cannot communicate with site y but can communicate with site z. when two operating sites x and y cannot communicate. the means that no communication path is available between them and the network is partitioned into two or more completely disconnected sub networks . the site z cannot communicate with y either.

2) Exclusive locks: When a truncation needs to lock data item Q. while transaction T2 may succeed in locking Q at sites S 1 and S4.immediately. 1) Shared locks: when a transaction needs to block data item Q. The transaction does not operate on Q until it has successfully obtained a lock on a majority of the replicas of Q. Each then must wait to acquire the third lock. it simply requests a lock on Q from the lock manager at one site that contains a replica of Q. The response is delayed until the request can be granted. it is possible for a deadlock to occur even if only one data item is being locked. It requires 2(n/2+1) messages for handling lock requests. This saving is significant in common cases in which the frequency of read is much greater than the frequency of write. a deadlock has occurred. For example: Suppose that the transactions T1 and T2 wish to lock data items Q in the exclusive mode. The difference from the majority protocol is that request for shared locks are given more favorable treatment than requests for exclusive locks. Transaction T 1 may succeed in locking Q at sites S1 and S3 . . 2) Deadlock Handling: In addition to the problem of global deadlocks due to the use of a distributed lock-manager approach. The above scheme has following disadvantages: 1) Implementation: The majority protocol is more complicated to implement. it requests a lock on Q from the lock manager at all sites that contain a replica of Q. and (n/2+1) messages for handling unlock requests. hence. • BIASED PROTOCOL This is another type to handling replication. The biased scheme has the advantage of imposing less overhead on read operation that does the majority protocol.

reads need to read fewer replicas. Our first task. where S is the total weight of all sites at which x resides: Qr + Qw > S and 2* Qw >S To execute a read operation. This protocol assigns each site a nonnegative weight. That software must also cooperate with other sites in exchanging information about transactions. • TIMESTAMPING The basic idea behind this scheme is that each transaction is given a unique timestamp that the system uses in deciding the serialization order. The advantage of this approach is that it can permit the cost of either read or writes to be selectively reduce by appropriately defining the read and write quorums. but the write quorum will be higher. It assigns read and write operations on an item x two integers. enough replicas must be read that their total weight is >= Qr. Also if higher weights are given to some sites (for e. and write quorum Qw. to make transaction processing possible across multiple sites. enough replicas must be written so that their total weight is >= Qw. To execute a write operation. fewer sites need to be accessed for acquiring the lock. hence write can succeed only if correspondingly more replicas are available. In contrast. The sites may be aware of one another. in a homogeneous distributed database. For example: With a small read quorum. different sites may use different schemas. and they may provide only limited facilities for cooperation in transaction processing.• QUORUM CONSENSUS PROTOCOL This protocol is a generalization of the majority protocol. . called read quorum Qr. while the divergence in software becomes difficult for processing transactions that access multiple sites. in generalizing the centralized scheme to a distributed in terms of their right to change schemas or DBMS software. that must satisfy the following condition. and different DBMS software. those which less likely to fail).g.

2) If transaction T1 contained in C then all conflicting transaction which have preceded T in the serialization. in the former case we say that T is contained in C. local logs& global check point. A consistent global state C is characterized by the following two properties. The property 1 is related to the atomicity of transaction: either all effect of t or none of the m can appear in consistent state. Check Point And Cold Restart Check Point: A check point are used to reduce the number of log record that the system must scan when it recover from a crash. A global check point is set of local check points which performed at all site of the network & are synchronized by the following condition. . A global consistent state in a distributed database is to use local dumps. The property 2 is related to serialization: if the effects of T are kept as it is then we must keep all the effect of T1. In distributed data base the problem of cold restart is worse than in centralized one because if one site has to establish on earlier state. 1) For each transaction T. A previous consistence state is marked by a check point. Cold restart is required after some catastrophic (sudden accident with teriable result) failure which has caused the loss of log information on stable storage. C contains the update performed by all subtraction of Tat any site or it does not contain any them. Cold Restart: A cold restart is required if the log information is last at the site of network & effected site is not capable reconstructing it’s most recent state then the previous state is reconstructed where the check point is located . so that the current consistent state of the data base can not be reconstructed & a previous consistent sate must be restored. then all other sites also have to establish earlier states which are consistent.This effect in the loss of some local subtransition.

If a sub-transition of a transition T is contained in the local check point at some site then all other subtraction of T must be contained local check point at other site. Which break base requirement of global check point. C= COMMIT The main problem of global check point synchronization is shown in above fig. T3 is coordinator for 2-phase. Site1 C1 time Site 2 C2 T2 R Site 3 T3 C3 C T2& T3 are subtraction of T.  Management Of Distributed Transactions . C2 & C3 where C2 does not contain subtraction T2 & C3 contain subtraction T3. The transaction T performed two phase commitments which do not eliminate the problem the problem of synchronization of subtraction.commitment. first consider the latest local point which earlier global state has to be reconstructed then all other sites are requested to reestablish the local states of the corresponding the local check point. C1. Massage of 2-phase commitments protocol. R=READY. There fore to avoid such problem it required that all the site become inactive simultaneously before which one record its local check point.T3 of the same transaction T & local check point C1. C2&C3 are local check point. the fig consist of two sub transaction T 2. If the global check points are available it is very easy to reconstruction. “Write check point “measure.

Example of transaction:Begin_transaction Reservation begin input(flight_no. like reliability concurrency control & the efficient utilizing of the resources of whole system. Atomicity: either all or none of the transactions operation are performed atomicity requires that if a transactions interrupted by a failure. & 2-phase locking for concurrency control Framework for Transaction Management In this section. state the goals of distributed transaction Properties OF Transactions 1. used in building most commercial systems & research prototypes: 2-phase commitment for recovery. In this section we consider only the most well-known technique. its partial results are undone. {Reservation} The management of distributed transactions requires dealing with several problems which are strictly interconnected. date. date. customer_name. SPECIAL). CNAME. . output(“reservation completed”) end . VALUES (flight_no. EXEC SQL INSERT INTO FC(FNO. EXEC SQL UPDATE FLIGHT SET STSOLD = STSOLD + 1 WHERE FNO = flight_no AND DATE = date. customer_name). DATE. we define the properties of transaction. null).A transaction is a collection of actions that make consistent transformations of system states while preserving system consistency.

A transaction abort can also be forced by the system for system dependent reasons. Goals Of Transaction Management: After having consideration the characteristics of transactions. moreover. Serilizability: if several transactions are executed concurrently. If a system provides concurrency control. the system must guarantee that the results of its operation will never be lost. the programmer can write the transaction as if it executed alone. the result must be the same as if they were executed serially in some order. reliable & concurrent execution of transaction. these three goals are strongly interrelated. the activity of providing the transaction durability is called database recovery 3. This property is needed in order to avoid the problem of cascading aborts. Durability Once a transaction has committed.since the result of a transaction which must be preserved by the system are stored in database. The activity of ensuring atomicity in the presence of transaction abort is called transaction recovery& the activity of ensuring atomicity in presence of system crash is called crash recovery 2. The abort of a transactional be requested by transaction itself because some of its inputs are wrong or because some conditions are recognized that make transaction completion inappropriate or useless . because the effort which is required in order to implement in a reliable way the properties of transactions causes an obvious performance penalty. Isolation an incomplete transaction cannot reveal to other transaction before its commitment. let us return to the goals of transaction management: the efficient. 1. The activity of guaranteeing transactions Serializibility is called concurrency control. typically system overload &deadlocks. indepent of subsequent failures .There are two typical reasons why a transaction is not completed: transaction aborts &system crashes.e the necessity to abort all transaction which have observed the partial result of transaction which was later aborted. there is a trade-off between them. CPU & Main Memory Utilization .i.

Availability Another aspect which must be consider by transaction manager of a distributed database is the availability of whole system. the effort of increasing the systems availability in the presence of site failure is significant characteristic of the algorithm which are used for transaction recovery & concurrency control in ddbms . most of these processes will be swapped in & out of main memory. If the operating system has to create a process for each active transaction. obtaining an acceptable response time can be more critical for distributed application than for local application. the algorithms implemented by the transaction manager must not block the execution of those transactions which do not strictly need to access a site which is not operational.In order to reduce this overhead transaction managers apply specialized techniques which take advantage of the typical characteristics of database applications. Moreover. Response Time As third important efficiency aspect. avoid considering them in same way as the generalized processes which dealt with by general purpose operating system. Control Messages In a distributed database we have to consider also another aspect of efficiency: the number of control message which are exchanged between sites . Therefore.Ofcoures . 3. A lot of context switching will required . Although typical database applications are I/O bounded in large system can reveal a bottleneck in main memory or in CPU time.A control message is not used to transfer data but needed in order to control the execution of the application. 2.This aspect is common to both centralized &distributed databases. Clearly. we have to consider the response time of each individual transaction. As a result.in a distributed system is not acceptance for failure of one site to stop the whole systems operation. because of the additional time which is required for communication between different sites 4.

This agent is called coordinator. 2) Goal of second phase is to implement this secession Phase one: there is first phase during which the coordinator asks all the participants to prepare for commitment. all the other agents which must commit together are called participants. Note that when the transaction performs some write action at the site of coordinator. it is responsible for performing the write action at its local database. We assume that each participant is at different site.Summary 1) Transaction properties. durability. 1) Goal of first phase of the protocol is to reach a common decision. 3) The availability of the system is maximized The 2 Phase-Commitment Protocol In the basic 2-phase-commitment protocol. each participant answer ready if it is ready to commit &willing to do so. In 2 phase-commitment protocol consist of two phases. serializability. the coordinator records on stable storage a log record of a new type. have atomicity. The coordinator is responsible for making final commit to abort decision Each participant corresponds to a sub transaction which has performed some write action. & isolation 2) Their cost in term of main memory. there is one agent which has special role. in which the identifiers of all sub transactions participating to the two –phase-commitment are . Before sending first prepare for commitment message. CPU.& number of transmitted control messages & their response time are minimized. though they don’t need to communicate using the network. we assume that they follow the protocol as if they were at different sites. then the coordinator &one participant are at same site. called a “prepare “log record.

this means that each participant has to record on stable storage two things: 1) All the information which is required for locally committing the substraction. it decides to abort the transaction. the coordinator can forget the . The coordinator decides whether to commit or abort the transaction as a result. This means that a log record of a new type. When a participant answers Ready. it ensures that it will be able to commit the sub transaction even if failures occur at its site. If all participants answered ready it decides to commit transaction. If instead some participant has answer abort or has not yet answered when time out expires. Phase two: The coordinator be gains the second phase of 2pc by recording on stable storage its decision .recorded. based on the command massage received from the co-coordinator.This means that all the log records of the sub transaction must be recorded on stable storage. Then the coordinator informs all participants of it decision. in spite of failures. which will interrupt the coordinator after that a given time interval expired. 2) The fact that this sub transaction has declared to be ready to commit. called a “ready” log record.This corresponds to writing a “global _commit” or “global abort record in log. When coordinator has received an ACK massage from all participants he or she writes a log record of new type called a “complete” record. of the answer it has received from participants. Finally. From this movement. and perform the actions required for committing or aborting the sub transaction. the local recovery procedure is capable of insuring that effect of the subs transaction will not be losses. All the participants write a commit or abort record in the log. After having written this record. The fact that the coordinator records its decision on storage table means that the distributed transaction will eventually be committed or aborted. by sending them the command massage. The coordinator also activates a time out mechanism. all participants send a final acknowdgement (ACK) massage to coordinator. In practice. must be recorded on stable storage.

B) Explain the mechanism for storage of data.outcome of the transaction thus all records related to this transaction can be taken offline after the next check point. What are time-based and quorum based protocols. How to avoid . What do you mean by a deadlock? Explain any one protocol used for deadlock handling 6. Explain in detail the execution of client/ server database technology 10. 2. 4. Write a detailed note on concurrency control 3. 2. What is query Optimization? How is it Carried Out? Explain with your own example 4. Explain in detail the timestamp based protocol used in concurrency control 5. What are the different types of failures occurring in transaction processing? Explain. A) Enlist the features of distribute DBMS and its need. What are deadlocks? Explain distributed dead-locks. 3. Explain in detail the concept of data definition language. Questions 2007 1. 8. Explain in detail the procedure of replication and fragmentation techniques carried out for designing distributed database environment. Explain the different factors affecting in designing of distributed database environment 7. Write short note on: a) Need of distributed databases b) Heterogeneous database 2004 1. data manipulation language and the various types of data manipulation language. What do you mean by serializability? Explain its importance in database management 9.

b) Distributed data dictionary management. 3. Explain in detail the working of client-server technology in the distributed database system 7. B) What is the need of concurrent execution of transactions? What are the different factors affecting concurrent execution? 2. ii) Share Something. What is access planning? Why is it necessary 6. What is the working of client server technology in the distributed database system? Explain in detail. What the different types of failure occurring in the distributed database environment? Explain in detail the cause of all the solution for them. iii) check points. What is meant by concurrency control? Why for is it important in the management of several transactions over the database. Write short note on: i) partitioned networks. c) Checkpoints and cold starts 2003 1. Explain this compatibility relations using a matrix format. Write a short note on: a) Constructing an application. Explain in brief. ii) distributed database dictionary management. 7. 4. 6. iii) Share Nothing. What are the main advantages of this protocol? Whether it is able to eliminate the problem of deadlock? Explain in brief.deadlocks 5. 5. A) What do you mean by compatibility of two lock modes. Explain the two phase locking protocol in detail. Explain the following architecture used in client-server technology: i) Shared Everything. .