Subject Re: [firebird-support] transaction concurrency question
Author Fidel Viegas
On Fri, Feb 29, 2008 at 10:33 AM, Eugen Stoianovici
<eugen.stoianovici@...> wrote:

> How does firebird's versioning work on transactions? If i have..let's
> say a stocks application. At some point there are 10 items A in stock
> Users U1 and U2 both sell 8 A's roughly at the same time:
>
> 1. --U1 : begin transaction--
> 2. --U2 : begin transaction--
>
> 3. U1: Insert some sale info into sale table
> 4. U1: Check if there are 8 A's available (true at this poing)
> 5. U2: Insert some sale info into sale table
> 6. U1: Update stock for A to stockA-8 items available
> 7. U2: Check if there are 8 A'2 available (also true at this point?)
> 8. --U1: Commit transaction--
> 9. U2: Update stock for A to stockA-8 items available (which would set
> stock for A at -6)
> 10 --U2: commits--(does firebird accept this transaction?)
>
> From what i understood reading the docs, U2 (the second transaction)
> doesn't see what U1 does until U2 commits. Am i right? How does firebird
> handle this issue? How should i handle this issue?

Hi Eugen,

Firebird uses Multi Version Concurrency control. Have a look here
http://www.firebirdsql.org/doc/whitepapers/fb_vs_ibm_vs_oracle.htm for
a better understading on how that works.

All the best,

Fidel.