Salesforce

Records locked that do not match search criteria

« Go Back

Information

 
TitleRecords locked that do not match search criteria
URL Namerecords-locked-that-do-not-match-search-criteria
Article Number000124654
EnvironmentProduct: Progress
Version: 7.x, 8.x, 9.x
Product: OpenEdge
Version: All Supported Versions
OS: All Supported Platforms
Question/Problem Description

Performing a FOR EACH on a table whose WHERE clause does not find any records, and seeing error 2624 causing locks to be made on records that should not be included in the result set.
 
Steps to Reproduce
Clarifying Information

The following query causes lock contention with other users that are updating records in the same table:
FOR EACH Customer WHERE Customer.phone EQ "bogusnumber" EXCLUSIVE-LOCK:
END.

 
Error Message<file-name> in use by <user> on <tty>. Wait or choose CANCEL to stop. (2624)
Defect Number
Enhancement Number
Cause

This is expected behavior and is a side-effect of searching on a non-indexed field. When searching using an index the ABL identifies the index entries, then applies a lock on each record to meet the search criteria until the end of the locking scope.

When searching without using an index (i.e. client-side selection), every record in the table is searched and the locking condition specified in the query is very briefly applied to each record while identifying whether it meets the selection criteria.

If other users are locking records in the same table simultaneously this causes the lock message (above).
 
Resolution

If possible, define an index to reduce the number of records returned or use an optimistic record locking strategy to access the records, thus only locking them when absolutely necessary. 
e.g.
4GL/ABL: How to Implement the Optimistic Locking Strategy to manage record locking in a Multi-User Environment?
 
Workaround
Notes
Keyword Phrase
Last Modified Date11/20/2020 7:13 AM

Powered by