Try OpenEdge Now
skip to main content
Developing AppServer Applications
Design and Implementation Considerations : Transaction and record management considerations : Buffer currency and NO-LOCK
 

Buffer currency and NO-LOCK

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 AVM (ABL Virtual Machine) 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 AppServer), 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 an AppServer 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 a request to an AppServer whose operating mode is stateless. The AppServer agent who processes the request updates some record. The client then sends another request to the AppServer. This request happens to go to an AppServer agent that is different then the one that processed the first request. The AppServer agent 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 clients request executed at this AppServer agent, the AVM may not reread the record. When this occurs, the AppServer agent 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:
*Readingthe current record
*Releasingthe record
*Settingthe -rereadnolock parameter
* Reading the current record
* Releasing the record
* Setting the -rereadnolock parameter