Commit f45e431e authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: unused function argument

parent 11dc5c45
......@@ -57,7 +57,6 @@ static int read_string(File file, uchar**to, size_t length)
*/
Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
LEX_CSTRING *partition_engine_name,
LEX_CUSTRING *table_version)
{
File file;
......@@ -86,11 +85,6 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
engine_name->length= 0;
((char*) (engine_name->str))[0]= 0;
}
if (partition_engine_name)
{
partition_engine_name->length= 0;
partition_engine_name->str= 0;
}
if (table_version)
{
table_version->length= 0;
......@@ -133,25 +127,10 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
{
if (engine_name)
*engine_name= hton2plugin[ht->slot]->name;
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_engine_name && dbt == DB_TYPE_PARTITION_DB)
{
handlerton *p_ht;
legacy_db_type new_dbt= (legacy_db_type) header[61];
if (new_dbt >= DB_TYPE_FIRST_DYNAMIC)
goto cont;
if (!(p_ht= ha_resolve_by_legacy_type(thd, new_dbt)))
goto err;
*partition_engine_name= *hton_name(p_ht);
}
#endif // WITH_PARTITION_STORAGE_ENGINE
goto err;
}
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
cont:
#endif
/* read the true engine name */
if (engine_name)
{
......@@ -197,43 +176,6 @@ Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
}
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_engine_name && dbt == DB_TYPE_PARTITION_DB)
{
uint len;
const uchar *extra2;
/* Length of the MariaDB extra2 segment in the form file. */
len = uint2korr(frm_image+4);
extra2= frm_image + 64;
if (*extra2 != '/') // old frm had '/' there
{
const uchar *e2end= extra2 + len;
while (extra2 + 3 <= e2end)
{
uchar type= *extra2++;
size_t length= *extra2++;
if (!length)
{
if (extra2 + 2 >= e2end)
break;
length= uint2korr(extra2);
extra2+= 2;
if (length < 256)
break;
}
if (extra2 + length > e2end)
break;
if (type == EXTRA2_DEFAULT_PART_ENGINE)
{
partition_engine_name->str= thd->strmake((char*)extra2, length);
partition_engine_name->length= length;
break;
}
extra2+= length;
}
}
}
#endif // WITH_PARTITION_STORAGE_ENGINE
my_free(frm_image);
}
......
......@@ -39,12 +39,11 @@ enum Table_type
*/
enum Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
LEX_CSTRING *partition_engine_name,
LEX_CUSTRING *table_version);
static inline bool dd_frm_is_view(THD *thd, char *path)
{
return dd_frm_type(thd, path, NULL, NULL, NULL) == TABLE_TYPE_VIEW;
return dd_frm_type(thd, path, NULL, NULL) == TABLE_TYPE_VIEW;
}
bool dd_recreate_table(THD *thd, const char *db, const char *table_name);
......
......@@ -6630,7 +6630,6 @@ static my_bool discover_existence(THD *thd, plugin_ref plugin,
bool ha_table_exists(THD *thd, const LEX_CSTRING *db,
const LEX_CSTRING *table_name, LEX_CUSTRING *table_id,
LEX_CSTRING *partition_engine_name,
handlerton **hton, bool *is_sequence)
{
handlerton *dummy;
......@@ -6656,21 +6655,6 @@ bool ha_table_exists(THD *thd, const LEX_CSTRING *db,
if (!hton)
hton= &dummy;
*hton= element->share->db_type();
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (partition_engine_name && element->share->db_type() == partition_hton)
{
if (!static_cast<Partition_share *>(element->share->ha_share)->
partition_engine_name)
{
/* Partition engine found, but table has never been opened */
tdc_unlock_share(element);
goto retry_from_frm;
}
lex_string_set(partition_engine_name,
static_cast<Partition_share *>(element->share->ha_share)->
partition_engine_name);
}
#endif
*is_sequence= element->share->table_type == TABLE_TYPE_SEQUENCE;
if (*hton != view_pseudo_hton && element->share->tabledef_version.length &&
table_id &&
......@@ -6681,9 +6665,6 @@ bool ha_table_exists(THD *thd, const LEX_CSTRING *db,
DBUG_RETURN(TRUE);
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
retry_from_frm:
#endif
char path[FN_REFLEN + 1];
size_t path_len = build_table_filename(path, sizeof(path) - 1,
db->str, table_name->str, "", 0);
......@@ -6696,9 +6677,7 @@ bool ha_table_exists(THD *thd, const LEX_CSTRING *db,
{
char engine_buf[NAME_CHAR_LEN + 1];
LEX_CSTRING engine= { engine_buf, 0 };
Table_type type= dd_frm_type(thd, path, &engine,
partition_engine_name,
table_id);
Table_type type= dd_frm_type(thd, path, &engine, table_id);
switch (type) {
case TABLE_TYPE_UNKNOWN:
......
......@@ -5672,7 +5672,6 @@ int ha_discover_table_names(THD *thd, const LEX_CSTRING *db, MY_DIR *dirp,
bool ha_table_exists(THD *thd, const LEX_CSTRING *db,
const LEX_CSTRING *table_name,
LEX_CUSTRING *table_version= 0,
LEX_CSTRING *partition_engine_name= 0,
handlerton **hton= 0, bool *is_sequence= 0);
bool ha_check_if_updates_are_ignored(THD *thd, handlerton *hton,
const char *op);
......
......@@ -4292,7 +4292,7 @@ static bool upgrade_lock_if_not_exists(THD *thd,
DEBUG_SYNC(thd,"create_table_before_check_if_exists");
if (!create_info.or_replace() &&
ha_table_exists(thd, &create_table->db, &create_table->table_name,
NULL, NULL, &create_table->db_type))
NULL, &create_table->db_type))
{
if (create_info.if_not_exists())
{
......
......@@ -1716,8 +1716,7 @@ int plugin_init(int *argc, char **argv, int flags)
{
char path[FN_REFLEN + 1];
build_table_filename(path, sizeof(path) - 1, "mysql", "plugin", reg_ext, 0);
Table_type ttype= dd_frm_type(0, path, &plugin_table_engine_name,
NULL, NULL);
Table_type ttype= dd_frm_type(0, path, &plugin_table_engine_name, NULL);
if (ttype != TABLE_TYPE_NORMAL)
plugin_table_engine_name=empty_clex_str;
}
......
......@@ -283,8 +283,7 @@ check_rename(THD *thd, rename_param *param,
DBUG_ASSERT(param->new_alias.str);
if (!ha_table_exists(thd, &ren_table->db, &param->old_alias,
&param->old_version, NULL,
&param->from_table_hton) ||
&param->old_version, &param->from_table_hton) ||
!param->from_table_hton)
{
my_error(ER_NO_SUCH_TABLE, MYF(if_exists ? ME_NOTE : 0),
......@@ -304,7 +303,7 @@ check_rename(THD *thd, rename_param *param,
DBUG_RETURN(-1);
}
if (ha_table_exists(thd, &new_db, &param->new_alias, NULL, NULL, 0))
if (ha_table_exists(thd, &new_db, &param->new_alias))
{
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), param->new_alias.str);
DBUG_RETURN(1); // This can't be skipped
......
......@@ -4680,7 +4680,7 @@ static void get_table_engine_for_i_s(THD *thd, char *buf, TABLE_LIST *tl,
char path[FN_REFLEN];
build_table_filename(path, sizeof(path) - 1,
db->str, table->str, reg_ext, 0);
if (dd_frm_type(thd, path, &engine_name, NULL, NULL) == TABLE_TYPE_NORMAL)
if (dd_frm_type(thd, path, &engine_name, NULL) == TABLE_TYPE_NORMAL)
tl->option= engine_name.str;
}
}
......@@ -4919,8 +4919,7 @@ static int fill_schema_table_names(THD *thd, TABLE_LIST *tables,
handlerton *hton;
bool is_sequence;
if (ha_table_exists(thd, db_name, table_name, NULL, NULL,
&hton, &is_sequence))
if (ha_table_exists(thd, db_name, table_name, NULL, &hton, &is_sequence))
{
if (hton == view_pseudo_hton)
table->field[3]->store(STRING_WITH_LEN("VIEW"), cs);
......
......@@ -1565,7 +1565,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables,
*/
char engine_buf[NAME_CHAR_LEN + 1];
LEX_CSTRING engine= { engine_buf, 0 };
table_type= dd_frm_type(thd, path, &engine, NULL, &version);
table_type= dd_frm_type(thd, path, &engine, &version);
if (table_type == TABLE_TYPE_NORMAL || table_type == TABLE_TYPE_SEQUENCE)
{
plugin_ref p= plugin_lock_by_name(thd, &engine,
......@@ -4450,7 +4450,7 @@ int create_table_impl(THD *thd,
handlerton *db_type;
if (!internal_tmp_table &&
ha_table_exists(thd, &db, &table_name,
&create_info->org_tabledef_version, NULL, &db_type))
&create_info->org_tabledef_version, &db_type))
{
if (ha_check_if_updates_are_ignored(thd, db_type, "CREATE"))
{
......
......@@ -574,7 +574,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
DBUG_ASSERT(tables->next_global == 0);
build_table_filename(path, sizeof(path) - 1, tables->db.str, tables->alias.str, ".frm", 0);
tables->required_type= dd_frm_type(NULL, path, NULL, NULL, NULL);
tables->required_type= dd_frm_type(NULL, path, NULL, NULL);
/* We do not allow creation of triggers on temporary tables or sequence. */
if (tables->required_type == TABLE_TYPE_SEQUENCE ||
......
......@@ -3798,7 +3798,7 @@ bool Rdb_validate_tbls::check_frm_file(const std::string &fullpath,
char eng_type_buf[NAME_CHAR_LEN+1];
LEX_CSTRING eng_type_str = {eng_type_buf, 0};
enum Table_type type = dd_frm_type(nullptr, fullfilename.c_ptr(),
&eng_type_str, nullptr, nullptr);
&eng_type_str, nullptr);
if (type == TABLE_TYPE_UNKNOWN) {
// NO_LINT_DEBUG
sql_print_warning("RocksDB: Failed to open/read .from file: %s",
......
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