[ 
https://issues.apache.org/jira/browse/HDDS-1782?focusedWorklogId=275280&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-275280
 ]

ASF GitHub Bot logged work on HDDS-1782:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Jul/19 10:37
            Start Date: 11/Jul/19 10:37
    Worklog Time Spent: 10m 
      Work Description: adoroszlai commented on pull request #1076: HDDS-1782. 
Add an option to MiniOzoneChaosCluster to read files multiple times. 
Contributed by Mukul Kumar Singh.
URL: https://github.com/apache/hadoop/pull/1076#discussion_r302474945
 
 

 ##########
 File path: 
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/chaos/TestProbability.java
 ##########
 @@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.ozone.chaos;
+
+import org.apache.commons.lang3.RandomUtils;
+
+/**
+ * Class to keep track of test probability.
+ */
+public class TestProbability {
+  private int pct;
+
+  private TestProbability(int pct) {
+    this.pct = pct;
+  }
+
+  public boolean isTrue() {
+    return (RandomUtils.nextInt() * pct / 100) == 1;
 
 Review comment:
   Can you please explain how this should work?
   
   I would assume that `pct = 100` means 100% probability, ie. it should always 
return `true`.  This requires `nextInt=1`, but `RandomUtils.nextInt()` returns 
values between 0 and `Integer.MAX_VALUE`, so it happens only with very low 
probability.  On the other hand, for `pct = 1` this returns `true` for any 
`nextInt` in `[100, 199]`, which has higher probability than for `pct  = 100`, 
but still lower than 1%.
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 275280)
    Time Spent: 20m  (was: 10m)

> Add an option to MiniOzoneChaosCluster to read files multiple times.
> --------------------------------------------------------------------
>
>                 Key: HDDS-1782
>                 URL: https://issues.apache.org/jira/browse/HDDS-1782
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>          Components: test
>    Affects Versions: 0.4.0
>            Reporter: Mukul Kumar Singh
>            Assignee: Mukul Kumar Singh
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Right now MiniOzoneChaosCluster writes a file/ reads it and deletes it 
> immediately. This jira proposes to add an option to read the file multiple 
> time in MiniOzoneChaosCluster.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to