Re: SE & Dynamic Server
Posted in 1998
Staff wrote: > > We just upgraded a client from SE to Dynamic Server 7.30 TC5. They > continue to run an application which was compiled against an SE without > logging. > > The client now gets random errors about not being able to position > within a table or having no cursor for update. We've been told this is > the result of running an application, which has been compiled against an > SE database with no logging, for an Online database with logging. > > Is this true? > > The client removed logging and no longer gets the errors. Is there a > better way to accomplish this? And will the client have to anything > special in order to perform backups? (such as being the only user?) If you check the ISAM errors you will see locking errors like -107. In a database with logging SELECT statements take shared locks on the rows/pages accessed which means that your update processes may not be able to get an exclusive lock on the row/page to perform an update. Also if the table's lock mode is page multiple update processes are more likely to interfere with each other. The solution is to either trap these "cannot position" and lock errors and retry or execute "SET LOCK MODE TO WAIT 10" so the update lock request will wait for a period of time for the locks by other processes to be released. Also be careful not to hold locks for long periods in applications. In effect do not SELECT...FOR UPDATE in an interactive program use the following scheme, or one like it, to reduce lock duration to a minimum: 1) SELECT data, without "FOR UPDATE" 2) Display data 3) Acquire user modifications 4) BEGIN WORK 5) Re-SELECT data rows that were modified WITH "FOR UPDATE" and verify that the data has not been modfied by another user/task by checking a timestamp column of comparing all columns if no timestamp exits. 6) If verify fails, notify the user and display the new version of the record. Release the FOR UPDATE lock by closing the cursor. If the verify succeeds, update WHERE CURRENT OF cursor and close the cursor. 7) COMMIT WORK or ROLLBACK WORK as appropriate. Art S. Kagel