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

Chinmay Kulkarni commented on ZOOKEEPER-2662:
---------------------------------------------

[~eribeiro] are you still working on this JIRA? Your diff seems to solve the 
issue. I have added a test inside {{FileTxnSnapLogTest.java}} to check that 
{{syncElapsedTime}} is updated. The test is as follows:

{code:title=FileTxnSnapLogTest.java|borderStyle=solid} 
    @Test
    public void testGetTxnLogSyncElapsedTime() throws IOException {
        File tmpDir = ClientBase.createEmptyTestDir();
        FileTxnSnapLog fileTxnSnapLog = new FileTxnSnapLog(new File(tmpDir, 
"data"), 
            new File(tmpDir, "data_txnlog"));

        TxnHeader hdr = new TxnHeader(1, 1, 1, 1, ZooDefs.OpCode.setData);
        Record txn = new SetDataTxn("/foo", new byte[0], 1);
        Request req = new Request(0, 0, 0, hdr, txn, 0);
        fileTxnSnapLog.append(req);
        fileTxnSnapLog.commit();
        long syncElapsedTime = fileTxnSnapLog.getTxnLogElapsedSyncTime();
        Assert.assertNotEquals("Did not update syncElapsedTime!", -1L, 
syncElapsedTime);
    }
{code}

[~apurtell] Is this sufficient to test the changes?

> Export a metric for txn log sync times
> --------------------------------------
>
>                 Key: ZOOKEEPER-2662
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2662
>             Project: ZooKeeper
>          Issue Type: Improvement
>            Reporter: Andrew Purtell
>            Assignee: Edward Ribeiro
>         Attachments: ZOOKEEPER-2662.diff
>
>
> In FileTxnLog there is code that records the amount of time required to fsync 
> the txn log in order to warn if that time exceeds a configurable threshold. 
> This information should also be exported as a metric available by JMX so an 
> important aspect of quorum performance can be monitored. 
> ZooKeeperServerMXBean carries some global latency information for the server 
> process already, seems like a good place to put it if not an entirely new 
> bean for the TxnLog. After ZOOKEEPER-2310 might want to collect the same 
> information for snapshots. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to