reswqa commented on code in PR #22652: URL: https://github.com/apache/flink/pull/22652#discussion_r1214057806
########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/TestingTierProducerAgent.java: ########## @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierProducerAgent; + +import java.util.function.Supplier; + +/** Test implementation for {@link TierProducerAgent}. */ +public class TestingTierProducerAgent implements TierProducerAgent { + + private Supplier<Boolean> tryStartNewSegmentReturnValueSupplier; Review Comment: ```suggestion private Supplier<Boolean> tryStartNewSegmentSupplier; ``` ```suggestion private Supplier<Boolean> tryStartNewSegmentSupplier; ``` In general, for mock class, we named it's fields as follows: `MethodName+(Runnable/Supplier/Consumer/Function)` ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/TestingTierProducerAgent.java: ########## @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierProducerAgent; + +import java.util.function.Supplier; + +/** Test implementation for {@link TierProducerAgent}. */ +public class TestingTierProducerAgent implements TierProducerAgent { + + private Supplier<Boolean> tryStartNewSegmentReturnValueSupplier; + + private Supplier<Boolean[]> tryWriteReturnValueSupplier; Review Comment: ```suggestion private BiFunction<TieredStorageSubpartitionId, Buffer, Boolean> tryWriterFunction; ``` ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/storage/TieredStorageProducerClientTest.java: ########## @@ -0,0 +1,187 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered.storage; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.buffer.NetworkBufferPool; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.TestingBufferAccumulator; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.TestingTierProducerAgent; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierProducerAgent; +import org.apache.flink.testutils.junit.extensions.parameterized.Parameter; +import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension; +import org.apache.flink.testutils.junit.extensions.parameterized.Parameters; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.TestTemplate; +import org.junit.jupiter.api.extension.ExtendWith; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Random; + +import static org.apache.flink.runtime.io.network.partition.hybrid.tiered.TieredStorageTestUtils.generateRandomData; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; + +/** Tests for {@link TieredStorageProducerClient}. */ +@ExtendWith(ParameterizedTestExtension.class) +public class TieredStorageProducerClientTest { + + private static final int NUM_TOTAL_BUFFERS = 1000; + + private static final int NETWORK_BUFFER_SIZE = 1024; + + @Parameter public boolean isBroadcast; + + private NetworkBufferPool globalPool; + + @Parameters(name = "isBroadcast={0}") + public static Collection<Boolean> parameters() { + return Arrays.asList(false, true); + } + + @BeforeEach + void before() { + globalPool = new NetworkBufferPool(NUM_TOTAL_BUFFERS, NETWORK_BUFFER_SIZE); + } + + @AfterEach + void after() { + globalPool.destroy(); + } + + @TestTemplate + void testWriteRecordsToEmptyStorageTiers() { + int numSubpartitions = 10; + int bufferSize = 1024; + Random random = new Random(); + + TieredStorageProducerClient tieredStorageProducerClient = + createTieredStorageProducerClient(numSubpartitions, Collections.emptyList()); + assertThatThrownBy( + () -> + tieredStorageProducerClient.write( + generateRandomData(bufferSize, random), + new TieredStorageSubpartitionId(0), + Buffer.DataType.DATA_BUFFER, + isBroadcast)) + .isInstanceOf(RuntimeException.class) + .hasMessageContaining("Failed to choose a storage tier"); + } + + @TestTemplate + void testWriteRecords() throws IOException { + int numSubpartitions = 10; + int bufferSize = 1024; + int maxNumToWriteRecordsPerSubpartition = 1000; + Random random = new Random(); + + TestingTierProducerAgent tierProducerAgent = new TestingTierProducerAgent(); + tierProducerAgent.setTryStartNewSegmentReturnValueSupplier(() -> true); + tierProducerAgent.setTryWriteReturnValueSupplier(() -> new Boolean[] {false, true}); + + TieredStorageProducerClient tieredStorageProducerClient = + createTieredStorageProducerClient( + numSubpartitions, Collections.singletonList(tierProducerAgent)); + + int numWriteRecords = 0; + for (int j = 0; j < numSubpartitions; j++) { + for (int i = 0; i < random.nextInt(maxNumToWriteRecordsPerSubpartition); i++) { + tieredStorageProducerClient.write( + generateRandomData(bufferSize, random), + new TieredStorageSubpartitionId(j), + Buffer.DataType.DATA_BUFFER, + isBroadcast); + numWriteRecords++; + } + } + + int numExpectedBuffers = isBroadcast ? numWriteRecords * numSubpartitions : numWriteRecords; + assertThat(tierProducerAgent.numTotalReceivedBuffers()).isEqualTo(numExpectedBuffers); + } + + @TestTemplate + void testTierCanNotStartNewSegment() throws IOException { + int numSubpartitions = 10; + int bufferSize = 1024; + Random random = new Random(); + + TestingTierProducerAgent tierProducerAgent = new TestingTierProducerAgent(); + tierProducerAgent.setTryStartNewSegmentReturnValueSupplier(() -> false); + tierProducerAgent.setTryWriteReturnValueSupplier(() -> new Boolean[] {false, true}); + TieredStorageProducerClient tieredStorageProducerClient = + createTieredStorageProducerClient( + numSubpartitions, Collections.singletonList(tierProducerAgent)); + + assertThatThrownBy( + () -> + tieredStorageProducerClient.write( + generateRandomData(bufferSize, random), + new TieredStorageSubpartitionId(0), + Buffer.DataType.DATA_BUFFER, + isBroadcast)) + .isInstanceOf(RuntimeException.class) + .hasMessageContaining("Failed to choose a storage tier"); + + tierProducerAgent.setTryStartNewSegmentReturnValueSupplier(() -> true); + tieredStorageProducerClient.write( + generateRandomData(bufferSize, random), + new TieredStorageSubpartitionId(0), + Buffer.DataType.DATA_BUFFER, + isBroadcast); + + assertThat(tierProducerAgent.numTotalReceivedBuffers()) + .isEqualTo(isBroadcast ? numSubpartitions : 1); + } + + @TestTemplate + void testClose() { + int numSubpartitions = 10; + + TestingTierProducerAgent tierProducerAgent = new TestingTierProducerAgent(); + tierProducerAgent.setTryStartNewSegmentReturnValueSupplier(() -> true); + tierProducerAgent.setTryWriteReturnValueSupplier(() -> new Boolean[] {false, true}); Review Comment: Are these two lines necessary? Because we haven't even call the `write` method, why do we care about them? ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/storage/TieredStorageProducerClientTest.java: ########## @@ -0,0 +1,187 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered.storage; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.buffer.NetworkBufferPool; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.TestingBufferAccumulator; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.TestingTierProducerAgent; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierProducerAgent; +import org.apache.flink.testutils.junit.extensions.parameterized.Parameter; +import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension; +import org.apache.flink.testutils.junit.extensions.parameterized.Parameters; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.TestTemplate; +import org.junit.jupiter.api.extension.ExtendWith; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Random; + +import static org.apache.flink.runtime.io.network.partition.hybrid.tiered.TieredStorageTestUtils.generateRandomData; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; + +/** Tests for {@link TieredStorageProducerClient}. */ +@ExtendWith(ParameterizedTestExtension.class) +public class TieredStorageProducerClientTest { Review Comment: We also need to test metric updating in a separate test method. ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/TestingTierProducerAgent.java: ########## @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierProducerAgent; + +import java.util.function.Supplier; + +/** Test implementation for {@link TierProducerAgent}. */ +public class TestingTierProducerAgent implements TierProducerAgent { + + private Supplier<Boolean> tryStartNewSegmentReturnValueSupplier; + + private Supplier<Boolean[]> tryWriteReturnValueSupplier; + + private int numTotalReceivedBuffers; + + private int tryWriteCounter; + + private boolean isClosed; + + public void setTryStartNewSegmentReturnValueSupplier( + Supplier<Boolean> tryStartNewSegmentReturnValueSupplier) { + this.tryStartNewSegmentReturnValueSupplier = tryStartNewSegmentReturnValueSupplier; + } + + public void setTryWriteReturnValueSupplier(Supplier<Boolean[]> tryWriteReturnValueSupplier) { + this.tryWriteReturnValueSupplier = tryWriteReturnValueSupplier; + } + + public int numTotalReceivedBuffers() { + return numTotalReceivedBuffers; + } + + public boolean isClosed() { + return isClosed; + } + + @Override + public boolean tryStartNewSegment(TieredStorageSubpartitionId subpartitionId, int segmentId) { + return tryStartNewSegmentReturnValueSupplier.get(); + } + + @Override + public boolean tryWrite(TieredStorageSubpartitionId subpartitionId, Buffer finishedBuffer) { + boolean isSuccess = tryWriteReturnValueSupplier.get()[(tryWriteCounter++) % 2]; + if (isSuccess) { + numTotalReceivedBuffers++; + } + return isSuccess; Review Comment: Control logic should be put in specific testing method instead of mock class. ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/TestingTierProducerAgent.java: ########## @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierProducerAgent; + +import java.util.function.Supplier; + +/** Test implementation for {@link TierProducerAgent}. */ +public class TestingTierProducerAgent implements TierProducerAgent { Review Comment: For testing(mock) class, we usually via `builder` pattern to make it's fields immutable. You can refer to `TestingSlotAllocator` or `TestingHsDataView`. ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/TestingTierProducerAgent.java: ########## @@ -0,0 +1,75 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierProducerAgent; + +import java.util.function.Supplier; + +/** Test implementation for {@link TierProducerAgent}. */ +public class TestingTierProducerAgent implements TierProducerAgent { + + private Supplier<Boolean> tryStartNewSegmentReturnValueSupplier; + + private Supplier<Boolean[]> tryWriteReturnValueSupplier; + + private int numTotalReceivedBuffers; + + private int tryWriteCounter; + + private boolean isClosed; + + public void setTryStartNewSegmentReturnValueSupplier( + Supplier<Boolean> tryStartNewSegmentReturnValueSupplier) { + this.tryStartNewSegmentReturnValueSupplier = tryStartNewSegmentReturnValueSupplier; + } + + public void setTryWriteReturnValueSupplier(Supplier<Boolean[]> tryWriteReturnValueSupplier) { + this.tryWriteReturnValueSupplier = tryWriteReturnValueSupplier; + } + + public int numTotalReceivedBuffers() { + return numTotalReceivedBuffers; + } + + public boolean isClosed() { + return isClosed; + } + + @Override + public boolean tryStartNewSegment(TieredStorageSubpartitionId subpartitionId, int segmentId) { + return tryStartNewSegmentReturnValueSupplier.get(); + } + + @Override + public boolean tryWrite(TieredStorageSubpartitionId subpartitionId, Buffer finishedBuffer) { + boolean isSuccess = tryWriteReturnValueSupplier.get()[(tryWriteCounter++) % 2]; + if (isSuccess) { + numTotalReceivedBuffers++; + } + return isSuccess; + } + + @Override + public void close() { + this.isClosed = true; Review Comment: It is best to use `closeRunnable()` as it will be more versatile. Mock testing class should be flexible and reusable. ########## flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/storage/TieredStorageProducerClientTest.java: ########## @@ -0,0 +1,187 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.partition.hybrid.tiered.storage; + +import org.apache.flink.runtime.io.network.buffer.Buffer; +import org.apache.flink.runtime.io.network.buffer.NetworkBufferPool; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.TestingBufferAccumulator; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.TestingTierProducerAgent; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.common.TieredStorageSubpartitionId; +import org.apache.flink.runtime.io.network.partition.hybrid.tiered.tier.TierProducerAgent; +import org.apache.flink.testutils.junit.extensions.parameterized.Parameter; +import org.apache.flink.testutils.junit.extensions.parameterized.ParameterizedTestExtension; +import org.apache.flink.testutils.junit.extensions.parameterized.Parameters; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.TestTemplate; +import org.junit.jupiter.api.extension.ExtendWith; + +import java.io.IOException; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Random; + +import static org.apache.flink.runtime.io.network.partition.hybrid.tiered.TieredStorageTestUtils.generateRandomData; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; + +/** Tests for {@link TieredStorageProducerClient}. */ +@ExtendWith(ParameterizedTestExtension.class) +public class TieredStorageProducerClientTest { + + private static final int NUM_TOTAL_BUFFERS = 1000; + + private static final int NETWORK_BUFFER_SIZE = 1024; + + @Parameter public boolean isBroadcast; + + private NetworkBufferPool globalPool; + + @Parameters(name = "isBroadcast={0}") + public static Collection<Boolean> parameters() { + return Arrays.asList(false, true); + } + + @BeforeEach + void before() { + globalPool = new NetworkBufferPool(NUM_TOTAL_BUFFERS, NETWORK_BUFFER_SIZE); + } + + @AfterEach + void after() { + globalPool.destroy(); + } + + @TestTemplate + void testWriteRecordsToEmptyStorageTiers() { + int numSubpartitions = 10; + int bufferSize = 1024; + Random random = new Random(); + + TieredStorageProducerClient tieredStorageProducerClient = + createTieredStorageProducerClient(numSubpartitions, Collections.emptyList()); + assertThatThrownBy( + () -> + tieredStorageProducerClient.write( + generateRandomData(bufferSize, random), + new TieredStorageSubpartitionId(0), + Buffer.DataType.DATA_BUFFER, + isBroadcast)) + .isInstanceOf(RuntimeException.class) + .hasMessageContaining("Failed to choose a storage tier"); + } + + @TestTemplate + void testWriteRecords() throws IOException { + int numSubpartitions = 10; + int bufferSize = 1024; + int maxNumToWriteRecordsPerSubpartition = 1000; + Random random = new Random(); + + TestingTierProducerAgent tierProducerAgent = new TestingTierProducerAgent(); + tierProducerAgent.setTryStartNewSegmentReturnValueSupplier(() -> true); + tierProducerAgent.setTryWriteReturnValueSupplier(() -> new Boolean[] {false, true}); + + TieredStorageProducerClient tieredStorageProducerClient = + createTieredStorageProducerClient( + numSubpartitions, Collections.singletonList(tierProducerAgent)); + + int numWriteRecords = 0; + for (int j = 0; j < numSubpartitions; j++) { + for (int i = 0; i < random.nextInt(maxNumToWriteRecordsPerSubpartition); i++) { + tieredStorageProducerClient.write( + generateRandomData(bufferSize, random), + new TieredStorageSubpartitionId(j), + Buffer.DataType.DATA_BUFFER, + isBroadcast); + numWriteRecords++; + } + } + + int numExpectedBuffers = isBroadcast ? numWriteRecords * numSubpartitions : numWriteRecords; Review Comment: I wonder if repeating write multiple times here is actually equivalent to `tryWrite (false) -> tryStartNewSegment -> tryWrite (true)`? 🤔 -- 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]
