You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Bo Cui (JIRA)" <ji...@apache.org> on 2019/01/15 03:36:00 UTC

[jira] [Created] (HBASE-21721) reduce write#syncs() times

Bo Cui created HBASE-21721:
------------------------------

             Summary: reduce write#syncs() times
                 Key: HBASE-21721
                 URL: https://issues.apache.org/jira/browse/HBASE-21721
             Project: HBase
          Issue Type: Improvement
    Affects Versions: 2.1.1, 1.3.1
            Reporter: Bo Cui


the number of write#syncs can be reduced by updating the highestUnsyncedSequence:
before write#sync(), get the current highestUnsyncedSequence 
after write#sync, highestSyncedSequence=highestUnsyncedSequence

 
{code:title=FSHLog.java|borderStyle=solid}
// Some comments here
public void run()
{
    long currentSequence;
      while (!isInterrupted()) {
        int syncCount = 0;

        try {
          while (true) {
            ...
          try {
            Trace.addTimelineAnnotation("syncing writer");
            long unSyncedFlushSeq = highestUnsyncedSequence;
            writer.sync();
            Trace.addTimelineAnnotation("writer synced");
            if( unSyncedFlushSeq > currentSequence ) currentSequence = unSyncedFlushSeq;
            currentSequence = updateHighestSyncedSequence(currentSequence);
          } catch (IOException e) {
            LOG.error("Error syncing, request close of WAL", e);
            lastException = e;
          } catch (Exception e) {
           ...
    }
}
{code}

Add code
 long unSyncedFlushSeq = highestUnsyncedSequence;
 if( unSyncedFlushSeq > currentSequence ) currentSequence = unSyncedFlushSeq;



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