Database Glitch

Post Reply
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Database Glitch

Post 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
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

addendum

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Post by Rick Lipkin »

Greg

Is the database on a Novell server ??

Rick Lipkin
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Post 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?
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
Carlos Mora
Posts: 988
Joined: Thu Nov 24, 2005 3:01 pm
Location: Madrid, España

Post 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.
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Greg,

What Harbour build are you using ?

You should use the most recent one
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Greg Gammon
Posts: 105
Joined: Fri Jun 09, 2006 3:27 pm
Location: Bryan, Texas

Post 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
Post Reply