Re: Disk Blocks/pages, Consistent Reads, undo

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Fri, 4 Jan 2008 12:41:53 -0000
Message-ID: <xPqdncJttNwMtOPanZ2dnUVZ8v6dnZ2d@bt.com>

"markpapadakis" <markpapadakis_at_gmail.com> wrote in message news:6646154c-6de8-460e-a965-a30bbadbf581_at_x69g2000hsx.googlegroups.com...
> Good day,
>
>
> Whenever a transaction reads a block, it compares its SCN with the
> transaction's SCN, and based on whether the block's SCN is >
> transaction's SCN it will replay undo data until the final data are
> consistent with the SCN of the said transaction.
>
> However, if the above is true, and a transaction B wishes to update a
> row in a block, and that transaction B was initiated some time ago,
> while in the mean time other transactions have updated the block and
> committed those changes thus having set the block's SCN to be >
> transaction B's SCN, when transaction B reads the block, the data will
> be consistent with the time transaction B began.
>
> So transaction B, having retrieved the block data being in the state
> they were the moment transaction B was initiated, will perhaps modify
> the rows directory, rows data, ITL and other segments/properties of
> the table and then commit that changes to the block, effectively
> undoing whatever was done by the transactions that began after
> transaction B which affected that block themselves ( because the block
> data transaction B touched based using consistent reads did not
> contain those changes ).
>
> I am sure I am missing something here. Anyone who can help me
> understand that is wrong that assumptions?
>
> Thank you,
> Mark Papadakis

Mark,

The transaction will only change the current version of the block. But it generates the read consistent version of the block to make sure that the data it wants to change in the current version is identical to the data as it was when the transaction started.

For example:

    I want to change col1 from X to Z in something that is     current row 3 of the block (update where co1 = 'X')

    I create the read-consistent version of the block, and     find that the same row was there when my transaction     started - but the value of col1 was then 'Y'.

    So I can't update it because when my transaction started     it wasn't a row that I was supposed to update.

For more details on how messy and expensive this can get do a search on AskTom for "write consistency"

-- 
Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com

Author: Cost Based Oracle: Fundamentals
http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html
Received on Fri Jan 04 2008 - 06:41:53 CST

Original text of this message