Reread Nolock (-rereadnolock)
- Last Updated: March 30, 2020
- 3 minute read
- OpenEdge
- Version 12.2
- Documentation
Reread Nolock (-rereadnolock)
Use Reread Nolock (-rereadnolock)
to tell the AVM how to decide between multiple copies of a cached
record that were read from the database using NO-LOCK.
By default, the AVM chooses the oldest of the NO-LOCK copies.
When you start a session with -rereadnolock, the
AVM chooses the most recently cached NO-LOCK copy.
| Operating system and syntax | UNIX / Windows |
-rereadnolock
|
||
|---|---|---|---|---|
| Use with | Maximum value | Minimum value | Single-user default | Multi-user default |
| Client Session | — | — | — | — |
The AVM stores records read from the database in internal buffers that are linked to the record buffers of your ABL application. When two internal buffers for the same record exist, the AVM decides which to keep and use by rules based on the locking level and age of each copy. This parameter only affects how the decision is made when both of the following conditions are true:
- A
record is read from the database with
NO-LOCK. - The AVM finds an older
NO-LOCKcopy of that same record already in memory.
For more information on record locking, see the topic on data handling and record locking in Develop ABL Applications.
You use this parameter to resolve client-server currency conflicts. You
also use it to resolve server-to-server currency conflicts by using it as an application
server startup parameter through the OpenEdge Management. When applications use record
buffers with a large scope, such as default buffers scoped to the main block of long life
persistent procedures as you might have on an application server, using -rereadnolock is strongly advised.
Remember
the following when using -rereadnolock:
- It has no affect on records that are retrieved through RECID or ROWID. In that case, the AVM will not reread the record. Instead, it uses the copy of the record already stored in the buffer. If you need the most current version of the record, use the RELEASE statement on all buffers that contain a copy of the record before reading the record, or use the FIND CURRENT or GET CURRENT statement to reread the record.
- It has no affect on the behavior of the query cache used for a query with NO-LOCK that is specified through the CACHE phrase of the DEFINE QUERY statement. To force the AVM to always re-read the record, set the cache size to zero (0). However, this may significantly degrade performance if the database is accessed across a network. Set the cache size to zero only when it is critical to retrieve the most current version of a record.
- It has no affect on the behavior of the prefetch cache that is used by default when retrieving records NO-LOCK across the network. By default, when executing a CAN-FIND function or a FIND, FOR, or OPEN QUERY statement on a database that is accessed across a network, the AVM fetches several records at a time and stores them in a prefetch cache. The AVM will only send a request to the database server to fetch more records if the requested record is not in the current prefetch cache. If the record is in the current cache, the AVM will not read a new copy of that record even if -rereadnolock is set. To eliminate this cache so that the most current version of the record is always read, use the NO-PREFETCH keyword in the appropriate statements. However, using the NO-PREFETCH keyword may significantly degrade performance. Set NO-PREFETCH only if it is critical to retrieve the most current version of a record.