Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random record loss in Multiuser environment

Status
Not open for further replies.

barno

Programmer
May 27, 2002
10
0
0
I'm experiencing record loss randomly in Fox 2.6 application running under Win 2000 network
This is the section of the Code where the record is being lost

SELECT 2
IF <condition>
*save debit record
APPEND BLANK
IF LOCK()
<replacement is done>
UNLOCK
ENDIF

*save credit record
APPEND BLANK
IF LOCK()
<replacement is done>
UNLOCK
ENDIF
ENDIF

The record is usualy lost in the second section of saving ie. its not even appending blank thus the record is not saved.
This is not always but mostly one record is lost in a day. and most of the times it saves.

My question is What causes this ? and is there an alternative code that ican use to eliminate this problem?
Could also this be a hardware problem?
 
First, it's unlikely this code is causing the problem. Is the Win2000 system the file server? Does it have SCSI or EIDE hard drives? Is it running Service Pack 2? How are the OP Lock settings configured on this machine?

Bottomline, there are a number of upgrades, configurations that make Win2000 more stable as a desktop database file server.

See the following Knowledgebase articles for details - - &quot;Possible Data Loss After You Enable the &quot;Write Cache Enabled&quot; Feature (Q281672)&quot;
- &quot;PC Ext: Explanation of Opportunistic Locking on Windows NT (Q129202)&quot;
- &quot;Level II Oplocks Are Not Granted After a File Is Locked (Q306981)&quot;

Consider upgrading to VFP so you can use Transactions to make sure multi-file updates all go or no-go.

Rick
 

Dear Brano ,

I faced almost simalar problem some time back in FPD 2.6 where I am printing the invoce immediately after writing to tables , the record fully disappear some times.

Since the data missing &quot;Some time &quot; only it can not be mistake from the forpro code .It look like a Hardware/Operating system problem .I moved the application to another system and never face it again.

Also you may try a Commit / Flush command after Unlock , but still why data disapper some time only.

Regards

Santhosh

 
Here is a bit of code from our POS System, (saving bit)
we run on Novell 4.11 Network sizes are 5-30 users
Invoices 1,000-20,000 a day per site (35 sites)

Is almost the same except we lock before appending
is rare to loose transactions, only looses are if
the site has a power cut or the server goes splat

-Zim

SELECT Day_Sale

DO WHILE NOT FLOCK()
WAIT WINDOW 'Waiting for Daily Sales line file...' TIMEOUT 0.1
ENDDO

m.vFirst_Rec = RECCOUNT() + 1 && save position in file

APPEND FROM (m.invname)
UNLOCK

FLUSH
 
Please analyse the following:

1. Is any other part of the application running on another client picking up the APPENDed blank record for editing or delete, before you are able to lock it?
2. Why is the program not looping back if the lock is not successful?
3. If you use INSERT INTO ... VALUES ... instead of APPEND BLANK and REPLACE, there will be no need of LOCKing the record.
4. If, however, you insist to use APPEND BLANK with REPLACE, use FLOCK (with looping) before APPEND BLANK.

Thanks

S P Mall
 
suggestion, in a multi user environment let user input into memvars instead of dbf... then insert into (it will cut the time the record is unlocked and accessible to muliple users)

like this
done = .f.
do while !done
scatter memvar
@ 1,1 say 'fist' get m.first
@ 1,2 say 'last' get m.last
read

<<<< error checking code goes here >>>>
ok = 'no'
@ 5,5 say 'done???' get ok
read
if ok = 'yes'
append blank
insert into <<alias>> from memvar
done = .t.
else
*try again
endif
enddo if it is to be it's up to me
 
From my experience, Win 2000 is not the prefect software for DOS applications. Just use Novell 5.x.
It works better.

And please try to check the dbf first if it's been lock
by other program or not, then you can just lock it.

 
Thanks much my friends for your assistance but i tried all what you suggested but the problem not yet solved.
Instead i made a new discovery.ie
This record goes in the database well most of the times now,but when you switch on the server in the following morning ,the record is not in the database
Could you please tell me what is happening.Remember i'm using Win2000 as the file server on a SCSI hard drive.I look forward to your assistance

Barno
 
Chances are, there are buffered records on the server that are not getting committed prior to it getting shut down. Why would you want to shut the server down? That should only be done occasionally for maintenence and after performing a rigorous backup routine.

Dave S.
 
Thanks my dear programmers . Your help enabled me solve the problem and many people have benefitted from me through you.
A million Thanks Once more!
 
So Barno, what was your solution?

Darrell

'We all must do the hard bits so when we get bit we know where to bite' :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top