Buffer currency and NO-LOCK
- Last Updated: December 16, 2014
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
If you try to find a record with NO-LOCK and
that record is already located in a buffer, then depending on the exact nature of the
request, The ABL Virtual Machine (AVM) may not reread the record from the database.
The fact that the AVM does not always reread NO-LOCK records may cause unexpected behavior in your distributed
application. More specifically, although a record was updated within one session (client
or server), that update may not be seen within another session if that record was
previously read with NO-LOCK. There are two scenarios
where this may occur. These scenarios are called currency
conflicts to denote the fact that they involve a buffer whose contents is not
current:
-
Client-server currency conflict
In this scenario, a client finds a record
NO-LOCK, and then sends a request to a server to update the same record. When the request finishes, the client attempts to find the same record. Because the AVM may not reread the record, the client buffer might contain the copy of the record before the update occurred rather than the updated copy of the record. -
Server-server currency conflict
In this scenario, a client sends to a request a server over a session-free or unbound session-managed connection. The server session that processes the request updates some record. The client then sends another request to the server. This request happens to go to a server session that is different then the one that processed the first request. This second server session attempts to find the same record that was updated using
NO-LOCK. If the record was already stored in a buffer due to some previous client's request executed by this server session, the AVM may not reread the record. When this occurs, the server session's buffer will contain the copy of the record before the update occurred rather than the updated copy of the record.
If resolving client-server or server-server currency conflicts is important to you, there are three general approaches that you can use: