acelyc111 commented on code in PR #1108: URL: https://github.com/apache/incubator-pegasus/pull/1108#discussion_r949849415
########## src/server/pegasus_server_impl.h: ########## @@ -413,11 +425,18 @@ class pegasus_server_impl : public pegasus_read_service std::shared_ptr<KeyWithTTLCompactionFilterFactory> _key_ttl_compaction_filter_factory; std::shared_ptr<rocksdb::Statistics> _statistics; rocksdb::DBOptions _db_opts; + // The value of option in data_cf according to conf template file config.ini rocksdb::ColumnFamilyOptions _data_cf_opts; + // Dynamically calculate the value of current data_cf option according to the conf module file + // and usage mode Review Comment: ```suggestion // and usage scenario ``` ########## src/server/pegasus_server_impl.h: ########## @@ -413,11 +425,18 @@ class pegasus_server_impl : public pegasus_read_service std::shared_ptr<KeyWithTTLCompactionFilterFactory> _key_ttl_compaction_filter_factory; std::shared_ptr<rocksdb::Statistics> _statistics; rocksdb::DBOptions _db_opts; + // The value of option in data_cf according to conf template file config.ini rocksdb::ColumnFamilyOptions _data_cf_opts; + // Dynamically calculate the value of current data_cf option according to the conf module file + // and usage mode + rocksdb::ColumnFamilyOptions _table_data_cf_opts; rocksdb::ColumnFamilyOptions _meta_cf_opts; rocksdb::ReadOptions _data_cf_rd_opts; std::string _usage_scenario; std::string _user_specified_compaction; + // Whether it is necessary to update the current data_cf, it is required when opening the db, + // but not later + bool _table_data_cf_opts_recalculated; Review Comment: the name `_table_data_cf_opts_recalculated` means option has been **recalculated**, it's different with the meaning you defined before, that is to say, true and flase should reverse. ########## src/server/pegasus_server_impl.cpp: ########## @@ -3007,6 +3013,97 @@ void pegasus_server_impl::reset_usage_scenario_options( target_opts->max_write_buffer_number = base_opts.max_write_buffer_number; } +void pegasus_server_impl::recalculate_data_cf_options( + const rocksdb::ColumnFamilyOptions &cur_data_cf_opts) +{ +#define UPDATE_NUMBER_OPTION_IF_NEEDED(option, value) \ + do { \ + if ((value) != cur_data_cf_opts.option) { \ + new_options[#option] = std::to_string((value)); \ + } \ + } while (0) + +#define UPDATE_BOOL_OPTION_IF_NEEDED(option, value) \ + do { \ + if ((value) != cur_data_cf_opts.option) { \ + if ((value)) \ Review Comment: it's recommend to keep `{}` for `if..else..` even though there is only one line. some other places are the same. ########## src/server/pegasus_server_impl.h: ########## @@ -413,11 +425,18 @@ class pegasus_server_impl : public pegasus_read_service std::shared_ptr<KeyWithTTLCompactionFilterFactory> _key_ttl_compaction_filter_factory; std::shared_ptr<rocksdb::Statistics> _statistics; rocksdb::DBOptions _db_opts; + // The value of option in data_cf according to conf template file config.ini rocksdb::ColumnFamilyOptions _data_cf_opts; + // Dynamically calculate the value of current data_cf option according to the conf module file + // and usage mode + rocksdb::ColumnFamilyOptions _table_data_cf_opts; rocksdb::ColumnFamilyOptions _meta_cf_opts; rocksdb::ReadOptions _data_cf_rd_opts; std::string _usage_scenario; std::string _user_specified_compaction; + // Whether it is necessary to update the current data_cf, it is required when opening the db, + // but not later Review Comment: ```suggestion // Whether it is necessary to update the current data_cf, it is required when opening the db at the first time, // but not later ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@pegasus.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pegasus.apache.org For additional commands, e-mail: dev-h...@pegasus.apache.org