MDEV-28004 ha_innobase::reset_auto_increment() is never executed
The virtual member function handler::reset_auto_increment(ulonglong) is only ever invoked by the default implementation of the virtual member function handler::truncate(). Because ha_innobase::truncate() overrides handler::truncate() without ever invoking handler::truncate(), some InnoDB member functions are never called. ha_innobase::innobase_reset_autoinc(), ha_innobase::reset_auto_increment(): Removed (unreachable code). ha_innobase::delete_all_rows(): Removed. The default implementation handler::delete_all_rows() works just as fine.
This commit is contained in:
parent
1248fe7277
commit
3c06a0b7dc
@ -2702,64 +2702,6 @@ overflow:
|
|||||||
return(~(ulonglong) 0);
|
return(~(ulonglong) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************************************************************//**
|
|
||||||
Reset the autoinc value in the table.
|
|
||||||
@return DB_SUCCESS if all went well else error code */
|
|
||||||
UNIV_INTERN
|
|
||||||
dberr_t
|
|
||||||
ha_innobase::innobase_reset_autoinc(
|
|
||||||
/*================================*/
|
|
||||||
ulonglong autoinc) /*!< in: value to store */
|
|
||||||
{
|
|
||||||
dberr_t error;
|
|
||||||
|
|
||||||
error = innobase_lock_autoinc();
|
|
||||||
|
|
||||||
if (error == DB_SUCCESS) {
|
|
||||||
|
|
||||||
dict_table_autoinc_initialize(m_prebuilt->table, autoinc);
|
|
||||||
|
|
||||||
dict_table_autoinc_unlock(m_prebuilt->table);
|
|
||||||
}
|
|
||||||
|
|
||||||
return(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*******************************************************************//**
|
|
||||||
Reset the auto-increment counter to the given value, i.e. the next row
|
|
||||||
inserted will get the given value. This is called e.g. after TRUNCATE
|
|
||||||
is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is
|
|
||||||
returned by storage engines that don't support this operation.
|
|
||||||
@return 0 or error code */
|
|
||||||
UNIV_INTERN
|
|
||||||
int
|
|
||||||
ha_innobase::reset_auto_increment(
|
|
||||||
/*==============================*/
|
|
||||||
ulonglong value) /*!< in: new value for table autoinc */
|
|
||||||
{
|
|
||||||
DBUG_ENTER("ha_innobase::reset_auto_increment");
|
|
||||||
|
|
||||||
dberr_t error;
|
|
||||||
|
|
||||||
update_thd(ha_thd());
|
|
||||||
|
|
||||||
error = row_lock_table_autoinc_for_mysql(m_prebuilt);
|
|
||||||
|
|
||||||
if (error != DB_SUCCESS) {
|
|
||||||
DBUG_RETURN(convert_error_code_to_mysql(
|
|
||||||
error, m_prebuilt->table->flags, m_user_thd));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The next value can never be 0. */
|
|
||||||
if (value == 0) {
|
|
||||||
value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
innobase_reset_autoinc(value);
|
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*********************************************************************//**
|
/*********************************************************************//**
|
||||||
Initializes some fields in an InnoDB transaction object. */
|
Initializes some fields in an InnoDB transaction object. */
|
||||||
static
|
static
|
||||||
@ -9119,16 +9061,6 @@ ha_innobase::delete_row(
|
|||||||
error, m_prebuilt->table->flags, m_user_thd));
|
error, m_prebuilt->table->flags, m_user_thd));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Delete all rows from the table.
|
|
||||||
@return error number or 0 */
|
|
||||||
|
|
||||||
int
|
|
||||||
ha_innobase::delete_all_rows()
|
|
||||||
{
|
|
||||||
DBUG_ENTER("ha_innobase::delete_all_rows");
|
|
||||||
DBUG_RETURN(HA_ERR_WRONG_COMMAND);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************//**
|
/**********************************************************************//**
|
||||||
Removes a new lock set on a row, if it was not read optimistically. This can
|
Removes a new lock set on a row, if it was not read optimistically. This can
|
||||||
be called after a row has been read in the processing of an UPDATE or a DELETE
|
be called after a row has been read in the processing of an UPDATE or a DELETE
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
|
||||||
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||||
Copyright (c) 2013, 2021, MariaDB Corporation.
|
Copyright (c) 2013, 2022, MariaDB Corporation.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
@ -113,8 +113,6 @@ public:
|
|||||||
|
|
||||||
double read_time(uint index, uint ranges, ha_rows rows);
|
double read_time(uint index, uint ranges, ha_rows rows);
|
||||||
|
|
||||||
int delete_all_rows();
|
|
||||||
|
|
||||||
int write_row(uchar * buf);
|
int write_row(uchar * buf);
|
||||||
|
|
||||||
int update_row(const uchar * old_data, const uchar * new_data);
|
int update_row(const uchar * old_data, const uchar * new_data);
|
||||||
@ -253,7 +251,6 @@ public:
|
|||||||
ulonglong nb_desired_values,
|
ulonglong nb_desired_values,
|
||||||
ulonglong* first_value,
|
ulonglong* first_value,
|
||||||
ulonglong* nb_reserved_values);
|
ulonglong* nb_reserved_values);
|
||||||
int reset_auto_increment(ulonglong value);
|
|
||||||
|
|
||||||
virtual bool get_error_message(int error, String *buf);
|
virtual bool get_error_message(int error, String *buf);
|
||||||
|
|
||||||
@ -441,7 +438,6 @@ protected:
|
|||||||
dberr_t innobase_lock_autoinc();
|
dberr_t innobase_lock_autoinc();
|
||||||
ulonglong innobase_peek_autoinc();
|
ulonglong innobase_peek_autoinc();
|
||||||
dberr_t innobase_set_max_autoinc(ulonglong auto_inc);
|
dberr_t innobase_set_max_autoinc(ulonglong auto_inc);
|
||||||
dberr_t innobase_reset_autoinc(ulonglong auto_inc);
|
|
||||||
|
|
||||||
/** Resets a query execution 'template'.
|
/** Resets a query execution 'template'.
|
||||||
@see build_template() */
|
@see build_template() */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user