Skip to content

Commit 35c21b1

Browse files
committed
MB-42607 [1/2]: Make bio_drain_buffer_sz dynamic
Modify Settings.bio_drain_buffer_sz to allow it to be changed dynamically (only affects TLS connections created after it is changed). Change-Id: I6b2ea398e66716f7eb54db466c33026354a58b3e Reviewed-on: http://review.couchbase.org/c/kv_engine/+/139893 Tested-by: Build Bot <[email protected]> Reviewed-by: James Harrison <[email protected]> Reviewed-by: Trond Norbye <[email protected]> Well-Formed: Build Bot <[email protected]>
1 parent 281dfee commit 35c21b1

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

daemon/settings.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -803,12 +803,6 @@ void Settings::updateSettings(const Settings& other, bool apply) {
803803
throw std::invalid_argument("audit can't be changed dynamically");
804804
}
805805
}
806-
if (other.has.bio_drain_buffer_sz) {
807-
if (other.bio_drain_buffer_sz != bio_drain_buffer_sz) {
808-
throw std::invalid_argument(
809-
"bio_drain_buffer_sz can't be changed dynamically");
810-
}
811-
}
812806
if (other.has.datatype_json) {
813807
if (other.datatype_json != datatype_json) {
814808
throw std::invalid_argument(
@@ -901,6 +895,15 @@ void Settings::updateSettings(const Settings& other, bool apply) {
901895
}
902896
}
903897

898+
if (other.has.bio_drain_buffer_sz) {
899+
if (other.bio_drain_buffer_sz != bio_drain_buffer_sz) {
900+
LOG_INFO("Change BIO drain buffer size from {} to {}",
901+
bio_drain_buffer_sz,
902+
other.bio_drain_buffer_sz);
903+
setBioDrainBufferSize(other.bio_drain_buffer_sz);
904+
}
905+
}
906+
904907
if (other.has.reqs_per_event_high_priority) {
905908
if (other.reqs_per_event_high_priority !=
906909
reqs_per_event_high_priority) {

tests/config_parse_test/config_parse_test.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1358,18 +1358,17 @@ TEST(SettingsUpdateTest, ConnectionIdleTimeIsDynamic) {
13581358
settings.getConnectionIdleTime());
13591359
}
13601360

1361-
TEST(SettingsUpdateTest, BioDrainBufferSzIsNotDynamic) {
1361+
TEST(SettingsUpdateTest, BioDrainBufferSzIsDynamic) {
13621362
Settings updated;
13631363
Settings settings;
13641364
// setting it to the same value should work
13651365
auto old = settings.getBioDrainBufferSize();
13661366
updated.setBioDrainBufferSize(old);
13671367
EXPECT_NO_THROW(settings.updateSettings(updated, false));
13681368

1369-
// changing it should not work
1369+
// changing it should work
13701370
updated.setBioDrainBufferSize(old + 10);
1371-
EXPECT_THROW(settings.updateSettings(updated, false),
1372-
std::invalid_argument);
1371+
EXPECT_NO_THROW(settings.updateSettings(updated, false));
13731372
}
13741373

13751374
TEST(SettingsUpdateTest, DatatypeJsonIsNotDynamic) {

0 commit comments

Comments
 (0)