Skip to content

Repository Pattern - findAll pagination returns inconsistent result with redis read replicas #3174

Open
@sureshkmit

Description

@sureshkmit

Sample Usage:

    Example entity = Example.of(entityAttributes);
    final Pageable pageable = Pageable.ofSize(pageSize).withPage(pageNumber);
    return repository.findAll(entity, pageable);

Redis set data type doesn't guarantee the element order when retrieved from replica. As the keys returned by the findKeys method in RedisQueryEngine are not ordered, it causes issues when applying subList for pagination, especially with Redis read replicas. To ensure consistent pagination, the list of keys should be sorted before sublisting.

RedisQueryEngine.java#L118

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions