Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`migrate(…)` ignores `MigrateOption` when using Lettuce

Open
#3,467 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 5 days

@CCCLL is already working on this.

Since Oct 14, 2026.

  • #3468 by @CCCLL — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
22/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
java, redis
Domain
databases

Research direction

Start in the Lettuce implementation of migrate(…) in LettuceServerCommands, which calls RedisKeyAsyncCommands::migrate without a MigrateOption. Compare it with JedisServerCommands, which applies options through MigrateParams, and check the DefaultClusterOperations.reshard(…) caller. Done means COPY and REPLACE reach Redis through Lettuce's MigrateArgs overload. Note that PR #3468 is already open against this issue, so review or extend that work rather than starting a parallel fix.

Written by the indexing model from the issue text.

Description

status: waiting-for-triage

LettuceServerCommands.migrate(…) does not pass the given MigrateOption to Lettuce:

connection.invoke().just(RedisKeyAsyncCommands::migrate, target.getRequiredHost(), target.getRequiredPort(), key,
		dbIndex, timeout);

Redis therefore receives a plain MIGRATE without COPY or REPLACE:

// key exists on the source instance only
connection.serverCommands().migrate(key, target, 0, MigrateOption.COPY, 1000);
// the key is removed from the source instance, expected it to be kept

// key exists on both instances
connection.serverCommands().migrate(key, target, 0, MigrateOption.REPLACE, 1000);
// fails with RedisSystemException: Error in execution, expected the key on the target instance to be replaced

For the REPLACE case, Redis replies with ERR Target instance replied with error: BUSYKEY Target key name already exists.

JedisServerCommands applies both options through MigrateParams since 4.1. Lettuce offers migrate(host, port, db, timeout, MigrateArgs), which sends the same command with COPY or REPLACE appended.

Reproduced on main against two Redis 8.6.2 instances. 3.5.x, 4.0.x and 4.1.x contain the same code; on 3.5.x and 4.0.x, JedisServerCommands does not apply the option either. Within the project, DefaultClusterOperations.reshard(…) is the only caller and passes MigrateOption.COPY, so it would send COPY with Lettuce as well after a fix. 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

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.

More from spring-projects/spring-data-redis

All issues in spring-projects/spring-data-redis

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.