Skip to content

Commit

Permalink
[mysql-5.6][PR] Fix rdb_i_s_sst_props_fields_info
Browse files Browse the repository at this point in the history
Summary:
In `rdb_i_s_sst_props_fields_info` definition, flag `MY_I_S_MAYBE_NULL`
is missing for fields `COMPRESSION_ALGO`, `FILTER_POLICY`,
`COMPRESSION_OPTIONS`, causing the `set_null` does not take effect,
these 3 fields will keep last SST's value.

This PR fixed this issue.

Pull Request resolved: facebook#1267
GitHub Author: leipeng <peng@topling.cn>

Test Plan: Imported from GitHub, without a `Test Plan:` line.

Reviewers: luqun, rpan, mung, chni

Reviewed By: mung

Subscribers: webscalesql-eng@fb.com

Differential Revision: https://phabricator.intern.facebook.com/D42928109

Tags: accept2ship
  • Loading branch information
hermanlee authored and Herman Lee committed Feb 6, 2023
1 parent 57a0d0a commit 662dc11
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions storage/rocksdb/rdb_i_s.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1691,16 +1691,18 @@ static ST_FIELD_INFO rdb_i_s_sst_props_fields_info[] = {
MYSQL_TYPE_LONGLONG, 0),
ROCKSDB_FIELD_INFO("FILTER_BLOCK_SIZE", sizeof(int64_t),
MYSQL_TYPE_LONGLONG, 0),
ROCKSDB_FIELD_INFO("COMPRESSION_ALGO", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
ROCKSDB_FIELD_INFO("COMPRESSION_ALGO", NAME_LEN + 1, MYSQL_TYPE_STRING,
MY_I_S_MAYBE_NULL),
ROCKSDB_FIELD_INFO("CREATION_TIME", sizeof(int64_t), MYSQL_TYPE_LONGLONG,
0),
ROCKSDB_FIELD_INFO("FILE_CREATION_TIME", sizeof(int64_t),
MYSQL_TYPE_LONGLONG, 0),
ROCKSDB_FIELD_INFO("OLDEST_KEY_TIME", sizeof(int64_t), MYSQL_TYPE_LONGLONG,
0),
ROCKSDB_FIELD_INFO("FILTER_POLICY", NAME_LEN + 1, MYSQL_TYPE_STRING, 0),
ROCKSDB_FIELD_INFO("FILTER_POLICY", NAME_LEN + 1, MYSQL_TYPE_STRING,
MY_I_S_MAYBE_NULL),
ROCKSDB_FIELD_INFO("COMPRESSION_OPTIONS", NAME_LEN + 1, MYSQL_TYPE_STRING,
0),
MY_I_S_MAYBE_NULL),
ROCKSDB_FIELD_INFO_END};

static int rdb_i_s_sst_props_fill_table(
Expand Down Expand Up @@ -1769,6 +1771,7 @@ static int rdb_i_s_sst_props_fill_table(
if (props.second->compression_name.empty()) {
field[RDB_SST_PROPS_FIELD::COMPRESSION_ALGO]->set_null();
} else {
field[RDB_SST_PROPS_FIELD::COMPRESSION_ALGO]->set_notnull();
field[RDB_SST_PROPS_FIELD::COMPRESSION_ALGO]->store(
props.second->compression_name.c_str(),
props.second->compression_name.size(), system_charset_info);
Expand All @@ -1782,13 +1785,15 @@ static int rdb_i_s_sst_props_fill_table(
if (props.second->filter_policy_name.empty()) {
field[RDB_SST_PROPS_FIELD::FILTER_POLICY]->set_null();
} else {
field[RDB_SST_PROPS_FIELD::FILTER_POLICY]->set_notnull();
field[RDB_SST_PROPS_FIELD::FILTER_POLICY]->store(
props.second->filter_policy_name.c_str(),
props.second->filter_policy_name.size(), system_charset_info);
}
if (props.second->compression_options.empty()) {
field[RDB_SST_PROPS_FIELD::COMPRESSION_OPTIONS]->set_null();
} else {
field[RDB_SST_PROPS_FIELD::COMPRESSION_OPTIONS]->set_notnull();
field[RDB_SST_PROPS_FIELD::COMPRESSION_OPTIONS]->store(
props.second->compression_options.c_str(),
props.second->compression_options.size(), system_charset_info);
Expand Down

0 comments on commit 662dc11

Please sign in to comment.