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

Surendra Singh Lilhore commented on HDFS-14196:
-----------------------------------------------

Thanks [[email protected]].

{{bufferCount}} increment only in insert() method and immediately check the 
{{bufferCount}}. If it reached to buffer max size(500) then it will be changed 
to 0. {{ArrayIndexOutOfBoundsException}} came for 500 index. So it is not 
possible two thread can change the value.
{code:java}
  synchronized public void insert(long v) {
    buffer[bufferCount] = v;
    bufferCount++;

    count++;

    if (bufferCount == buffer.length) {
      insertBatch();
      compress();
    }
  }{code}
I though may be because of thread caching same value is not visible for all the 
thread for {{bufferCount}}. {{volatile}} can solve this problem.

Correct me if I am wrong :)

> ArrayIndexOutOfBoundsException in JN metrics makes JN out of sync
> -----------------------------------------------------------------
>
>                 Key: HDFS-14196
>                 URL: https://issues.apache.org/jira/browse/HDFS-14196
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Ranith Sardar
>            Assignee: Ranith Sardar
>            Priority: Major
>         Attachments: HDFS-14196.001.patch
>
>
> {{2018-11-26 21:55:39,100 | WARN | IPC Server handler 4 on 25012 | IPC Server 
> handler 4 on 25012, call 
> org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocol.journal from 
> 192.100.2.4:41622 Call#785140293 Retry#0 | Server.java:2334 
> java.lang.ArrayIndexOutOfBoundsException: 500 at 
> org.apache.hadoop.metrics2.util.SampleQuantiles.insert(SampleQuantiles.java:114)
>  at 
> org.apache.hadoop.metrics2.lib.MutableQuantiles.add(MutableQuantiles.java:130)
>  at 
> org.apache.hadoop.hdfs.qjournal.server.JournalMetrics.addSync(JournalMetrics.java:120)
>  at org.apache.hadoop.hdfs.qjournal.server.Journal.journal(Journal.java:400) 
> at 
> org.apache.hadoop.hdfs.qjournal.server.JournalNodeRpcServer.journal(JournalNodeRpcServer.java:153)
>  at 
> org.apache.hadoop.hdfs.qjournal.protocolPB.QJournalProtocolServerSideTranslatorPB.journal(QJournalProtocolServerSideTranslatorPB.java:158)
>  at 
> org.apache.hadoop.hdfs.qjournal.protocol.QJournalProtocolProtos$QJournalProtocolService$2.callBlockingMethod(QJournalProtocolProtos.java:2542}}



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to