Pick the fix
Two support agents edit the same ticket in a web form for several minutes. Which approach fits?
Hint 1 of 1
Can you hold a database lock while a human types?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Optimistic: a version column, sent as an ETag, checked with If-Match
Correct. No lock is held during think time; the second save gets 412 and can merge.
Optimistic locking checks for conflicts only at save time. The version read with the form travels as an ETag, and a save with an old version is refused, so no lock is held while people type.
Why not the others?
- B
SELECT ... FOR UPDATEwhen the form opens. A transaction can't stay open across HTTP requests for minutes. - C SERIALIZABLE isolation. Each save is its own short transaction; isolation can't see the other agent's open form.
- D Last write wins. Silently throws away the first agent's work.