spring-projects / spring-projects/spring-data-couchbase
Support selecting and counting in parallel in SimpleCouchbaseRepository#findAll(Pageable pageable)
Open
Nobody has claimed this yet.
status: waiting-for-triage
- Dominant language
- Java
- Stars
- 284
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
We use something like this in our custom base repository:
final Mono<Long> totalCount = getReactiveCouchbaseOperations().findByQuery(getEntityInformation().getJavaType())
.withConsistency(buildQueryScanConsistency())
.matching(new Query().with(pageable))
.count();
final Mono<List<T>> pageContents = getReactiveCouchbaseOperations().findByQuery(getEntityInformation().getJavaType())
.withConsistency(buildQueryScanConsistency())
.matching(new Query().with(pageable))
.all()
.collectList();
// zip the two queries together to return the requested Page
return Mono.zip(pageContents, totalCount, (list, count) -> new PageImpl<T>(list, pageable, count))
.block();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at SimpleCouchbaseRepository#findAll(Pageable pageable) and compare its current paging behavior with the two reactive queries shown in the issue. Check how the repository creates the page contents and total count, then verify that both results are combined into the requested Page without blocking each operation separately.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100