hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedict Jin (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-18470) `RetriesExhaustedWithDetailsException#getDesc` describe is not right
Date Wed, 02 Aug 2017 01:18:00 GMT

    [ https://issues.apache.org/jira/browse/HBASE-18470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16110091#comment-16110091
] 

Benedict Jin commented on HBASE-18470:
--------------------------------------

Hi, [~tedyu]. Thank you for comment. Sure, skipping add comma is a good solution and i tried
it in the beginning. But i changed my mind after some performance tests that seems `substring`
solution is always faster than `skipping add comma`. Details is here: 

```java
/*
JVM: -ea -Xmx512M -Xms512M -Xmn128M -XX:+AlwaysPreTouch
Time: 0.023948 ms
Time: 0.012752 ms
  */
@Test
public void testStringBuilder() {
    Set<String> uniqAddr = new HashSet<>();
    StringBuilder addrs = new StringBuilder();
    long begin, performanceTime;
    {
        uniqAddr.add("a");
        uniqAddr.add("b");
        uniqAddr.add("c");
        begin = System.nanoTime();
        int count = 0, addrLen = uniqAddr.size();
        for (String addr : uniqAddr) {
            addrs.append(addr);
            count++;
            if (count != addrLen) {
                addrs.append(", ");
            }
        }
        String withoutTail = addrs.toString();
        performanceTime = System.nanoTime() - begin;
        _log.info("Time: {} ms", performanceTime * Math.pow(10, -6));
        assertEquals("a, b, c", withoutTail);
    }
    {
        addrs = new StringBuilder();
        uniqAddr.clear();
        uniqAddr.add("a");
        uniqAddr.add("b");
        uniqAddr.add("c");
        begin = System.nanoTime();
        for (String addr : uniqAddr) {
            addrs.append(addr).append(", ");
        }
        String withoutTail = uniqAddr.size() > 0 ? addrs.substring(0, addrs.length() -
2) : addrs.toString();
        performanceTime = System.nanoTime() - begin;
        _log.info("Time: {} ms", performanceTime * Math.pow(10, -6));
        assertEquals("a, b, c", withoutTail);
        assertEquals("a, b, c", uniqAddr.size() > 0 ?
                addrs.delete(addrs.length() - 2, addrs.length()).toString() : addrs.toString());
    }
}
```

(Full code: https://github.com/asdf2014/yuzhouwan/blob/master/yuzhouwan-hacker/src/test/java/com/yuzhouwan/hacker/algorithms/collection/StringTest.java#L38)

> `RetriesExhaustedWithDetailsException#getDesc` describe is not right
> --------------------------------------------------------------------
>
>                 Key: HBASE-18470
>                 URL: https://issues.apache.org/jira/browse/HBASE-18470
>             Project: HBase
>          Issue Type: Bug
>          Components: Client
>            Reporter: Benedict Jin
>            Assignee: Benedict Jin
>         Attachments: HBASE-18470.master.001.patch
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> The describe from `RetriesExhaustedWithDetailsException#getDesc` is `
> org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException: Failed 3 actions:
FailedServerException: 3 times, `, there is a not need ', ' in the tail.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message