On Saturday, 3 July 2021 at 20:28:55 UTC+10, Nicola wrote:Separate to the "serialisation failures", which are the rough equivalent to deadlocks in a SQL Platform (with a Lock Manager), if deadlocks cannot happen, what is this, that people are experiencing problems with in PusGross, that they are calling deadlocks ?
Whether it makes sense to code that on in a similar way is still unclear
to me. It's a one page procedure performing several lookups just to
insert a record, a step which in PostgreSQL would conflict only with
a similar insertrCoand the duration of the conflict would be short. Also, one purpose of your template is to avoid deadlocks, which in MVCC cannot happen anyway. In fact, adding explicit locking might introduce the possibility of deadlocks.
in MVCC [deadlocks] cannot happen anyway
Example 2 (assume SERIALIZABLE):
2. As an academic example, yes, it is a [true] deadlock.
3. In real life, the two UPDATES bracketed by BEGIN-COMMIT TRAN in Connection[T1] are Atomic, in the same contiguous code block, and thus
will execute at Time[0]. 4. There is no rCLinterleavingrCY of Atomic operations.
The notion of rCLinterleaved operationsrCY is plain stupid, self-contradictory. The Transaction is Atomic.
Sybase has no rCLinterleaved operationsrCY, it preserves the Atom. Sybase has no internal deadlocks, all deadlocks are true (coding in the app).
You are not getting it.
as opposed to poor code], without changing either the database or the
app code, as a fixed price service. If you are interested, I can
provide proof.
-------------------------------------------
-- Example 2 Sybase Side --
-------------------------------------------
LetrCOs say Row[Tom] is on Page[Px].
__ at Time[2]
____ Connection[T1] obtains a Shared-Page-Lock on Page[Px], until EoT
__ at Time[3]
____ Connection[T2] obtains an Update[Intent]-Page-Lock on Page[Px]
(which does not escalate to Exclusive), and the lock is chained onto Page[Px], behind Connection[T1]rCOs lock
____ Connection[T2] is in TaskStatus *sleep*, in LockStatus *lock-wait*
__ at Time[4]
____ Connection[T1] lock on Page[Px] is escalated [change of
lock-type] to Update[Intent]-Page-Lock (succeeds),
and thence to Exclusive-Page-Lock (succeeds)
[At time [4], Sybase] rolls back a transaction, which happens to be
T1. T2 can now commit.
No. As explained in detail above. There is no deadlock. Both Connections[T1][T2] succeed.
Anyway, in Example 2 it is not correct to talk about deadlocks in
PostgreSQL, because the read statements do not acquire any locks, so
it's not possible for the two transactions to be waiting upon each
other. The update at time (3) proceeds normally (such update is local to
T2). At time (4), though, T1 must be put on hold, because, according to
the rule above, another transaction has concurrently updated the same
record and is stil active. When T2 commits, PostgreSQL realises that T1
cannot sensibly continue (because that would result in a lost update),
and kills it. Now, T2 can commit.
1. Repeating:
I think we agree: in PoopGres, where it is reported as (a) rollbacks,
or (b) rCLdeadlocksrCY, or (c) rCLserialisation failuresrCY,
it is one logical category: the effects that should not happen, but
that do happen.
LetrCOs call that category FalseDeadlocks, because even the [b] reported deadlocks are false, not caused by the app code, but internal.
3. rCLKillrCY.
I hope you mean rolled back.
2. Can there be a concurrent interleaving of operations that leads to
a deadlock in Sybase, but the same concurrent interleaving does not
yield a deadlock or a serialization error in PostgreSQL? No, because
a concurrent interleaving of operations leading to a deadlock is an
incorrect interleaving. So, if Sybase "encounters a deadlock
situation", then PostgreSQL must also produce an error in that same
situation, otherwise it would output an incorrect result. The
difference is that PostgreSQL may output a "serialization error",
rather than a deadlock error.
Definitely not. As explained above, so I will not repeat.
- Interestingly, when T1 and T2 are implemented as stored procedures,
no deadlocks occur
On Monday, 30 August 2021 at 17:39:27 UTC+10, Nicola wrote:
On 2021-08-29, Nicola wrote:Wait. I haven't started a transaction.
- Interestingly, when T1 and T2 are implemented as stored procedures,
no deadlocks occur
After adding begin transaction..
commit to each stored procedure, I do get deadlocks. That makes more
sense to me.
On Monday, 30 August 2021 at 17:39:27 UTC+10, Nicola wrote:
On 2021-08-29, Nicola wrote:Wait. I haven't started a transaction.
- Interestingly, when T1 and T2 are implemented as stored procedures,
no deadlocks occur
After adding begin transaction..
commit to each stored procedure, I do get deadlocks. That makes more
sense to me.
On Monday, 30 August 2021 at 17:39:27 UTC+10, Nicola wrote:
On 2021-08-29, Nicola wrote:Wait. I haven't started a transaction.
- Interestingly, when T1 and T2 are implemented as stored procedures,
no deadlocks occur
Yes, that was not clear. Refer my questions in my response.
After adding begin transaction..
commit to each stored procedure, I do get deadlocks. That makes more
sense to me.
1. Per my comments, re the lock duration, yes, that makes more sense.
2. But from a Transaction perspective, no, it doesn't make sense to me.
__ stored proc [T1] is not holding anything that [T2] holds, so a deadlock between them is not possible.
3. Therefore (debugging this remotely, with the little detail
provided), it would be that you do have several concurrent [T1]
connections that are deadlocking each other, nothing to do with [T2].
Best to read my response and provide more detail (summary) for each test.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 03:51:35 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
684 files (6,931M bytes) |
| Messages: | 264,528 |