[Harbour] cdx internal error question

Przemyslaw Czerpak druzus at acn.waw.pl
Wed May 13 12:32:09 EDT 2009


On Wed, 13 May 2009, Szak�ts Viktor wrote:

Hi,

> How should I fix this on .prg level? It's a simple open + reindex done in
> read-only mode, which sometimes fails, but works in most cases.
> I can easily switch off RO mode if that's the problematic part, but I still
> wonder on the reasons and also why an internal error is generated
> instead of an RTE, if the condition can be caused by .prg code.

Below is a message I sent few hours ago but it has not been delivered
so far :-(
Maybe this time? If not I'm setting CC to your and Pritpal address too.

best regards,
Przemek



----- Forwarded message from Przemyslaw Czerpak <druzus at acn.waw.pl> -----

From: Przemyslaw Czerpak <druzus at acn.waw.pl>
Subject: Re: [Harbour] cdx internal error question
To: "Harbour Project Main Developer List." <harbour at harbour-project.org>
Date: Wed, 13 May 2009 15:31:24 +0200
Lines: 57

On Wed, 13 May 2009, Szak�ts Viktor wrote:

Hi,

> I'm getting this internal error with DBFCDX RDD (didn't test other RDDs):
> Unrecoverable error 9101: hb_cdxIndexLockWrite: readonly index.
> Called from ORDCREATE(0)
> This happens if I try to open a table for indexing in read-only mode,
> but only when another station has kept the same table + index open
> until the open command:
> dbUseArea(.T., NIL, "test.dbf", "w_TEST", .F., .T.)
> ordCreate( ... )

No. This is not the reason though due to some of your own synchronization
conditions you created in your code above situation can exploit the problem
in your case.

> Any ideas what could cause this?

It happens when you open table in read only mode then you open some
existing indexes to this table (they are automatically open in readonly
mode too just like the table) and then you try to add or change TAG in
such readonly opened index. That's all.
You description suggests that in your case it's structural index which
is automatically open due to _SET_AUTOPEN flag in readonly mode in
dbUseArea(). Here is self contain example which illustrates such situation:

   request DBFCDX
   proc main()
      field F
      ? version()
      rddSetDefault("DBFCDX")
      dbcreate( "_tst", {{"F","C",10,0}} )
      ferase( "_tst.cdx" )
      use _tst readonly
      ? "indexing..."
      index on F tag T
      close
      ? "indexing..."
      use _tst readonly
      index on F tag T
   return

Both Harbour and Clipper generate RTE error in such case so the behavior
is compatible though literal error message in both cases is a little
bit different, in Clipper52/53 it is:

   Unrecoverable error 24: Write error

in [x]Harbour:

   Unrecoverable error 9101: hb_cdxIndexLockWrite: readonly index.

IMHO the Harbour message is more precise.

best regards,
Przemek

----- End forwarded message -----


More information about the Harbour mailing list