Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Fred and Mary start with:

    1 A
    2 B
    3 C

    Fred starts a transaction and updates the first two rows so the table that looks like:

    1 X
    2 Y
    3 C

    In the mean time Mary has started and finished a transaction that updates the third row:

    1 A
    2 B
    3 Z

    which means that Fred is seeing the "old" version of row three, and the table as a whole reflects something that will never have existed in the database.

    Make sense?

    • Oh! I replied to Aristotle without thinking too carefully about your reply. I can see how this could occur, but it's problematic because then things aren't atomic. If you take actions based upon this, you can still corrupt your data. You update row 3 because 'C' is there, but it's really not. Now you have a race condition because consistent reads aren't. Or did I misunderstand something?

      • You can't talk about atomic operations and transactions at the same time - its kind of contradictory. Atomic operations mean that the database is either in a state before the operation or in a state after the operation, and never in between. But transaction means that you can group several actions and execute them so that the database reflect the changes only after the execution of all actions - the transaction can't be atomic in the sense that from inside it you can see the intermediate state. In the example above, if after Fred's first change he says something like "if row 3 has C, update it to D" then that operation would succeed and the commit that terminates the transaction would fail - the same way that an atomic update, all by itself, would fail when row 3 no longer has C.