Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KeyValue and EvaluationContext args to compare #156

Closed
wants to merge 1 commit into from

Conversation

Richardds
Copy link

@Richardds Richardds commented Sep 14, 2024

Problem Statement:
The current compare command in Redis RIOT does not support specifying key/value processing arguments, such as --key-proc, when performing an on-demand comparison. This limits the ability to replicate the same key transformations that are automatically applied during the replication process (e.g., prefixing keys with --key-proc "yourprefix:#{key}" argument).

While the automatic comparison after each replicate scan cycle correctly respects these transformations, the on-demand compare command lacks the capability to apply them, which prevents users from comparing data in the same way as they would during replication.

Proposed Solution:
This PR introduces support for key/value processing arguments (e.g., --key-proc) to the on-demand compare command using the same KeyValueProcessorArgs as in replicate command. This ensures that users can apply the same transformations during ad-hoc comparisons as they can during the replication process, maintaining consistent behavior between automatic and on-demand comparisons.

Benefits:

  • Feature Parity: Aligns the on-demand compare command with the automatic compare performed after each scan cycle.
  • Flexibility: Enables users to run ad-hoc comparisons with the same key/value transformation options used during replication.
  • Improved Workflow: Helps users verify and debug key manipulations more easily, especially for complex scenarios where keys or values are dynamically transformed during replication.

Use Case:
For example, when replicating keys and prefixing them (e.g., with --key-proc "yourprefix:#{key}" argument), users cannot currently perform an accurate on-demand comparison because the transformations are not applied in the compare command. This PR resolves that limitation by enabling key/value processing arguments in the on-demand comparison.

@jruaux
Copy link
Collaborator

jruaux commented Sep 15, 2024

Thank you for reporting this. I put your changes in AbstractCompareCommand to avoid code duplication between compare and replicate.

@jruaux jruaux closed this in 20025ee Sep 15, 2024
@jruaux jruaux added the released Issue has been released label Sep 15, 2024
@jruaux
Copy link
Collaborator

jruaux commented Sep 15, 2024

🎉 This issue has been resolved in v4.1.3 (Release Notes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Issue has been released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants