Skip to content

Commit db347eb

Browse files
committed
Moved commit "Call ByteSizeLong on each WriteRequest separately" from ydb repo
1 parent 56d4674 commit db347eb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/client/topic/impl/write_session_impl.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,8 +1371,11 @@ void TWriteSessionImpl::SendImpl() {
13711371
auto* writeRequest = clientMessage.mutable_write_request();
13721372

13731373
ui32 prevCodec = 0;
1374+
1375+
ui64 currentSize = 0;
1376+
13741377
// Send blocks while we can without messages reordering.
1375-
while (IsReadyToSendNextImpl() && clientMessage.ByteSizeLong() < GetMaxGrpcMessageSize()) {
1378+
while (IsReadyToSendNextImpl() && currentSize < GetMaxGrpcMessageSize()) {
13761379
const auto& block = PackedMessagesToSend.top();
13771380
Y_ABORT_UNLESS(block.Valid);
13781381
if (writeRequest->messages_size() > 0 && prevCodec != block.CodecID) {
@@ -1420,6 +1423,8 @@ void TWriteSessionImpl::SendImpl() {
14201423
moveBlock.Move(block);
14211424
SentPackedMessage.emplace(std::move(moveBlock));
14221425
PackedMessagesToSend.pop();
1426+
1427+
currentSize += writeRequest->ByteSizeLong();
14231428
}
14241429
UpdateTokenIfNeededImpl();
14251430
LOG_LAZY(DbDriverState->Log,

0 commit comments

Comments
 (0)