peterxcli commented on code in PR #11348:
URL: https://github.com/apache/ozone/pull/11348#discussion_r4152455439
##########
hadoop-hdds/client/src/test/java/org/apache/hadoop/hdds/scm/storage/PositionedReadTestHelper.java:
##########
@@ -60,7 +60,8 @@ public static void runConcurrentPositionedReads(byte[] source,
final int threadId = t;
futures.add(pool.submit((Callable<Void>) () -> {
for (int i = 0; i < ITERATIONS; i++) {
- int offset = (threadId * 1000 + i * 17) % (source.length -
BUFFER_SIZE);
+ int offset = (int) (((long) threadId * source.length /
THREAD_COUNT + i * 17L)
+ % (source.length - BUFFER_SIZE));
Review Comment:
The old formula read only the first 13 KiB of a 512 KiB source, and the new
formula reads more chunks and parts.
```
OLD · 512 KiB source
T0 T1 T2 T3 T4 T5 T6 T7
\ \ \ \ / / / /
↓
+---------+-------------------------------------------------------------------------------+
| READS |
|
+---------+-------------------------------------------------------------------------------+
0 12,779 B
512 KiB
NEW · 512 KiB source
T0 T1 T2 T3 T4 T5
T6 T7
↓ ↓ ↓ ↓ ↓ ↓
↓ ↓
+-----------------------------------------------------------------------------------------------+
| [===] [===] [===] [===] [===] [===]
[===] [===] |
+-----------------------------------------------------------------------------------------------+
0 64 128 192 256 320
384 448 512 KiB
ONE THREAD · 100 reads · 4,096 bytes/read
start offset end
offset
│ │
Read 0 +0 B ├───────────────── 4,096 B ──────────────────────────┤
+4,096 B
Read 1 +17 B ├───────────────── 4,096 B
──────────────────────────┤ +4,113 B
Read 2 +34 B ├───────────────── 4,096 B
──────────────────────────┤ +4,130 B
⋮
Read 99 +1,683 B ├───────────────── 4,096 B
──────────────────────────┤ +5,779 B
│
│
└──────────────── [===] = 5,779 B
─────────────────────────────┘
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]