Page 1 of 1
Database Glitch
Posted: Fri Aug 31, 2007 2:05 am
by Greg Gammon
This is an issue I have had sporadically and have no clue where to begin to look. I have an application that is just a simple update of a database with two relational databases...typically have about 15 users at a time.
Inexplicably, the main database will replicate itself many times over...this used to happen ocassionally...very rarely, just chalked it up to some computer glitch...but this same thing has happend to me three times in the past month. The main database will typically only have 250-300 live records, with maybe another 200 or so that have been deleted prior to a pack and reindex. Then BOOM...some operation has cause the database to expand to anywhere from 4000 to 16,000 records, the entire database having been copied into itself 100s of times, in the same record order (i.e. record 1 to 300 , then 1 to 300 again...1-300 again..and again and again and again).
Im using database objects. Can anyone give me a clue of where to begin to look for what would cause this? The program behaves normally 99.9% of the time. Its beginning to be a real nightmare, especially when reports are produced that should be 5-10 pages and come out 100-500 pages.
Thanks again!
Greg
addendum
Posted: Fri Aug 31, 2007 2:20 am
by Greg Gammon
Oh, should have stated outright the the most likely culprit, a DO loop of some kind, is not even part of the code...no Loops whatsoever...only database objects oDbf:load, oDdb:append(), oDbf:save...etc.
Thanks,
G
Posted: Fri Aug 31, 2007 3:03 pm
by James Bott
Greg,
I have been programming in xBase languages since they were developed and with database objects for at least ten years, and I have never seen such a thing. So, I am thinking that it must be something in your code causing the problem. What database class are you using and are you subclassing it?
James
Posted: Fri Aug 31, 2007 3:48 pm
by Rick Lipkin
Greg
Is the database on a Novell server ??
Rick Lipkin
Posted: Fri Aug 31, 2007 3:57 pm
by Greg Gammon
No...using CDX driver and running on Win2000 server. I have 30 other database files running with never a glitch. This one file though is so strange....this morning, it had 77,000 records...after deleting duplicates and packing...back down to 350....what could possibly cause this?
Posted: Fri Aug 31, 2007 4:01 pm
by Greg Gammon
James,
Sorry missed your post.... using the native FivWin Database class...no subclassing (not even aware how to do that).
The only thing that I can think might be causing this is multiple work areas and something getting mixed up...going to work on it from that angle...I have a main database and an archive database...when a job is completed, i copy to the archive and delete in the main (to keep things running fast)...switching work areas might be one of the issues....but how it (the background running processes/classes) think I want to replicate the database 1000 times over is a real mystery.
Greg
Posted: Fri Aug 31, 2007 5:06 pm
by James Bott
Greg,
>... using the native FivWin Database class...no subclassing (not even aware how to do that).
Well without subclassing you are missing out on the best part. There are a couple of articles about this on my website.
http://ourworld.compuserve.com/homepage ... rogram.htm
>>The only thing that I can think might be causing this is multiple work areas and something getting mixed up...going to work on it from that angle...
I don't think it is workareas as far as FWH or TDatabase. It still could be your code.
>I have a main database and an archive database...when a job is completed, i copy to the archive and delete in the main (to keep things running fast)...switching work areas might be one of the issues....but how it (the background running processes/classes) think I want to replicate the database 1000 times over is a real mystery.
If you want to email me the code where this is going on, I will take a look at it. I suspect something is falling through some code when opening a database in exclusive mode fails--thus it only happens occasionally.
One thing that might solve it is, surprise, subclassing.
James
Posted: Sat Sep 01, 2007 3:34 pm
by Carlos Mora
What compiler and version are you using? RDD?
Do you use to PACK frequently? Some time ago, using Harbour + DBFCDX a database started to duplicate records. After some time, headaches and aspirines the problem appeared with pack. The best solution was to change APCK command for a Rename/Create/Append From !Deleted().
Regards,
Carlos.
Posted: Tue Sep 04, 2007 1:14 pm
by Greg Gammon
Carlos,
using DBFCDX and Harbour. I recall now a few years ago having this trouble when executing a re-index and pack...that was with FW20 and NTX if I recall. And it was with the same database, so I suspect as James has surmised that there must be something in the code.
James...Im going to start sifting through this and reworking the code since it is a mismash of old code from even the dBase days....I appreciate your willingness to help and I'll shoot you something if I can't get this figured out.
Thanks,
Greg
Posted: Tue Sep 04, 2007 2:04 pm
by Antonio Linares
Greg,
What Harbour build are you using ?
You should use the most recent one
Posted: Tue Sep 04, 2007 2:12 pm
by Greg Gammon
Antonio,
19/May/2006 is the version I have. Is there any known problem with this build regarding database? I'll download most recent.
G
Posted: Tue Sep 04, 2007 2:16 pm
by Antonio Linares
Greg,
Its very important that you try with the most recent build. There have been lots of important changes on the RDDs.
Posted: Tue Sep 04, 2007 2:31 pm
by Greg Gammon
Antonio,
I will do that...hope that solves the problem as I have found nothing in the code that could possibly cause that.
A few months ago we were seeing this strangeness and found where the workarea was changing (different browses) and then not changing back to the proper browse after an action...got that fixed and thought it had settled it for good. I'll keep you posted.
G