I have read through the documentation and would ike to post a comment on this. First off, let's review the PSQLv10 docs concerning the release of locks:
User Transactions
-->
var WebWorksSeeAlso = new WebWorksSeeAlso_Object();
-->if( self == top ){ window.location.replace( "../../../../index.jsp?topic=/com.pervasive.psql.doc/html/prog_gde/prog_gde-12-5.html");}
Multiple-Record Locks
A multiple-record lock allows a client to lock
several records concurrently in the same file. When a client successfully locks
one or more records with multiple-record locks, those locks remain in effect
until the client completes one or more of the following events:
- Deletes the locked record(s).
- Explicitly unlocks the record(s) using the Unlock operation (27).
- Closes the file.
- Closes all open files by issuing a Reset operation (28).
- Obtains a file lock during an exclusive transaction.
Further, regarding transactions:
User Transactions
-->
var WebWorksSeeAlso = new WebWorksSeeAlso_Object();
-->if( self == top ){ window.location.replace( "../../../../index.jsp?topic=/com.pervasive.psql.doc/html/prog_gde/prog_gde-12-5.html");}
The events that cause the release of single- and
multiple-record locks in concurrent transactions are similar to those for the
non-transactional environment. For single, see Single-Record Locks . For multiple, see Multiple-Record Locks with the following exceptions:
- A Close operation does not release explicit record
locks secured from within a concurrent transaction. With version 7.0 of the
MicroKernel, you can close the file within a transaction even if a record is
locked.
- An End or Abort Transaction operation releases all record locks obtained
from within the transaction.
As expected, locking a record INSIDE a transaction and then terminating that transaction should cause this record to be unlocked. This is completely expected. However, I think some discussion is needed for records that are locked OUTSIDE of the transaction.
I was actually quite surprised when I did my own testing on DemoData with this. I opened Person.MKD, read and locked the first 8 records, started a concurrent transaction, then read the ninth record inside the transaction with the expectation of modifying it.
As soon as I read the ninth record, my locks on the other 8 records disappeared completely! This was quite unexpected. The documentation never mentions that starting a concurrent transaction can clear record locks. It does explcitily state that starting an Exclusive Transaction would clear locks, as such locks would then be superfluous, so this makes sense.
This observation indicates that the behaviour of the engine is incorrect (indicating a bug in the engine), or that the documentation is incorrect (indicating a bug in the docs).
Which one SHOULD it be? I am actually leaning towards the former. Locking a record outside of a transaction should not necessarily be affected by the beginning of a transaction on the same file. Will this break backward compatibility with some applications? Perhaps. I'd be interested in the comments of other developers using locks and concurrent transactions to see if you ever expected locks issues outside of transactions to be retained...