Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Signed-off-by: JaySon-Huang <[email protected]>
  • Loading branch information
JaySon-Huang committed Apr 14, 2022
1 parent af10523 commit 830012f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
19 changes: 9 additions & 10 deletions dbms/src/Server/StorageConfigParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ void TiFlashStorageConfig::parseStoragePath(const String & storage, Poco::Logger

auto get_checked_qualified_array = [log](const std::shared_ptr<cpptoml::table> table, const char * key) -> cpptoml::option<Strings> {
auto throw_invalid_value = [log, key]() {
String error_msg = fmt::format("The configuration \"storage.{}\" should be an array of strings. Please check your configuration file.", key);
String error_msg
= fmt::format("The configuration \"storage.{}\" should be an array of strings. Please check your configuration file.", key);
LOG_FMT_ERROR(log, "{}", error_msg);
throw Exception(error_msg, ErrorCodes::INVALID_CONFIG_PARAMETER);
};
Expand Down Expand Up @@ -91,10 +92,9 @@ void TiFlashStorageConfig::parseStoragePath(const String & storage, Poco::Logger
}
if (!main_capacity_quota.empty() && main_capacity_quota.size() != main_data_paths.size())
{
String error_msg = fmt::format(
"The array size of \"storage.main.dir\"[size={}] "
"is not equal to \"storage.main.capacity\"[size={}]. "
"Please check your configuration file.",
String error_msg = fmt::format("The array size of \"storage.main.dir\"[size={}] "
"is not equal to \"storage.main.capacity\"[size={}]. "
"Please check your configuration file.",
main_data_paths.size(),
main_capacity_quota.size());
LOG_ERROR(log, error_msg);
Expand Down Expand Up @@ -126,10 +126,9 @@ void TiFlashStorageConfig::parseStoragePath(const String & storage, Poco::Logger
}
if (!latest_capacity_quota.empty() && latest_capacity_quota.size() != latest_data_paths.size())
{
String error_msg = fmt::format(
"The array size of \"storage.latest.dir\"[size={}] "
"is not equal to \"storage.latest.capacity\"[size={}]. "
"Please check your configuration file.",
String error_msg = fmt::format("The array size of \"storage.latest.dir\"[size={}] "
"is not equal to \"storage.latest.capacity\"[size={}]. "
"Please check your configuration file.",
latest_data_paths.size(),
latest_capacity_quota.size());
LOG_ERROR(log, error_msg);
Expand Down Expand Up @@ -367,7 +366,7 @@ void StorageIORateLimitConfig::parse(const String & storage_io_rate_limit, Poco:
readConfig("foreground_write_weight", fg_write_weight);
readConfig("background_write_weight", bg_write_weight);
readConfig("foreground_read_weight", fg_read_weight);
readConfig("background_read_weight", bg_read_weight);
readConfig("background_read_weight", bg_read_weight);
readConfig("emergency_pct", emergency_pct);
readConfig("high_pct", high_pct);
readConfig("medium_pct", medium_pct);
Expand Down
16 changes: 8 additions & 8 deletions dbms/src/Server/tests/gtest_storage_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dir=["/data0/tiflash"]
const auto & test_case = tests[i];
auto config = loadConfigFromString(test_case);

LOG_FMT_INFO(log, "parsing [index={}] [content={}]", i, test_case);
LOG_INFO(log, "parsing [index=" << i << "] [content=" << test_case << "]");

size_t global_capacity_quota = 0;
TiFlashStorageConfig storage;
Expand Down Expand Up @@ -129,7 +129,7 @@ dir=["/data222/kvstore"]
const auto & test_case = tests[i];
auto config = loadConfigFromString(test_case);

LOG_FMT_INFO(log, "parsing [index={}] [content={}]", i, test_case);
LOG_INFO(log, "parsing [index=" << i << "] [content=" << test_case << "]");

size_t global_capacity_quota = 0;
TiFlashStorageConfig storage;
Expand Down Expand Up @@ -259,7 +259,7 @@ dir=["/data0/tiflash", "/data1/tiflash", "/data2/tiflash"]
}
CATCH

TEST_F(StorageConfig_test, SSD_HDD_Settings)
TEST_F(StorageConfigTest, SSD_HDD_Settings)
try
{
Strings tests = {
Expand Down Expand Up @@ -421,7 +421,7 @@ dir = [1,2,3]
}
CATCH

TEST(PathCapacityMetrics_test, Quota)
TEST(PathCapacityMetricsTest, Quota)
try
{
Strings tests = {
Expand Down Expand Up @@ -456,7 +456,7 @@ dir=["/data0/tiflash"]
capacity=[ 1024 ]
)",
};
Poco::Logger * log = &Poco::Logger::get("PathCapacityMetrics_test");
Poco::Logger * log = &Poco::Logger::get("PathCapacityMetricsTest");

for (size_t i = 0; i < tests.size(); ++i)
{
Expand Down Expand Up @@ -506,10 +506,10 @@ capacity=[ 1024 ]
}
CATCH

class UsersConfigParser_test : public ::testing::Test
class UsersConfigParserTest : public ::testing::Test
{
public:
UsersConfigParser_test() : log(&Poco::Logger::get("UsersConfigParser_test")) {}
UsersConfigParserTest() : log(&Poco::Logger::get("UsersConfigParserTest")) {}

static void SetUpTestCase() {}

Expand All @@ -518,7 +518,7 @@ class UsersConfigParser_test : public ::testing::Test
};


TEST_F(UsersConfigParser_test, ParseConfigs)
TEST_F(UsersConfigParserTest, ParseConfigs)
try
{
Strings tests = {
Expand Down

0 comments on commit 830012f

Please sign in to comment.