You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "BELUGA BEHR (JIRA)" <ji...@apache.org> on 2019/02/03 02:27:00 UTC

[jira] [Comment Edited] (HBASE-19616) Review of LogCleaner Class

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

BELUGA BEHR edited comment on HBASE-19616 at 2/3/19 2:26 AM:
-------------------------------------------------------------

{code:java}
        while (!setFromCleaner) {
          long startTimeNanos = System.nanoTime();
          wait(waitIfNotFinished);
          totalTimeMsec += TimeUnit.MILLISECONDS.convert(System.nanoTime() - startTimeNanos,
              TimeUnit.NANOSECONDS);
          if (totalTimeMsec >= timeoutMsec) {
            LOG.warn("Spend too much time " + totalTimeMsec + " ms to delete oldwals " + target);
            return result;
          }
        }
{code}
Used a [CountDownLatch|https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html] to replace a bunch of the existing code. It currently loops with a 500ms interval to check if some sort of condition has been met until the amount of time spent looping is greater than some timeout value. Using a {{CountDownLatch}} allows one or more threads to wait until a set of operations being performed in other threads completes. It will not blindly sleep between checks and it will return immediately after the condition is met. This removes the HBase configuration that controls the sleep interval.

 

I also cleaned up the unit tests a bit and enhanced the logging of this class to ease troubleshooting.


was (Author: belugabehr):
{code:java}
        while (!setFromCleaner) {
          long startTimeNanos = System.nanoTime();
          wait(waitIfNotFinished);
          totalTimeMsec += TimeUnit.MILLISECONDS.convert(System.nanoTime() - startTimeNanos,
              TimeUnit.NANOSECONDS);
          if (totalTimeMsec >= timeoutMsec) {
            LOG.warn("Spend too much time " + totalTimeMsec + " ms to delete oldwals " + target);
            return result;
          }
        }
{code}
Used a [CountDownLatch|https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CountDownLatch.html] to replace a bunch of the existing code. It currently loops with a 500ms interval to check if some sort of condition has been met until the amount of time spent looping is greater than some timeout value. Using a {{CountDownLatch}} allows one or more threads to wait until a set of operations being performed in other threads completes. It will not blindly sleep between checks and it will return immediately after the condition is met. This removes the HBase configuration that controls the sleep interval.

 

I also cleaned up the unit tests a bit

> Review of LogCleaner Class
> --------------------------
>
>                 Key: HBASE-19616
>                 URL: https://issues.apache.org/jira/browse/HBASE-19616
>             Project: HBase
>          Issue Type: Improvement
>    Affects Versions: 3.0.0
>            Reporter: BELUGA BEHR
>            Assignee: BELUGA BEHR
>            Priority: Trivial
>         Attachments: HBASE-19616.1.patch, HBASE-19616.2.patch
>
>
> * Parameterize logging
> * Remove compiler-reported dead code to re-enabling useful logging
> * Use ArrayList instead of LinkedList



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)