iotdb icon indicating copy to clipboard operation
iotdb copied to clipboard

[IOTDB-4358] set read consistency level to 'weak', quey SimpleFragmentParallelPlanner may exist out of bounds exception

Open BanDuWuZi opened this issue 3 years ago • 5 comments

set read consistency level to 'weak', quey SimpleFragmentParallelPlanner may exist out of bounds exception see: https://issues.apache.org/jira/browse/IOTDB-4358

BanDuWuZi avatar Sep 07 '22 09:09 BanDuWuZi

Can we see the log like available replicas: before the exception occurs ?

xingtanzjr avatar Sep 07 '22 10:09 xingtanzjr

Can we see the log like available replicas: before the exception occurs ?

there 3 available datanode: java.lang.IndexOutOfBoundsException: Index: -2, Size: 3 (https://issues.apache.org/jira/browse/IOTDB-4358 exception info), I will find the detail log later. the reason of the issue is that the generated sessionId is negative , so [queryContext.getSession().getSessionId() % availableDataNodes.size()] is negative.

BanDuWuZi avatar Sep 07 '22 10:09 BanDuWuZi

Can we see the log like available replicas: before the exception occurs ?

there 3 available datanode: java.lang.IndexOutOfBoundsException: Index: -2, Size: 3 (https://issues.apache.org/jira/browse/IOTDB-4358 exception info), I will find the detail log later. the reason of the issue is that the generated sessionId is negative , so [queryContext.getSession().getSessionId() % availableDataNodes.size()] is negative.

Yes, your analysis is correct. But...it is wired that we got an index -2 because the sessionId is always positive and the value of mod operation should be in [0, 2]. Why did we got a -2 here ? Thus I want to know the detailed log here

xingtanzjr avatar Sep 08 '22 07:09 xingtanzjr

Can we see the log like available replicas: before the exception occurs ?

there 3 available datanode: java.lang.IndexOutOfBoundsException: Index: -2, Size: 3 (https://issues.apache.org/jira/browse/IOTDB-4358 exception info), I will find the detail log later. the reason of the issue is that the generated sessionId is negative , so [queryContext.getSession().getSessionId() % availableDataNodes.size()] is negative.

Yes, your analysis is correct. But...it is wired that we got an index -2 because the sessionId is always positive and the value of mod operation should be in [0, 2]. Why did we got a -2 here ? Thus I want to know the detailed log here

The session ID cannot be automatically incremented. It should be secure random number . In the case of a secure random number, a negative number appears. We're using a secure random number.

wangchao316 avatar Sep 08 '22 11:09 wangchao316

Can we see the log like available replicas: before the exception occurs ?

there 3 available datanode: java.lang.IndexOutOfBoundsException: Index: -2, Size: 3 (https://issues.apache.org/jira/browse/IOTDB-4358 exception info), I will find the detail log later. the reason of the issue is that the generated sessionId is negative , so [queryContext.getSession().getSessionId() % availableDataNodes.size()] is negative.

Yes, your analysis is correct. But...it is wired that we got an index -2 because the sessionId is always positive and the value of mod operation should be in [0, 2]. Why did we got a -2 here ? Thus I want to know the detailed log here

there is a sample code ` // if the current id is (Long.MAX_VALUE - 10)

    AtomicLong ge = new AtomicLong(Long.MAX_VALUE - 10);
    System.out.println(Long.MAX_VALUE);
    long idd;
    while (true) {
        idd = ge.incrementAndGet();
        if (idd < 0) {
            System.out.println("idd < 0: " + idd);
            break;
        }
    }

` the result is : idd < 0: -9223372036854775808 because of long type overflow

BanDuWuZi avatar Sep 08 '22 11:09 BanDuWuZi