Article View: comp.lang.pascal.delphi.databases
Article #4Let's get technical... what does Table Repair (DTutil32, et al) actually =do= anyway?
From: Sundial Services
Date: Mon, 28 Feb 2000 00:00
Date: Mon, 28 Feb 2000 00:00
73 lines
4735 bytes
4735 bytes
There's a utility that we all know, and I guess we all 'love' because it
comes built into Paradox and is readily obtainable for Delphi as
"DTutil32." It is the old familiar TUTILITY, nee TUTIL32. "It will,
indeed, make 'index out of date' go away." But what does it actually
-do?- And why do we actually -need- it?
We came up with a lot of those answers in writing the competition,
ChimneySweep. Having given due acknowledgement thereby to the fact that
"I am biased," and that my signature line does contain a useful URL,
let's dive in...
Like all fileserver-based database systems, Paradox works by updating
one or more files each time you do anything to a table. It includes
mechanisms to synchronize those updates so that (a) if everything is
working correctly, more than one user can safely update the same table
at the same time; and (b) if everything does not work correctly, Paradox
will probably be able to know that it didn't.
The reality of Windows NT4 seems to be that "fileserver databases are a
whole lot less reliable than they used to be," at least for the time
being. There's a bug - again - in the disk-cacheing logic called
"opportunistic locking" (and VREDIR.VXD) that Microsoft sorta slipped
into the system "because they thought would be really nifty." It can
cause a greater occurrence of data-corruption problems than we are used
to seeing. The good news is that Paradox can detect the problem easily;
the bad news is that it happens.
Paradox detects table-corruption in most cases by using a
counter-mechanism. Each file has a header, and each header includes a
counter that must be in agreement among every one of the files. If the
counters do not agree, "index out of date."
An index-out-of-date problem can be benign, or it can be serious. After
all, "indexes can always be replaced." But if the glitch turns out to
affect the DB-file itself, there seem to be about four different
bad-things which can happen:
(a) The file is supposed to get larger, but it didn't. "I/O errors"
occur without warning due to "read past end-of-file" problems.
(b) Autoincrement field-counters, which are stored in the header,
suddenly get off-by-one and you can't insert anything new into the
table. Deleting the last record usually removes the logjam, "but what
kind of a solution is that?"
(c) Classic computer-science-101 race conditions, where updates to
records "vanish."
(d) Structural errors, lost records, endless loops etc. caused when the
pointer-chains that link various records in the file together get wozzed
up. (ahem...)
Table Repair provides one cure for all evils: it creates a new table
that is the mirror of the old one, then scanning through the original
table-file copying all of the records that it can from the old file to
the new. Since an index-update occurs each time (and you can't avoid
it), the rebuilding-process is typically quite slow. And if an
index-problem is the only thing that got you there in the first place...
well, enjoy your coffee. The whole pot.
Sigh... It's a process kinda like your Grandpa's Studebaker ... (which
you could probably sell on e*bay now for boatloads of money, hmm) ... it
will haul an unlimited number of farm supplies from here to there as
promised, but there is absolutely nothing elegant about it.
------------------------------------------------------------------
� Sundial Services :: Scottsdale, AZ (USA) :: (480) 946-8259
mailto:info@sundialservices.com (PGP public key available.)
> Fast(!), automatic table-repair with two clicks of the mouse!
> ChimneySweep: "Click click, it's fixed!" {tm}
> http://www.sundialservices.com/products/chimneysweep
Technical Details
Message-ID:
<38BB49B2.641D@sundialservices.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: ffff5,ed0080ed9fa690ee,start X-Google-Attributes: gidffff5,public X-Google-Thread: ff75c,ed0080ed9fa690ee,start X-Google-Attributes: gidff75c,public X-Google-Thread: 10034a,ed0080ed9fa690ee,start X-Google-Attributes: gid10034a,public X-Google-Thread: fc0db,ed0080ed9fa690ee,start X-Google-Attributes: gidfc0db,public From: Sundial Services <info@sundialservices.com> Subject: Let's get technical... what does Table Repair (DTutil32, et al) actually =do= anyway? Date: 2000/02/28 Message-ID: <38BB49B2.641D@sundialservices.com> X-Deja-AN: 591164222 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=iso-8859-1 X-Complaints-To: abuse@prserv.net X-Trace: 29 Feb 2000 04:26:05 GMT, 32.101.171.79 Organization: Sundial Services MIME-Version: 1.0 Reply-To: info@sundialservices.com Newsgroups: comp.lang.pascal.delphi.databases,comp.databases.paradox,borland.public.bde,borland.public.delphi.database.desktop