Multiple user is trying to access the database, same time users wnats to lock the same records at the same time
If first user lock the record another user wait until the record is realesed by first user
Incase of dead lock arrived, transaction must be aborted
when overlapping transactions editing the same data is small, optimistic locking increase concurrency and thus transaction throughput. Enable OCC for a table by setting the property OccEnabled to Yes
Never implement dialog with the user inside a transaction.
Try to lock central resources in the same order. This avoids the dead
lock situation discussed previously. This serializes the process,
which means that only one user can perform this at a time.
lock situation discussed previously. This serializes the process,
which means that only one user can perform this at a time.
Try to avoid locking central resources.
Keep the transactions as short in time as possible. Do not
compromise the integrity of the data.
Locking is held when it takes to finish the process
Process of locking
Process 1 Process 2
Item C - Locked -
Item A - Locked -
Item B - Locked Item G - Locked
Item G - Waiting for lock from Item A - Waiting for lock from
Process 2 Process 1
Item A - Locked -
Item B - Locked Item G - Locked
Item G - Waiting for lock from Item A - Waiting for lock from
Process 2 Process 1
ttsbegin;
while select inventTable
{
if
(CustTable::find(branchTable.PrimaryBranchid).Blocked == CustBranchBlocked::All)
{
BranchTableUpdate = BranchTable::find(BranchTable.BranchId, true);
BranchTableUpdate.PrimaryBranchId ="";
BranchTableUpdate.update();
}
}
ttscommit;
while select inventTable
{
if
(CustTable::find(branchTable.PrimaryBranchid).Blocked == CustBranchBlocked::All)
{
BranchTableUpdate = BranchTable::find(BranchTable.BranchId, true);
BranchTableUpdate.PrimaryBranchId ="";
BranchTableUpdate.update();
}
}
ttscommit;
* ------------------------------------------------------------------------------------------------------------*
while select forupdate inventTable
exists join vendTable
where vendTable.AccountNum == inventTable.PrimaryVendorId &&
vendTable.Blocked == CustVendorBlocked::All
exists join vendTable
where vendTable.AccountNum == inventTable.PrimaryVendorId &&
vendTable.Blocked == CustVendorBlocked::All
ReplyDeleteYou can subscribe for video clips update on Online trainng related to topics Micorsoft Axapta ERP, Microsoft Power BI ,SQL Administration and Online Training clips etc
https://www.youtube.com/user/sksingh1980