Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FB8-264: rocksdb.type_* fail in 8.0.23 because of cardinality #2

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions sql/dd_table_share.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,16 @@ static bool prepare_share(THD *thd, TABLE_SHARE *share,
share->primary_key = MAX_KEY;
}

restart:
/*
The next call is here for MyRocks: Now, we have filled in field and key
definitions, give the storage engine a chance to adjust its properties.
MyRocks may (and typically does) adjust HA_PRIMARY_KEY_IN_READ_INDEX
flag in this call.
*/
if (handler_file->init_with_fields()) return true;
ha_option = handler_file->ha_table_flags();

dd::Table::Index_collection::const_iterator idx_it(
table_def->indexes().begin());

Expand Down Expand Up @@ -372,6 +382,13 @@ static bool prepare_share(THD *thd, TABLE_SHARE *share,
*/
if (primary_key < MAX_KEY && share->keys_in_use.is_set(primary_key)) {
share->primary_key = primary_key;
/*
OK, we decided to use it as primary key, but that may have impact on
HA_PRIMARY_KEY_IN_READ_INDEX flag, which is set by MyRocks basing on
the information about PK. Restart the iteration, but with PK already
set.
*/
goto restart;
}
}

Expand Down Expand Up @@ -492,14 +509,6 @@ static bool prepare_share(THD *thd, TABLE_SHARE *share,
++idx_it;
}

/*
The next call is here for MyRocks: Now, we have filled in field and key
definitions, give the storage engine a chance to adjust its properties.
MyRocks may (and typically does) adjust HA_PRIMARY_KEY_IN_READ_INDEX
flag in this call.
*/
if (handler_file->init_with_fields()) return true;

if (primary_key < MAX_KEY &&
(handler_file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX)) {
keyinfo = &share->key_info[primary_key];
Expand Down
24 changes: 16 additions & 8 deletions sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,15 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share,
share->primary_key = MAX_KEY;
}

restart:
/*
The next call is here for MyRocks: Now, we have filled in field and key
definitions, give the storage engine a chance to adjust its properties.
MyRocks may (and typically does) adjust HA_PRIMARY_KEY_IN_READ_INDEX
flag in this call.
*/
if (handler_file->init_with_fields()) goto err;

longlong ha_option = handler_file->ha_table_flags();
keyinfo = share->key_info;
key_part = keyinfo->key_part;
Expand Down Expand Up @@ -2087,6 +2096,13 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share,
*/
if (primary_key < MAX_KEY && share->keys_in_use.is_set(primary_key)) {
share->primary_key = primary_key;
/*
OK, we decided to use it as primary key, but that may have impact on
HA_PRIMARY_KEY_IN_READ_INDEX flag, which is set by MyRocks basing on
the information about PK. Restart the iteration, but with PK already
set.
*/
goto restart;
}
}

Expand Down Expand Up @@ -2184,14 +2200,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share,
std::max(share->max_unique_length, keyinfo->key_length);
}

/*
The next call is here for MyRocks: Now, we have filled in field and key
definitions, give the storage engine a chance to adjust its properties.
MyRocks may (and typically does) adjust HA_PRIMARY_KEY_IN_READ_INDEX
flag in this call.
*/
if (handler_file->init_with_fields()) goto err;

if (primary_key < MAX_KEY &&
(handler_file->ha_table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX)) {
keyinfo = &share->key_info[primary_key];
Expand Down