Re: C-ISAM locking conflicts between v4.1 and v7.1 on SCO UNIX.
Posted in 1996
In article <01bbd201$ac98b5b0$5b1b06cf@bd91nt>, Heinz Wittenbecher <heinz@bytedesigns.com> writes >C-ISAM locking conflicts between v4.1 and v7.1 on SCO UNIX. > >Can someone shed some light on whether this apparent difference (conflict) >is intentional or a bug? > The locking startegy changed somewhere near v4 or v5. >Unfortunately we have some legacy progs at some sites that prevent running >all on one and the same flavor so we're trying to determine if perhaps >someone else has run across the problem and may have a >solution/work-around. Looked at Informix web-site but didn't find anything. > Check you release notes in $INFORMIXDIR/release/..ISAM.. there is something about the enviroment variable RESETLOCK. >Record locking discrepancy: >The problem appears to be that version 7.1 is placing a lock on the .idx >file, rather than .dat. I suspect the file locking discrepancy is due to >7.1 placing a lock on the .dat rather than the .idx for excllock. It >appears as though record locking file locking behaviors have been reversed. > >File locks: isopen( "file", ISINOUT+ISEXCLLOCK ); > > senario: > > program 1 linked with cisam7.1 exclusively locks a file on open > > program 2 linked with cisam4.1 exclusively locks the same file > ( should fail with EACCESS ) > > ** the order in which the programs are executed doesn't make a > difference..neither recognizes the others exclusive lock. > > >Record locks: isread( fd, (char *)&buf, ISFIRST+ISLOCK ); > > senario: > > program 1 linked with cisam7.1 locks a record ( file is open MANULOCK ) > > program 2 linked with cisam4.1 attempts to open the same file as > isopen( "file", ISINOUT+ISMANULOCK ); and fails with EACCESS > > ** locking a record should NOT exlusively lock the file > > ** if the order of execution is reversed ( ie. cisam4.1 locks first ) > program 2 ( cisam7.1 ) correctly fails with ELOCKED when attempting > to lock the same record > > >---------------------------------------------------------------------------- >-- >/* Sample code for File Locks */ > >#include "cisam.h" > >main() >{ >int fd; >char filename[80]; >char recbuf[5]; > > strcpy( filename, "locktest" ); > fd = isopen( filename, ISINOUT + ISEXCLLOCK ); > if ( fd < 0 ) > { > printf("isopen iserrno = %d\\n", iserrno); > exit(1); > } > > printf("File locktest exclusively locked!\\n"); > getchar(); > isclose( fd ); >} > >---------------------------------------------------------------------------- >-- >/* Sample code for Record Locks */ > >#include "cisam.h" > >main() >{ >int fd; >char filename[80]; >char recbuf[5]; > > strcpy( filename, "locktest" ); > fd = isopen( filename, ISINOUT + ISMANULOCK ); > if ( fd < 0 ) > { > printf("isopen iserrno = %d\\n", iserrno); > exit(1); > } > > if( isread( fd, (char *)&recbuf, ISFIRST+ISLOCK ) != 0 ) > { > printf(" isread iserrno = %d\\n", iserrno ); > isclose( fd ); > exit(1); > } > > printf("Record: %5s locked by process locktest\\n", recbuf ); > getchar(); > isrelease( fd ); > isclose( fd ); >} > > >Thanks in advance for any suggestions or light you may be able to shed. > >Heinz > >*********************************************************************** >* Heinz Wittenbecher, Byte Designs Ltd. Voice: (604) 534-0722 * >* heinz@bytedesigns.com Langley, BC CANADA Fax: (604) 534-2601 * >* http://www.bytedesigns.com * > > > > > -- David Williams