You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "duongkame (via GitHub)" <gi...@apache.org> on 2023/05/31 01:20:20 UTC

[GitHub] [ozone] duongkame commented on a diff in pull request #4772: HDDS-8693. Generate linear keys for freon ockrw

duongkame commented on code in PR #4772:
URL: https://github.com/apache/ozone/pull/4772#discussion_r1210985106


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OzoneClientKeyReadWriteOps.java:
##########
@@ -229,15 +236,20 @@ public TaskType decideReadOrWriteTask() {
 
   public String getKeyName() {
     StringBuilder keyNameSb = new StringBuilder();
-    int randomIdxWithinRange = ThreadLocalRandom.current().
-            nextInt(startIndex, startIndex + range);
+    int next;
+    if (linear) {
+      next = nextNumber.getAndUpdate(x -> (x + 1) % (startIndex + range + 1));

Review Comment:
   Does this result in a number in the range of `[0, startIndex + range]`, while we actually want a sequential cursor in the range [startIndex, range)?
   
   If that's true, something like the below could work
   ```
      next = nextNumber.increaseAndGet() % range + startIndex;
   ```



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org