• unknown's avatar
    BUG#10365 Cluster handler uses non-standard error codes · 205ac33c
    unknown authored
     - Added better error messages when trying to open a table that can't be discovered or unpacked. The most likely cause of this is that it does not have any frm data, probably since it has been created from NdbApi or is a NDB system table.
     - Separated functionality that was in ha_create_table_from_engine into two functions. One that checks if the table exists and another one that tries to create the table from the engine.
    
    
    mysql-test/r/ndb_autodiscover.result:
      Add tests for reading from a table that can't be discovered(SYSTAB_0)
      Discovery is not performed during create table anymore.
    mysql-test/t/ndb_autodiscover.test:
      Add tests for reading from a table that can't be discovered(SYSTAB_0)
      Discovery is not performed during create table anymore.
    ndb/test/ndbapi/create_tab.cpp:
      Set connectstring before creating Ndb object.
    sql/ha_ndbcluster.cc:
      Rename and use the function ndbcluster_table_exists_in_engine.
      Correct return valu from ndbcluster_discover
      Remove old code "ndb_discover_tables"
    sql/ha_ndbcluster.h:
      Rename function ndbcluster_table_exists to ndb ndbcluster_table_exists_in_engine
    sql/handler.cc:
      Update comment of ha_create_table_from_engine
      Remove parameter create_if_found from ha_create_table_from_engine, the function ha_table_exists_in_engine is now used toi check if table is found in engine.
      Cleanup return codes from ha_create_table_from_engine.
      Change name of ha_table_exists to ha_table_exists_in_engine, update comment and returne codes.
    sql/handler.h:
      Remove paramter create_if_cound from  ha_create_table_from_engine
      Rename ha_table_exists to ha_table_exists_in_engine
    sql/sql_base.cc:
      Use the function ha_table_exists_in_engine to detect if table exists in enegine. 
      If it exists, call function ha_create_table_from_engine to try and create it.
      If create of table fails, set correct error message.
    sql/sql_table.cc:
      Add comments, remove parameter create_if_found to ha_create_table_from_engine.
      When dropping a table, try to discover it from engine. If discover fails, use same error message as if the table didn't exists. 
      Maybe another message should be displayed here, ex: "Table could not be dropped, unpack failed"
      
      When creating a new table, use ha_table_exists_in_engine to check if a table with the given name already exists.
    205ac33c
ndb_autodiscover.test 11.7 KB