Commit 66581f5d authored by unknown's avatar unknown
Browse files

bug, added error handling to information_schema files

parent d8acfecb
Loading
Loading
Loading
Loading
+46 −24
Original line number Diff line number Diff line
@@ -9608,8 +9608,12 @@ 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);
  ndberr= dict->getNdbError();
  if (ndberr.classification != ndberror_cl_none)
    return 0;

  for (unsigned i= 0; i < dflist.count; i++)
  {
@@ -9622,9 +9626,18 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
    while (id= g_ndb_cluster_connection->get_next_node(iter))
    {
      NdbDictionary::Datafile df= dict->getDatafile(id, elt.name);
      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()),
                               system_charset_info);
@@ -9632,8 +9645,6 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
      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()),
@@ -9685,6 +9696,9 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
  }

  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++)
  {
@@ -9697,18 +9711,25 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
    while (id= g_ndb_cluster_connection->get_next_node(iter))
    {
      NdbDictionary::Undofile uf= dict->getUndofile(id, elt.name);
      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(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()),
@@ -9758,4 +9779,5 @@ static int ndbcluster_fill_files_table(THD *thd, TABLE_LIST *tables, COND *cond)
      schema_table_store_record(thd, table);
    }
  }
  return 0;
}