spring-projects / spring-projects/spring-data-couchbase

Support selecting and counting in parallel in SimpleCouchbaseRepository#findAll(Pageable pageable)

Open
#1,061 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.