1
1
/* ****************************************************************************
2
2
3
3
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
4
- Copyright (c) 2013, 2016 , MariaDB Corporation. All Rights Reserved.
4
+ Copyright (c) 2013, 2017 , MariaDB Corporation. All Rights Reserved.
5
5
6
6
This program is free software; you can redistribute it and/or modify it under
7
7
the terms of the GNU General Public License as published by the Free Software
@@ -6569,9 +6569,10 @@ innobase_online_rebuild_log_free(
6569
6569
/* * For each user column, which is part of an index which is not going to be
6570
6570
dropped, it checks if the column number of the column is same as col_no
6571
6571
argument passed.
6572
- @param[in] table table object
6573
- @param[in] col_no column number of the column which is to be checked
6574
- @param[in] is_v if this is a virtual column
6572
+ @param[in] table table
6573
+ @param[in] col_no column number
6574
+ @param[in] is_v if this is a virtual column
6575
+ @param[in] only_committed whether to consider only committed indexes
6575
6576
@retval true column exists
6576
6577
@retval false column does not exist, true if column is system column or
6577
6578
it is in the index. */
@@ -6580,17 +6581,21 @@ bool
6580
6581
check_col_exists_in_indexes (
6581
6582
const dict_table_t * table,
6582
6583
ulint col_no,
6583
- bool is_v)
6584
+ bool is_v,
6585
+ bool only_committed = false )
6584
6586
{
6585
6587
/* This function does not check system columns */
6586
6588
if (!is_v && dict_table_get_nth_col (table, col_no)->mtype == DATA_SYS) {
6587
6589
return (true );
6588
6590
}
6589
6591
6590
- for (dict_index_t * index = dict_table_get_first_index (table); index;
6592
+ for (const dict_index_t * index = dict_table_get_first_index (table);
6593
+ index;
6591
6594
index = dict_table_get_next_index (index)) {
6592
6595
6593
- if (index->to_be_dropped ) {
6596
+ if (only_committed
6597
+ ? !index->is_committed ()
6598
+ : index->to_be_dropped ) {
6594
6599
continue ;
6595
6600
}
6596
6601
@@ -6769,14 +6774,24 @@ rollback_inplace_alter_table(
6769
6774
we do this by checking every existing column, if any current
6770
6775
index would index them */
6771
6776
for (ulint i = 0 ; i < dict_table_get_n_cols (prebuilt->table ); i++) {
6772
- if (!check_col_exists_in_indexes (prebuilt->table , i, false )) {
6773
- prebuilt->table ->cols [i].ord_part = 0 ;
6777
+ dict_col_t & col = prebuilt->table ->cols [i];
6778
+ if (!col.ord_part ) {
6779
+ continue ;
6780
+ }
6781
+ if (!check_col_exists_in_indexes (prebuilt->table , i, false ,
6782
+ true )) {
6783
+ col.ord_part = 0 ;
6774
6784
}
6775
6785
}
6776
6786
6777
6787
for (ulint i = 0 ; i < dict_table_get_n_v_cols (prebuilt->table ); i++) {
6778
- if (!check_col_exists_in_indexes (prebuilt->table , i, true )) {
6779
- prebuilt->table ->v_cols [i].m_col .ord_part = 0 ;
6788
+ dict_col_t & col = prebuilt->table ->v_cols [i].m_col ;
6789
+ if (!col.ord_part ) {
6790
+ continue ;
6791
+ }
6792
+ if (!check_col_exists_in_indexes (prebuilt->table , i, true ,
6793
+ true )) {
6794
+ col.ord_part = 0 ;
6780
6795
}
6781
6796
}
6782
6797
0 commit comments