Skip to content

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

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

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions