This is an automated email from the ASF dual-hosted git repository.
zuston pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new 3326272a2 [MINOR] fix: Get and increment ATOMIC_LONG in that order
everywhere (#1496)
3326272a2 is described below
commit 3326272a2b8a978a8ba716805167cf84e036b5ec
Author: Enrico Minack <[email protected]>
AuthorDate: Thu Feb 1 02:25:47 2024 +0100
[MINOR] fix: Get and increment ATOMIC_LONG in that order everywhere (#1496)
### What changes were proposed in this pull request?
Make `ShuffleReadClientImplTest.writeDuplicatedData` call
`ATOMIC_LONG.getAndIncrement`, rather than `ATOMIC_LONG.incrementAndGet`.
### Why are the changes needed?
In `ShuffleReadClientImplTest`
- method `writeTestData` calls `ATOMIC_LONG.getAndIncrement()`
- method `writeDuplicatedData` calls `ATOMIC_LONG.incrementAndGet()`
Calling `writeTestData` after `writeDuplicatedData` produces a duplicate
sequence number, which is unexpected. All code paths in
`ShuffleReadClientImplTest` that increment `ATOMIC_LONG` should use the same
order of get and increment.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Manually.
---
.../java/org/apache/uniffle/client/impl/ShuffleReadClientImplTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/client/src/test/java/org/apache/uniffle/client/impl/ShuffleReadClientImplTest.java
b/client/src/test/java/org/apache/uniffle/client/impl/ShuffleReadClientImplTest.java
index 1b19ef084..14e9af91a 100644
---
a/client/src/test/java/org/apache/uniffle/client/impl/ShuffleReadClientImplTest.java
+++
b/client/src/test/java/org/apache/uniffle/client/impl/ShuffleReadClientImplTest.java
@@ -611,7 +611,7 @@ public class ShuffleReadClientImplTest extends
HadoopTestBase {
byte[] buf = new byte[length];
new Random().nextBytes(buf);
long blockId =
- (ATOMIC_LONG.incrementAndGet()
+ (ATOMIC_LONG.getAndIncrement()
<< (Constants.PARTITION_ID_MAX_LENGTH +
Constants.TASK_ATTEMPT_ID_MAX_LENGTH))
+ taskAttemptId;
ShufflePartitionedBlock spb =