How is Oracle ACID compliant when it does not honour 'isolation' property fully?

[亡魂溺海] 提交于 2019-12-23 04:35:45

问题


Claim: Oracle does not honour isolation property in ACID properties. As per Wikipedia page on ACID

"Isolation ensures that concurrent execution of transactions leaves the database in the same state that would have been obtained if the transactions were executed sequentially."

This can happen only if the transactions are serializable. Yes, Oracle has a transaction level called Serializable but it is not true serializability and is only snapshot isolation.

Read https://blog.dbi-services.com/oracle-serializable-is-not-serializable/ An excerpt from Wiki page of Snapshot isolation (https://en.wikipedia.org/wiki/Snapshot_isolation)

"In spite of its distinction from serializability, snapshot isolation is sometimes referred to as serializable by Oracle".

There are weaker isolation levels but they are not sufficient to guarantee that the sequence of transactions would lead to the outcome that would be obtained if they were executed sequentially. To guarantee it, serializability is a must.

Q1) Since Oracle does not provide it (its serializaibility is not a true one), it does not honor isolation 100 percent. How can then it be called ACID compliant?

Q2) Looks like Oracle was treated here leniently with regard to isolation. Is this leniency extended to other databases as well?

Q3) If we take an unforgiving stance and say (isolation means 100 percent isolation - no less is accepted), won't Oracle's claim of being ACID compliant fall to pieces? What about other relational databases? Will they be able to make the cut or will they fall short like Oracle?


回答1:


SQL Server has SERIALIZABLE in addition to SNAPSHOT. But, at least in SQL Server, for most practical purposes SERIALIZABLE is useless, as it's too expensive, and not really effective. And you use special constructs for the few transactions that actually need to be serialized (ie run one-at-a-time).

SERIALIZABLE is to expensive because transaction ordering is accomplished by some combination eliminating concurrency, and by generating run-time failures (deadlocks). Both of which are very expensive and troublesome.

SERIALIZABLE is not really effective, because doesn't actually accomplish complete transaction isolation. To do so would require every transactions to exclusively lock all data it reads, to prevent two transactions from reading the same data, and then writing.
The classic example is where two sessions run

SELECT salary FROM emp where id = 1

and then, compute a new value based on the existing in the client, and then

UPDATE emp set salary = :newSalary 

The only way to make this work right is to place an exclusive lock on the first read, so a second session can't read too.

In Oracle this is accomplished with SELECT ... FOR UPDATE, and in SQL Server with an UPDLOCK hint. Or with an explicit "application lock", Oracle's DMBS_LOCK, or SQL Server's sp_getapplock.



来源:https://stackoverflow.com/questions/56811167/how-is-oracle-acid-compliant-when-it-does-not-honour-isolation-property-fully

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!