redis/riot

Error when using `replicate` with `--show-diffs` option

samongyr-sq opened this issue · 2 comments

The tool (v3.0.3) outputs an error when using the replicate command with the --show-diffs option taken from this section of the documentation

$ riot <source> replicate <target> --show-diffs

Scanning 100% │██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████│ 113580/113580 (0:00:07 / 0:00:00) 16225.7/s
Verifying  93% │████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉        │ 105400/112899 (0:00:09 / 0:00:00) 11711.1/s >0 T0 ≠1 ⧗0
Encountered an error executing step verification in job snapshot-replication: class java.util.ArrayList cannot be cast to class java.util.Set (java.util.ArrayList and java.util.Set are in module java.base of loader 'bootstrap')

Version Info

$ riot --version

      ▀        █     ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 █ ██ █  ███  ████   ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 ██   █ █   █  █     ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 █    █ █   █  █     ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
 █    █  ███    ██   ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄  v3.0.3
$ java --version
openjdk 11.0.19 2023-04-18 LTS

Additional Logs

21:47:42.349 SEVERE org.springframework.batch.core.step.AbstractStep	: Encountered an error executing step verification in job snapshot-replication
org.springframework.batch.core.listener.StepListenerFailedException: Error in afterWrite.
	at org.springframework.batch.core.listener.MulticasterBatchListener.afterWrite(MulticasterBatchListener.java:271)
	at org.springframework.batch.core.step.item.SimpleChunkProcessor.doAfterWrite(SimpleChunkProcessor.java:175)
	at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:160)
	at org.springframework.batch.core.step.item.SimpleChunkProcessor.write(SimpleChunkProcessor.java:294)
	at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:217)
	at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:77)
	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:407)
	at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:331)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:273)
	at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:82)
	at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:375)
	at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
	at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:145)
	at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:258)
	at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:208)
	at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:152)
	at org.springframework.batch.core.job.AbstractJob.handleStep(AbstractJob.java:413)
	at org.springframework.batch.core.job.SimpleJob.doExecute(SimpleJob.java:136)
	at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:320)
	at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:149)
	at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
	at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:140)
	at com.redis.spring.batch.common.JobRunner.run(JobRunner.java:229)
	at com.redis.riot.cli.common.AbstractCommand.call(AbstractCommand.java:62)
	at com.redis.riot.cli.common.AbstractCommand.call(AbstractCommand.java:26)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at com.redis.riot.cli.common.RiotExecutionStrategy.execute(RiotExecutionStrategy.java:42)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at com.redis.riot.cli.Main.execute(Main.java:56)
	at com.redis.riot.cli.Main.main(Main.java:44)
Caused by: java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Set (java.util.ArrayList and java.util.Set are in module java.base of loader 'bootstrap')
	at com.redis.riot.core.KeyComparisonLogger.showSetDiff(KeyComparisonLogger.java:174)
	at com.redis.riot.core.KeyComparisonLogger.log(KeyComparisonLogger.java:56)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at java.base/java.util.Collections$UnmodifiableCollection.forEach(Collections.java:1085)
	at com.redis.riot.cli.common.KeyComparisonWriteListener.afterWrite(KeyComparisonWriteListener.java:30)
	at org.springframework.batch.core.listener.CompositeItemWriteListener.afterWrite(CompositeItemWriteListener.java:60)
	at org.springframework.batch.core.listener.MulticasterBatchListener.afterWrite(MulticasterBatchListener.java:268)
	... 36 more

21:47:42.350 INFO org.springframework.batch.core.step.AbstractStep	: Step: [verification] executed in 10s209ms
jruaux commented

Thanks for reporting this issue. Working on a fix.

jruaux commented

🎉 This issue has been resolved in v3.0.4 (Release Notes)