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

ASF GitHub Bot commented on TEPHRA-243:
---------------------------------------

Github user poornachandra commented on a diff in the pull request:

    https://github.com/apache/incubator-tephra/pull/53#discussion_r138723289
  
    --- Diff: 
tephra-core/src/main/java/org/apache/tephra/persist/AbstractTransactionLog.java 
---
    @@ -85,44 +99,20 @@ public long getTimestamp() {
     
       @Override
       public void append(TransactionEdit edit) throws IOException {
    -    long startTime = System.nanoTime();
    -    synchronized (this) {
    -      ensureAvailable();
    -
    -      Entry entry = new Entry(new 
LongWritable(logSequence.getAndIncrement()), edit);
    -
    -      // add to pending edits
    -      append(entry);
    -    }
    -
    -    // wait for sync to complete
    -    sync();
    -    long durationMillis = (System.nanoTime() - startTime) / 1000000L;
    -    if (durationMillis > SLOW_APPEND_THRESHOLD) {
    -      LOG.info("Slow append to log " + getName() + ", took " + 
durationMillis + " msec.");
    -    }
    +    append(Collections.singletonList(edit));
       }
     
       @Override
       public void append(List<TransactionEdit> edits) throws IOException {
    -    long startTime = System.nanoTime();
    -    synchronized (this) {
    +    // synchronizing here ensures that elements in the queue are ordered 
by seq number
    +    synchronized (logSequence) {
           ensureAvailable();
    --- End diff --
    
    `ensureAvailable()` can move out of the synchronized block since it uses a 
couple of volatile variables and calls  a synchronized method `init()`


> When transaction log sync is slow, the warning message should contain more 
> information
> --------------------------------------------------------------------------------------
>
>                 Key: TEPHRA-243
>                 URL: https://issues.apache.org/jira/browse/TEPHRA-243
>             Project: Tephra
>          Issue Type: Improvement
>    Affects Versions: 0.12.0-incubating
>            Reporter: Andreas Neumann
>            Assignee: Andreas Neumann
>             Fix For: 0.13.0-incubating
>
>
> Currently we get this message:
> {noformat}
> 2017-08-12 00:59:46,938 - INFO 
> [TTransactionServer-rpc-857:o.a.t.p.AbstractTransactionLog@102] - Slow append 
> to log txlog.1502517541689, took 1431 msec.
> {noformat}
> It would be more useful to know how many bytes were written, how many edits 
> were in this sync. 



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

Reply via email to