Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,22 @@ public void testReleaseBuffers() throws Exception {
try (XceiverClientSpi xceiverClient = mgr.acquireClient(pipeline)) {
assertEquals(1, xceiverClient.getRefcount());
XceiverClientRatis ratisClient = assertInstanceOf(XceiverClientRatis.class, xceiverClient);
// Commit one request synchronously before the async write burst so the
// Ratis client is fully established and the container already exists.
// Issuing the burst directly on a freshly-acquired client was seen to
// fail intermittently with AlreadyClosedException (HDDS-16398).
ratisClient.sendCommandAsync(
ContainerTestHelper.getCreateContainerRequest(containerId, pipeline))
.getResponse().get();
CommitWatcher watcher = new CommitWatcher(bufferPool, ratisClient);
BlockID blockID = ContainerTestHelper.getTestBlockID(containerId);
List<XceiverClientReply> replies = new ArrayList<>();
long length = 0;
List<CompletableFuture<ContainerCommandResponseProto>>
futures = new ArrayList<>();
for (int i = 0; i < capacity; i++) {
// Use a distinct block per iteration; a real client never rewrites the
// same blockID and offset with different data.
BlockID blockID = ContainerTestHelper.getTestBlockID(containerId);
ContainerCommandRequestProto writeChunkRequest =
ContainerTestHelper
.getWriteChunkRequest(pipeline, blockID, CHUNK_SIZE);
Expand Down Expand Up @@ -223,13 +232,22 @@ public void testReleaseBuffersOnException() throws Exception {
try (XceiverClientSpi xceiverClient = mgr.acquireClient(pipeline)) {
assertEquals(1, xceiverClient.getRefcount());
XceiverClientRatis ratisClient = assertInstanceOf(XceiverClientRatis.class, xceiverClient);
// Commit one request synchronously before the async write burst so the
// Ratis client is fully established and the container already exists.
// Issuing the burst directly on a freshly-acquired client was seen to
// fail intermittently with AlreadyClosedException (HDDS-16398).
ratisClient.sendCommandAsync(
ContainerTestHelper.getCreateContainerRequest(containerId, pipeline))
.getResponse().get();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if leader election is really the cause here. In the DN logs from my run, the second WriteChunk failed with CHUNK_FILE_INCONSISTENCY after the first PutBlock closed the block file. The container was then marked UNHEALTHY, followed by pipeline closure. Would using a different blockID per iteration avoid this?

CommitWatcher watcher = new CommitWatcher(bufferPool, ratisClient);
BlockID blockID = ContainerTestHelper.getTestBlockID(containerId);
List<XceiverClientReply> replies = new ArrayList<>();
long length = 0;
List<CompletableFuture<ContainerCommandResponseProto>>
futures = new ArrayList<>();
for (int i = 0; i < capacity; i++) {
// Use a distinct block per iteration; a real client never rewrites the
// same blockID and offset with different data.
BlockID blockID = ContainerTestHelper.getTestBlockID(containerId);
ContainerCommandRequestProto writeChunkRequest =
ContainerTestHelper
.getWriteChunkRequest(pipeline, blockID, CHUNK_SIZE);
Expand Down