Copilot commented on code in PR #3792:
URL: https://github.com/apache/celeborn/pull/3792#discussion_r3757967553
##########
cpp/celeborn/client/tests/PushStateTest.cpp:
##########
@@ -247,6 +247,26 @@ TEST_F(PushStateBytesSizeTest,
limitMaxInFlightByTotalBytesSize) {
EXPECT_TRUE(thirdBatchCompleted.load());
}
+// The existing byte-size tests exceed the request-count limit at the same time
+// as the byte limit, so they pass either way. Here only the byte limit is
+// exceeded: two in-flight batches stay within maxReqsInFlight (2 total, 100
per
+// worker) while their 4000 bytes exceed both maxBytesSizeInFlight limits (3000
+// total, 2500 per worker). The push must block.
+TEST_F(PushStateBytesSizeTest, limitMaxInFlightByBytesSizeOnly) {
+ const std::string hostAndPushPort = "xx.xx.xx.xx:8080";
+ const int batchSize = 2000;
+
+ pushState_->addBatch(0, batchSize, hostAndPushPort);
+ pushState_->addBatch(1, batchSize, hostAndPushPort);
+
+ EXPECT_TRUE(pushState_->limitMaxInFlight(hostAndPushPort))
+ << "Push should be throttled while the in-flight bytes exceed the limit";
+
+ // Dropping one batch brings the bytes back under both limits.
+ pushState_->removeBatch(0, hostAndPushPort);
+ EXPECT_FALSE(pushState_->limitMaxInFlight(hostAndPushPort));
+}
Review Comment:
The new test asserts `limitMaxInFlight()` returns `true` while bytes are
over limit, but `true` in this API means it waited until *timeout* (see `return
times <= 0;`). That makes the test slower (always waits ~kPushTimeoutMs_) and
it doesn't actually validate the intended "throttles until bytes drop"
behavior; it validates "times out" instead. Consider rewriting the test to run
`limitMaxInFlight()` on a background thread, assert it blocks briefly, then
remove a batch and assert the call completes and returns `false` (i.e.,
succeeded before timeout).
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]