3
我开始使用Amazon DynamoDB并且遇到查询问题。AWS错误代码:ValidationException,AWS错误消息:全局辅助索引不支持一致性读取
我有id作为主哈希键和三个全球次级索引的表Dev_Testgame1_Mail,
- fromPlayerId(哈希键)
- toPlayerId(哈希键)+ isRead(RANGE键)
- toPlayerId(散列键)+结束日期(RANGE键)
我上面的代码做了查询,
**DynamoDBMail hashKObject = new DynamoDBMail();
hashKObject.setToPlayerId(playerId);
Condition endDateRangeKeyCondition = new Condition();
//endDateRangeKeyCondition.withComparisonOperator(ComparisonOperator.NULL).withAttributeValueList(new AttributeValue().withB(Utils.convertDateToByteBuffer(DateUtil.getUtcDateTime())));
endDateRangeKeyCondition.withComparisonOperator(ComparisonOperator.NULL);
DynamoDBQueryExpression<DynamoDBMail> queryExpression = new DynamoDBQueryExpression<DynamoDBMail>();
queryExpression.withHashKeyValues(hashKObject).withRangeKeyCondition("endDate", endDateRangeKeyCondition);
queryExpression.withIndexName("gsi_tp_enddt").withLimit(pageSize).withScanIndexForward(false);
return dynamodbMapper.queryPage(DynamoDBMail.class, queryExpression, new DynamoDBMapperConfig(TableNameOverride.withTableNamePrefix(Utils.getDynamoDBTableNamePrefix(gameId, env))));**
而且我得到以下错误,
com.amazonaws.AmazonServiceException:状态代码:400,AWS服务:AmazonDynamoDBv2,AWS请求ID:GUUBV24K2O40T276R9NNN0EKB7VV4KQNSO5AEMVJF66Q9ASUAAJG,AWS错误代码:ValidationException,AWS错误消息:持续读在全球二级索引上不受支持
您对此问题的帮助非常感谢。
感谢 阿伦