Icon View Incident Report

Serious Serious
Reported By: Terry Swiers
Reported On: 11/21/2003
For: Version 4.00 Build 1
# 1488 Opening a Table Concurrently While Writes Occurring Can Cause a 8961 Table Corrupt Error

I've been reloading one of my larger tables via an import function built into my application and have run into something that I'm not quite sure how to deal with.

The import function has the ability to add or update inventory items depending upon the settings the user selects. In this case, I'm using the add only option so that existing items are not touched. So the overall flow of this is as follows:

get next inventory item
Application.ProcessMessages
check to see if it exists using Locate(...)
if it exists, move to next source item
insert into destination table
set field information
post the new record
if insert count mod 250 = 0 then FlushBuffers
move to next source item and repeat

I call ProcessMessages after each read of the source table so that the application doesn't appear frozen, and I call FlushBuffers on the target table every 250 posts to ensure that the data is written down to the drive. If it makes any difference, I am using a TDBISAMTable for doing the inserts.

My application runs all of this just fine without any issues at all. But if I attempt to open the target table with DBSys while the import process is running, I get error 8961 "Header information is corrupt" about 50% of the time. The table is not corrupt as repeated attempts will eventually open the table.

I've tried increasing the frequency of the call to FlushBuffers down to every 50 records but the problem remains. Calling FlushBuffers after each record insertion prevents the error but really slows down the import. Removing the call to flush buffers causes DBSys to fail 100% of the time until the process is completed and the target table is closed.


Comments Comments
The version 4 read locks were not being respected properly, resulting in readers getting "dirty reads" on data. This problem does not affect writers, however, and does not cause corruption.


Resolution Resolution
Fixed Problem on 11/27/2003 in version 4.01 build 1
Image