Skip to content

Commit

Permalink
Extended Replication config with a parameter specific to CPP-HTTPLIB
Browse files Browse the repository at this point in the history
  • Loading branch information
iagaponenko committed Aug 5, 2024
1 parent 7793961 commit 514a02b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/replica/config/ConfigTestData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ map<string, set<string>> ConfigTestData::parameters() {
"async-loader-auto-resume",
"async-loader-cleanup-on-resume",
"http-max-listen-conn",
"http-max-queued-requests",
"svc-port",
"fs-port",
"data-dir",
Expand Down Expand Up @@ -124,6 +125,7 @@ json ConfigTestData::data() {
{"async-loader-auto-resume", 0},
{"async-loader-cleanup-on-resume", 0},
{"http-max-listen-conn", 512},
{"http-max-queued-requests", 1024},
{"svc-port", 51000},
{"fs-port", 52000},
{"data-dir", "/data"},
Expand Down
8 changes: 8 additions & 0 deletions src/replica/config/ConfigurationSchema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ json const ConfigurationSchema::_schemaJson = json::object(
"The maximum length of the queue of pending connections sent to the Replication worker's"
" HTTP-based ingest service. Must be greater than 0."},
{"default", max_listen_connections}}},
{"http-max-queued-requests",
{{"description",
"The maximum number of pending requests, i.e. requests accept()ed by"
" the listener but still waiting to be routed by the HTTP server."
" If set to 0 then no specific limit will be enforced. It's recommented to keep"
" the default value unless there are specific reasons to change it."},
{"empty-allowed", 1},
{"default", 0}}},
{"svc-port",
{{"description", "The port number for the worker's replication service."}, {"default", 25000}}},
{"fs-port",
Expand Down
7 changes: 7 additions & 0 deletions src/replica/tests/testConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ BOOST_AUTO_TEST_CASE(ConfigurationTestReadingGeneralParameters) {
BOOST_CHECK(config->get<size_t>("worker", "async-loader-auto-resume") == 0);
BOOST_CHECK(config->get<size_t>("worker", "async-loader-cleanup-on-resume") == 0);
BOOST_CHECK(config->get<unsigned int>("worker", "http-max-listen-conn") == 512);
BOOST_CHECK(config->get<size_t>("worker", "http-max-queued-requests") == 1024);
BOOST_CHECK(config->get<unsigned int>("worker", "loader-max-warnings") == 2);
BOOST_CHECK(config->get<string>("worker", "ingest-charset-name") == "latin1");
BOOST_CHECK(config->get<unsigned int>("worker", "ingest-num-retries") == 1);
Expand Down Expand Up @@ -375,6 +376,12 @@ BOOST_AUTO_TEST_CASE(ConfigurationTestModifyingGeneralParameters) {
BOOST_REQUIRE_NO_THROW(config->set<unsigned int>("worker", "http-max-listen-conn", 2048));
BOOST_CHECK(config->get<unsigned int>("worker", "http-max-listen-conn") == 2048);

BOOST_CHECK(config->get<size_t>("worker", "http-max-queued-requests") == 1024);
BOOST_REQUIRE_NO_THROW(config->set<size_t>("worker", "http-max-queued-requests", 2048));
BOOST_CHECK(config->get<size_t>("worker", "http-max-queued-requests") == 2048);
BOOST_REQUIRE_NO_THROW(config->set<size_t>("worker", "http-max-queued-requests", 0));
BOOST_CHECK(config->get<size_t>("worker", "http-max-queued-requests") == 0);

BOOST_CHECK_THROW(config->set<unsigned int>("worker", "loader-max-warnings", 0), std::invalid_argument);
BOOST_REQUIRE_NO_THROW(config->set<unsigned int>("worker", "loader-max-warnings", 100));
BOOST_CHECK(config->get<unsigned int>("worker", "loader-max-warnings") == 100);
Expand Down

0 comments on commit 514a02b

Please sign in to comment.