Bug #105202 ha_innopart::store_lock() traverse all partitions starting from index 1 not 0
Description:
The function ha_innopart::store_lock() intend to traverse all partitions to call row_quiesce_set_state() for each partition's dict_table_t. But it starts from array index one instead of zero. How about the first partition with index 0 in array m_part_share? I think this is a typo error to leave out the first partition.
How to repeat:
Look into the function ha_innopart::store_lock() code in storage/innobase/handler/ha_innopart.cc .
THR_LOCK_DATA **ha_innopart::store_lock(THD *thd, THR_LOCK_DATA **to,
thr_lock_type lock_type) {
trx_t *trx = m_prebuilt->trx;
const uint sql_command = thd_sql_command(thd);
ha_innobase::store_lock(thd, to, lock_type);
if (sql_command == SQLCOM_FLUSH && lock_type == TL_READ_NO_INSERT) {
for (uint i = 1; i < m_tot_parts; i++) {
dict_table_t *table = m_part_share->get_table_part(i);
dberr_t err = row_quiesce_set_state(table, QUIESCE_START, trx);
ut_a(err == DB_SUCCESS || err == DB_UNSUPPORTED);
}
}
return to;
}
Suggested fix:
diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc
index e6c2fe0eebe..6eda8f685fe 100644
--- a/storage/innobase/handler/ha_innopart.cc
+++ b/storage/innobase/handler/ha_innopart.cc
@@ -3985,7 +3985,7 @@ THR_LOCK_DATA **ha_innopart::store_lock(THD *thd, THR_LOCK_DATA **to,
ha_innobase::store_lock(thd, to, lock_type);
if (sql_command == SQLCOM_FLUSH && lock_type == TL_READ_NO_INSERT) {
- for (uint i = 1; i < m_tot_parts; i++) {
+ for (uint i = 0; i < m_tot_parts; i++) {
dict_table_t *table = m_part_share->get_table_part(i);
dberr_t err = row_quiesce_set_state(table, QUIESCE_START, trx);
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.
Description: The function ha_innopart::store_lock() intend to traverse all partitions to call row_quiesce_set_state() for each partition's dict_table_t. But it starts from array index one instead of zero. How about the first partition with index 0 in array m_part_share? I think this is a typo error to leave out the first partition. How to repeat: Look into the function ha_innopart::store_lock() code in storage/innobase/handler/ha_innopart.cc . THR_LOCK_DATA **ha_innopart::store_lock(THD *thd, THR_LOCK_DATA **to, thr_lock_type lock_type) { trx_t *trx = m_prebuilt->trx; const uint sql_command = thd_sql_command(thd); ha_innobase::store_lock(thd, to, lock_type); if (sql_command == SQLCOM_FLUSH && lock_type == TL_READ_NO_INSERT) { for (uint i = 1; i < m_tot_parts; i++) { dict_table_t *table = m_part_share->get_table_part(i); dberr_t err = row_quiesce_set_state(table, QUIESCE_START, trx); ut_a(err == DB_SUCCESS || err == DB_UNSUPPORTED); } } return to; } Suggested fix: diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc index e6c2fe0eebe..6eda8f685fe 100644 --- a/storage/innobase/handler/ha_innopart.cc +++ b/storage/innobase/handler/ha_innopart.cc @@ -3985,7 +3985,7 @@ THR_LOCK_DATA **ha_innopart::store_lock(THD *thd, THR_LOCK_DATA **to, ha_innobase::store_lock(thd, to, lock_type); if (sql_command == SQLCOM_FLUSH && lock_type == TL_READ_NO_INSERT) { - for (uint i = 1; i < m_tot_parts; i++) { + for (uint i = 0; i < m_tot_parts; i++) { dict_table_t *table = m_part_share->get_table_part(i); dberr_t err = row_quiesce_set_state(table, QUIESCE_START, trx);