Skip to content

Commit

Permalink
[#2259] fix(server) dataLength of ShuffleBufferWithLinkedList not cle…
Browse files Browse the repository at this point in the history
…ar after toFlushEvent (#2260)

Co-authored-by: wenlongwlli <[email protected]>

### What changes were proposed in this pull request?
The private variable dataLength of ShuffleBufferWithLinkedList will be cleared after toFlushEvent.

### Why are the changes needed?
The private variable dataLength of ShuffleBufferWithLinkedList not be cleared after toFlushEvent.

Fix: #2259 

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?
Tested by UT.
  • Loading branch information
lwllvyb authored Nov 25, 2024
1 parent ab1d3ae commit 54611f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public synchronized ShuffleDataFlushEvent toFlushEvent(
blocks = new LinkedHashSet<>();
inFlushSize.addAndGet(encodedLength);
encodedLength = 0;
dataLength = 0;
return event;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public void toFlushEventTest() {
assertEquals(42, shuffleBuffer.getEncodedLength());
event = shuffleBuffer.toFlushEvent("appId", 0, 0, 1, null);
assertEquals(42, event.getEncodedLength());
assertEquals(10, event.getDataLength());
shuffleBuffer.append(createData(10));
event = shuffleBuffer.toFlushEvent("appId", 0, 0, 1, null);
assertEquals(42, event.getEncodedLength());
assertEquals(10, event.getDataLength());
assertEquals(0, shuffleBuffer.getEncodedLength());
assertEquals(0, shuffleBuffer.getBlocks().size());
}
Expand Down

0 comments on commit 54611f3

Please sign in to comment.