Strange get next-operation in Pervasive 8.6? -
09-04-2008
, 09:55 AM
Hi, i have a - may be deep - btrieve-question:
The situation is as follows: (Pervasive 8.6):
we have a plain btrieve-file (btrieve-version 7.x), say product.dat,
with internal indices
AUTOINC
and a second index(let me call'em KARTON) with two segments:
1. a fiels from type LONGINT (the field KARTON)
2. AUTOINC
Pervasive itself does only know the position of the keysegments - real
field-information are due to the application: there are no DDF-files!
The contents of the field KARTON is not unique, i.e. there are several
records containing the same number in this fields (the KARTON-Nr!).
Now I want to read all records with the same KARTON-Nr. K
so I use a while-loop:
start with
Get Greater Than or Equal operation (9= B_GET_GE)
and continue with
Get Next operation (6=B_GET_NEXT)
while the contents of the loaded record is identical with the
the given KOARTON-Nr (or B_GET_NEXT returns Status <>0).
In most cases this will lead to the desired result.
But now we have observed in a productive envrionment, that for unknown
reasons this while-loop reports more(!) records with the same
KARTON-NR then existent in the datafile, i.e. some of the records
appear twice.
It semms, that the B_GET_NEXT operation sometimes returns not the next
but the current record again.
Up to now we observe only one incident of this type.
Fact is, that during the while-loop runs, there where several update
(3) - and insert (2) operations on that file (from other sessions).
The updates definitely does not change the above index much less the
key involved (i.e. key-vales are not changed! this we where able to
verify by analyse a special log-file). The insert-operations of course
affect the index, but the really added records all come by KARTON-Nr=0
(the while - loop runs with KARTON-NR<>0).
We guess, that while insert new key to the index (insert-operation)
the key-pages (sometimes) are reorganised in such a way, that a
database-cursor (from an different session) points now in such a way,
that the following next (6)-operation will report the same record again?
The question is:
-is this possible at all? does the engine do such "reorganisation"?
-is this a known issus in PSQL 8.6 (and is it fixed in 9.x/10.x?)
-if the described (presumed!) reorganisation of key-pages will not
occur, what other reason may be respnsible for that? (all Get Next
operations of the while-loop returned Status 0!).
Any hints, comments, remarks etc. are very wellcome!
Regards
Mircea |