mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
- Save and restore srcdef when getting a sub-table (could stay in cache)
modified: storage/connect/tabutil.cpp - Change order of tests when looking for valid tdbp. In rare cases an invalid tdbp was still existing causing a crash of the server. modified: storage/connect/ha_connect.cc
This commit is contained in:
@ -1094,8 +1094,9 @@ PTDB ha_connect::GetTDB(PGLOBAL g)
|
|||||||
|
|
||||||
table_name= GetTableName();
|
table_name= GetTableName();
|
||||||
|
|
||||||
if (tdbp && !stricmp(tdbp->GetName(), table_name)
|
if (!xp->CheckQuery(valid_query_id && tdbp
|
||||||
&& tdbp->GetMode() == xmod && !xp->CheckQuery(valid_query_id)) {
|
&& !stricmp(tdbp->GetName(), table_name)
|
||||||
|
&& tdbp->GetMode() == xmod)) {
|
||||||
tp= tdbp;
|
tp= tdbp;
|
||||||
tp->SetMode(xmod);
|
tp->SetMode(xmod);
|
||||||
} else if ((tp= CntGetTDB(g, table_name, xmod, this)))
|
} else if ((tp= CntGetTDB(g, table_name, xmod, this)))
|
||||||
|
@ -313,6 +313,7 @@ TDBPRX::TDBPRX(PPRXDEF tdp) : TDBASE(tdp)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
|
PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
|
||||||
{
|
{
|
||||||
|
const char *sp;
|
||||||
char *db, *name;
|
char *db, *name;
|
||||||
bool mysql = true;
|
bool mysql = true;
|
||||||
PTDB tdbp = NULL;
|
PTDB tdbp = NULL;
|
||||||
@ -349,6 +350,9 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
|
|||||||
// Don't use caller's columns
|
// Don't use caller's columns
|
||||||
fp = hc->get_table()->field;
|
fp = hc->get_table()->field;
|
||||||
hc->get_table()->field = NULL;
|
hc->get_table()->field = NULL;
|
||||||
|
|
||||||
|
// Make caller use the source definition
|
||||||
|
sp = hc->get_table()->s->option_struct->srcdef;
|
||||||
hc->get_table()->s->option_struct->srcdef = tabp->GetSrc();
|
hc->get_table()->s->option_struct->srcdef = tabp->GetSrc();
|
||||||
} // endif srcdef
|
} // endif srcdef
|
||||||
|
|
||||||
@ -379,8 +383,11 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
|
|||||||
s->field = NULL;
|
s->field = NULL;
|
||||||
|
|
||||||
hc->tshp = NULL;
|
hc->tshp = NULL;
|
||||||
} else if (b)
|
} else if (b) {
|
||||||
|
// Restore s structure that can be in cache
|
||||||
hc->get_table()->field = fp;
|
hc->get_table()->field = fp;
|
||||||
|
hc->get_table()->s->option_struct->srcdef = sp;
|
||||||
|
} // endif s
|
||||||
|
|
||||||
if (trace && tdbp)
|
if (trace && tdbp)
|
||||||
htrc("Subtable %s in %s\n",
|
htrc("Subtable %s in %s\n",
|
||||||
|
Reference in New Issue
Block a user