Fix reduce range bug
This commit is contained in:
parent
dd11e24351
commit
fbf17c8650
@ -469,23 +469,22 @@ public class GrpcServer extends Server {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<FirstAndLast> reduceRangeFirstAndLast(GetRangeRequest request) {
|
public Mono<FirstAndLast> reduceRangeFirstAndLast(GetRangeRequest request) {
|
||||||
return executeSync(() -> {
|
var arena = Arena.ofAuto();
|
||||||
try (var arena = Arena.ofConfined()) {
|
return Mono.fromFuture(() -> asyncApi.reduceRangeAsync(arena, request.getTransactionId(), request.getColumnId(),
|
||||||
it.cavallium.rockserver.core.common.FirstAndLast<it.cavallium.rockserver.core.common.KV> firstAndLast
|
mapKeys(arena, request.getStartKeysInclusiveCount(), request::getStartKeysInclusive),
|
||||||
= api.reduceRange(arena,
|
mapKeys(arena, request.getEndKeysExclusiveCount(), request::getEndKeysExclusive),
|
||||||
request.getTransactionId(),
|
request.getReverse(),
|
||||||
request.getColumnId(),
|
RequestType.firstAndLast(),
|
||||||
mapKeys(arena, request.getStartKeysInclusiveCount(), request::getStartKeysInclusive),
|
request.getTimeoutMs()
|
||||||
mapKeys(arena, request.getEndKeysExclusiveCount(), request::getEndKeysExclusive),
|
)).map(firstAndLast -> {
|
||||||
request.getReverse(),
|
var resultBuilder = FirstAndLast.newBuilder();
|
||||||
RequestType.firstAndLast(),
|
if (firstAndLast.first() != null) {
|
||||||
request.getTimeoutMs()
|
resultBuilder.setFirst(unmapKV(firstAndLast.first()));
|
||||||
);
|
|
||||||
return FirstAndLast.newBuilder()
|
|
||||||
.setFirst(unmapKV(firstAndLast.first()))
|
|
||||||
.setLast(unmapKV(firstAndLast.last()))
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
if (firstAndLast.last() != null) {
|
||||||
|
resultBuilder.setLast(unmapKV(firstAndLast.last()));
|
||||||
|
}
|
||||||
|
return resultBuilder.build();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user