Skip to content

Commit ec3c8e8

Browse files
Mandate flow control in bytes (#4353)
Resolves #3781 and #4374. This change removes the `ENABLE_FLOW_CONTROL_BYTES` config option and always uses flow control in bytes. # Checklist - [x] Reviewed the [contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes) document - [x] Rebased on top of master (no merge commits) - [x] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio extension) - [x] Compiles - [x] Ran all tests - [ ] If change impacts performance, include supporting evidence per the [performance document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
2 parents 79f2b5f + ee2bd68 commit ec3c8e8

14 files changed

+215
-423
lines changed

docs/stellar-core_example.cfg

-5
Original file line numberDiff line numberDiff line change
@@ -530,11 +530,6 @@ PEER_FLOOD_READING_CAPACITY_BYTES=300000
530530
# processes `FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES` bytes
531531
FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES=100000
532532

533-
# Enable flow control in bytes. This config allows core to process large
534-
# transactions on the network more efficiently and apply back pressure if
535-
# needed.
536-
ENABLE_FLOW_CONTROL_BYTES=true
537-
538533
# Byte limit for outbound transaction queue.
539534
OUTBOUND_TX_QUEUE_BYTE_LIMIT=3145728
540535

src/herder/Herder.h

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class Herder
153153

154154
virtual VirtualTimer const& getTriggerTimer() const = 0;
155155
virtual void setMaxClassicTxSize(uint32 bytes) = 0;
156+
virtual void setMaxTxSize(uint32 bytes) = 0;
156157
virtual void setFlowControlExtraBufferSize(uint32 bytes) = 0;
157158

158159
virtual ClassicTransactionQueue& getTransactionQueue() = 0;

src/herder/HerderImpl.h

+5
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ class HerderImpl : public Herder
126126
{
127127
mMaxClassicTxSize = std::make_optional<uint32_t>(bytes);
128128
}
129+
void
130+
setMaxTxSize(uint32 bytes) override
131+
{
132+
mMaxTxSize = bytes;
133+
}
129134
std::optional<uint32_t> mFlowControlExtraBuffer;
130135
void
131136
setFlowControlExtraBufferSize(uint32 bytes) override

src/main/Config.cpp

+2-7
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ Config::Config() : NODE_SEED(SecretKey::random())
151151
LEDGER_PROTOCOL_VERSION = CURRENT_LEDGER_PROTOCOL_VERSION;
152152
LEDGER_PROTOCOL_MIN_VERSION_INTERNAL_ERROR_REPORT = 18;
153153

154-
OVERLAY_PROTOCOL_MIN_VERSION = 32;
155-
OVERLAY_PROTOCOL_VERSION = 34;
154+
OVERLAY_PROTOCOL_MIN_VERSION = 33;
155+
OVERLAY_PROTOCOL_VERSION = 35;
156156

157157
VERSION_STR = STELLAR_CORE_VERSION;
158158

@@ -261,7 +261,6 @@ Config::Config() : NODE_SEED(SecretKey::random())
261261
PEER_FLOOD_READING_CAPACITY_BYTES = 0;
262262
FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES = 0;
263263
OUTBOUND_TX_QUEUE_BYTE_LIMIT = 1024 * 1024 * 3;
264-
ENABLE_FLOW_CONTROL_BYTES = true;
265264

266265
// WORKER_THREADS: setting this too low risks a form of priority inversion
267266
// where a long-running background task occupies all worker threads and
@@ -1031,10 +1030,6 @@ Config::processConfig(std::shared_ptr<cpptoml::table> t)
10311030
FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES =
10321031
readInt<uint32_t>(item, 1);
10331032
}
1034-
else if (item.first == "ENABLE_FLOW_CONTROL_BYTES")
1035-
{
1036-
ENABLE_FLOW_CONTROL_BYTES = readBool(item);
1037-
}
10381033
else if (item.first == "OUTBOUND_TX_QUEUE_BYTE_LIMIT")
10391034
{
10401035
OUTBOUND_TX_QUEUE_BYTE_LIMIT = readInt<uint32_t>(item, 1);

src/main/Config.h

-5
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,6 @@ class Config : public std::enable_shared_from_this<Config>
324324
uint32_t PEER_FLOOD_READING_CAPACITY_BYTES;
325325
uint32_t FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES;
326326

327-
// Enable flow control in bytes. This config allows core to process large
328-
// transactions on the network more efficiently and apply back pressure if
329-
// needed.
330-
bool ENABLE_FLOW_CONTROL_BYTES;
331-
332327
// Byte limit for outbound transaction queue.
333328
uint32_t OUTBOUND_TX_QUEUE_BYTE_LIMIT;
334329

0 commit comments

Comments
 (0)