Commit 66581f5d authored by unknown's avatar unknown

bug, added error handling to information_schema files

parent d8acfecb
......@@ -9608,10 +9608,14 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
Ndb *ndb= check_ndb_in_thd(thd);
NdbDictionary::Dictionary* dict= ndb->getDictionary();
NdbDictionary::Dictionary::List dflist;
NdbError ndberr;
dict->listObjects(dflist,NdbDictionary::Object::Datafile);
dict->listObjects(dflist, NdbDictionary::Object::Datafile);
ndberr= dict->getNdbError();
if (ndberr.classification != ndberror_cl_none)
return 0;
for(unsigned i= 0;i < dflist.count;i++)
for (unsigned i= 0; i < dflist.count; i++)
{
NdbDictionary::Dictionary::List::Element& elt = dflist.elements[i];
Ndb_cluster_connection_node_iter iter;
......@@ -9619,21 +9623,28 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
g_ndb_cluster_connection->init_get_next_node(iter);
while(id= g_ndb_cluster_connection->get_next_node(iter))
while (id= g_ndb_cluster_connection->get_next_node(iter))
{
NdbDictionary::Datafile df= dict->getDatafile(id, elt.name);
int c=0;
ndberr= dict->getNdbError();
if(ndberr.classification != ndberror_cl_none)
continue;
NdbDictionary::Tablespace ts= dict->getTablespace(df.getTablespace());
ndberr= dict->getNdbError();
if (ndberr.classification != ndberror_cl_none)
continue;
int c= 0;
table->field[c++]->set_null(); // FILE_ID
table->field[c++]->store(elt.name,strlen(elt.name),system_charset_info);
table->field[c++]->store(elt.name, strlen(elt.name),
system_charset_info);
table->field[c++]->store("DATAFILE",8,system_charset_info);
table->field[c++]->store(df.getTablespace(),strlen(df.getTablespace()),
table->field[c++]->store(df.getTablespace(), strlen(df.getTablespace()),
system_charset_info);
table->field[c++]->set_null(); // TABLE_CATALOG
table->field[c++]->set_null(); // TABLE_SCHEMA
table->field[c++]->set_null(); // TABLE_NAME
NdbDictionary::Tablespace ts= dict->getTablespace(df.getTablespace());
// LOGFILE_GROUP_NAME
table->field[c++]->store(ts.getDefaultLogfileGroup(),
strlen(ts.getDefaultLogfileGroup()),
......@@ -9662,7 +9673,7 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
table->field[c++]->store(df.getObjectVersion()); // VERSION
table->field[c++]->store("FIXED",5,system_charset_info); // ROW_FORMAT
table->field[c++]->store("FIXED", 5, system_charset_info); // ROW_FORMAT
table->field[c++]->set_null(); // TABLE_ROWS
table->field[c++]->set_null(); // AVG_ROW_LENGTH
......@@ -9675,40 +9686,50 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
table->field[c++]->set_null(); // CHECK_TIME
table->field[c++]->set_null(); // CHECKSUM
table->field[c++]->store("NORMAL",6, system_charset_info);
table->field[c++]->store("NORMAL", 6, system_charset_info);
char extra[30];
int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u",id);
table->field[c]->store(extra,len,system_charset_info);
int len= my_snprintf(extra, sizeof(extra), "CLUSTER_NODE=%u", id);
table->field[c]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table);
}
}
dict->listObjects(dflist,NdbDictionary::Object::Undofile);
dict->listObjects(dflist, NdbDictionary::Object::Undofile);
ndberr= dict->getNdbError();
if (ndberr.classification != ndberror_cl_none)
return 0;
for(unsigned i= 0;i < dflist.count;i++)
for (unsigned i= 0; i < dflist.count; i++)
{
NdbDictionary::Dictionary::List::Element& elt = dflist.elements[i];
NdbDictionary::Dictionary::List::Element& elt= dflist.elements[i];
Ndb_cluster_connection_node_iter iter;
unsigned id;
g_ndb_cluster_connection->init_get_next_node(iter);
while(id= g_ndb_cluster_connection->get_next_node(iter))
while (id= g_ndb_cluster_connection->get_next_node(iter))
{
NdbDictionary::Undofile uf= dict->getUndofile(id, elt.name);
int c=0;
ndberr= dict->getNdbError();
if (ndberr.classification != ndberror_cl_none)
continue;
NdbDictionary::LogfileGroup lfg=
dict->getLogfileGroup(uf.getLogfileGroup());
ndberr= dict->getNdbError();
if (ndberr.classification != ndberror_cl_none)
continue;
int c= 0;
table->field[c++]->set_null(); // FILE_ID
table->field[c++]->store(elt.name,strlen(elt.name),system_charset_info);
table->field[c++]->store("UNDO LOG",8,system_charset_info);
table->field[c++]->store(elt.name, strlen(elt.name),
system_charset_info);
table->field[c++]->store("UNDO LOG", 8, system_charset_info);
table->field[c++]->set_null(); // TABLESPACE NAME
table->field[c++]->set_null(); // TABLE_CATALOG
table->field[c++]->set_null(); // TABLE_SCHEMA
table->field[c++]->set_null(); // TABLE_NAME
NdbDictionary::LogfileGroup lfg=
dict->getLogfileGroup(uf.getLogfileGroup());
// LOGFILE_GROUP_NAME
table->field[c++]->store(uf.getLogfileGroup(),
strlen(uf.getLogfileGroup()),
......@@ -9750,12 +9771,13 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
table->field[c++]->set_null(); // CHECK_TIME
table->field[c++]->set_null(); // CHECKSUM
table->field[c++]->store("NORMAL",6, system_charset_info);
table->field[c++]->store("NORMAL", 6, system_charset_info);
char extra[30];
int len= my_snprintf(extra,sizeof(extra),"CLUSTER_NODE=%u",id);
table->field[c]->store(extra,len,system_charset_info);
table->field[c]->store(extra, len, system_charset_info);
schema_table_store_record(thd, table);
}
}
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment