`RedisList.putFirst(…)` adds the element at the tail of the list
Maintainers usually reply within 5 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 30/100
Research direction
The bug is in DefaultRedisList.putFirst(…), which delegates to add(…) and so appends with RPUSH; compare it with addFirst(…), offerFirst(…) and push(…) in the same class to see how the front insertion is done. The existing testPutFirst() in AbstractRedisListIntegrationTests calls testAdd() and never exercises putFirst(…), so it needs a real assertion. Done means putFirst puts the element at the head and reversed().putLast(…) gives the expected order. A linked pull request (#3465) is already open, so check it before starting.
Written by the indexing model from the issue text.
Description
DefaultRedisList.putFirst(…) delegates to add(…), which appends the element with RPUSH:
public void putFirst(E element) {
add(element);
}
BlockingDeque.putFirst(…) inserts the element at the front of the deque, like addFirst(…), offerFirst(…) and push(…) of DefaultRedisList do:
RedisList<String> list = RedisList.create("list", template); // [1, 2]
list.putFirst("0"); // [1, 2, 0], expected [0, 1, 2]
The view returned by RedisList.reversed() implements putLast(…) through putFirst(…) of the underlying list, so it is affected as well:
RedisList<String> reversed = list.reversed(); // [2, 1]
reversed.putLast("0"); // [0, 2, 1], expected [2, 1, 0]
Reproduced on main against Redis 8.6.2 with Lettuce and Jedis. The method has delegated to add(…) since RedisList became a BlockingDeque, so 3.5.x, 4.0.x and 4.1.x contain the same code. The existing testPutFirst() in AbstractRedisListIntegrationTests calls testAdd() and never invokes putFirst(…), so the behavior is not covered by a test. I will submit a PR with a fix and tests.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing 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.
More from spring-projects/spring-data-redis
-
DefaultRedisList.get(int) does not reject an index equal to the list sizePossibly taken @ryujungkyun claimed this today. Openstatus: waiting-for-triage
Difficulty 1/5 Under an hour Newbie friendliness 68/100
spring-projects/spring-data-redis#3471 ·
Maintainers usually reply within 5 days
-
`RedisList.reversed()` view returns an empty `range` and `trim` removes all elementsPossibly taken @CCCLL claimed this 2 days ago. Openstatus: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
spring-projects/spring-data-redis#3461 ·
Maintainers usually reply within 5 days
-
PathIndexResolver iterates byte[] element-by-element, causing O(n) overheadPossibly taken @zemiles claimed this 2 days ago. Openstatus: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
spring-projects/spring-data-redis#3460 ·
Maintainers usually reply within 5 days
-
`migrate(…)` ignores `MigrateOption` when using LettucePossibly taken @CCCLL claimed this 1 day ago. Openstatus: waiting-for-triage
Difficulty 2/5 1-3 hours Newbie friendliness 22/100
spring-projects/spring-data-redis#3467 ·
Maintainers usually reply within 5 days
-
Asynchronous Redis cache writes ignore failed lock acquisition and delete an existing lockPossibly taken @mp911de claimed this 10 days ago. Opentype: bug
Difficulty 4/5 3-5 days Newbie friendliness 25/100
spring-projects/spring-data-redis#3450 · 1 assignee ·
Maintainers usually reply within 5 days
All issues in spring-projects/spring-data-redis
Similar issues
-
agent-java community triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
elastic/apm-agent-java#4594 ·
Maintainers usually reply within 1 day
-
area/plugin good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
kestra-io/plugin-soda#137 ·
-
area/plugin good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
kestra-io/plugin-aws#816 ·
Maintainers usually reply within 2 days
-
area/plugin good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kestra-io/plugin-kestra#200 ·
Maintainers usually reply within 1 day
-
bug untriaged
Difficulty 1/5 Under an hour Newbie friendliness 92/100
opensearch-project/search-relevance#618 ·
Maintainers usually reply within 3 days