distirbuted database semantic
TRANSCRIPT
-
8/9/2019 Distirbuted DataBase Semantic
1/24
Distributed DBMS Page 6. 1 1998 M. Tamer zsu & Patrick Valduriez
OutlineI IntroductionI Background
I Distributed DBMS ArchitectureI Distributed Database Design Semantic Data Control
View Management
Data Security Semantic Integrity Control Distributed Query Processing Distributed Transaction Management Distributed Database Operating Systems Parallel Database Systems Distributed Object DBMS Database Interoperability
Current Issues
-
8/9/2019 Distirbuted DataBase Semantic
2/24
Distributed DBMS Page 6. 2 1998 M. Tamer zsu & Patrick Valduriez
I Involves:
View management
Security control
Integrity control
I Objective :
Insure that authorized users perform correctoperations on the database, contributing to the
maintenance of the database integrity.
Semantic Data Control
-
8/9/2019 Distirbuted DataBase Semantic
3/24
Distributed DBMS Page 6. 3 1998 M. Tamer zsu & Patrick Valduriez
View virtual relation
generated from base relation(s) by aquery
not stored as base relations
Example :CREATE VIEW SYSAN(ENO,ENAME)
AS SELECT ENO,ENAME
FROM EMP
WHERE TITLE=Syst. Anal.
View Management
ENO ENAMEE2 M.Smith
E5 B.Casey
E8 J.Jones
SYSAN
ENO ENAME TITLE
E1 J. Doe Elect. Eng
E2 M. Smith Syst. Anal.
E3 A. Lee Mech. Eng.
E4 J. Miller Programmer
E5 B. Casey Syst. Anal.
E6 L. Chu Elect. Eng.E7 R. Davis Mech. Eng.
E8 J. Jones Syst. Anal.
EMP
-
8/9/2019 Distirbuted DataBase Semantic
4/24
Distributed DBMS Page 6. 4 1998 M. Tamer zsu & Patrick Valduriez
Views can be manipulated as base relations
Example :
SELECT ENAME, PNO, RESPFROM SYSAN, ASG
WHERE SYSAN.ENO = ASG.ENO
View Management
-
8/9/2019 Distirbuted DataBase Semantic
5/24
-
8/9/2019 Distirbuted DataBase Semantic
6/24
Distributed DBMS Page 6. 6 1998 M. Tamer zsu & Patrick Valduriez
I To restrict access
CREATE VIEW ESAMEAS SELECT *
FROM EMP E1, EMP E2
WHERE E1.TITLE = E2.TITLE
AND E1.ENO = USER
I QuerySELECT *
FROM ESAME
View Management
ENO ENAME TITLE
E1 J. Doe Elect. Eng
E2 L. Chu Elect. Eng
-
8/9/2019 Distirbuted DataBase Semantic
7/24
Distributed DBMS Page 6. 7 1998 M. Tamer zsu & Patrick Valduriez
I Updatable
CREATE VIEW SYSAN(ENO,ENAME)
AS SELECT ENO,ENAME
FROM EMP
WHERE TITLE=Syst. Anal.
I Non-updatable
CREATE VIEW EG(ENAME,RESP)
AS SELECT ENAME,RESP
FROM EMP, ASG
WHERE EMP.ENO=ASG.ENO
View Updates
-
8/9/2019 Distirbuted DataBase Semantic
8/24
Distributed DBMS Page 6. 8 1998 M. Tamer zsu & Patrick Valduriez
I Views might be derived from fragments.
I View definition storage should be treated asdatabase storage
I Query modification results in a distributed query
I View evaluations might be costly if base relationsare distributed use snapshots
N Static views - do not reflect the updates to the base relations
N managed as temporary relations - only access path issequential scan
N bad selectivity - snapshots behave as pre-calculated answers
N periodic recalculation
View Management in DDBMS
-
8/9/2019 Distirbuted DataBase Semantic
9/24
Distributed DBMS Page 6. 9 1998 M. Tamer zsu & Patrick Valduriez
Data Security
I Data protection
prevent the physical content of data to beunderstood by unauthorized users encryption/decryption
N Data Encryption StandardN Public-key encryption
I Authorization control only authorized users perform operations they are
allowed to on the databaseN identification of subjects and objects
N authentication of subjectsN granting of rights (authorization matrix)
-
8/9/2019 Distirbuted DataBase Semantic
10/24
Distributed DBMS Page 6. 10 1998 M. Tamer zsu & Patrick Valduriez
Semantic Integrity Control
I Maintain database consistency by enforcing a
set of constraints defined on the database.I Structural constraints basic semantic properties inherent to a data model
e.g., unique key constraint in relational model
I
Behavioral constraints regulate application behaviorN e.g., dependencies in the relational model
I Two components
Integrity constraint specification Integrity constraint enforcement
-
8/9/2019 Distirbuted DataBase Semantic
11/24
Distributed DBMS Page 6. 11 1998 M. Tamer zsu & Patrick Valduriez
Semantic Integrity Control
I Procedural
control embedded in each application programI Declarative
assertions in predicate calculus
easy to define constraints
definition of database consistency clear
inefficient to check assertions for each updateN limit the search space
N decrease the number of data accesses/assertion
N preventive strategies
N checking at compile time
-
8/9/2019 Distirbuted DataBase Semantic
12/24
Distributed DBMS Page 6. 12 1998 M. Tamer zsu & Patrick Valduriez
Predefined constraints
specify the more common constraints of the relational model
Not-null attribute
ENO NOT NULL IN EMP
Unique key
(ENO, PNO) UNIQUE IN ASG
Foreign key
A key in a relation R is a foreign key if it is a primary key ofanother relation Sand the existence of any of its values in R
is dependent upon the existence of the same value in S
PNO IN ASG REFERENCES PNO IN PROJ
Functional dependency
ENO IN EMP DETERMINES ENAME
Constraint Specification Language
-
8/9/2019 Distirbuted DataBase Semantic
13/24
Distributed DBMS Page 6. 13 1998 M. Tamer zsu & Patrick Valduriez
Precompiled constraints
Express preconditions that must be satisfied by all tuples ina relation for a given update type
(INSERT, DELETE, MODIFY)
NEW - ranges over new tuples to be insertedOLD - ranges over old tuples to be deleted
General Form
CHECK ON [WHEN ]
Constraint Specification Language
-
8/9/2019 Distirbuted DataBase Semantic
14/24
Distributed DBMS Page 6. 14 1998 M. Tamer zsu & Patrick Valduriez
Precompiled constraints
Domain constraint
CHECK ON PROJ(BUDGET500000 AND BUDGET1000000)
Domain constraint on deletion
CHECK ON PROJ WHEN DELETE (BUDGET = 0)
Transition constraint
CHECK ON PROJ (NEW.BUDGET > OLD.BUDGET AND
NEW.PNO = OLD.PNO)
Constraint Specification Language
-
8/9/2019 Distirbuted DataBase Semantic
15/24
Distributed DBMS Page 6. 15 1998 M. Tamer zsu & Patrick Valduriez
General constraints
Constraints that must always be true. Formulae of tuplerelational calculus where all variables are quantified.
General FormCHECK ON :,()
Functional dependencyCHECK ON e1:EMP, e2:EMP
(e1.ENAME = e2.ENAME IF e1.ENO = e2.ENO)
Constraint with aggregate function
CHECK ON g:ASG, j:PROJ(SUM(g.DUR WHERE g.PNO = j.PNO) < 100 IF
j.PNAME = CAD/CAM)
Constraint Specification Language
-
8/9/2019 Distirbuted DataBase Semantic
16/24
Distributed DBMS Page 6. 16 1998 M. Tamer zsu & Patrick Valduriez
Two methods
I DetectionExecute update u:D DuIfDu is inconsistent then
compensateDu Du
else
undoDu D
I PreventiveExecute u:D Du only ifDu will be consistent
Determine valid programs
Determine valid states
Integrity Enforcement
-
8/9/2019 Distirbuted DataBase Semantic
17/24
Distributed DBMS Page 6. 17 1998 M. Tamer zsu & Patrick Valduriez
I PreventiveI Add the assertion qualification to the update
queryI Only applicable to tuple calculus formulae with
universally quantified variablesUPDATE PROJ
SET BUDGET = BUDGET*1.1WHERE PNAME =CAD/CAM
UPDATE PROJ
SET BUDGET = BUDGET*1.1
WHERE PNAME =CAD/CAM
AND NEW.BUDGET 500000
AND NEW.BUDGET 1000000
Query Modification
-
8/9/2019 Distirbuted DataBase Semantic
18/24
Distributed DBMS Page 6. 18 1998 M. Tamer zsu & Patrick Valduriez
Triple (R,T,C) whereR relation
T update type (insert, delete, modify)C assertion on differential relations
Example: Foreign key assertion
g ASG, j PROJ : g.PNO = j.PNO
Compiled assertions:(ASG, INSERT, C1), (PROJ, DELETE, C2), (PROJ, MODIFY, C3)
where
C1:NEWASG+, j PROJ: NEW.PNO = j.PNO
C2:g ASG, OLD PROJ- : g.PNO OLD.PNOC3:g ASG, OLD =PROJ-, NEW PROJ+:g.PNO OLD.PNO
OR OLD.PNO = NEW.PNO
Compiled Assertions
-
8/9/2019 Distirbuted DataBase Semantic
19/24
Distributed DBMS Page 6. 19 1998 M. Tamer zsu & Patrick Valduriez
Given relation R and update u
R+ contains tuples inserted by uR- contains tuples deleted by u
Type ofu
insert R- empty
delete R+ empty
modify R+ (R R- )
Differential Relations
-
8/9/2019 Distirbuted DataBase Semantic
20/24
Distributed DBMS Page 6. 20 1998 M. Tamer zsu & Patrick Valduriez
AlgorithmInput: Relation R, update u, compiled assertion CiStep 1: Generate differential relations R+ and RStep 2: Retrieve the tuples ofR+ and R which do not
satisfy CiStep 3: If retrieval is not successful, then the
assertion is valid.Example :
u is delete on J. Enforcing (J, DELETE, C2) :retrieve all tuples of J-
into RESULTwhere not(C2)
If RESULT = , the assertion is verified.
Differential Relations
-
8/9/2019 Distirbuted DataBase Semantic
21/24
Distributed DBMS Page 6. 21 1998 M. Tamer zsu & Patrick Valduriez
I Problems:
Definition of constraints
N consideration for fragments
Where to store
N replication
N non-replicated : fragments
Enforcement
N minimize costs
Distributed Integrity Control
-
8/9/2019 Distirbuted DataBase Semantic
22/24
Distributed DBMS Page 6. 22 1998 M. Tamer zsu & Patrick Valduriez
Types of Distributed
Assertions
I Individual assertions
single relation, single variable domain constraint
I Set oriented assertions single relation, multi-variable
N functional dependency multi-relation, multi-variable
N foreign key
I Assertions involving aggregates
-
8/9/2019 Distirbuted DataBase Semantic
23/24
Distributed DBMS Page 6. 23 1998 M. Tamer zsu & Patrick Valduriez
Distributed Integrity Control
I Assertion Definition similar to the centralized techniques
transform the assertions to compiled assertions
I Assertion Storage Individual assertions
N one relation, only fragments
N at each fragment site, check for compatibility
N if compatible, store; otherwise reject
N if all the sites reject, globally reject
Set-oriented assertions
N involves joins (between fragments or relations)N maybe necessary to perform joins to check for compatibility
N store if compatible
-
8/9/2019 Distirbuted DataBase Semantic
24/24
Distributed DBMS Page 6. 24 1998 M. Tamer zsu & Patrick Valduriez
Distributed Integrity Control
I Assertion Enforcement Where do you enforce each assertion?
N type of assertionN type of update and where update is issued
Individual AssertionsN update = insert
enforce at the site where the update is issued
N update = qualified send the assertions to all the sites involved execute the qualification to obtain R+ and R- each site enforce its own assertion
Set-oriented AssertionsN single relation
similar to individual assertions with qualified updates
N multi-relation move data between sites to perform joins; then send the result to the query
master site