Skip to content

Commit 927cb4b

Browse files
committed
feedback review.
1 parent 0413eb3 commit 927cb4b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/SequentialBlockGroupIdGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class SequentialBlockGroupIdGenerator extends SequentialNumber {
5151
}
5252

5353
@Override // NumberGenerator
54-
synchronized public long nextValue() {
54+
public synchronized long nextValue() {
5555
skipTo((getCurrentValue() & ~BLOCK_GROUP_INDEX_MASK) + MAX_BLOCKS_IN_GROUP);
5656
// Make sure there's no conflict with existing random block IDs
5757
final Block b = new Block(getCurrentValue());

hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestSequentialBlockGroupId.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,9 @@ public void testBlockGroupIdThreadSafety() throws Exception {
203203
Set<Long> allBlockIds = new HashSet<>();
204204
for (List<Long> set : blockIds) {
205205
for (long id : set) {
206-
if (allBlockIds.contains(id)) {
206+
if (!allBlockIds.add(id)) {
207207
fail("Same block group id is generated!");
208208
}
209-
allBlockIds.add(id);
210209
}
211210
}
212211
}

0 commit comments

Comments
 (0)