13
1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

Embed Size (px)

Citation preview

Page 1: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

1

Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties.

By

Lars Frank

Copenhagen Business School

Page 2: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

Database Consistency:

A database is consistent if its data complies with the consistency rules of the database.

Automatic DBMS consistency control normally consists of attribute validation and referential integrity control.  

If the database is consistent both when a transaction starts and when it has been committed, the execution has the consistency property.

 

Page 3: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

3

The ACID properties of transactions:

• Atomicity = the all or nothing update property.

• Consistency property = if a database is consistent before a transaction is executed, then the database must also be consistent after the transaction is executed.

• Isolation = The updates of a transaction must not be seen by other transactions before the transaction is committed.

• Durability = Committed data can be recovered in case of failures.

-----------------------------------------------

Page 4: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

Asymptotic Consistency:

Databases with relaxed ACID properties is almost always inconsistent.

With asymptotic consistency the database should converge towards a consistent state when all active transactions have been committed/compensated.  

Countermeasures against Consistency anomalies are used to implement asymptotic consistency.

Page 5: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

Consistency Control:

Automatic DBMS consistency control normally consists of attribute validation and referential integrity control.

Attributes may be validated against its domain where e.g. minimum and maximum values may be described. Referential integrity may validate that e.g. so called child records must not be created without relationship to a parent record.

Page 6: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

Consistency Anomaly =

Violation of the consistency constraints of a database.

Page 7: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

Countermeasures against isolation anomalies:

 

•The Reread Counter-measure•The Commutative Updates Counter-measure•The Version File Counter-measure •The Version File and Commutative Updates

Counter-measure •The Pessimistic View Counter-measure •The Semantic Lock Counter-measure•The End of Day Transaction Countermeasure •Counter-measures by Value  •The Pivot Lock Counter-measure  •The Enforcement Method Counter-measure

Page 8: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

The Pessimistic View Counter-measure:

The idea of this countermeasure is to “limit” the options of concurrent users to prevent them from outsize a lower limit of existing resources.

•Therefore, compensatable subtransactions should be used for updates that decrease the users’ options. That is, concurrent transactions cannot use resources that are reserved for the compensatable subtransaction.

•The retriable subtransactions should be used for updates that “increase” the users’ options. That is, concurrent transactions can only use increased resources after the increase has been committed globally.

•The pivot subtransactions may also be used for updates that “increase” and/or “limit” the users’ options because this update reflects the real world reality.

Page 9: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

The Optimistic Countermeasure:

Suppose a stock in a remote location has an maximum capacity.The Optimistic Countermeasure can eliminate the risk involved in violating an upper limit in some remote stock attribute. The optimistic countermeasure should be implemented by using:

-The pivot or compensatable subtransactions for updates that “increase” the users’ options. That is, concurrent transactions cannot deposit resources that are reserved for depositing by the compensatable/pivot subtransactions.-The pivot or retriable subtransactions for updates that “decrease” the users’ options. That is, concurrent transactions can only withdraw resources after the increase has been committed.

Sometimes transactions that use the optimistic countermeasure cannot be compensated. Therefore, these transactions have to be optimistic.

Page 10: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

Referential integrity control 

The remote parent Countermeasure creates the potential child record by initiating a retriable creating subtransaction in the location of the parent record.

The i-safe replication may be viewed as a special case of distributed referential integrity control as the first or primary copy of a record may be viewed as the parent and all the replicas may be viewed as children.

Page 11: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

A distributed modular ERP system have relaxed ACID properties across the autonomous databases of the ERP modules.

Orders

Accounts

Customers

Orderlines

Stocks per product per location

Products

Account items

Mobile sales module The account module offer services with relaxed ACID properties. (That is at least read, compensatable, and retriable services).How would

you implement relaxed consistency control?

Page 12: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

End of session

Thank you !!!Thank you !!!

Page 13: 1 Countermeasures against Consistency Anomalies in Databases with Relaxed ACID Properties. By Lars Frank Copenhagen Business School

An ERP sales module integrated with mobile autonomous salesmen

Orders Orderlines

Customers

Mobile sales locations

Products