/// <summary> /// is other's transaction has held the table's lock and conflict with the ctx-lock /// </summary> /// <param name="ctx"></param> /// <returns></returns> private bool IsOthersHeldOrWaitConflictTabLock(Transaction tx, TableIndex index, LockFlags flags, LockEntry endEntry = null) { var locks = TabLocks.GetValueOrDefault(index); if (locks == null) { return(false); } for (var node = locks.First; node != null; node = node.Next) { var entry = node.Value; if (entry == endEntry) { break; } if (entry.Transaction == tx) { continue; } if (entry.IsExclusive || flags.IsExclusive()) { return(true); } } return(false); }
/// <summary> /// is other's transaction has held the recrod's lock and conflict with the ctx-lock /// </summary> /// <param name="ctx"></param> /// <returns></returns> private bool IsOthersHeldOrWaitConflictRecLock(Transaction tx, PagePosition page, int slot, LockFlags flags, LockEntry endEntry = null) { var locks = RecLocks.GetValueOrDefault(page); if (locks == null) { return(false); } for (var node = locks.First; node != null; node = node.Next) { var entry = node.Value; if (entry == endEntry) { break; } if (entry.Transaction == tx || entry.GetBit(slot) == 0) { continue; } if (entry.IsExclusive || flags.IsExclusive()) { return(true); } } return(false); }