Simple SELECT Query giving error

classic Classic list List threaded Threaded
2 messages Options
digitalchemist digitalchemist
Reply | Threaded
Open this post in threaded view
|

Simple SELECT Query giving error

This post was updated on .
##########################################################################################################################
@DAO
public String findByKey(String keyValue) {
        List<String> keyList = new ArrayList<>();
        keyList = this.igniteJdbcTemplate.query(
                        "SELECT KEY FROM SCHEMANAME.TABLE_NAME WHERE KEY =?"
,new Object[]{keyValue},(rs, i) -> rs.getString("KEY")
        );
        if(keyList != null && keyList.size() >0 )
                return keyList.get(0);
       
        return Strings.EMPTY;
}
##########################################################################################################################
@Service

@Override
@Transactional(transactionManager = "igniteTxManager")
public String findByKey(String key) {
        String keyValue = pairRepo.findByKey(key);
        return keyValue;
}
##########################################################################################################################
@Usage

void someMethod(String text1, String text2){
        String origPair = text1+text2;
        String flipPair = text2+text1;

        dbResponse = currencyPairService.findByCurrencyPair(origPair);
        LOG.info("{} Received from DB {}", origPair, dbResponse);

        if(StringUtils.isEmpty(dbResponse)) {
                flipResponse = currencyPairService.findByCurrencyPair(flipPair);
                LOG.info("Trying flip value for {} received from DB {} ", flipPair,
flipResponse);
        }
}
##########################################################################################################################
@Exception
org.springframework.jdbc.UncategorizedSQLException:
PreparedStatementCallback; uncategorized SQLException for SQL [SELECT KEY
FROM SCHEMANAME.PAIR WHERE KEY = ? ]; SQL state [50000]; error code [1];
javax.cache.CacheException: Failed to execute map query on remote node
[nodeId=e0840889-2ca4-431b-a123-f7f3548b6609, errMsg=Failed to execute SQL
query. General error: "class
org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException:
Runtime failure on lookup row: RowSimple [vals=['USDPLN', null, null,
'USDPLN', null]]"; SQL statement:
SELECT
__Z0.KEY __C0_0
FROM SCHEMANAME.TABLE_NAME __Z0
WHERE __Z0.KEY = ?1 [50000-197]]; nested exception is java.sql.SQLException:
javax.cache.CacheException: Failed to execute map query on remote node
[nodeId=e0840889-2ca4-431b-a123-f7f3548b6609, errMsg=Failed to execute SQL
query. General error: "class
org.apache.ignite.internal.processors.cache.persistence.tree.CorruptedTreeException:
Runtime failure on lookup row: RowSimple [vals=['XXXTTT', null, null,
'XXXTTT', null]]"; SQL statement:
SELECT
__Z0.KEY __C0_0
FROM SCHEMANAME.TABLE_NAME __Z0
WHERE __Z0.KEY = ?1 [50000-197]]
        at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:89)
        at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
        at
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)
        at
org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1442)
        at
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:632)
        at
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:668)
        at
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:699)
        at
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:711)
        at
org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:762)
        at com.xx.xxx.xx.Service.someMethod(ServiceDAO.java:47)

##########################################################################################################################

I am just Posting a SELECT request. The interesting part is if you see

dbResponse = currencyPairService.findByCurrencyPair(origPair);
LOG.info("{} Received from DB {}", origPair, dbResponse);

if(StringUtils.isEmpty(dbResponse)) {
        flipResponse = currencyPairService.findByCurrencyPair(flipPair);
        LOG.info("Trying flip value for {} received from DB {} ", flipPair,
flipResponse); }

I call two times the service, the first one works fine, and second one
throws exception




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/
akurbanov akurbanov
Reply | Threaded
Open this post in threaded view
|

Re: Simple SELECT Query giving error

Hello,

It looks like an index was damaged by some operation. What data types are
used in mentioned table (the ones that are null)? Were there any recent
changes to them?

Could you please pinpoint the exact Ignite version that you are using?

Also please share the full log for the cluster, looks like the exception is
only partially displayed in the log. Sharing small reproducer that can
steadily reproduce this behaviour would be perfect.

Best regards,
Anton



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/