Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGCHECK on second attempt of COMMIT of DDL statements [CORE2283] #2709

Open
firebird-automations opened this issue Jan 19, 2009 · 2 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @hvlad

SQL> set autoddl off;
SQL> create table test_cs__master
CON> (
CON> str_pk varchar(32) character set UNICODE_FSS not null,
CON>
CON> primary key (str_pk)
CON> );
CON>
SQL> create table test_cs__detail
CON> (
CON> str_pk varchar(32) character set WIN1251 not null,
CON>
CON> foreign key (str_pk) references test_cs__master (str_pk)
CON> );
SQL>
SQL> commit;
Statement failed, SQLSTATE = 42000
unsuccessful metadata update
-partner index segment no 1 has incompatible data type
SQL> commit;
Statement failed, SQLSTATE = 08006
connection lost to database
SQL>

Firebird.log contains record :
internal Firebird consistency check (partner index description not found (175), file: idx.cpp line: 191)

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

The reason of BUGCHECK is that on second commit new relation_id is assigned to both newly created tables and when foreign key's index created master relation can't be found in metadata cache.

Patch below solve this issue but i can't say about side effects so far.

cvs -z9 diff -u -wb jrd\dfw.epp
Index: jrd/dfw.epp

RCS file: /cvsroot/firebird/firebird2/src/jrd/dfw.epp,v
retrieving revision 1.258
diff -u -w -b -r1.258 dfw.epp
--- jrd/dfw.epp 23 Dec 2008 13:34:18 -0000 1.258
+++ jrd/dfw.epp 19 Jan 2009 09:22:08 -0000
@@ -2210,6 +2210,38 @@
return true;

case 3:

+ request = CMP_find_request(tdbb, irq_c_relation2, IRQ_REQUESTS);
+
+ if (work->dfw_id)
+ {
+ bool err = true;
+
+ FOR(REQUEST_HANDLE request)
+ X IN RDB$RELATIONS WITH
+ X.RDB$RELATION_NAME EQ work->dfw_name.c_str()
+
+ if (!REQUEST(irq_c_relation2))
+ REQUEST(irq_c_relation2) = request;
+
+ if (!X.RDB$RELATION_ID.NULL &&
+ X.RDB$RELATION_ID == work->dfw_id)
+ {
+ err = false;
+ }
+
+ END_FOR;
+
+ if (!REQUEST(irq_c_relation2))
+ REQUEST(irq_c_relation2) = request;
+
+ if (err)
+ ERR_post(Arg::Gds(isc_no_meta_update) <<
+ Arg::Gds(isc_table_name) << Arg::Str(work->dfw_name) <<
+ Arg::Gds(isc_imp_exc));
+
+ return true;
+ }
+
/* Take a relation lock on rel id -1 before actually
generating a relation id. */

@@ -2304,6 +2336,8 @@
{
relation = MET_relation(tdbb, rel_id);
DPM_create_relation(tdbb, relation);
+
+ work->dfw_id = rel_id;
}

	return true;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants