mongo4.2版本在查询业务方法上添加事务注解,导致查询超时中断。
如果把方法上事务注解去掉,查询是没问题的。代码如下:
@Transactional(rollbackFor = Exception.class) public XXX findByCode(String vid, String XX, String XXX, Integer XXX) { Query query = new Query();
应用的错误信息如下:
org.springframework.data.mongodb.UncategorizedMongoDbException: Query failed with error code 262 and error message ‘Encountered non-retryable error during query :: caused by :: operation was interrupted’ on server 47.112.22.220:27022; nested exception is com.mongodb.MongoQueryException: Query failed with error code 262 and error message ‘Encountered non-retryable error during query :: caused by :: operation was interrupted’ on server 47.112.22.220:27022
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:138)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2781)
at org.springframework.data.mongodb.core.MongoTemplate.executeFindOneInternal(MongoTemplate.java:2636)
at org.springframework.data.mongodb.core.MongoTemplate.doFindOne(MongoTemplate.java:2360)
at org.springframework.data.mongodb.core.MongoTemplate.findOne(MongoTemplate.java:776)
mongo服务端的错误信息如下:
Sun Mar 29 14:04:57.355 I COMMAND [conn43987] command XX.XXXXXX command: find { find: “XXXXXX “, filter: { codeInfo.codes.QCC.vid: “1”, codeInfo.codes.xxx.xxx: “61”, codeInfo.codes.xxx.tpid: “1000000000000000” }, limit: 1, singleBatch: true, $db: “hacher”, $clusterTime: { clusterTime: Timestamp(1585461803, 3), signature: { hash: BinData(0, 34F3577B41ACFE45BBBF05C52EE80E858A364C79), keyId: 6796153711417622557 } }, lsid: { id: UUID(“3a9b6f32-3321-4ccd-a5fe-625fc2eb3d45″) }, txnNumber: 2, startTransaction: true, autocommit: false } numYields:0 ok:0 errMsg:”Encountered non-retryable error during query :: caused by :: operation was interrupted” errName:ExceededTimeLimit errCode:262 reslen:304 protocol:op_msg 85722ms
没解决,感觉跟环境有关系,线上环境没这个问题。
请问解决了?我也碰到了