Database Glitch
- Greg Gammon
- Posts: 105
- Joined: Fri Jun 09, 2006 3:27 pm
- Location: Bryan, Texas
Database Glitch
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
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
- Greg Gammon
- Posts: 105
- Joined: Fri Jun 09, 2006 3:27 pm
- Location: Bryan, Texas
addendum
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
Thanks,
G
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
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
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
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
- Greg Gammon
- Posts: 105
- Joined: Fri Jun 09, 2006 3:27 pm
- Location: Bryan, Texas
- Greg Gammon
- Posts: 105
- Joined: Fri Jun 09, 2006 3:27 pm
- Location: Bryan, Texas
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
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
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
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
>... 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
-
- Posts: 988
- Joined: Thu Nov 24, 2005 3:01 pm
- Location: Madrid, España
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.
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.
- Greg Gammon
- Posts: 105
- Joined: Fri Jun 09, 2006 3:27 pm
- Location: Bryan, Texas
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
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
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Greg Gammon
- Posts: 105
- Joined: Fri Jun 09, 2006 3:27 pm
- Location: Bryan, Texas
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Greg Gammon
- Posts: 105
- Joined: Fri Jun 09, 2006 3:27 pm
- Location: Bryan, Texas
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
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