Subject Re: Database corruption if server is not properly shutdown
Author Adam
--- In firebird-support@yahoogroups.com, Federico Tello Gentile
<fgentile@s...> wrote:
> Mensaje citado por Adam <s3057043@y...>:
>
> > I doubt it. Unless you have turned off forced writes in which
case it
> > is your own fault. Real corruption on that sort of frequency is
more
> > likely to be a hardware related.
>
> I don't know how to disable that, so I guess I didn't do it. In
case this is a
> system thing I use ubuntu Linux (kernel 2.6.10-5-386), Firebird
1.5.1
> (superserver), JayBird 1.5.5 (latest). I created the database with
all
> defaults, using UNICODE_FSS charset. I use the java client and
Flamerobin
> 0.2.5.
> As I'm still in developement phase, the tables don't have more than
2 or 3 rows
> and I'm the only user.
>
> >
> > Bogus errors could mean you have an incorrect message file, but
if you
> > want assistance with diagnosing these errors you will need to be
> > specific with versions etc.
> >
> > How did you "drop and re create" the database? What sort of
> > "referential integrity" was broken, ie a declared constraint such
as a
> > foreign key, or was it some action that a trigger you wrote is
meant
> > to prevent?
>


> Well, when I clicked on the tree view in Squirrel (it uses the java
driver) the
> operation failed and no tables were shown after accepting the error
message.
> The DBMS alowed me to delete a record leaving a child record
(created as
> references ... on delete no action on update no action) with a null
value in
> the foreing key column. I recreated that foreign key with on delete
set null
> and I expected to fail because of the not null constraint, but the
same
> happened after I did the delete again.
> I algo had an error when updating, telling "internal gds software
consistency
> check (partner index description not found (175)", but I didn't see
how this
> could be my wrong SQL code.

Hopefully someone can confirm this or prove it is ok, but this may
well be your issue.

Your foreign key is defined as on delete set null, BUT you have a not
NULL constraint on the table. First thing you need to understand is
that constraints are internally implemented as triggers. Infact check
the RDB$CHECK_CONSTRAINTS, that will return the trigger name, then
check RDB$TRIGGERS

Depending on which order these constraints are processed, the NULL
value may be able to be stored in a NOT NULL field. This IMO would be
a bug.

You could do some experimenting and get rid of the not null
constraint, and see if this corruption goes away. If this is the bug,
then Firebird ideally should not allow you to create both
constraints, but it should be not too hard to come up with a work
around.

Adam


> I pasted the log at the end.
>
> I fixed the problem by shuting down, deleting the fdb file,
creating a new DB
> with the same name and running again the DDL statements to create
my schema.
> The exact same updates that were failing, worked again. The
referential
> integrity worked as I exected it, and all seemed great again.
> Now I have FB as a service and it is properly shutdown every time I
reboot and I
> dont see any problems, so I guess it had to be that.
>
>
> Here's the log
>
> localhost (Server) Fri Sep 2 00:33:26 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Fri Sep 2 00:35:04 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Fri Sep 2 00:35:29 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Fri Sep 2 00:35:32 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Fri Sep 2 00:41:16 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Fri Sep 2 00:43:17 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
>
> And before that day I had the same errors.
>
>
> localhost (Server) Sun Aug 28 14:37:09 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Sun Aug 28 14:39:37 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Sun Aug 28 14:40:24 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Sun Aug 28 14:44:09 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
> localhost (Server) Sun Aug 28 14:44:55 2005
> Database: /var/db/cobranzas.fdb
> internal gds software consistency check (partner index
description not
> found (175))
>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.