You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Stephen O'Donnell (Jira)" <ji...@apache.org> on 2021/10/04 10:41:00 UTC

[jira] [Created] (HDFS-16252) Correct docs for dfs.http.client.retry.policy.spec

Stephen O'Donnell created HDFS-16252:
----------------------------------------

             Summary: Correct docs for dfs.http.client.retry.policy.spec 
                 Key: HDFS-16252
                 URL: https://issues.apache.org/jira/browse/HDFS-16252
             Project: Hadoop HDFS
          Issue Type: Improvement
            Reporter: Stephen O'Donnell
            Assignee: Stephen O'Donnell


The hdfs-default doc for dfs.http.client.retry.policy.spec is incorrect, as it has the wait time and retries switched around in the descriptio. Also, the doc for dfs.client.retry.policy.spec is not present and should be the same as for dfs.http.client.retry.policy.spec.

The code shows the timeout is first and then the number of retries:

{code}
    String  POLICY_SPEC_KEY = PREFIX + "policy.spec";
    String  POLICY_SPEC_DEFAULT = "10000,6,60000,10"; //t1,n1,t2,n2,...


    // In RetryPolicies.java, we can see it gets the timeout as the first in the pair


   /**
     * Parse the given string as a MultipleLinearRandomRetry object.
     * The format of the string is "t_1, n_1, t_2, n_2, ...",
     * where t_i and n_i are the i-th pair of sleep time and number of retries.
     * Note that the white spaces in the string are ignored.
     *
     * @return the parsed object, or null if the parsing fails.
     */
    public static MultipleLinearRandomRetry parseCommaSeparatedString(String s) {
      final String[] elements = s.split(",");
      if (elements.length == 0) {
        LOG.warn("Illegal value: there is no element in \"" + s + "\".");
        return null;
      }
      if (elements.length % 2 != 0) {
        LOG.warn("Illegal value: the number of elements in \"" + s + "\" is "
            + elements.length + " but an even number of elements is expected.");
        return null;
      }

      final List<RetryPolicies.MultipleLinearRandomRetry.Pair> pairs
          = new ArrayList<RetryPolicies.MultipleLinearRandomRetry.Pair>();
   
      for(int i = 0; i < elements.length; ) {
        //parse the i-th sleep-time
        final int sleep = parsePositiveInt(elements, i++, s);
        if (sleep == -1) {
          return null; //parse fails
        }

        //parse the i-th number-of-retries
        final int retries = parsePositiveInt(elements, i++, s);
        if (retries == -1) {
          return null; //parse fails
        }

        pairs.add(new RetryPolicies.MultipleLinearRandomRetry.Pair(retries, sleep));
      }
      return new RetryPolicies.MultipleLinearRandomRetry(pairs);
  }
{code}

This change simply updates the docs.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org